issue_id
int64 2.03k
426k
| title
stringlengths 9
251
| body
stringlengths 1
32.8k
⌀ | status
stringclasses 6
values | after_fix_sha
stringlengths 7
7
| project_name
stringclasses 6
values | repo_url
stringclasses 6
values | repo_name
stringclasses 6
values | language
stringclasses 1
value | issue_url
null | before_fix_sha
null | pull_url
null | commit_datetime
timestamp[us, tz=UTC] | report_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 2
187
| file_content
stringlengths 0
368k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/ExtractTempTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/InlineTempTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/MoveMembersTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/PullUpTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RefactoringScannerTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RefactoringTest.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RenameJavaProjectTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RenamePackageTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RenameSourceFolderChangeTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RenameTempTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/RenameTypeTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/ReorgTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/SefTestSetup.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/SefTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/SurroundWithTests.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui/core
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/sef/AccessAnalyzer.java
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
org.eclipse.jdt.ui/core
| |
20,017 |
Bug 20017 Self Encapsulate does not work correctly when "this.field = value" is used before refactoring [refactoring]
|
As an example I start with this class: public class Test { private Object obj; public Test (Object obj) { this.obj = obj; } } Then apply the "Self Encapsulate" refactoring on the obj field, which results: public class Test { private Object obj; public Test (Object obj) { this.getObj() = obj; } private void setObj(Object obj) { this.obj = obj; } private Object getObj() { return obj; } } The "this.getObj() = obj;" in the constructor should be "setObj(obj);" correctly. My Eclipse version was: 20020602
|
resolved fixed
|
698c0fe
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T13:51:56Z | 2002-06-12T13:53:20Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/sef/EncapsulateWriteAccess.java
| |
20,677 |
Bug 20677 close/open project: incorrect compile order
|
eclipse-SDK-20020612 ibm jdk1.3.1 I closed 20 projects in the java perspective, choosing the projects from the package view. The 20 projects I closed were org.eclipse.swt.* and org.eclipse.jdt.* I closed all 20 projects simultaneously using the project>close menu. I then re-openned all 20 projects simultaneously using the project>open menu pull down. When I perform this operation I generage over 40,000 compile errors. It appears the projects are being re-openned one at a time, not in compile order. I would expect the open project to perform the operation as a group, in compile order. I repeated the same experiment in the java perspective using the navigator view and everything behaved correctly. In addition the behaviour in the resource perspective using the navigator view was also correct. Finally I tried the package view in the resource perspective and observed the same behaviour as that in the java perspective (40,000 compile errors). A rebuild in both error cases clears all compile errors
|
resolved fixed
|
d22851a
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T14:36:36Z | 2002-06-19T18:06:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/WorkbenchRunnableAdapter.java
|
package org.eclipse.jdt.internal.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jdt.internal.ui.JavaPlugin;
/**
* An <code>IRunnableWithProgress</code> that adapts and <code>IWorkspaceRunnable</code>
* so that is can be executed inside <code>IRunnableContext</code>. <code>OperationCanceledException</code>
* throws by the apapted runnabled are cought and rethrown as a <code>InterruptedException</code>.
*/
public class WorkbenchRunnableAdapter implements IRunnableWithProgress {
private IWorkspaceRunnable fWorkspaceRunnable;
public WorkbenchRunnableAdapter(IWorkspaceRunnable runnable) {
fWorkspaceRunnable= runnable;
}
/*
* @see IRunnableWithProgress#run(IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
JavaPlugin.getWorkspace().run(fWorkspaceRunnable, monitor);
} catch (OperationCanceledException e) {
throw new InterruptedException(e.getMessage());
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
}
|
20,677 |
Bug 20677 close/open project: incorrect compile order
|
eclipse-SDK-20020612 ibm jdk1.3.1 I closed 20 projects in the java perspective, choosing the projects from the package view. The 20 projects I closed were org.eclipse.swt.* and org.eclipse.jdt.* I closed all 20 projects simultaneously using the project>close menu. I then re-openned all 20 projects simultaneously using the project>open menu pull down. When I perform this operation I generage over 40,000 compile errors. It appears the projects are being re-openned one at a time, not in compile order. I would expect the open project to perform the operation as a group, in compile order. I repeated the same experiment in the java perspective using the navigator view and everything behaved correctly. In addition the behaviour in the resource perspective using the navigator view was also correct. Finally I tried the package view in the resource perspective and observed the same behaviour as that in the java perspective (40,000 compile errors). A rebuild in both error cases clears all compile errors
|
resolved fixed
|
d22851a
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T14:36:36Z | 2002-06-19T18:06:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OpenProjectAction.java
|
/*******************************************************************************
* Copyright (c) 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.ui.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.dialogs.ListDialog;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
/**
* Action to open a closed project. Action presents a dialog from which the
* user can select the projects to be opened.
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class OpenProjectAction extends Action implements IResourceChangeListener {
private IWorkbenchSite fSite;
/**
* Creates a new <code>OpenProjectAction</code>.
*
* @param site the site providing context information for this action
*/
public OpenProjectAction(IWorkbenchSite site) {
Assert.isNotNull(site);
fSite= site;
setEnabled(hasCloseProjects());
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.OPEN_PROJECT_ACTION);
}
/*
* @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
*/
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta != null) {
IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
for (int i = 0; i < projDeltas.length; ++i) {
IResourceDelta projDelta = projDeltas[i];
if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
setEnabled(hasCloseProjects());
return;
}
}
}
}
/*
* @see IAction#run()
*/
public void run() {
ElementListSelectionDialog dialog= new ElementListSelectionDialog(fSite.getShell(), new JavaElementLabelProvider());
dialog.setTitle(ActionMessages.getString("OpenProjectAction.dialog.title")); //$NON-NLS-1$
dialog.setMessage(ActionMessages.getString("OpenProjectAction.dialog.message")); //$NON-NLS-1$
dialog.setElements(getClosedProjects());
dialog.setMultipleSelection(true);
int result= dialog.open();
if (result != Dialog.OK)
return;
final Object[] projects= dialog.getResult();
final List nonJavaProjects= new ArrayList(3);
IRunnableWithProgress runnable= createRunnable(projects, nonJavaProjects);
ProgressMonitorDialog pd= new ProgressMonitorDialog(fSite.getShell());
try {
pd.run(true, true, runnable);
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, fSite.getShell(),
ActionMessages.getString("OpenProjectAction.dialog.title"), //$NON-NLS-1$
ActionMessages.getString("OpenProjectAction.error.message")); //$NON-NLS-1$
} catch (InterruptedException e) {
}
showWarningDialog(nonJavaProjects);
}
private IRunnableWithProgress createRunnable(
final Object[] projects,
final List nonJavaProjects) {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("", projects.length); //$NON-NLS-1$
MultiStatus errorStatus= null;
for (int i = 0; i < projects.length; i++) {
IProject project= (IProject)projects[i];
try {
project.open(new SubProgressMonitor(monitor, 1));
if (project.getNature(JavaCore.NATURE_ID) == null) {
nonJavaProjects.add(project);
}
} catch (CoreException e) {
if (errorStatus == null)
errorStatus = new MultiStatus(JavaPlugin.getPluginId(), IStatus.ERROR, ActionMessages.getString("OpenProjectAction.error.message"), e); //$NON-NLS-1$
errorStatus.merge(e.getStatus());
}
}
monitor.done();
if (errorStatus != null)
throw new InvocationTargetException(new CoreException(errorStatus));
}
};
}
private void showWarningDialog(final List nonJavaProjects) {
int size= nonJavaProjects.size();
if (size > 0) {
ListDialog warningDialog= new ListDialog(fSite.getShell());
warningDialog.setAddCancelButton(false);
warningDialog.setTitle(ActionMessages.getString("OpenProjectAction.dialog.title")); //$NON-NLS-1$
if (size == 1)
warningDialog.setMessage(ActionMessages.getString("OpenProjectAction.no_java_nature.one")); //$NON-NLS-1$
else
warningDialog.setMessage(ActionMessages.getString("OpenProjectAction.no_java_nature.multiple")); //$NON-NLS-1$
warningDialog.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
return ((List)inputElement).toArray();
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
warningDialog.setLabelProvider(new JavaElementLabelProvider());
warningDialog.setInput(nonJavaProjects);
warningDialog.open();
}
}
private Object[] getClosedProjects() {
IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
List result= new ArrayList(5);
for (int i = 0; i < projects.length; i++) {
IProject project= projects[i];
if (!project.isOpen())
result.add(project);
}
return result.toArray();
}
private boolean hasCloseProjects() {
IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
if (!projects[i].isOpen())
return true;
}
return false;
}
}
|
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/A.java
|
public class A{
public A(int i) {
}
public void foo() {
A a= new A(10);
}
}
|
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_in/A_test621.java
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_in/A_test622.java
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_out/A_test621.java
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_out/A_test622.java
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui/core
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
org.eclipse.jdt.ui/core
| |
3,582 |
Bug 3582 extract method: constructor //reminder (1GEYNSB)
|
AK (6/7/01 7:21:46 PM) just a reminder: DB knows well about it class A{ A(){ this(8 + 9); } A(int i){} } if you want to extract anything from the super or this call in the constructor you have to make the new method static. it's a special case. NOTES: EG (6/7/2001 11:14:08 AM) defer DB (09.08.2001 11:34:32) Currently you can't extract any expression from the argument list of super or this. Defer until the feature is implemented.
|
resolved fixed
|
ce575ee
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-13T16:03:18Z | 2001-10-11T03:13:20Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/core
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/base/Context.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/core
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/base/FileContext.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/core
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/base/JavaSourceContext.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/ui
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/ui/refactoring/ErrorWizardPage.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/ui
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/ui/refactoring/IErrorContextViewer.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/ui
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/ui/refactoring/PreviewWizardPage.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/ui
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
refactoring/org/eclipse/jdt/internal/ui/refactoring/SourceContextViewer.java
| |
9,448 |
Bug 9448 Improve layout and appearanceof the refactoring error page [refactoring]
|
- the top viewer should have a pane and may be step buttons - the lower viewer should have a pane with a title.
|
resolved fixed
|
b7a1462
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-14T15:55:46Z | 2002-02-12T13:20:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/ViewerPane.java
| |
18,467 |
Bug 18467 Radio bullet on Packages view's Filters... item [filters]
|
Build 20020530 The Filters... item on the view menu has a radio bullet, even though there are no other items in this group to choose from.
|
resolved fixed
|
1609d1a
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-15T10:18:00Z | 2002-05-31T15:46:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/CustomFiltersActionGroup.java
| |
22,467 |
Bug 22467 TextEdits: replace != delete + insert
|
see TextBufferTest.testReplaceAndInsert1
|
resolved fixed
|
29f00f2
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-15T12:57:11Z | 2002-08-15T14:00:00Z |
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/TextBufferTest.java
|
/*
* Copyright (c) 2002 IBM Corp. All rights reserved.
* This file is made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*/
package org.eclipse.jdt.ui.tests.core;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.jdt.internal.corext.textmanipulation.MoveTextEdit;
import org.eclipse.jdt.internal.corext.textmanipulation.SimpleTextEdit;
import org.eclipse.jdt.internal.corext.textmanipulation.SwapTextEdit;
import org.eclipse.jdt.internal.corext.textmanipulation.TextBuffer;
import org.eclipse.jdt.internal.corext.textmanipulation.TextBufferEditor;
import org.eclipse.jdt.internal.corext.textmanipulation.TextRange;
import org.eclipse.jdt.internal.corext.textmanipulation.UndoMemento;
import org.eclipse.jdt.testplugin.TestPluginLauncher;
public class TextBufferTest extends TestCase {
private static final Class THIS= TextBufferTest.class;
private TextBuffer fBuffer;
private TextBufferEditor fEditor;
public TextBufferTest(String name) {
super(name);
}
public static void main(String[] args) {
TestPluginLauncher.run(TestPluginLauncher.getLocationFromProperties(), THIS, args);
}
public static Test suite() {
TestSuite result= new TestSuite(THIS);
if (false) { // For hot code replace when debugging test cases
result.addTestSuite(THIS);
result.addTestSuite(THIS);
result.addTestSuite(THIS);
result.addTestSuite(THIS);
result.addTestSuite(THIS);
result.addTestSuite(THIS);
}
return result;
// TestSuite result= new TestSuite();
// result.addTest(new TextBufferTest("testReplaceAndInsert1"));
// result.addTest(new TextBufferTest("testReplaceAndInsert2"));
// return result;
}
protected void setUp() throws Exception {
fBuffer= TextBuffer.create("0123456789");
fEditor= new TextBufferEditor(fBuffer);
}
protected void tearDown() throws Exception {
fEditor= null;
}
public void testOverlap1() throws Exception {
// [ [ ] ]
fEditor.add(SimpleTextEdit.createReplace(0, 2, "01"));
fEditor.add(SimpleTextEdit.createReplace(1, 2, "12"));
assertTrue(!fEditor.canPerformEdits());
}
public void testOverlap2() throws Exception {
// [[ ] ]
fEditor.add(SimpleTextEdit.createReplace(0, 2, "01"));
fEditor.add(SimpleTextEdit.createReplace(0, 1, "0"));
assertTrue(!fEditor.canPerformEdits());
}
public void testOverlap3() throws Exception {
// [ [ ]]
fEditor.add(SimpleTextEdit.createReplace(0, 2, "01"));
fEditor.add(SimpleTextEdit.createReplace(1, 1, "1"));
assertTrue(!fEditor.canPerformEdits());
}
public void testOverlap4() throws Exception {
// [ [ ] ]
fEditor.add(SimpleTextEdit.createReplace(0, 3, "012"));
fEditor.add(SimpleTextEdit.createReplace(1, 1, "1"));
assertTrue(!fEditor.canPerformEdits());
}
public void testOverlap5() throws Exception {
// [ [] ]
fEditor.add(SimpleTextEdit.createReplace(0, 3, "012"));
fEditor.add(SimpleTextEdit.createInsert(1, "xx"));
assertTrue(!fEditor.canPerformEdits());
}
public void testOverlap6() throws Exception {
// [ [] ]
fEditor.add(SimpleTextEdit.createReplace(0, 3, "012"));
fEditor.add(SimpleTextEdit.createInsert(2, "xx"));
assertTrue(!fEditor.canPerformEdits());
}
public void testOverlap7() throws Exception {
boolean catched= false;
try {
new MoveTextEdit(2,5,3);
} catch (Exception e) {
catched= true;
}
assertTrue(catched);
}
public void testOverlap8() throws Exception {
boolean catched= false;
try {
new MoveTextEdit(2,5,6);
} catch (Exception e) {
catched= true;
}
assertTrue(catched);
}
public void testOverlap9() throws Exception {
MoveTextEdit e1= new MoveTextEdit(3, 1, 7);
MoveTextEdit e2= new MoveTextEdit(2, 3, 8);
fEditor.add(e1);
fEditor.add(e2);
assertTrue(!fEditor.canPerformEdits());
}
public void testInsert1() throws Exception {
// [][ ]
SimpleTextEdit e1= SimpleTextEdit.createInsert(2, "yy");
SimpleTextEdit e2= SimpleTextEdit.createReplace(2, 3, "3456");
fEditor.add(e1);
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTextRange(), 2, 2);
assert(e2.getTextRange(), 4, 4);
assertEquals("Buffer content", "01yy345656789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 2, 0);
assert(e2.getTextRange(), 2, 3);
}
public void testInsert2() throws Exception {
// [][]
SimpleTextEdit e1= SimpleTextEdit.createInsert(2, "yy");
SimpleTextEdit e2= SimpleTextEdit.createInsert(2, "xx");
fEditor.add(e1);
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTextRange(), 2, 2);
assert(e2.getTextRange(), 4, 2);
assertEquals("Buffer content", "01yyxx23456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 2, 0);
assert(e2.getTextRange(), 2, 0);
}
public void testInsert3() throws Exception {
// [ ][][ ]
SimpleTextEdit e1= SimpleTextEdit.createReplace(0, 2, "011");
SimpleTextEdit e2= SimpleTextEdit.createInsert(2, "xx");
SimpleTextEdit e3= SimpleTextEdit.createReplace(2, 2, "2");
fEditor.add(e1);
fEditor.add(e2);
fEditor.add(e3);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTextRange(), 0, 3);
assert(e2.getTextRange(), 3, 2);
assert(e3.getTextRange(), 5, 1);
assertEquals("Buffer content", "011xx2456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 0, 2);
assert(e2.getTextRange(), 2, 0);
assert(e3.getTextRange(), 2, 2);
}
public void testInsert4() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createInsert(0, "xx");
fEditor.add(e1);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer length", 12, fBuffer.getLength());
assert(e1.getTextRange(), 0, 2);
assertEquals("Buffer content", "xx0123456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 0, 0);
}
public void testInsert5() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createInsert(10, "xx");
fEditor.add(e1);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer length", 12, fBuffer.getLength());
assert(e1.getTextRange(), 10, 2);
assertEquals("Buffer content", "0123456789xx", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 10, 0);
}
public void testDelete1() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createDelete(3, 1);
fEditor.add(e1);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTextRange(), 3, 0);
assertEquals("Buffer content", "012456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 3, 1);
}
public void testDelete2() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createDelete(4, 1);
SimpleTextEdit e2= SimpleTextEdit.createDelete(3, 1);
SimpleTextEdit e3= SimpleTextEdit.createDelete(5, 1);
fEditor.add(e1);
fEditor.add(e2);
fEditor.add(e3);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTextRange(), 3, 0);
assert(e2.getTextRange(), 3, 0);
assert(e3.getTextRange(), 3, 0);
assertEquals("Buffer content", "0126789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 4, 1);
assert(e2.getTextRange(), 3, 1);
assert(e3.getTextRange(), 5, 1);
}
public void testDelete3() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createInsert(3, "x");
SimpleTextEdit e2= SimpleTextEdit.createDelete(3, 1);
fEditor.add(e1);
fEditor.add(e2);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTextRange(), 3, 1);
assert(e2.getTextRange(), 4, 0);
assertEquals("Buffer content", "012x456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getTextRange(), 3, 0);
assert(e2.getTextRange(), 3, 1);
}
public void testMove1() throws Exception {
MoveTextEdit e1= new MoveTextEdit(2, 2, 5);
fEditor.add(e1);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0142356789", fBuffer.getContent());
assert(e1.getTargetRange(), 3, 2);
assert(e1.getSourceRange(), 2, 0);
doUndo(undo);
assert(e1.getSourceRange(), 2, 2);
assert(e1.getTargetRange(), 5, 0);
}
public void testMove2() throws Exception {
MoveTextEdit e1= new MoveTextEdit(5, 2, 2);
fEditor.add(e1);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0156234789", fBuffer.getContent());
assert(e1.getTargetRange(), 2, 2);
assert(e1.getSourceRange(), 7, 0);
doUndo(undo);
assert(e1.getSourceRange(), 5, 2);
assert(e1.getTargetRange(), 2, 0);
}
public void testMove3() throws Exception {
MoveTextEdit e1= new MoveTextEdit(2, 2, 7);
SimpleTextEdit e2= SimpleTextEdit.createReplace(4, 1, "x");
fEditor.add(e1);
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "01x5623789", fBuffer.getContent());
assert(e1.getTargetRange(), 5, 2);
assert(e1.getSourceRange(), 2, 0);
assert(e2.getTextRange(), 2, 1);
doUndo(undo);
assert(e1.getSourceRange(), 2, 2);
assert(e1.getTargetRange(), 7, 0);
assert(e2.getTextRange(), 4, 1);
}
public void testMove4() throws Exception {
MoveTextEdit e1= new MoveTextEdit(7, 2, 2);
SimpleTextEdit e2= SimpleTextEdit.createReplace(5, 1, "x");
fEditor.add(e2);
fEditor.add(e1);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0178234x69", fBuffer.getContent());
assert(e1.getTargetRange(), 2, 2);
assert(e1.getSourceRange(), 9, 0);
assert(e2.getTextRange(), 7, 1);
doUndo(undo);
assert(e1.getSourceRange(), 7, 2);
assert(e1.getTargetRange(), 2, 0);
assert(e2.getTextRange(), 5, 1);
}
public void testMove5() throws Exception {
// Move onto itself
MoveTextEdit e1= new MoveTextEdit(2, 1, 3);
SimpleTextEdit e2= SimpleTextEdit.createReplace(2,1,"x");
fEditor.add(e1);
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTargetRange(), 2, 1);
assert(e1.getSourceRange(), 3, 0);
assert(e2.getTextRange(), 2, 1);
assertEquals("Buffer content", "01x3456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getSourceRange(), 2, 1);
assert(e1.getTargetRange(), 3, 0);
assert(e2.getTextRange(), 2, 1);
}
public void testMove6() throws Exception {
// Move onto itself
MoveTextEdit e1= new MoveTextEdit(2, 1, 2);
SimpleTextEdit e2= SimpleTextEdit.createReplace(2,1,"x");
fEditor.add(e1);
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTargetRange(), 2, 1);
assert(e1.getSourceRange(), 3, 0); // This gets normalized since a move from [2,1] -> 2 == [2,1] -> 3
assert(e2.getTextRange(), 2, 1);
assertEquals("Buffer content", "01x3456789", fBuffer.getContent());
doUndo(undo);
assert(e1.getSourceRange(), 2, 1);
assert(e1.getTargetRange(), 3, 0);
assert(e2.getTextRange(), 2, 1);
}
public void testMove7() throws Exception {
MoveTextEdit e1= new MoveTextEdit(2, 3, 7);
SimpleTextEdit e2= SimpleTextEdit.createReplace(3, 1, "x");
fEditor.add(e1);
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "01562x4789", fBuffer.getContent());
assert(e1.getTargetRange(), 4, 3);
assert(e1.getSourceRange(), 2, 0);
assert(e2.getTextRange(), 5, 1);
doUndo(undo);
assert(e1.getSourceRange(), 2, 3);
assert(e1.getTargetRange(), 7, 0);
assert(e2.getTextRange(), 3, 1);
}
public void testMove8() throws Exception {
MoveTextEdit e1= new MoveTextEdit(5, 3, 1);
SimpleTextEdit e2= SimpleTextEdit.createReplace(6, 1, "x");
fEditor.add(e2);
fEditor.add(e1);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "05x7123489", fBuffer.getContent());
assert(e1.getTargetRange(), 1, 3);
assert(e1.getSourceRange(), 8, 0);
assert(e2.getTextRange(), 2, 1);
doUndo(undo);
assert(e1.getSourceRange(), 5, 3);
assert(e1.getTargetRange(), 1, 0);
assert(e2.getTextRange(), 6, 1);
}
public void testMove9() throws Exception {
MoveTextEdit e1= new MoveTextEdit(1, 1, 3);
MoveTextEdit e2= new MoveTextEdit(1, 3, 5);
fEditor.add(e1);
fEditor.add(e2);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assert(e1.getTargetRange(), 3, 1);
assert(e1.getSourceRange(), 2, 0);
assert(e2.getTargetRange(), 2, 3);
assert(e2.getSourceRange(), 1, 0);
assertEquals("Buffer content", "0421356789", fBuffer.getContent());
doUndo(undo);
assert(e1.getSourceRange(), 1, 1);
assert(e1.getTargetRange(), 3, 0);
assert(e2.getSourceRange(), 1, 3);
assert(e2.getTargetRange(), 5, 0);
}
public void testMove10() throws Exception {
MoveTextEdit e1= new MoveTextEdit(2, 2, 8);
MoveTextEdit e2= new MoveTextEdit(5, 2, 1);
fEditor.add(e1);
fEditor.add(e2);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0561472389", fBuffer.getContent());
doUndo(undo);
}
public void testSwap1() throws Exception {
SwapTextEdit e1= new SwapTextEdit(1, 1, 3, 1);
fEditor.add(e1);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0321456789", fBuffer.getContent());
doUndo(undo);
}
public void testSwap2() throws Exception {
SwapTextEdit e1= new SwapTextEdit(1, 1, 3, 1);
SwapTextEdit e2= new SwapTextEdit(5, 1, 7, 1);
fEditor.add(e1);
fEditor.add(e2);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0321476589", fBuffer.getContent());
doUndo(undo);
}
public void testSwap3() throws Exception {
SwapTextEdit e1= new SwapTextEdit(1, 1, 3, 1);
SwapTextEdit e2= new SwapTextEdit(5, 1, 7, 1);
SwapTextEdit e3= new SwapTextEdit(1, 3, 5, 3);
fEditor.add(e1);
fEditor.add(e2);
fEditor.add(e3);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "0765432189", fBuffer.getContent());
doUndo(undo);
}
public void testSwapAndReplace() throws Exception {
SwapTextEdit e1= new SwapTextEdit(1, 3, 5, 3);
SimpleTextEdit e2= SimpleTextEdit.createReplace(6, 1, "ab");
fEditor.add(e1);
fEditor.add(e2);
assertTrue("Can perform edits", fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "05ab7412389", fBuffer.getContent());
doUndo(undo);
}
public void testReplaceAndInsert1() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createReplace(0, 2, "xx");
fEditor.add(e1);
SimpleTextEdit e2= SimpleTextEdit.createInsert(0, "y");
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "xxy23456789", fBuffer.getContent());
}
public void testReplaceAndInsert2() throws Exception {
SimpleTextEdit e1= SimpleTextEdit.createDelete(0, 2);
fEditor.add(e1);
SimpleTextEdit e11= SimpleTextEdit.createInsert(0, "xx");
fEditor.add(e11);
SimpleTextEdit e2= SimpleTextEdit.createInsert(0, "y");
fEditor.add(e2);
assertTrue(fEditor.canPerformEdits());
UndoMemento undo= fEditor.performEdits(null);
assertEquals("Buffer content", "xxy23456789", fBuffer.getContent());
}
private void doUndo(UndoMemento undo) throws Exception {
fEditor.add(undo);
fEditor.performEdits(null);
assertBufferContent();
}
private void assert(TextRange r, int offset, int length) {
assertEquals("Offset", offset, r.getOffset());
assertEquals("Length", length, r.getLength());
}
private void assertBufferContent() {
assertEquals("Buffer content restored", "0123456789", fBuffer.getContent());
}
}
|
18,409 |
Bug 18409 EmptyInnerPackageFilter needs to be revisited [filters]
|
The Empty inner package filter also filter import declarations. This should be changed or made configurable. After 2.0
|
resolved fixed
|
b01531e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T09:36:08Z | 2002-05-31T07:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/filters/EmptyInnerPackageFilter.java
| |
18,409 |
Bug 18409 EmptyInnerPackageFilter needs to be revisited [filters]
|
The Empty inner package filter also filter import declarations. This should be changed or made configurable. After 2.0
|
resolved fixed
|
b01531e
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T09:36:08Z | 2002-05-31T07:26:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/filters/PackageDeclarationFilter.java
| |
19,278 |
Bug 19278 jar source attachment: jar icon not refreshed [package explorer] [browsing]
|
F2 .a jar with no source attached .attach source the icon is still suggesting that no source is attached
|
resolved fixed
|
5b0b955
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T10:29:15Z | 2002-06-05T09:40:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaBrowsingContentProvider.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.browsing;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.IImportContainer;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaElementDelta;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IParent;
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.IWorkingCopy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.JavaBasePreferencePage;
class JavaBrowsingContentProvider extends StandardJavaElementContentProvider implements IElementChangedListener {
private StructuredViewer fViewer;
private Object fInput;
private JavaBrowsingPart fBrowsingPart;
public JavaBrowsingContentProvider(boolean provideMembers, JavaBrowsingPart browsingPart) {
super(provideMembers, reconcileJavaViews());
fBrowsingPart= browsingPart;
fViewer= fBrowsingPart.getViewer();
JavaCore.addElementChangedListener(this);
}
private static boolean reconcileJavaViews() {
return JavaBasePreferencePage.reconcileJavaViews();
}
public Object[] getChildren(Object element) {
if (!exists(element))
return NO_CHILDREN;
try {
if (element instanceof Collection) {
Collection elements= (Collection)element;
if (elements.isEmpty())
return NO_CHILDREN;
Object[] result= new Object[0];
Iterator iter= ((Collection)element).iterator();
while (iter.hasNext()) {
Object[] children= getChildren(iter.next());
if (children != NO_CHILDREN)
result= concatenate(result, children);
}
return result;
}
if (element instanceof IPackageFragment)
return getPackageContents((IPackageFragment)element);
if (fProvideMembers && element instanceof IType)
return getChildren((IType)element);
if (fProvideMembers && element instanceof ISourceReference && element instanceof IParent)
return removeImportAndPackageDeclarations(super.getChildren(element));
if (element instanceof IJavaProject)
return getPackageFragmentRoots((IJavaProject)element);
return super.getChildren(element);
} catch (JavaModelException e) {
return NO_CHILDREN;
}
}
private Object[] getPackageContents(IPackageFragment fragment) throws JavaModelException {
ISourceReference[] sourceRefs;
if (fragment.getKind() == IPackageFragmentRoot.K_SOURCE) {
sourceRefs= fragment.getCompilationUnits();
if (getProvideWorkingCopy()) {
for (int i= 0; i < sourceRefs.length; i++) {
IWorkingCopy wc= EditorUtility.getWorkingCopy((ICompilationUnit)sourceRefs[i]);
if (wc != null)
sourceRefs[i]= (ICompilationUnit)wc;
}
}
}
else {
IClassFile[] classFiles= fragment.getClassFiles();
List topLevelClassFile= new ArrayList();
for (int i= 0; i < classFiles.length; i++) {
IType type= classFiles[i].getType();
if (type != null && type.getDeclaringType() == null && !type.isAnonymous() && !type.isLocal())
topLevelClassFile.add(classFiles[i]);
}
sourceRefs= (ISourceReference[])topLevelClassFile.toArray(new ISourceReference[topLevelClassFile.size()]);
}
Object[] result= new Object[0];
for (int i= 0; i < sourceRefs.length; i++)
result= concatenate(result, removeImportAndPackageDeclarations(getChildren(sourceRefs[i])));
return concatenate(result, fragment.getNonJavaResources());
}
private Object[] removeImportAndPackageDeclarations(Object[] members) {
ArrayList tempResult= new ArrayList(members.length);
for (int i= 0; i < members.length; i++)
if (!(members[i] instanceof IImportContainer) && !(members[i] instanceof IPackageDeclaration))
tempResult.add(members[i]);
return tempResult.toArray();
}
private Object[] getChildren(IType type) throws JavaModelException{
IParent parent;
if (type.isBinary())
parent= type.getClassFile();
else {
parent= type.getCompilationUnit();
if (getProvideWorkingCopy()) {
IWorkingCopy wc= EditorUtility.getWorkingCopy((ICompilationUnit)parent);
if (wc != null) {
parent= (IParent)wc;
IMember wcType= EditorUtility.getWorkingCopy(type);
if (wcType != null)
type= (IType)wcType;
}
}
}
if (type.getDeclaringType() != null)
return type.getChildren();
// Add import declarations
IJavaElement[] members= parent.getChildren();
ArrayList tempResult= new ArrayList(members.length);
for (int i= 0; i < members.length; i++)
if ((members[i] instanceof IImportContainer))
tempResult.add(members[i]);
tempResult.addAll(Arrays.asList(type.getChildren()));
return tempResult.toArray();
}
private Object[] getPackageFragmentRoots(IJavaProject project) throws JavaModelException {
if (!project.getProject().isOpen())
return NO_CHILDREN;
IPackageFragmentRoot[] roots= project.getPackageFragmentRoots();
List list= new ArrayList(roots.length);
// filter out package fragments that correspond to projects and
// replace them with the package fragments directly
for (int i= 0; i < roots.length; i++) {
IPackageFragmentRoot root= (IPackageFragmentRoot)roots[i];
if (!root.isExternal()) {
Object[] children= root.getChildren();
for (int k= 0; k < children.length; k++)
list.add(children[k]);
}
else if (hasChildren(root)) {
list.add(root);
}
}
return concatenate(list.toArray(), project.getNonJavaResources());
}
// ---------------- Element change handling
/* (non-Javadoc)
* Method declared on IContentProvider.
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
super.inputChanged(viewer, oldInput, newInput);
if (newInput instanceof Collection) {
// Get a template object from the collection
Collection col= (Collection)newInput;
if (!col.isEmpty())
newInput= col.iterator().next();
else
newInput= null;
}
fInput= newInput;
}
/* (non-Javadoc)
* Method declared on IContentProvider.
*/
public void dispose() {
super.dispose();
JavaCore.removeElementChangedListener(this);
}
/* (non-Javadoc)
* Method declared on IElementChangedListener.
*/
public void elementChanged(final ElementChangedEvent event) {
try {
processDelta(event.getDelta());
} catch(JavaModelException e) {
JavaPlugin.getDefault().log(e.getStatus()); //$NON-NLS-1$
}
}
/**
* Processes a delta recursively. When more than two children are affected the
* tree is fully refreshed starting at this node. The delta is processed in the
* current thread but the viewer updates are posted to the UI thread.
*/
protected void processDelta(IJavaElementDelta delta) throws JavaModelException {
int kind= delta.getKind();
int flags= delta.getFlags();
IJavaElement element= delta.getElement();
if (!getProvideWorkingCopy() && element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy())
return;
if (element != null && element.getElementType() == IJavaElement.COMPILATION_UNIT && !isOnClassPath((ICompilationUnit)element))
return;
// handle open and closing of a solution or project
if (((flags & IJavaElementDelta.F_CLOSED) != 0) || ((flags & IJavaElementDelta.F_OPENED) != 0)) {
postRefresh(element);
return;
}
if (kind == IJavaElementDelta.REMOVED) {
Object parent= internalGetParent(element);
if (fBrowsingPart.isValidElement(element)) {
if (element instanceof IClassFile) {
postRemove(((IClassFile)element).getType());
} else if (element instanceof ICompilationUnit && !((ICompilationUnit)element).isWorkingCopy()) {
postRefresh(null);
} else if (element instanceof ICompilationUnit && ((ICompilationUnit)element).isWorkingCopy()) {
if (getProvideWorkingCopy())
postRefresh(null);
} else if (parent instanceof ICompilationUnit && getProvideWorkingCopy() && !((ICompilationUnit)parent).isWorkingCopy()) {
if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy()) {
// working copy removed from system - refresh
postRefresh(null);
}
} else if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy() && parent != null && parent.equals(fInput))
// closed editor - removing working copy
postRefresh(null);
else
postRemove(element);
}
if (fBrowsingPart.isAncestorOf(element, fInput)) {
if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy()) {
postAdjustInputAndSetSelection(((IWorkingCopy)element).getOriginal((IJavaElement)fInput));
} else
postAdjustInputAndSetSelection(null);
}
if (fInput != null && fInput.equals(element))
postRefresh(null);
return;
}
if (kind == IJavaElementDelta.ADDED && delta.getMovedFromElement() != null && element instanceof ICompilationUnit)
return;
if (kind == IJavaElementDelta.ADDED) {
if (fBrowsingPart.isValidElement(element)) {
Object parent= internalGetParent(element);
if (element instanceof IClassFile) {
postAdd(parent, ((IClassFile)element).getType());
} else if (element instanceof ICompilationUnit && !((ICompilationUnit)element).isWorkingCopy()) {
postAdd(parent, ((ICompilationUnit)element).getAllTypes());
} else if (parent instanceof ICompilationUnit && getProvideWorkingCopy() && !((ICompilationUnit)parent).isWorkingCopy()) {
// do nothing
} else if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy()) {
// new working copy comes to live
postRefresh(null);
} else
postAdd(parent, element);
} else if (fInput == null) {
IJavaElement newInput= fBrowsingPart.findInputForJavaElement(element);
if (newInput != null)
postAdjustInputAndSetSelection(element);
} else if (element instanceof IType && fBrowsingPart.isValidInput(element)) {
IJavaElement cu1= element.getAncestor(IJavaElement.COMPILATION_UNIT);
IJavaElement cu2= ((IJavaElement)fInput).getAncestor(IJavaElement.COMPILATION_UNIT);
if (cu1 != null && cu2 != null && cu1.equals(cu2))
postAdjustInputAndSetSelection(element);
}
return;
}
if (kind == IJavaElementDelta.CHANGED) {
if (fBrowsingPart.isValidElement(element)) {
postRefresh(element);
}
}
if (isClassPathChange(delta))
// throw the towel and do a full refresh
postRefresh(null);
if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0 && fInput instanceof IJavaElement) {
IPackageFragmentRoot pkgRoot= (IPackageFragmentRoot)element;
IJavaElement inputsParent= ((IJavaElement)fInput).getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
if (pkgRoot.equals(inputsParent))
postRefresh(null);
}
IJavaElementDelta[] affectedChildren= delta.getAffectedChildren();
if (affectedChildren.length > 1) {
// a package fragment might become non empty refresh from the parent
if (element instanceof IPackageFragment) {
IJavaElement parent= (IJavaElement)internalGetParent(element);
// avoid posting a refresh to an unvisible parent
if (element.equals(fInput)) {
postRefresh(element);
} else {
postRefresh(parent);
}
}
// more than one child changed, refresh from here downwards
if (element instanceof IPackageFragmentRoot && fBrowsingPart.isValidElement(element)) {
postRefresh(skipProjectPackageFragmentRoot((IPackageFragmentRoot)element));
return;
}
}
for (int i= 0; i < affectedChildren.length; i++) {
processDelta(affectedChildren[i]);
}
}
private boolean isOnClassPath(ICompilationUnit element) throws JavaModelException {
IJavaProject project= element.getJavaProject();
if (project == null || !project.exists())
return false;
return project.isOnClasspath(element);
}
/**
* Updates the package icon
*/
private void updatePackageIcon(final IJavaElement element) {
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.update(element, new String[]{IBasicPropertyConstants.P_IMAGE});
}
});
}
private void postRefresh(final Object root) {
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.refresh(root);
}
});
}
private void postAdd(final Object parent, final Object element) {
postAdd(parent, new Object[] {element});
}
private void postAdd(final Object parent, final Object[] elements) {
if (elements.length <= 0)
return;
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.setRedraw(false);
if (fViewer instanceof AbstractTreeViewer) {
if (fViewer.testFindItem(parent) == null) {
Object root= ((AbstractTreeViewer)fViewer).getInput();
if (root != null)
((AbstractTreeViewer)fViewer).add(root, elements);
}
else
((AbstractTreeViewer)fViewer).add(parent, elements);
}
else if (fViewer instanceof ListViewer)
((ListViewer)fViewer).add(elements);
else if (fViewer instanceof TableViewer)
((TableViewer)fViewer).add(elements);
if (fViewer.testFindItem(elements[0]) != null)
fBrowsingPart.adjustInputAndSetSelection((IJavaElement)elements[0]);
ctrl.setRedraw(true);
}
}
});
}
private void postRemove(final Object element) {
postRemove(new Object[] {element});
}
private void postRemove(final Object[] elements) {
if (elements.length <= 0)
return;
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.setRedraw(false);
if (fViewer instanceof AbstractTreeViewer)
((AbstractTreeViewer)fViewer).remove(elements);
else if (fViewer instanceof ListViewer)
((ListViewer)fViewer).remove(elements);
else if (fViewer instanceof TableViewer)
((TableViewer)fViewer).remove(elements);
ctrl.setRedraw(true);
}
}
});
}
private void postAdjustInputAndSetSelection(final Object element) {
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.setRedraw(false);
fBrowsingPart.adjustInputAndSetSelection((IJavaElement)element);
ctrl.setRedraw(true);
}
}
});
}
private void postRunnable(final Runnable r) {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
fBrowsingPart.setProcessSelectionEvents(false);
try {
Display currentDisplay= ctrl.getDisplay().getCurrent();
if (currentDisplay != null && currentDisplay.equals(ctrl.getDisplay()))
ctrl.getDisplay().syncExec(r);
else
ctrl.getDisplay().asyncExec(r);
} finally {
fBrowsingPart.setProcessSelectionEvents(true);
}
}
}
/**
* Returns the parent for the element.
* <p>
* Note: This method will return a working copy if the
* parent is a working copy. The super class implementation
* returns the original element instead.
* </p>
*/
protected Object internalGetParent(Object element) {
if (element instanceof IJavaProject) {
return ((IJavaProject)element).getJavaModel();
}
// try to map resources to the containing package fragment
if (element instanceof IResource) {
IResource parent= ((IResource)element).getParent();
Object jParent= JavaCore.create(parent);
if (jParent != null)
return jParent;
return parent;
}
// for package fragments that are contained in a project package fragment
// we have to skip the package fragment root as the parent.
if (element instanceof IPackageFragment) {
IPackageFragmentRoot parent= (IPackageFragmentRoot)((IPackageFragment)element).getParent();
return skipProjectPackageFragmentRoot(parent);
}
if (element instanceof IJavaElement)
return ((IJavaElement)element).getParent();
return null;
}
}
|
19,278 |
Bug 19278 jar source attachment: jar icon not refreshed [package explorer] [browsing]
|
F2 .a jar with no source attached .attach source the icon is still suggesting that no source is attached
|
resolved fixed
|
5b0b955
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T10:29:15Z | 2002-06-05T09:40:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerContentProvider.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.packageview;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.swt.widgets.Control;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaElementDelta;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IWorkingCopy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
import org.eclipse.jdt.internal.ui.JavaPlugin;
/**
* A ContentProvider for the PackageExplorer
*
* @see StandardJavaElementContentProvider
*/
public class PackageExplorerContentProvider extends StandardJavaElementContentProvider implements ITreeContentProvider, IElementChangedListener {
protected TreeViewer fViewer;
protected Object fInput;
/* (non-Javadoc)
* Method declared on IContentProvider.
*/
public void dispose() {
super.dispose();
JavaCore.removeElementChangedListener(this);
}
/* (non-Javadoc)
* Method declared on IContentProvider.
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
super.inputChanged(viewer, oldInput, newInput);
fViewer= (TreeViewer)viewer;
if (oldInput == null && newInput != null) {
JavaCore.addElementChangedListener(this);
} else if (oldInput != null && newInput == null) {
JavaCore.removeElementChangedListener(this);
}
fInput= newInput;
}
/**
* Creates a new content provider for Java elements.
*/
public PackageExplorerContentProvider() {
}
/**
* Creates a new content provider for Java elements.
*/
public PackageExplorerContentProvider(boolean provideMembers, boolean provideWorkingCopy) {
super(provideMembers, provideWorkingCopy);
}
/* (non-Javadoc)
* Method declared on IElementChangedListener.
*/
public void elementChanged(final ElementChangedEvent event) {
try {
processDelta(event.getDelta());
} catch(JavaModelException e) {
JavaPlugin.log(e);
}
}
/**
* Processes a delta recursively. When more than two children are affected the
* tree is fully refreshed starting at this node. The delta is processed in the
* current thread but the viewer updates are posted to the UI thread.
*/
protected void processDelta(IJavaElementDelta delta) throws JavaModelException {
int kind= delta.getKind();
int flags= delta.getFlags();
IJavaElement element= delta.getElement();
if (!getProvideWorkingCopy() && isWorkingCopy(element))
return;
if (element != null && element.getElementType() == IJavaElement.COMPILATION_UNIT && !isOnClassPath((ICompilationUnit)element))
return;
// handle open and closing of a solution or project
if (((flags & IJavaElementDelta.F_CLOSED) != 0) || ((flags & IJavaElementDelta.F_OPENED) != 0)) {
postRefresh(element);
return;
}
if (kind == IJavaElementDelta.REMOVED) {
// when a working copy is removed all we have to do
// is to refresh the compilation unit
if (isWorkingCopy(element)) {
refreshWorkingCopy((IWorkingCopy)element);
return;
}
Object parent= internalGetParent(element);
postRemove(element);
if (parent instanceof IPackageFragment)
updatePackageIcon((IPackageFragment)parent);
// we are filtering out empty subpackages, so we
// a package becomes empty we remove it from the viewer.
if (isPackageFragmentEmpty(element.getParent())) {
if (fViewer.testFindItem(parent) != null)
postRefresh(internalGetParent(parent));
}
return;
}
if (kind == IJavaElementDelta.ADDED) {
// when a working copy is added all we have to do
// is to refresh the compilation unit
if (isWorkingCopy(element)) {
refreshWorkingCopy((IWorkingCopy)element);
return;
}
Object parent= internalGetParent(element);
// we are filtering out empty subpackages, so we
// have to handle additions to them specially.
if (parent instanceof IPackageFragment) {
Object grandparent= internalGetParent(parent);
// 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View
// avoid posting a refresh to an unvisible parent
if (parent.equals(fInput)) {
postRefresh(parent);
} else {
// refresh from grandparent if parent isn't visible yet
if (fViewer.testFindItem(parent) == null)
postRefresh(grandparent);
else {
postRefresh(parent);
}
}
} else {
postAdd(parent, element);
}
}
if (element instanceof ICompilationUnit) {
if (getProvideWorkingCopy()) {
IJavaElement original= ((IWorkingCopy)element).getOriginalElement();
if (original != null)
element= original;
}
if (kind == IJavaElementDelta.CHANGED) {
postRefresh(element);
updateSelection(delta);
return;
}
}
// we don't show the contents of a compilation or IClassFile, so don't go any deeper
if ((element instanceof ICompilationUnit) || (element instanceof IClassFile))
return;
// the contents of an external JAR has changed
if (element instanceof IPackageFragmentRoot && ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0))
postRefresh(element);
if (isClassPathChange(delta)) {
// throw the towel and do a full refresh of the affected java project.
postRefresh(element.getJavaProject());
}
if (delta.getResourceDeltas() != null) {
IResourceDelta[] rd= delta.getResourceDeltas();
for (int i= 0; i < rd.length; i++) {
processResourceDelta(rd[i], element);
}
}
IJavaElementDelta[] affectedChildren= delta.getAffectedChildren();
if (affectedChildren.length > 1) {
// a package fragment might become non empty refresh from the parent
if (element instanceof IPackageFragment) {
IJavaElement parent= (IJavaElement)internalGetParent(element);
// 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View
// avoid posting a refresh to an unvisible parent
if (element.equals(fInput)) {
postRefresh(element);
} else {
postRefresh(parent);
}
return;
}
// more than one child changed, refresh from here downwards
if (element instanceof IPackageFragmentRoot)
postRefresh(skipProjectPackageFragmentRoot((IPackageFragmentRoot)element));
else
postRefresh(element);
return;
}
for (int i= 0; i < affectedChildren.length; i++) {
processDelta(affectedChildren[i]);
}
}
private boolean isOnClassPath(ICompilationUnit element) throws JavaModelException {
IJavaProject project= element.getJavaProject();
if (project == null || !project.exists())
return false;
return project.isOnClasspath(element);
}
/**
* Updates the selection. It finds newly added elements
* and selects them.
*/
private void updateSelection(IJavaElementDelta delta) {
final IJavaElement addedElement= findAddedElement(delta);
if (addedElement != null) {
final StructuredSelection selection= new StructuredSelection(addedElement);
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
// 19431
// if the item is already visible then select it
if (fViewer.testFindItem(addedElement) != null)
fViewer.setSelection(selection);
}
}
});
}
}
private IJavaElement findAddedElement(IJavaElementDelta delta) {
if (delta.getKind() == IJavaElementDelta.ADDED)
return delta.getElement();
IJavaElementDelta[] affectedChildren= delta.getAffectedChildren();
for (int i= 0; i < affectedChildren.length; i++)
return findAddedElement(affectedChildren[i]);
return null;
}
/**
* Refreshes the Compilation unit corresponding to the workging copy
* @param iWorkingCopy
*/
private void refreshWorkingCopy(IWorkingCopy workingCopy) {
IJavaElement original= workingCopy.getOriginalElement();
if (original != null)
postRefresh(original);
}
private boolean isWorkingCopy(IJavaElement element) {
return (element instanceof IWorkingCopy) && ((IWorkingCopy)element).isWorkingCopy();
}
/**
* Updates the package icon
*/
private void updatePackageIcon(final IJavaElement element) {
postRunnable(new Runnable() {
public void run() {
// 1GF87WR: ITPUI:ALL - SWTEx + NPE closing a workbench window.
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.update(element, new String[]{IBasicPropertyConstants.P_IMAGE});
}
});
}
/**
* Process resource deltas
*/
private void processResourceDelta(IResourceDelta delta, Object parent) {
int status= delta.getKind();
IResource resource= delta.getResource();
// filter out changes affecting the output folder
if (resource == null)
return;
// this could be optimized by handling all the added children in the parent
if ((status & IResourceDelta.REMOVED) != 0) {
if (parent instanceof IPackageFragment)
// refresh one level above to deal with empty package filtering properly
postRefresh(internalGetParent(parent));
else
postRemove(resource);
}
if ((status & IResourceDelta.ADDED) != 0) {
if (parent instanceof IPackageFragment)
// refresh one level above to deal with empty package filtering properly
postRefresh(internalGetParent(parent));
else
postAdd(parent, resource);
}
IResourceDelta[] affectedChildren= delta.getAffectedChildren();
if (affectedChildren.length > 1) {
// more than one child changed, refresh from here downwards
postRefresh(resource);
return;
}
for (int i= 0; i < affectedChildren.length; i++)
processResourceDelta(affectedChildren[i], resource);
}
private void postRefresh(final Object root) {
postRunnable(new Runnable() {
public void run() {
// 1GF87WR: ITPUI:ALL - SWTEx + NPE closing a workbench window.
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.refresh(root);
}
});
}
private void postAdd(final Object parent, final Object element) {
postRunnable(new Runnable() {
public void run() {
// 1GF87WR: ITPUI:ALL - SWTEx + NPE closing a workbench window.
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.add(parent, element);
}
});
}
private void postRemove(final Object element) {
postRunnable(new Runnable() {
public void run() {
// 1GF87WR: ITPUI:ALL - SWTEx + NPE closing a workbench window.
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed())
fViewer.remove(element);
}
});
}
private void postRunnable(final Runnable r) {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
ctrl.getDisplay().asyncExec(r);
}
}
}
|
14,299 |
Bug 14299 Package filter [browsing]
|
Hello, I would suggest the following useful feature ; could it be possible to add a filter in the package view of the java browsing perspective, and elsewhere in order to aneble the user to filter the "package", "protected", "private", "public" classes of a package or a group of packages. Actually we often need to have in a glance all public classes of a package or a group of packages.... It corresponds to the interface of a an application towards the external world. Nobody in other tools implements this feature , except maybe in modeling tools like STOOD(a implementation tool of the HOOD method or the UML tools). Best regards Xavier
|
resolved fixed
|
543fd80
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T12:16:10Z | 2002-04-22T07:20:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/filters/NonPublicTypeFilter.java
| |
20,970 |
Bug 20970 class/interface filters in type browsing view [filters] [browsing]
|
Build 20020625 (GM2) A post 2.0 feature request... I think it would be useful to have "filter classes" and "filter interfaces" in the type browsing view. One use scenario for this: when the type hierarchy view is open on a package, it can't show interfaces. To get around this I generally stack the type browsing view with the type hierarchy view, so I can look at interfaces as well as classes. For this case it would be nice to be able to filter out classes in the type browsing view.
|
resolved fixed
|
43aa9ad
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T15:16:41Z | 2002-06-25T18:33:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/filters/ClassFilter.java
| |
20,970 |
Bug 20970 class/interface filters in type browsing view [filters] [browsing]
|
Build 20020625 (GM2) A post 2.0 feature request... I think it would be useful to have "filter classes" and "filter interfaces" in the type browsing view. One use scenario for this: when the type hierarchy view is open on a package, it can't show interfaces. To get around this I generally stack the type browsing view with the type hierarchy view, so I can look at interfaces as well as classes. For this case it would be nice to be able to filter out classes in the type browsing view.
|
resolved fixed
|
43aa9ad
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-19T15:16:41Z | 2002-06-25T18:33:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/filters/InterfaceFilter.java
| |
22,380 |
Bug 22380 "No Source" class file editor does not fetch keyboard focus
|
Build N20020813 Test Case: 1. From the package explorer open a class from a JAR without attached source 2. Activate the editor 3. Select something in another view (note: selection is blue) 4. Activate the class file editor by clicking on the tab ==> selection in other view remains blue but should be gray. Suggest to set the keyboard focus to the "Attach Source..." button
|
resolved fixed
|
c6c96b9
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T12:52:48Z | 2002-08-13T12:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java
|
package org.eclipse.jdt.internal.ui.javaeditor;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.IWidgetTokenKeeper;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModelStatusConstants;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.util.IClassFileDisassembler;
import org.eclipse.jdt.core.util.IClassFileReader;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaUIStatus;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
/**
* Java specific text editor.
*/
public class ClassFileEditor extends JavaEditor implements ClassFileDocumentProvider.InputChangeListener {
/** The horizontal scroll increment. */
private static final int HORIZONTAL_SCROLL_INCREMENT= 10;
/** The vertical scroll increment. */
private static final int VERTICAL_SCROLL_INCREMENT= 10;
/**
* A form to attach source to a class file.
*/
private class SourceAttachmentForm implements IPropertyChangeListener {
private final IClassFile fFile;
private ScrolledComposite fScrolledComposite;
private Color fBackgroundColor;
private Color fForegroundColor;
private Color fSeparatorColor;
private List fBannerLabels= new ArrayList();
private List fHeaderLabels= new ArrayList();
private Font fFont;
/**
* Creates a source attachment form for a class file.
*/
public SourceAttachmentForm(IClassFile file) {
fFile= file;
}
/**
* Returns the package fragment root of this file.
*/
private IPackageFragmentRoot getPackageFragmentRoot(IClassFile file) {
IJavaElement element= file.getParent();
while (element != null && element.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT)
element= element.getParent();
return (IPackageFragmentRoot) element;
}
/**
* Creates the control of the source attachment form.
*/
public Control createControl(Composite parent) {
Display display= parent.getDisplay();
fBackgroundColor= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
fForegroundColor= display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
fSeparatorColor= new Color(display, 152, 170, 203);
JFaceResources.getFontRegistry().addListener(this);
fScrolledComposite= new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
fScrolledComposite.setAlwaysShowScrollBars(false);
fScrolledComposite.setExpandHorizontal(true);
fScrolledComposite.setExpandVertical(true);
fScrolledComposite.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
JFaceResources.getFontRegistry().removeListener(SourceAttachmentForm.this);
fScrolledComposite= null;
fSeparatorColor.dispose();
fSeparatorColor= null;
fBannerLabels.clear();
fHeaderLabels.clear();
if (fFont != null) {
fFont.dispose();
fFont= null;
}
}
});
fScrolledComposite.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {}
public void controlResized(ControlEvent e) {
Rectangle clientArea = fScrolledComposite.getClientArea();
ScrollBar verticalBar= fScrolledComposite.getVerticalBar();
verticalBar.setIncrement(VERTICAL_SCROLL_INCREMENT);
verticalBar.setPageIncrement(clientArea.height - verticalBar.getIncrement());
ScrollBar horizontalBar= fScrolledComposite.getHorizontalBar();
horizontalBar.setIncrement(HORIZONTAL_SCROLL_INCREMENT);
horizontalBar.setPageIncrement(clientArea.width - horizontalBar.getIncrement());
}
});
Composite composite= createComposite(fScrolledComposite);
composite.setLayout(new GridLayout());
Label titleLabel= createTitleLabel(composite, JavaEditorMessages.getString("SourceAttachmentForm.title")); //$NON-NLS-1$
createLabel(composite, null);
createLabel(composite, null);
createHeadingLabel(composite, JavaEditorMessages.getString("SourceAttachmentForm.heading")); //$NON-NLS-1$
Composite separator= createCompositeSeparator(composite);
GridData data= new GridData(GridData.FILL_HORIZONTAL);
data.heightHint= 2;
separator.setLayoutData(data);
try {
final IPackageFragmentRoot root= getPackageFragmentRoot(fFile);
if (root != null) {
IClasspathEntry entry= root.getRawClasspathEntry();
if (!root.isArchive()) {
createLabel(composite, JavaEditorMessages.getFormattedString("SourceAttachmentForm.message.noSource", fFile.getElementName())); //$NON-NLS-1$
} else if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
IClasspathContainer container= JavaCore.getClasspathContainer(entry.getPath(), root.getJavaProject());
String containerName= container == null ? entry.getPath().toString() : container.getDescription();
createLabel(composite, JavaEditorMessages.getFormattedString("SourceAttachmentForm.message.containerEntry", containerName)); //$NON-NLS-1$
} else {
Button button;
IPath path= root.getSourceAttachmentPath();
if (path == null) {
createLabel(composite, JavaEditorMessages.getFormattedString("SourceAttachmentForm.message.noSourceAttachment", root.getElementName())); //$NON-NLS-1$
createLabel(composite, JavaEditorMessages.getString("SourceAttachmentForm.message.pressButtonToAttach")); //$NON-NLS-1$
createLabel(composite, null);
button= createButton(composite, JavaEditorMessages.getString("SourceAttachmentForm.button.attachSource")); //$NON-NLS-1$
} else {
createLabel(composite, JavaEditorMessages.getFormattedString("SourceAttachmentForm.message.noSourceInAttachment", fFile.getElementName())); //$NON-NLS-1$
createLabel(composite, JavaEditorMessages.getString("SourceAttachmentForm.message.pressButtonToChange")); //$NON-NLS-1$
createLabel(composite, null);
button= createButton(composite, JavaEditorMessages.getString("SourceAttachmentForm.button.changeAttachedSource")); //$NON-NLS-1$
}
button.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent event) {
try {
SourceAttachmentDialog dialog= new SourceAttachmentDialog(fScrolledComposite.getShell(), root);
if (dialog.open() == SourceAttachmentDialog.OK)
verifyInput(getEditorInput());
} catch (CoreException e) {
String title= JavaEditorMessages.getString("SourceAttachmentForm.error.title"); //$NON-NLS-1$
String message= JavaEditorMessages.getString("SourceAttachmentForm.error.message"); //$NON-NLS-1$
ExceptionHandler.handle(e, fScrolledComposite.getShell(), title, message);
}
}
public void widgetDefaultSelected(SelectionEvent e) {}
});
}
}
} catch (JavaModelException e) {
String title= JavaEditorMessages.getString("SourceAttachmentForm.error.title"); //$NON-NLS-1$
String message= JavaEditorMessages.getString("SourceAttachmentForm.error.message"); //$NON-NLS-1$
ExceptionHandler.handle(e, fScrolledComposite.getShell(), title, message);
}
separator= createCompositeSeparator(composite);
data= new GridData(GridData.FILL_HORIZONTAL);
data.heightHint= 2;
separator.setLayoutData(data);
StyledText styledText= createCodeView(composite);
data= new GridData(GridData.FILL_BOTH);
styledText.setLayoutData(data);
updateCodeView(styledText, fFile);
fScrolledComposite.setContent(composite);
fScrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
return fScrolledComposite;
}
/*
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
for (Iterator iterator = fBannerLabels.iterator(); iterator.hasNext();) {
Label label = (Label) iterator.next();
label.setFont(JFaceResources.getBannerFont());
}
for (Iterator iterator = fHeaderLabels.iterator(); iterator.hasNext();) {
Label label = (Label) iterator.next();
label.setFont(JFaceResources.getHeaderFont());
}
Control control= fScrolledComposite.getContent();
fScrolledComposite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT));
fScrolledComposite.setContent(control);
fScrolledComposite.layout(true);
fScrolledComposite.redraw();
}
// --- copied from org.eclipse.update.ui.forms.internal.FormWidgetFactory
private Composite createComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setBackground(fBackgroundColor);
// composite.addMouseListener(new MouseAdapter() {
// public void mousePressed(MouseEvent e) {
// ((Control) e.widget).setFocus();
// }
// });
return composite;
}
private Composite createCompositeSeparator(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setBackground(fSeparatorColor);
return composite;
}
private StyledText createCodeView(Composite parent) {
int styles= SWT.MULTI | SWT.FULL_SELECTION;
StyledText styledText= new StyledText(parent, styles);
styledText.setBackground(fBackgroundColor);
styledText.setForeground(fForegroundColor);
styledText.setEditable(false);
setFont(styledText);
return styledText;
}
private void setFont(StyledText styledText) {
IPreferenceStore store= getPreferenceStore();
if (store != null) {
FontData data= null;
if (store.contains(PREFERENCE_FONT) && !store.isDefault(PREFERENCE_FONT))
data= PreferenceConverter.getFontData(store, PREFERENCE_FONT);
else
data= PreferenceConverter.getDefaultFontData(store, PREFERENCE_FONT);
if (data != null) {
Font font= new Font(styledText.getDisplay(), data);
styledText.setFont(font);
if (fFont != null)
fFont.dispose();
fFont= font;
}
}
}
private Label createLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.NONE);
if (text != null)
label.setText(text);
label.setBackground(fBackgroundColor);
label.setForeground(fForegroundColor);
return label;
}
private Label createTitleLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.NONE);
if (text != null)
label.setText(text);
label.setBackground(fBackgroundColor);
label.setForeground(fForegroundColor);
label.setFont(JFaceResources.getHeaderFont());
fHeaderLabels.add(label);
return label;
}
private Label createHeadingLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.NONE);
if (text != null)
label.setText(text);
label.setBackground(fBackgroundColor);
label.setForeground(fForegroundColor);
label.setFont(JFaceResources.getBannerFont());
fBannerLabels.add(label);
return label;
}
private Button createButton(Composite parent, String text) {
Button button = new Button(parent, SWT.FLAT);
button.setBackground(fBackgroundColor);
button.setForeground(fForegroundColor);
if (text != null)
button.setText(text);
// button.addFocusListener(visibilityHandler);
return button;
}
private void updateCodeView(StyledText styledText, IClassFile classFile) {
String content= null;
int flags= IClassFileReader.FIELD_INFOS | IClassFileReader.METHOD_INFOS | IClassFileReader.SUPER_INTERFACES;
IClassFileReader classFileReader= ToolFactory.createDefaultClassFileReader(classFile, flags);
if (classFileReader != null) {
IClassFileDisassembler disassembler= ToolFactory.createDefaultClassFileDisassembler();
content= disassembler.disassemble(classFileReader, "\n"); //$NON-NLS-1$
}
styledText.setText(content == null ? "" : content); //$NON-NLS-1$
}
};
private StackLayout fStackLayout;
private Composite fParent;
private Composite fViewerComposite;
private Control fSourceAttachmentForm;
/**
* Default constructor.
*/
public ClassFileEditor() {
super();
setDocumentProvider(JavaPlugin.getDefault().getClassFileDocumentProvider());
setEditorContextMenuId("#ClassFileEditorContext"); //$NON-NLS-1$
setRulerContextMenuId("#ClassFileRulerContext"); //$NON-NLS-1$
setOutlinerContextMenuId("#ClassFileOutlinerContext"); //$NON-NLS-1$
// don't set help contextId, we install our own help context
}
/*
* @see AbstractTextEditor#createActions()
*/
protected void createActions() {
super.createActions();
setAction(ITextEditorActionConstants.SAVE, null);
setAction(ITextEditorActionConstants.REVERT_TO_SAVED, null);
/*
* 1GF82PL: ITPJUI:ALL - Need to be able to add bookmark to classfile
*
* // replace default action with class file specific ones
*
* setAction(ITextEditorActionConstants.BOOKMARK, new AddClassFileMarkerAction("AddBookmark.", this, IMarker.BOOKMARK, true)); //$NON-NLS-1$
* setAction(ITextEditorActionConstants.ADD_TASK, new AddClassFileMarkerAction("AddTask.", this, IMarker.TASK, false)); //$NON-NLS-1$
* setAction(ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS, new ClassFileMarkerRulerAction("ManageBookmarks.", getVerticalRuler(), this, IMarker.BOOKMARK, true)); //$NON-NLS-1$
* setAction(ITextEditorActionConstants.RULER_MANAGE_TASKS, new ClassFileMarkerRulerAction("ManageTasks.", getVerticalRuler(), this, IMarker.TASK, true)); //$NON-NLS-1$
*/
setAction(ITextEditorActionConstants.BOOKMARK, null);
setAction(ITextEditorActionConstants.ADD_TASK, null);
}
/*
* @see JavaEditor#getElementAt(int)
*/
protected IJavaElement getElementAt(int offset) {
if (getEditorInput() instanceof IClassFileEditorInput) {
try {
IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput();
return input.getClassFile().getElementAt(offset);
} catch (JavaModelException x) {
}
}
return null;
}
/*
* @see JavaEditor#getCorrespondingElement(IJavaElement)
*/
protected IJavaElement getCorrespondingElement(IJavaElement element) {
if (getEditorInput() instanceof IClassFileEditorInput) {
IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput();
IJavaElement parent= element.getAncestor(IJavaElement.CLASS_FILE);
if (input.getClassFile().equals(parent))
return element;
}
return null;
}
/*
* @see IEditorPart#saveState(IMemento)
*/
public void saveState(IMemento memento) {
}
/*
* @see JavaEditor#setOutlinePageInput(JavaOutlinePage, IEditorInput)
*/
protected void setOutlinePageInput(JavaOutlinePage page, IEditorInput input) {
if (page != null && input instanceof IClassFileEditorInput) {
IClassFileEditorInput cfi= (IClassFileEditorInput) input;
page.setInput(cfi.getClassFile());
}
}
/*
* 1GEPKT5: ITPJUI:Linux - Source in editor for external classes is editable
* Removed methods isSaveOnClosedNeeded and isDirty.
* Added method isEditable.
*/
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#isEditable()
*/
public boolean isEditable() {
return false;
}
/**
* Translates the given editor input into an <code>ExternalClassFileEditorInput</code>
* if it is a file editor input representing an external class file.
*
* @param input the editor input to be transformed if necessary
* @return the transformed editor input
*/
protected IEditorInput transformEditorInput(IEditorInput input) {
if (input instanceof IFileEditorInput) {
IFile file= ((IFileEditorInput) input).getFile();
IClassFileEditorInput classFileInput= new ExternalClassFileEditorInput(file);
if (classFileInput.getClassFile() != null)
input= classFileInput;
}
return input;
}
/*
* @see AbstractTextEditor#doSetInput(IEditorInput)
*/
protected void doSetInput(IEditorInput input) throws CoreException {
input= transformEditorInput(input);
if (!(input instanceof IClassFileEditorInput))
throw new CoreException(new JavaUIStatus(IJavaModelStatusConstants.INVALID_RESOURCE_TYPE, JavaEditorMessages.getString("ClassFileEditor.error.invalid_input_message"))); //$NON-NLS-1$
JavaModelException e= probeInputForSource(input);
if (e != null) {
IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input;
IClassFile file= classFileEditorInput.getClassFile();
if (!file.getJavaProject().isOnClasspath(file)) {
throw new CoreException(new JavaUIStatus(IJavaModelStatusConstants.INVALID_RESOURCE, JavaEditorMessages.getString("ClassFileEditor.error.classfile_not_on_classpath"))); //$NON-NLS-1$
} else {
throw e;
}
}
IDocumentProvider documentProvider= getDocumentProvider();
if (documentProvider instanceof ClassFileDocumentProvider)
((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this);
super.doSetInput(input);
documentProvider= getDocumentProvider();
if (documentProvider instanceof ClassFileDocumentProvider)
((ClassFileDocumentProvider) documentProvider).addInputChangeListener(this);
verifyInput(getEditorInput());
}
/*
* @see IWorkbenchPart#createPartControl(Composite)
*/
public void createPartControl(Composite parent) {
fParent= new Composite(parent, SWT.NONE);
fStackLayout= new StackLayout();
fParent.setLayout(fStackLayout);
fViewerComposite= new Composite(fParent, SWT.NONE);
fViewerComposite.setLayout(new FillLayout());
super.createPartControl(fViewerComposite);
fStackLayout.topControl= fViewerComposite;
fParent.layout();
try {
verifyInput(getEditorInput());
} catch (CoreException e) {
String title= JavaEditorMessages.getString("ClassFileEditor.error.title"); //$NON-NLS-1$
String message= JavaEditorMessages.getString("ClassFileEditor.error.message"); //$NON-NLS-1$
ExceptionHandler.handle(e, fParent.getShell(), title, message);
}
}
/**
* Returns the package fragment root corresponding to the class file.
*/
private static IPackageFragmentRoot getPackageFragmentRoot(IClassFile file) {
IJavaElement element= file.getParent();
while (element != null && element.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT)
element= element.getParent();
return (IPackageFragmentRoot) element;
}
private JavaModelException probeInputForSource(IEditorInput input) {
if (input == null)
return null;
IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input;
IClassFile file= classFileEditorInput.getClassFile();
try {
file.getSourceRange();
} catch (JavaModelException e) {
return e;
}
return null;
}
/**
* Checks if the class file input has no source attached. If so, a source attachment form is shown.
*/
private void verifyInput(IEditorInput input) throws CoreException {
if (fParent == null || input == null)
return;
IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input;
IClassFile file= classFileEditorInput.getClassFile();
// show source attachment form if no source found
if (file.getSourceRange() == null) {
// dispose old source attachment form
if (fSourceAttachmentForm != null)
fSourceAttachmentForm.dispose();
SourceAttachmentForm form= new SourceAttachmentForm(file);
fSourceAttachmentForm= form.createControl(fParent);
fStackLayout.topControl= fSourceAttachmentForm;
fParent.layout();
// show source viewer
} else {
if (fSourceAttachmentForm != null) {
fSourceAttachmentForm.dispose();
fSourceAttachmentForm= null;
fStackLayout.topControl= fViewerComposite;
fParent.layout();
}
}
}
/*
* @see ClassFileDocumentProvider.InputChangeListener#inputChanged(IClassFileEditorInput)
*/
public void inputChanged(final IClassFileEditorInput input) {
if (input != null && input.equals(getEditorInput())) {
ISourceViewer viewer= getSourceViewer();
if (viewer != null) {
StyledText textWidget= viewer.getTextWidget();
if (textWidget != null && !textWidget.isDisposed()) {
textWidget.getDisplay().asyncExec(new Runnable() {
public void run() {
setInput(input);
}
});
}
}
}
}
/*
* @see JavaEditor#createJavaSourceViewer(Composite, IVerticalRuler, int)
*/
protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
return new SourceViewer(parent, ruler, styles) {
public boolean requestWidgetToken(IWidgetTokenKeeper requester) {
if (WorkbenchHelp.isContextHelpDisplayed())
return false;
return super.requestWidgetToken(requester);
}
};
}
/*
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
public void dispose() {
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=18510
IDocumentProvider documentProvider= getDocumentProvider();
if (documentProvider instanceof ClassFileDocumentProvider)
((ClassFileDocumentProvider) documentProvider).removeInputChangeListener(this);
super.dispose();
}
}
|
20,622 |
Bug 20622 resize bug in "Override Method" [code manipulation]
|
When there's lot of methods potentially overrideable and I enlarge the override method view, the inner subfields do not enlarge accordingly. I enclose a screenshot that will make clear what I mean.
|
resolved fixed
|
c9ca516
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T14:24:19Z | 2002-06-19T07:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CheckedTreeSelectionDialog.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.actions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.dialogs.SelectionStatusDialog;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer;
/**
* A class to select elements out of a tree structure.
*
* @deprecated Remove after F2. Use class from org.eclipse.ui.dialogs
*/
public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
private CheckboxTreeViewer fViewer;
private ILabelProvider fLabelProvider;
private ITreeContentProvider fContentProvider;
private ISelectionStatusValidator fValidator= null;
private ViewerSorter fSorter;
private String fEmptyListMessage= WorkbenchMessages.getString("CheckedTreeSelectionDialog.nothing_available"); //$NON-NLS-1$
private IStatus fCurrStatus= new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
private List fFilters;
private Object fInput;
private boolean fIsEmpty;
private int fWidth= 60;
private int fHeight= 18;
private boolean fContainerMode;
private Object[] fExpandedElements;
/**
* Constructs an instance of <code>ElementTreeSelectionDialog</code>.
* @param labelProvider the label provider to render the entries
* @param contentProvider the content provider to evaluate the tree structure
*/
public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
ITreeContentProvider contentProvider) {
super(parent);
fLabelProvider= labelProvider;
fContentProvider= contentProvider;
setResult(new ArrayList(0));
setStatusLineAboveButtons(true);
fContainerMode= false;
fExpandedElements= null;
int shellStyle= getShellStyle();
setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
}
/**
* If set, the checked /gray state of containers (inner nodes) is derived from the checked state of its
* leaf nodes.
* @param containerMode The containerMode to set
*/
public void setContainerMode(boolean containerMode) {
fContainerMode= containerMode;
}
/**
* Sets the initial selection.
* Convenience method.
* @param selection the initial selection.
*/
public void setInitialSelection(Object selection) {
setInitialSelections(new Object[] {selection});
}
/**
* Sets the message to be displayed if the list is empty.
* @param message the message to be displayed.
*/
public void setEmptyListMessage(String message) {
fEmptyListMessage= message;
}
/**
* Sets the sorter used by the tree viewer.
*/
public void setSorter(ViewerSorter sorter) {
fSorter= sorter;
}
/**
* Adds a filter to the tree viewer.
* @param filter a filter.
*/
public void addFilter(ViewerFilter filter) {
if (fFilters == null)
fFilters= new ArrayList(4);
fFilters.add(filter);
}
/**
* Sets an optional validator to check if the selection is valid.
* The validator is invoked whenever the selection changes.
* @param validator the validator to validate the selection.
*/
public void setValidator(ISelectionStatusValidator validator) {
fValidator= validator;
}
/**
* Sets the tree input.
* @param input the tree input.
*/
public void setInput(Object input) {
fInput= input;
}
/**
* Expands the tree
*/
public void setExpandedElements(Object[] elements) {
fExpandedElements= elements;
}
/**
* Sets the size of the tree in unit of characters.
* @param width the width of the tree.
* @param height the height of the tree.
*/
public void setSize(int width, int height) {
fWidth= width;
fHeight= height;
}
protected void updateOKStatus() {
if (!fIsEmpty) {
if (fValidator != null) {
fCurrStatus= fValidator.validate(fViewer.getCheckedElements());
updateStatus(fCurrStatus);
} else if (!fCurrStatus.isOK()) {
fCurrStatus= new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
}
} else {
fCurrStatus= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, fEmptyListMessage, null);
}
updateStatus(fCurrStatus);
}
/*
* @see Window#open()
*/
public int open() {
fIsEmpty= evaluateIfTreeEmpty(fInput);
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
access$superOpen();
}
});
return getReturnCode();
}
private void access$superOpen() {
super.open();
}
/**
* Handles cancel button pressed event.
*/
protected void cancelPressed() {
setResult(null);
super.cancelPressed();
}
/*
* @see SelectionStatusDialog#computeResult()
*/
protected void computeResult() {
setResult(Arrays.asList(fViewer.getCheckedElements()));
}
/*
* @see Window#create()
*/
public void create() {
super.create();
List initialSelections= getInitialSelections();
if (initialSelections != null) {
fViewer.setCheckedElements(initialSelections.toArray());
}
if (fExpandedElements != null) {
fViewer.setExpandedElements(fExpandedElements);
}
updateOKStatus();
}
/*
* @see Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite composite= (Composite) super.createDialogArea(parent);
Label messageLabel= createMessageArea(composite);
Control treeWidget= createTreeViewer(composite);
Control buttonComposite= createSelectionButtons(composite);
GridData data= new GridData(GridData.FILL_BOTH);
data.widthHint= convertWidthInCharsToPixels(fWidth);
data.heightHint= convertHeightInCharsToPixels(fHeight);
treeWidget.setLayoutData(data);
if (fIsEmpty) {
messageLabel.setEnabled(false);
treeWidget.setEnabled(false);
buttonComposite.setEnabled(false);
}
return composite;
}
protected Tree createTreeViewer(Composite parent) {
if (fContainerMode) {
fViewer= new ContainerCheckedTreeViewer(parent, SWT.BORDER);
} else {
fViewer= new CheckboxTreeViewer(parent, SWT.BORDER);
}
fViewer.setContentProvider(fContentProvider);
fViewer.setLabelProvider(fLabelProvider);
fViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
updateOKStatus();
}
});
fViewer.setSorter(fSorter);
if (fFilters != null) {
for (int i= 0; i != fFilters.size(); i++)
fViewer.addFilter((ViewerFilter) fFilters.get(i));
}
fViewer.setInput(fInput);
return fViewer.getTree();
}
/**
* Add the selection and deselection buttons to the dialog.
* @param composite org.eclipse.swt.widgets.Composite
*/
protected Composite createSelectionButtons(Composite composite) {
Composite buttonComposite= new Composite(composite, SWT.RIGHT);
GridLayout layout= new GridLayout();
layout.numColumns= 2;
buttonComposite.setLayout(layout);
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
data.grabExcessHorizontalSpace= true;
composite.setData(data);
Button selectButton= createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, WorkbenchMessages.getString("CheckedTreeSelectionDialog.select_all"), false); //$NON-NLS-1$
SelectionListener listener= new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
fViewer.setCheckedElements(fContentProvider.getElements(fInput));
updateOKStatus();
}
};
selectButton.addSelectionListener(listener);
Button deselectButton= createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, WorkbenchMessages.getString("CheckedTreeSelectionDialog.deselect_all"), false); //$NON-NLS-1$
listener= new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
fViewer.setCheckedElements(new Object[0]);
updateOKStatus();
}
};
deselectButton.addSelectionListener(listener);
return buttonComposite;
}
private boolean evaluateIfTreeEmpty(Object input) {
Object[] elements= fContentProvider.getElements(input);
if (elements.length > 0) {
if (fFilters != null) {
for (int i= 0; i < fFilters.size(); i++) {
ViewerFilter curr= (ViewerFilter)fFilters.get(i);
elements= curr.filter(fViewer, input, elements);
}
}
}
return elements.length == 0;
}
}
|
20,622 |
Bug 20622 resize bug in "Override Method" [code manipulation]
|
When there's lot of methods potentially overrideable and I enlarge the override method view, the inner subfields do not enlarge accordingly. I enclose a screenshot that will make clear what I mean.
|
resolved fixed
|
c9ca516
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T14:24:19Z | 2002-06-19T07:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/OverrideMethodQuery.java
|
package org.eclipse.jdt.internal.ui.actions;
import java.util.ArrayList;
import java.util.HashSet;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.internal.corext.codemanipulation.IOverrideMethodQuery;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
public class OverrideMethodQuery implements IOverrideMethodQuery {
private static class OverrideTreeSelectionDialog extends CheckedTreeSelectionDialog{
private OverrideMethodContentProvider fContentProvider;
public OverrideTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, OverrideMethodContentProvider contentProvider) {
super(parent, labelProvider, contentProvider);
fContentProvider= contentProvider;
}
/*
* @see CheckedTreeSelectionDialog#createTreeViewer(Composite)
*/
protected Tree createTreeViewer(Composite composite) {
Composite inner= new Composite(composite, SWT.NONE);
GridLayout layout= new GridLayout();
layout.marginHeight= 0;
layout.marginWidth= 0;
layout.numColumns= 1;
inner.setLayout(layout);
Tree tree= super.createTreeViewer(inner);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
Button flatListButton= new Button(inner, SWT.CHECK);
flatListButton.setText(ActionMessages.getString("OverrideMethodQuery.groupMethodsByTypes")); //$NON-NLS-1$
flatListButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
flatListButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
boolean isSelected= (((Button) e.widget).getSelection());
fContentProvider.setShowTypes(isSelected);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
flatListButton.setSelection(fContentProvider.isShowTypes());
return tree;
}
/*
* @see org.eclipse.jface.window.Window#configureShell(Shell)
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
WorkbenchHelp.setHelp(newShell, IJavaHelpContextIds.OVERRIDE_TREE_SELECTION_DIALOG);
}
}
private static class OverrideMethodContentProvider implements ITreeContentProvider {
private final String SETTINGS_SECTION= "OverrideMethodDialog"; //$NON-NLS-1$
private final String SETTINGS_SHOWTYPES= "showtypes"; //$NON-NLS-1$
private Object[] fTypes;
private IMethod[] fMethods;
private final Object[] fEmpty= new Object[0];
private boolean fShowTypes;
private Viewer fViewer;
private IDialogSettings fSettings;
/**
* Constructor for OverrideMethodContentProvider.
*/
public OverrideMethodContentProvider(IMethod[] methods, Object[] types) {
fMethods= methods;
fTypes= types;
IDialogSettings dialogSettings= JavaPlugin.getDefault().getDialogSettings();
fSettings= dialogSettings.getSection(SETTINGS_SECTION);
if (fSettings == null) {
fSettings= dialogSettings.addNewSection(SETTINGS_SECTION);
fSettings.put(SETTINGS_SHOWTYPES, true);
}
fShowTypes= fSettings.getBoolean(SETTINGS_SHOWTYPES);
}
/*
* @see ITreeContentProvider#getChildren(Object)
*/
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof IType) {
ArrayList result= new ArrayList(fMethods.length);
for (int i= 0; i < fMethods.length; i++) {
if (fMethods[i].getDeclaringType().equals(parentElement)) {
result.add(fMethods[i]);
}
}
return result.toArray();
}
return fEmpty;
}
/*
* @see ITreeContentProvider#getParent(Object)
*/
public Object getParent(Object element) {
if (element instanceof IMethod) {
return ((IMethod)element).getDeclaringType();
}
return null;
}
/*
* @see ITreeContentProvider#hasChildren(Object)
*/
public boolean hasChildren(Object element) {
return getChildren(element).length > 0;
}
/*
* @see IStructuredContentProvider#getElements(Object)
*/
public Object[] getElements(Object inputElement) {
return fShowTypes ? fTypes : fMethods;
}
/*
* @see IContentProvider#dispose()
*/
public void dispose() {
}
/*
* @see IContentProvider#inputChanged(Viewer, Object, Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
fViewer= viewer;
}
public boolean isShowTypes() {
return fShowTypes;
}
public void setShowTypes(boolean showTypes) {
if (fShowTypes != showTypes) {
fShowTypes= showTypes;
fSettings.put(SETTINGS_SHOWTYPES, showTypes);
if (fViewer != null) {
fViewer.refresh();
}
}
}
}
private static class OverrideMethodSorter extends ViewerSorter {
private IType[] fAllTypes;
public OverrideMethodSorter(ITypeHierarchy typeHierarchy) {
IType curr= typeHierarchy.getType();
IType[] superTypes= typeHierarchy.getAllSupertypes(curr);
fAllTypes= new IType[superTypes.length + 1];
fAllTypes[0]= curr;
System.arraycopy(superTypes, 0, fAllTypes, 1, superTypes.length);
}
/*
* @see ViewerSorter#compare(Viewer, Object, Object)
*/
public int compare(Viewer viewer, Object e1, Object e2) {
if (e1 instanceof IType && e2 instanceof IType) {
if (e1.equals(e2)) {
return 0;
}
for (int i= 0; i < fAllTypes.length; i++) {
IType curr= fAllTypes[i];
if (curr.equals(e1)) {
return -1;
}
if (curr.equals(e2)) {
return 1;
}
}
return 0;
} else {
return super.compare(viewer, e1, e2);
}
}
}
private class OverrideMethodValidator implements ISelectionStatusValidator {
/*
* @see ISelectionValidator#validate(Object[])
*/
public IStatus validate(Object[] selection) {
int count= 0;
for (int i= 0; i < selection.length; i++) {
if (selection[i] instanceof IMethod) {
count++;
}
}
if (count == 0 && !fEmptySelectionAllowed) {
return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$
}
String message;
if (count == 1) {
message= ActionMessages.getFormattedString("OverrideMethodQuery.selectioninfo.one", String.valueOf(count)); //$NON-NLS-1$
} else {
message= ActionMessages.getFormattedString("OverrideMethodQuery.selectioninfo.more", String.valueOf(count)); //$NON-NLS-1$
}
return new StatusInfo(IStatus.INFO, message);
}
}
private boolean fEmptySelectionAllowed;
private Shell fShell;
public OverrideMethodQuery(Shell shell, boolean emptySelectionAllowed) {
fShell= shell;
fEmptySelectionAllowed= emptySelectionAllowed;
}
/*
* @see IOverrideMethodQuery#select(IMethod[], IMethod[], ITypeHierarchy)
*/
public IMethod[] select(IMethod[] methods, IMethod[] defaultSelected, ITypeHierarchy typeHierarchy) {
HashSet types= new HashSet(methods.length);
for (int i= 0; i < methods.length; i++) {
types.add(methods[i].getDeclaringType());
}
Object[] typesArrays= types.toArray();
ViewerSorter sorter= new OverrideMethodSorter(typeHierarchy);
sorter.sort(null, typesArrays);
HashSet expanded= new HashSet(defaultSelected.length);
for (int i= 0; i < defaultSelected.length; i++) {
expanded.add(defaultSelected[i].getDeclaringType());
}
if (expanded.isEmpty() && typesArrays.length > 0) {
expanded.add(typesArrays[0]);
}
ILabelProvider lprovider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
OverrideMethodContentProvider contentProvider= new OverrideMethodContentProvider(methods, typesArrays);
OverrideTreeSelectionDialog dialog= new OverrideTreeSelectionDialog(fShell, lprovider, contentProvider);
dialog.setValidator(new OverrideMethodValidator());
dialog.setTitle(ActionMessages.getString("OverrideMethodQuery.dialog.title")); //$NON-NLS-1$
dialog.setMessage(ActionMessages.getString("OverrideMethodQuery.dialog.description")); //$NON-NLS-1$
dialog.setInitialSelections(defaultSelected);
dialog.setExpandedElements(expanded.toArray());
dialog.setContainerMode(true);
dialog.setSorter(sorter);
dialog.setSize(60, 18);
dialog.setInput(this); // input does not matter
if (dialog.open() == dialog.OK) {
Object[] checkedElements= dialog.getResult();
ArrayList result= new ArrayList(checkedElements.length);
for (int i= 0; i < checkedElements.length; i++) {
Object curr= checkedElements[i];
if (curr instanceof IMethod) {
result.add(curr);
}
}
return (IMethod[]) result.toArray(new IMethod[result.size()]);
}
return null;
}
}
|
22,054 |
Bug 22054 Can't extract local variable from super send [refactoring]
|
- Import the following Java class into Eclipse: public class Foo { public String toString() { return super.toString() + new Integer(1).toString(); } } - Select 'super.toString()' and choose 'Extract local variable' - An error message appears saying: 'Cannot extract this kind of expression into a local variable'.
|
verified fixed
|
b9edfac
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T15:34:31Z | 2002-07-30T20:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test48_in.java
| |
22,054 |
Bug 22054 Can't extract local variable from super send [refactoring]
|
- Import the following Java class into Eclipse: public class Foo { public String toString() { return super.toString() + new Integer(1).toString(); } } - Select 'super.toString()' and choose 'Extract local variable' - An error message appears saying: 'Cannot extract this kind of expression into a local variable'.
|
verified fixed
|
b9edfac
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T15:34:31Z | 2002-07-30T20:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractTemp/canExtract/A_test48_out.java
| |
22,054 |
Bug 22054 Can't extract local variable from super send [refactoring]
|
- Import the following Java class into Eclipse: public class Foo { public String toString() { return super.toString() + new Integer(1).toString(); } } - Select 'super.toString()' and choose 'Extract local variable' - An error message appears saying: 'Cannot extract this kind of expression into a local variable'.
|
verified fixed
|
b9edfac
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T15:34:31Z | 2002-07-30T20:13:20Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
22,054 |
Bug 22054 Can't extract local variable from super send [refactoring]
|
- Import the following Java class into Eclipse: public class Foo { public String toString() { return super.toString() + new Integer(1).toString(); } } - Select 'super.toString()' and choose 'Extract local variable' - An error message appears saying: 'Cannot extract this kind of expression into a local variable'.
|
verified fixed
|
b9edfac
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-20T15:34:31Z | 2002-07-30T20:13:20Z |
cases/org/eclipse/jdt/ui/tests/refactoring/ExtractTempTests.java
| |
20,832 |
Bug 20832 NullPointerException in finally block hides real exception (in RenameMethodRefactoring.java) [refactoring]
|
I suddenly started having a problem with the rename method refactoring, getting an Internal Error with the following unhelpful root cause: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:280) [...rest of stack trace omitted] Caused by: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.analy zeRenameChanges(RenameMethodRefactoring.java:360) [...rest of stack trace omitted] ================== Examining the source of RenameMethodRefactoring, I discovered the NPE is caused by an unsafe call in a finally block: ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); for (int i= 0; i < fNewWorkingCopies.length; i++) { // <-- line 360 fNewWorkingCopies[i].destroy(); } } ================== The following change fixed this problem and let me see the real problem (the CoreException I was getting that also kept fNewWorkingCopies from being assigned to anything): ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); if (fNewWorkingCopies != null) { // <-- added this check for (int i= 0; i < fNewWorkingCopies.length; i++) { fNewWorkingCopies[i].destroy(); } } } ================== Here was the real problem: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:60) [...rest of stack trace omitted] Caused by: Java Model Exception: Core Exception [code 274] Resource is out of sync with the file system: /NMEAJava/src/gps/event/SentenceMulticaster.java. at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.check Input(RenameMethodRefactoring.java:237) [...rest of stack trace omitted] ================== (I thing the "out of sync" exception had to do with running another IDE at the same time as Eclipse and was easily corrected by re-saving the source file it was complaining about. I suspect this CoreException should be handled in a more user-friendly way, but this bug report isn't concerned with that.) Please make my or an equivalent fix to RenameMethodRefactoring. You might also want to search globally for similar dangerous code in finally blocks at some point.
|
resolved fixed
|
69236e6
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T11:02:45Z | 2002-06-21T20:06:40Z |
org.eclipse.jdt.ui/core
| |
20,832 |
Bug 20832 NullPointerException in finally block hides real exception (in RenameMethodRefactoring.java) [refactoring]
|
I suddenly started having a problem with the rename method refactoring, getting an Internal Error with the following unhelpful root cause: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:280) [...rest of stack trace omitted] Caused by: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.analy zeRenameChanges(RenameMethodRefactoring.java:360) [...rest of stack trace omitted] ================== Examining the source of RenameMethodRefactoring, I discovered the NPE is caused by an unsafe call in a finally block: ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); for (int i= 0; i < fNewWorkingCopies.length; i++) { // <-- line 360 fNewWorkingCopies[i].destroy(); } } ================== The following change fixed this problem and let me see the real problem (the CoreException I was getting that also kept fNewWorkingCopies from being assigned to anything): ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); if (fNewWorkingCopies != null) { // <-- added this check for (int i= 0; i < fNewWorkingCopies.length; i++) { fNewWorkingCopies[i].destroy(); } } } ================== Here was the real problem: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:60) [...rest of stack trace omitted] Caused by: Java Model Exception: Core Exception [code 274] Resource is out of sync with the file system: /NMEAJava/src/gps/event/SentenceMulticaster.java. at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.check Input(RenameMethodRefactoring.java:237) [...rest of stack trace omitted] ================== (I thing the "out of sync" exception had to do with running another IDE at the same time as Eclipse and was easily corrected by re-saving the source file it was complaining about. I suspect this CoreException should be handled in a more user-friendly way, but this bug report isn't concerned with that.) Please make my or an equivalent fix to RenameMethodRefactoring. You might also want to search globally for similar dangerous code in finally blocks at some point.
|
resolved fixed
|
69236e6
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T11:02:45Z | 2002-06-21T20:06:40Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameFieldRefactoring.java
| |
20,832 |
Bug 20832 NullPointerException in finally block hides real exception (in RenameMethodRefactoring.java) [refactoring]
|
I suddenly started having a problem with the rename method refactoring, getting an Internal Error with the following unhelpful root cause: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:280) [...rest of stack trace omitted] Caused by: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.analy zeRenameChanges(RenameMethodRefactoring.java:360) [...rest of stack trace omitted] ================== Examining the source of RenameMethodRefactoring, I discovered the NPE is caused by an unsafe call in a finally block: ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); for (int i= 0; i < fNewWorkingCopies.length; i++) { // <-- line 360 fNewWorkingCopies[i].destroy(); } } ================== The following change fixed this problem and let me see the real problem (the CoreException I was getting that also kept fNewWorkingCopies from being assigned to anything): ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); if (fNewWorkingCopies != null) { // <-- added this check for (int i= 0; i < fNewWorkingCopies.length; i++) { fNewWorkingCopies[i].destroy(); } } } ================== Here was the real problem: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:60) [...rest of stack trace omitted] Caused by: Java Model Exception: Core Exception [code 274] Resource is out of sync with the file system: /NMEAJava/src/gps/event/SentenceMulticaster.java. at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.check Input(RenameMethodRefactoring.java:237) [...rest of stack trace omitted] ================== (I thing the "out of sync" exception had to do with running another IDE at the same time as Eclipse and was easily corrected by re-saving the source file it was complaining about. I suspect this CoreException should be handled in a more user-friendly way, but this bug report isn't concerned with that.) Please make my or an equivalent fix to RenameMethodRefactoring. You might also want to search globally for similar dangerous code in finally blocks at some point.
|
resolved fixed
|
69236e6
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T11:02:45Z | 2002-06-21T20:06:40Z |
org.eclipse.jdt.ui/core
| |
20,832 |
Bug 20832 NullPointerException in finally block hides real exception (in RenameMethodRefactoring.java) [refactoring]
|
I suddenly started having a problem with the rename method refactoring, getting an Internal Error with the following unhelpful root cause: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:280) [...rest of stack trace omitted] Caused by: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.analy zeRenameChanges(RenameMethodRefactoring.java:360) [...rest of stack trace omitted] ================== Examining the source of RenameMethodRefactoring, I discovered the NPE is caused by an unsafe call in a finally block: ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); for (int i= 0; i < fNewWorkingCopies.length; i++) { // <-- line 360 fNewWorkingCopies[i].destroy(); } } ================== The following change fixed this problem and let me see the real problem (the CoreException I was getting that also kept fNewWorkingCopies from being assigned to anything): ================== // ... omitted } catch(CoreException e) { throw new JavaModelException(e); } finally{ pm.done(); if (fNewWorkingCopies != null) { // <-- added this check for (int i= 0; i < fNewWorkingCopies.length; i++) { fNewWorkingCopies[i].destroy(); } } } ================== Here was the real problem: ================== java.lang.reflect.InvocationTargetException at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:60) [...rest of stack trace omitted] Caused by: Java Model Exception: Core Exception [code 274] Resource is out of sync with the file system: /NMEAJava/src/gps/event/SentenceMulticaster.java. at org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodRefactoring.check Input(RenameMethodRefactoring.java:237) [...rest of stack trace omitted] ================== (I thing the "out of sync" exception had to do with running another IDE at the same time as Eclipse and was easily corrected by re-saving the source file it was complaining about. I suspect this CoreException should be handled in a more user-friendly way, but this bug report isn't concerned with that.) Please make my or an equivalent fix to RenameMethodRefactoring. You might also want to search globally for similar dangerous code in finally blocks at some point.
|
resolved fixed
|
69236e6
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T11:02:45Z | 2002-06-21T20:06:40Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameMethodRefactoring.java
| |
19,067 |
Bug 19067 Useless error message
|
F2 - create project Test with source folder src - create folder data - create Test.java in data - paste content class Test { public Object field; } class B extends Test { public Object field2; } - select field2 - select Refactor->Pullup... You get an error message saying: Pull up is not allowed on elements declared in this type. This error message isn't very usefull. Even if we disble the action in the case of java files not on build path we should improve the message for case in which it is used. Why can't I pull up elements.
|
resolved fixed
|
18b4ef5
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T12:50:47Z | 2002-06-04T14:13:20Z |
org.eclipse.jdt.ui/ui
| |
19,067 |
Bug 19067 Useless error message
|
F2 - create project Test with source folder src - create folder data - create Test.java in data - paste content class Test { public Object field; } class B extends Test { public Object field2; } - select field2 - select Refactor->Pullup... You get an error message saying: Pull up is not allowed on elements declared in this type. This error message isn't very usefull. Even if we disble the action in the case of java files not on build path we should improve the message for case in which it is used. Why can't I pull up elements.
|
resolved fixed
|
18b4ef5
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T12:50:47Z | 2002-06-04T14:13:20Z |
refactoring/org/eclipse/jdt/internal/ui/refactoring/actions/MoveMembersAction.java
| |
19,067 |
Bug 19067 Useless error message
|
F2 - create project Test with source folder src - create folder data - create Test.java in data - paste content class Test { public Object field; } class B extends Test { public Object field2; } - select field2 - select Refactor->Pullup... You get an error message saying: Pull up is not allowed on elements declared in this type. This error message isn't very usefull. Even if we disble the action in the case of java files not on build path we should improve the message for case in which it is used. Why can't I pull up elements.
|
resolved fixed
|
18b4ef5
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T12:50:47Z | 2002-06-04T14:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/PullUpAction.java
|
package org.eclipse.jdt.ui.actions;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.Assert;
import org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoring;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.SelectionConverter;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.refactoring.PullUpWizard;
import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages;
import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
/**
* Action to pull up method and fields into a superclass.
* <p>
* Action is applicable to selections containing elements of
* type <code>IField</code> and <code>IMethod</code>
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class PullUpAction extends SelectionDispatchAction{
private PullUpRefactoring fRefactoring;
private CompilationUnitEditor fEditor;
/**
* Creates a new <code>PullUpAction</code>. The action requires that the selection
* provided by the site's selection provider is of type <code>
* org.eclipse.jface.viewers.IStructuredSelection</code>.
*
* @param site the site providing context information for this action
*/
public PullUpAction(IWorkbenchSite site) {
super(site);
setText(RefactoringMessages.getString("RefactoringGroup.pull_Up_label"));//$NON-NLS-1$
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.PULL_UP_ACTION);
}
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
*/
public PullUpAction(CompilationUnitEditor editor) {
this(editor.getEditorSite());
fEditor= editor;
setEnabled(SelectionConverter.canOperateOn(fEditor));
}
/*
* @see SelectionDispatchAction#selectionChanged(IStructuredSelection)
*/
protected void selectionChanged(IStructuredSelection selection) {
setEnabled(canEnable(selection));
}
/*
* @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#selectionChanged(ITextSelection)
*/
protected void selectionChanged(ITextSelection selection) {
}
/*
* @see SelectionDispatchAction#run(IStructuredSelection)
*/
protected void run(IStructuredSelection selection) {
startRefactoring();
}
/*
* @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#run(ITextSelection)
*/
protected void run(ITextSelection selection) {
if (! canRun(selection)){
String unavailable= RefactoringMessages.getString("PullUpAction.unavailable"); //$NON-NLS-1$
MessageDialog.openInformation(getShell(), RefactoringMessages.getString("OpenRefactoringWizardAction.unavailable"), unavailable); //$NON-NLS-1$
fRefactoring= null;
return;
}
startRefactoring();
}
private boolean canEnable(IStructuredSelection selection){
if (selection.isEmpty())
return false;
for (Iterator iter= selection.iterator(); iter.hasNext(); ) {
if (! (iter.next() instanceof IMember))
return false;
}
return shouldAcceptElements(selection.toArray());
}
private boolean canRun(ITextSelection selection){
IJavaElement[] elements= resolveElements();
if (elements.length != 1)
return false;
return (elements[0] instanceof IMember) && shouldAcceptElements(elements);
}
private PullUpRefactoring createNewRefactoringInstance(Object[] obj){
Set memberSet= new HashSet();
memberSet.addAll(Arrays.asList(obj));
IMember[] members= (IMember[]) memberSet.toArray(new IMember[memberSet.size()]);
return new PullUpRefactoring(members, JavaPreferencesSettings.getCodeGenerationSettings());
}
private boolean shouldAcceptElements(Object[] elements) {
try{
fRefactoring= createNewRefactoringInstance(elements);
return fRefactoring.checkPreactivation().isOK();
} catch (JavaModelException e){
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
if (JavaModelUtil.filterNotPresentException(e))
JavaPlugin.log(e); //this happen on selection changes in viewers - do not show ui if fails, just log
return false;
}
}
private IJavaElement[] resolveElements() {
return SelectionConverter.codeResolveHandled(fEditor, getShell(), RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring")); //$NON-NLS-1$
}
private RefactoringWizard createWizard(){
String title= RefactoringMessages.getString("RefactoringGroup.pull_up"); //$NON-NLS-1$
String helpId= IJavaHelpContextIds.PULL_UP_ERROR_WIZARD_PAGE;
return new PullUpWizard(fRefactoring, title, helpId);
}
private void startRefactoring() {
Assert.isNotNull(fRefactoring);
try{
Object newElementToProcess= new RefactoringStarter().activate(fRefactoring, createWizard(), RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"), true); //$NON-NLS-1$
if (newElementToProcess == null)
return;
IStructuredSelection mockSelection= new StructuredSelection(newElementToProcess);
selectionChanged(mockSelection);
if (isEnabled())
run(mockSelection);
else
MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), ActionMessages.getString("PullUpAction.problem.title"), ActionMessages.getString("PullUpAction.problem.message")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (JavaModelException e){
ExceptionHandler.handle(e, RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"), RefactoringMessages.getString("OpenRefactoringWizardAction.exception")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
|
22,632 |
Bug 22632 inline temp: should disallow iniling arrays intialized with array constants
|
class A{ void f(A a){ A[] arr= {a}; arr[0]= null; } } cannot inline arr
|
resolved fixed
|
fa2abaa
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T14:37:12Z | 2002-08-21T14:26:40Z |
org.eclipse.jdt.ui.tests.refactoring/resources/InlineTemp/cannotInline/A_testFail14.java
| |
22,632 |
Bug 22632 inline temp: should disallow iniling arrays intialized with array constants
|
class A{ void f(A a){ A[] arr= {a}; arr[0]= null; } } cannot inline arr
|
resolved fixed
|
fa2abaa
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T14:37:12Z | 2002-08-21T14:26:40Z |
org.eclipse.jdt.ui.tests.refactoring/test
| |
22,632 |
Bug 22632 inline temp: should disallow iniling arrays intialized with array constants
|
class A{ void f(A a){ A[] arr= {a}; arr[0]= null; } } cannot inline arr
|
resolved fixed
|
fa2abaa
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T14:37:12Z | 2002-08-21T14:26:40Z |
cases/org/eclipse/jdt/ui/tests/refactoring/InlineTempTests.java
| |
22,632 |
Bug 22632 inline temp: should disallow iniling arrays intialized with array constants
|
class A{ void f(A a){ A[] arr= {a}; arr[0]= null; } } cannot inline arr
|
resolved fixed
|
fa2abaa
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T14:37:12Z | 2002-08-21T14:26:40Z |
org.eclipse.jdt.ui/core
| |
22,632 |
Bug 22632 inline temp: should disallow iniling arrays intialized with array constants
|
class A{ void f(A a){ A[] arr= {a}; arr[0]= null; } } cannot inline arr
|
resolved fixed
|
fa2abaa
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-21T14:37:12Z | 2002-08-21T14:26:40Z |
refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java
| |
12,261 |
Bug 12261 Eclipse dies after SWT error
|
build 20020321 Adding a method to a java file I get an SWT error and a dialog pops up asking if I want to exit Eclipse because of an Internal error. The log file is attached. I could not isolate the problem but I do have a workspace that reproduces it. If you need the workspace and the steps to reproduce, just let me know and I can put somewhere else or send by email.
|
resolved fixed
|
6189678
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-22T14:33:30Z | 2002-03-26T02:33:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionUI.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.text.link;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultPositionUpdater;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextInputListener;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
/**
* A user interface for <code>LinkedPositionManager</code>, using <code>ITextViewer</code>.
*/
public class LinkedPositionUI implements LinkedPositionListener,
ITextInputListener, ModifyListener, VerifyListener, VerifyKeyListener, PaintListener, IPropertyChangeListener {
/**
* A listener for notification when the user cancelled the edit operation.
*/
public interface ExitListener {
void exit(boolean accept);
}
// leave flags
private static final int UNINSTALL= 1; // uninstall linked position manager
private static final int COMMIT= 2; // commit changes
private static final int DOCUMENT_CHANGED= 4; // document has changed
private static final int UPDATE_CARET= 8; // update caret
private static final String CARET_POSITION= "LinkedPositionUI.caret.position"; //$NON-NLS-1$
private static final IPositionUpdater fgUpdater= new DefaultPositionUpdater(CARET_POSITION);
private static final IPreferenceStore fgStore= JavaPlugin.getDefault().getPreferenceStore();
private final ITextViewer fViewer;
private final LinkedPositionManager fManager;
private Color fFrameColor;
private int fFinalCaretOffset= -1; // no final caret offset
private Position fFramePosition;
private int fCaretOffset;
private ExitListener fExitListener;
/**
* Creates a user interface for <code>LinkedPositionManager</code>.
*
* @param viewer the text viewer.
* @param manager the <code>LinkedPositionManager</code> managing a <code>IDocument</code> of the <code>ITextViewer</code>.
*/
public LinkedPositionUI(ITextViewer viewer, LinkedPositionManager manager) {
Assert.isNotNull(viewer);
Assert.isNotNull(manager);
fViewer= viewer;
fManager= manager;
fManager.setLinkedPositionListener(this);
initializeHighlightColor(viewer);
}
/*
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(CompilationUnitEditor.LINKED_POSITION_COLOR)) {
initializeHighlightColor(fViewer);
redrawRegion();
}
}
private void initializeHighlightColor(ITextViewer viewer) {
if (fFrameColor != null)
fFrameColor.dispose();
StyledText text= viewer.getTextWidget();
if (text != null) {
Display display= text.getDisplay();
fFrameColor= createColor(fgStore, CompilationUnitEditor.LINKED_POSITION_COLOR, display);
}
}
/**
* Creates a color from the information stored in the given preference store.
* Returns <code>null</code> if there is no such information available.
*/
private Color createColor(IPreferenceStore store, String key, Display display) {
RGB rgb= null;
if (store.contains(key)) {
if (store.isDefault(key))
rgb= PreferenceConverter.getDefaultColor(store, key);
else
rgb= PreferenceConverter.getColor(store, key);
if (rgb != null)
return new Color(display, rgb);
}
return null;
}
/**
* Sets the final position of the caret when the linked mode is exited
* successfully by leaving the last linked position using TAB.
*/
public void setFinalCaretOffset(int offset) {
fFinalCaretOffset= offset;
}
/**
* Sets a <code>CancelListener</code> which is notified if the linked mode
* is exited unsuccessfully by hitting ESC.
*/
public void setCancelListener(ExitListener listener) {
fExitListener= listener;
}
/*
* @see LinkedPositionManager.LinkedPositionListener#setCurrentPositions(Position, int)
*/
public void setCurrentPosition(Position position, int caretOffset) {
if (!fFramePosition.equals(position)) {
redrawRegion();
fFramePosition= position;
}
fCaretOffset= caretOffset;
}
/**
* Enters the linked mode. The linked mode can be left by calling
* <code>exit</code>.
*
* @see #exit(boolean)
*/
public void enter() {
// track final caret
IDocument document= fViewer.getDocument();
document.addPositionCategory(CARET_POSITION);
document.addPositionUpdater(fgUpdater);
try {
if (fFinalCaretOffset != -1)
document.addPosition(CARET_POSITION, new Position(fFinalCaretOffset));
} catch (BadLocationException e) {
handleException(fViewer.getTextWidget().getShell(), e);
} catch (BadPositionCategoryException e) {
JavaPlugin.log(e);
Assert.isTrue(false);
}
fViewer.addTextInputListener(this);
ITextViewerExtension extension= (ITextViewerExtension) fViewer;
extension.prependVerifyKeyListener(this);
StyledText text= fViewer.getTextWidget();
text.addVerifyListener(this);
text.addModifyListener(this);
text.addPaintListener(this);
text.showSelection();
fFramePosition= fManager.getFirstPosition();
if (fFramePosition == null)
leave(UNINSTALL | COMMIT | UPDATE_CARET);
fgStore.addPropertyChangeListener(this);
}
/*
* @see LinkedPositionManager.LinkedPositionListener#exit(boolean)
*/
public void exit(boolean success) {
// no UNINSTALL since manager has already uninstalled itself
leave((success ? COMMIT : 0) | UPDATE_CARET);
}
/**
* Returns the cursor selection, after having entered the linked mode.
* <code>enter()</code> must be called prior to a call to this method.
*/
public IRegion getSelectedRegion() {
if (fFramePosition == null)
return new Region(fFinalCaretOffset, 0);
else
return new Region(fFramePosition.getOffset(), fFramePosition.getLength());
}
private void leave(int flags) {
if ((flags & UNINSTALL) != 0)
fManager.uninstall((flags & COMMIT) != 0);
fgStore.removePropertyChangeListener(this);
if (fFrameColor != null) {
fFrameColor.dispose();
fFrameColor= null;
}
StyledText text= fViewer.getTextWidget();
text.removePaintListener(this);
text.removeModifyListener(this);
text.removeVerifyListener(this);
ITextViewerExtension extension= (ITextViewerExtension) fViewer;
extension.removeVerifyKeyListener(this);
fViewer.removeTextInputListener(this);
try {
IRegion region= fViewer.getVisibleRegion();
IDocument document= fViewer.getDocument();
if (((flags & COMMIT) != 0) &&
((flags & DOCUMENT_CHANGED) == 0) &&
((flags & UPDATE_CARET) != 0))
{
Position[] positions= document.getPositions(CARET_POSITION);
if ((positions != null) && (positions.length != 0)) {
int offset= positions[0].getOffset() - region.getOffset();
if ((offset >= 0) && (offset <= region.getLength()))
text.setSelection(offset, offset);
}
}
document.removePositionUpdater(fgUpdater);
document.removePositionCategory(CARET_POSITION);
if (fExitListener != null)
fExitListener.exit(
((flags & COMMIT) != 0) ||
((flags & DOCUMENT_CHANGED) != 0));
} catch (BadPositionCategoryException e) {
JavaPlugin.log(e);
Assert.isTrue(false);
}
if ((flags & DOCUMENT_CHANGED) == 0)
text.redraw();
}
private void next() {
redrawRegion();
fFramePosition= fManager.getNextPosition(fFramePosition.getOffset());
if (fFramePosition == null) {
leave(UNINSTALL | COMMIT | UPDATE_CARET);
} else {
selectRegion();
redrawRegion();
}
}
private void previous() {
redrawRegion();
Position position= fManager.getPreviousPosition(fFramePosition.getOffset());
if (position == null) {
fViewer.getTextWidget().getDisplay().beep();
} else {
fFramePosition= position;
selectRegion();
redrawRegion();
}
}
/*
* @see VerifyKeyListener#verifyKey(VerifyEvent)
*/
public void verifyKey(VerifyEvent event) {
switch (event.character) {
// [SHIFT-]TAB = hop between edit boxes
case 0x09:
{
Point selection= fViewer.getTextWidget().getSelection();
IRegion region= fViewer.getVisibleRegion();
int offset= selection.x + region.getOffset();
int length= selection.y - selection.x;
// if tab was treated as a document change, would it exceed variable range?
if (!LinkedPositionManager.includes(fFramePosition, offset, length)) {
leave(UNINSTALL | COMMIT | UPDATE_CARET);
return;
}
}
if (event.stateMask == SWT.SHIFT)
previous();
else
next();
event.doit= false;
break;
// ENTER
case 0x0D:
leave(UNINSTALL | COMMIT | UPDATE_CARET);
event.doit= false;
break;
// ESC
case 0x1B:
leave(UNINSTALL | COMMIT);
event.doit= false;
break;
}
}
/*
* @see VerifyListener#verifyText(VerifyEvent)
*/
public void verifyText(VerifyEvent event) {
if (!event.doit)
return;
IRegion region= fViewer.getVisibleRegion();
int offset= event.start + region.getOffset();
int length= event.end - event.start;
// allow changes only within linked positions when coming through UI
if (!fManager.anyPositionIncludes(offset, length))
leave(UNINSTALL | COMMIT);
}
/*
* @see PaintListener#paintControl(PaintEvent)
*/
public void paintControl(PaintEvent event) {
if (fFramePosition == null)
return;
IRegion region= fViewer.getVisibleRegion();
// #6824
if (!includes(region, fFramePosition)) {
leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED);
return;
}
int offset= fFramePosition.getOffset() - region.getOffset();
int length= fFramePosition.getLength();
StyledText text= fViewer.getTextWidget();
// support for bidi
Point minLocation= getMinimumLocation(text, offset, length);
Point maxLocation= getMaximumLocation(text, offset, length);
int x1= minLocation.x;
int x2= minLocation.x + maxLocation.x - minLocation.x - 1;
int y= minLocation.y + text.getLineHeight() - 1;
GC gc= event.gc;
gc.setForeground(fFrameColor);
gc.drawLine(x1, y, x2, y);
}
private static Point getMinimumLocation(StyledText text, int offset, int length) {
Point minLocation= new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
for (int i= 0; i <= length; i++) {
Point location= text.getLocationAtOffset(offset + i);
if (location.x < minLocation.x)
minLocation.x= location.x;
if (location.y < minLocation.y)
minLocation.y= location.y;
}
return minLocation;
}
private static Point getMaximumLocation(StyledText text, int offset, int length) {
Point maxLocation= new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
for (int i= 0; i <= length; i++) {
Point location= text.getLocationAtOffset(offset + i);
if (location.x > maxLocation.x)
maxLocation.x= location.x;
if (location.y > maxLocation.y)
maxLocation.y= location.y;
}
return maxLocation;
}
private void redrawRegion() {
IRegion region= fViewer.getVisibleRegion();
if (!includes(region, fFramePosition)) {
leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED);
return;
}
int offset= fFramePosition.getOffset() - region.getOffset();
int length= fFramePosition.getLength();
StyledText text= fViewer.getTextWidget();
if (text != null && !text.isDisposed())
text.redrawRange(offset, length, true);
}
private void selectRegion() {
IRegion region= fViewer.getVisibleRegion();
if (!includes(region, fFramePosition)) {
leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED);
return;
}
int start= fFramePosition.getOffset() - region.getOffset();
int end= fFramePosition.getLength() + start;
StyledText text= fViewer.getTextWidget();
if (text != null && !text.isDisposed())
text.setSelection(start, end);
}
private void updateCaret() {
IRegion region= fViewer.getVisibleRegion();
if (!includes(region, fFramePosition)) {
leave(UNINSTALL | COMMIT | DOCUMENT_CHANGED);
return;
}
int offset= fFramePosition.getOffset() + fCaretOffset - region.getOffset();
if ((offset >= 0) && (offset <= region.getLength())) {
StyledText text= fViewer.getTextWidget();
if (text != null && !text.isDisposed())
text.setCaretOffset(offset);
}
}
/*
* @see ModifyListener#modifyText(ModifyEvent)
*/
public void modifyText(ModifyEvent e) {
// reposition caret after StyledText
redrawRegion();
updateCaret();
}
private static void handleException(Shell shell, Exception e) {
String title= LinkedPositionMessages.getString("LinkedPositionUI.error.title"); //$NON-NLS-1$
if (e instanceof CoreException)
ExceptionHandler.handle((CoreException)e, shell, title, null);
else if (e instanceof InvocationTargetException)
ExceptionHandler.handle((InvocationTargetException)e, shell, title, null);
else {
MessageDialog.openError(shell, title, e.getMessage());
JavaPlugin.log(e);
}
}
/*
* @see ITextInputListener#inputDocumentAboutToBeChanged(IDocument, IDocument)
*/
public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
// 5326: leave linked mode on document change
int flags= UNINSTALL | COMMIT | (oldInput.equals(newInput) ? 0 : DOCUMENT_CHANGED);
leave(flags);
}
/*
* @see ITextInputListener#inputDocumentChanged(IDocument, IDocument)
*/
public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
}
private static boolean includes(IRegion region, Position position) {
return
position.getOffset() >= region.getOffset() &&
position.getOffset() + position.getLength() <= region.getOffset() + region.getLength();
}
}
|
22,329 |
Bug 22329 Incorrect icon shown for jar entries [package explorer] [browsing]
|
The icon displayed for jar file entries is not always correct. I am supplying the following to demonstrate the problem: 1. test.plugin.zip - This is a plugin that defines several default text editors with unique icons for particular file names. Extract it into the eclipse/plugins directory. 2. IconJarTest.zip - This is a sample project which can be unzipped into your workspace directory. When you look at the project, you will see that the abc.xml and def.xml files in the MyFiles folder have unique icons (as defined by the plugin). However, if you expand the iconTest.jar file, def.xml has the same icon as abc.xml. If you open the two files in the jar though, the icon displayed in the editor tab is actually correct. I have seen a case where the editor tab icons are incorrect (a generic file icon appears rather than either of the specific icons), but have yet to be able to reproduce that particular problem.
|
resolved fixed
|
52e543c
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-23T15:11:05Z | 2002-08-09T21:53:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/StorageLabelProvider.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.viewsupport;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.resources.IStorage;
import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.PlatformUI;
/**
* Standard label provider for IStorage objects.
* Use this class when you want to present IStorage objects in a viewer.
*/
public class StorageLabelProvider extends LabelProvider {
private Map fJarImageMap= new HashMap(10);
/* (non-Javadoc)
* @see ILabelProvider#getImage
*/
public Image getImage(Object element) {
if (element instanceof IStorage)
return getImageForJarEntry((IStorage)element);
return super.getImage(element);
}
/* (non-Javadoc)
* @see ILabelProvider#getText
*/
public String getText(Object element) {
if (element instanceof IStorage)
return ((IStorage)element).getName();
return super.getText(element);
}
/* (non-Javadoc)
*
* @see IBaseLabelProvider#dispose
*/
public void dispose() {
if (fJarImageMap != null) {
Iterator each= fJarImageMap.values().iterator();
while (each.hasNext()) {
Image image= (Image)each.next();
image.dispose();
}
fJarImageMap= null;
}
}
/*
* Gets and caches an image for a JarEntryFile.
* The image for a JarEntryFile is retrieved from the EditorRegistry.
*/
private Image getImageForJarEntry(IStorage element) {
if (fJarImageMap == null)
return null;
String extension= element.getFullPath().getFileExtension();
Image image= (Image)fJarImageMap.get(extension);
if (image != null)
return image;
IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry();
ImageDescriptor desc= registry.getImageDescriptor(element.getName());
image= desc.createImage();
fJarImageMap.put(extension, image);
return image;
}
}
|
12,802 |
Bug 12802 modify parameters: should be enabled if a parameter is selected in the editor [refactoring]
|
currently, you have to select a method
|
resolved fixed
|
56cdb5a
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-26T13:38:20Z | 2002-04-04T17:06:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/ModifyParametersAction.java
|
/*******************************************************************************
* Copyright (c) 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.ui.actions;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.refactoring.Assert;
import org.eclipse.jdt.internal.corext.refactoring.structure.ModifyParametersRefactoring;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.ActionUtil;
import org.eclipse.jdt.internal.ui.actions.SelectionConverter;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jdt.internal.ui.refactoring.ModifyParametersWizard;
import org.eclipse.jdt.internal.ui.refactoring.RefactoringMessages;
import org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard;
import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
/**
* Action to start the modify parameters refactoring. The refactoring supports
* swapping and renaming of arguments.
* <p>
* This action is applicable to selections containing a method with one or
* more arguments.
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class ModifyParametersAction extends SelectionDispatchAction {
private ModifyParametersRefactoring fRefactoring;
private CompilationUnitEditor fEditor;
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
*/
public ModifyParametersAction(CompilationUnitEditor editor) {
this(editor.getEditorSite());
fEditor= editor;
setEnabled(SelectionConverter.canOperateOn(fEditor));
}
/**
* Creates a new <code>ModifyParametersAction</code>. The action requires
* that the selection provided by the site's selection provider is of type <code>
* org.eclipse.jface.viewers.IStructuredSelection</code>.
*
* @param site the site providing context information for this action
*/
public ModifyParametersAction(IWorkbenchSite site) {
super(site);
setText(RefactoringMessages.getString("RefactoringGroup.modify_Parameters_label"));//$NON-NLS-1$
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.MODIFY_PARAMETERS_ACTION);
}
/*
* @see SelectionDispatchAction#selectionChanged(IStructuredSelection)
*/
protected void selectionChanged(IStructuredSelection selection) {
setEnabled(canEnable(selection));
}
/*
* @see SelectionDispatchAction#selectionChanged(ITextSelection)
*/
protected void selectionChanged(ITextSelection selection) {
}
/*
* @see SelectionDispatchAction#run(IStructuredSelection)
*/
protected void run(IStructuredSelection selection) {
startRefactoring();
}
/*
* @see SelectionDispatchAction#run(ITextSelection)
*/
protected void run(ITextSelection selection) {
if (! canRun(selection)){
String unavailable= RefactoringMessages.getString("ModifyParametersAction.unavailable"); //$NON-NLS-1$
MessageDialog.openInformation(getShell(), RefactoringMessages.getString("OpenRefactoringWizardAction.unavailable"), unavailable); //$NON-NLS-1$
fRefactoring= null;
return;
}
startRefactoring();
}
private boolean canEnable(IStructuredSelection selection){
if (selection.isEmpty() || selection.size() != 1)
return false;
Object first= selection.getFirstElement();
return (first instanceof IMethod) && shouldAcceptElement((IMethod)first);
}
private boolean canRun(ITextSelection selection){
IJavaElement[] elements= resolveElements();
if (elements.length != 1)
return false;
return (elements[0] instanceof IMethod) && shouldAcceptElement((IMethod)elements[0]);
}
private boolean shouldAcceptElement(IMethod method) {
try{
fRefactoring= new ModifyParametersRefactoring(method);
return fRefactoring.checkPreactivation().isOK();
} catch (JavaModelException e) {
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
if (JavaModelUtil.filterNotPresentException(e))
JavaPlugin.log(e); //this happen on selection changes in viewers - do not show ui if fails, just log
return false;
}
}
private IJavaElement[] resolveElements() {
return SelectionConverter.codeResolveHandled(fEditor, getShell(), RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring")); //$NON-NLS-1$
}
private RefactoringWizard createWizard(){
String title= RefactoringMessages.getString("RefactoringGroup.modify_method_parameters"); //$NON-NLS-1$
String helpId= IJavaHelpContextIds.MODIFY_PARAMETERS_ERROR_WIZARD_PAGE;
return new ModifyParametersWizard(fRefactoring, title, helpId);
}
private void startRefactoring() {
Assert.isNotNull(fRefactoring);
// Work around for http://dev.eclipse.org/bugs/show_bug.cgi?id=19104
if (!ActionUtil.isProcessable(getShell(), fRefactoring.getMethod()))
return;
try{
Object newElementToProcess= new RefactoringStarter().activate(fRefactoring, createWizard(), RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"), true); //$NON-NLS-1$
if (newElementToProcess == null)
return;
IStructuredSelection mockSelection= new StructuredSelection(newElementToProcess);
selectionChanged(mockSelection);
if (isEnabled())
run(mockSelection);
else
MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), ActionMessages.getString("ModifyParameterAction.problem.title"), ActionMessages.getString("ModifyParameterAction.problem.message")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (JavaModelException e){
ExceptionHandler.handle(e, RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"), RefactoringMessages.getString("OpenRefactoringWizardAction.exception")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
|
22,725 |
Bug 22725 NLS Tool: Default common prefix [refactoring]
|
It would be nice if the "Externalize Strings" wizard filled in the "Enter common prefix for generated keys" field with the name of the name of the class by default. For example, if I'm externalizing the strings in JDIModelPresentation, the prefix would be set to "JDIModelPresentation." by default. I believe this is what most users do anyway, so it would be nice if the tool did it for us.
|
resolved fixed
|
c257cf3
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-28T14:51:05Z | 2002-08-22T15:26:40Z |
org.eclipse.jdt.ui/ui
| |
22,725 |
Bug 22725 NLS Tool: Default common prefix [refactoring]
|
It would be nice if the "Externalize Strings" wizard filled in the "Enter common prefix for generated keys" field with the name of the name of the class by default. For example, if I'm externalizing the strings in JDIModelPresentation, the prefix would be set to "JDIModelPresentation." by default. I believe this is what most users do anyway, so it would be nice if the tool did it for us.
|
resolved fixed
|
c257cf3
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-28T14:51:05Z | 2002-08-22T15:26:40Z |
refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/ExternalizeWizardPage.java
| |
22,827 |
Bug 22827 nls: incorrect error if package starts with uppercase [refactoring]
|
If you try to externalize strings from a class contained in a package whose name starts with a cap, you will not be able to complete the externalization because of an error on the second page. The error message says : "By convention, packages names usually start with a lowercase letter". This is inconsistent with the behaviour of the new Package Wizard which only gives a warning for package name starting with a cap.
|
resolved fixed
|
0d45186
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-08-28T16:16:19Z | 2002-08-26T08:20:00Z |
org.eclipse.jdt.ui/ui
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.