diff -Nru eclipse-jdt-ui-4.9/CONTRIBUTING eclipse-jdt-ui-4.10/CONTRIBUTING
--- eclipse-jdt-ui-4.9/CONTRIBUTING 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/CONTRIBUTING 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,59 @@
+# Contributing to Eclipse Java development tools
+
+Thanks for your interest in this project.
+
+## Project description
+
+The JDT project provides the tool plug-ins that implement a Java IDE supporting
+the development of any Java application, including Eclipse plug-ins. It adds a
+Java project nature and Java perspective to the Eclipse Workbench as well as a
+number of views, editors, wizards, builders, and code merging and refactoring
+tools. The JDT project allows Eclipse to be a development environment for
+itself.
+
+* https://projects.eclipse.org/projects/eclipse.jdt
+
+## Developer resources
+
+Information regarding source code management, builds, coding standards, and
+more.
+
+* https://projects.eclipse.org/projects/eclipse.jdt/developer
+
+The project maintains the following source code repositories
+
+* http://git.eclipse.org/c/jdt/eclipse.jdt.core.binaries.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.core.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git
+
+This project uses Bugzilla to track ongoing development and issues.
+
+* Search for issues: https://eclipse.org/bugs/buglist.cgi?product=JDT
+* Create a new report: https://eclipse.org/bugs/enter_bug.cgi?product=JDT
+
+Be sure to search for existing bugs before you create another one. Remember that
+contributions are always welcome!
+
+## Eclipse Contributor Agreement
+
+Before your contribution can be accepted by the project team contributors must
+electronically sign the Eclipse Contributor Agreement (ECA).
+
+* http://www.eclipse.org/legal/ECA.php
+
+Commits that are provided by non-committers must have a Signed-off-by field in
+the footer indicating that the author is aware of the terms by which the
+contribution has been provided to the project. The non-committer must
+additionally have an Eclipse Foundation account and must have a signed Eclipse
+Contributor Agreement (ECA) on file.
+
+For more information, please see the Eclipse Committer Handbook:
+https://www.eclipse.org/projects/handbook/#resources-commit
+
+## Contact
+
+Contact the project developers via the project's "dev" list.
+
+* https://dev.eclipse.org/mailman/listinfo/jdt-dev
\ No newline at end of file
diff -Nru eclipse-jdt-ui-4.9/debian/build.xml eclipse-jdt-ui-4.10/debian/build.xml
--- eclipse-jdt-ui-4.9/debian/build.xml 2018-12-03 12:13:31.000000000 +0000
+++ eclipse-jdt-ui-4.10/debian/build.xml 2018-12-28 14:06:37.000000000 +0000
@@ -4,8 +4,8 @@
-
-
+
+
@@ -27,6 +27,8 @@
+
+
diff -Nru eclipse-jdt-ui-4.9/debian/changelog eclipse-jdt-ui-4.10/debian/changelog
--- eclipse-jdt-ui-4.9/debian/changelog 2018-12-10 21:54:03.000000000 +0000
+++ eclipse-jdt-ui-4.10/debian/changelog 2018-12-28 14:32:30.000000000 +0000
@@ -1,3 +1,14 @@
+eclipse-jdt-ui (4.10-1) unstable; urgency=medium
+
+ * New upstream release
+ - Depend on libeclipse-jdt-core-java (>= 3.16)
+ - Depend on libeclipse-jface-text-java (>= 3.15)
+ - Depend on libeclipse-text-java (>= 3.8)
+ - Updated the bundle dependencies
+ * Standards-Version updated to 4.3.0
+
+ -- Emmanuel Bourg Fri, 28 Dec 2018 15:32:30 +0100
+
eclipse-jdt-ui (4.9-1) unstable; urgency=medium
* New upstream release
diff -Nru eclipse-jdt-ui-4.9/debian/control eclipse-jdt-ui-4.10/debian/control
--- eclipse-jdt-ui-4.9/debian/control 2018-12-10 21:52:09.000000000 +0000
+++ eclipse-jdt-ui-4.10/debian/control 2018-12-28 14:31:55.000000000 +0000
@@ -23,14 +23,14 @@
libeclipse-debug-core-java,
libeclipse-debug-ui-java,
libeclipse-help-java,
- libeclipse-jdt-core-java (>= 3.15),
+ libeclipse-jdt-core-java (>= 3.16),
libeclipse-jdt-launching-java (>= 3.11),
libeclipse-jface-java (>= 3.14),
- libeclipse-jface-text-java (>= 3.13),
+ libeclipse-jface-text-java (>= 3.15),
libeclipse-search-java,
libeclipse-team-core-java,
libeclipse-team-ui-java,
- libeclipse-text-java,
+ libeclipse-text-java (>= 3.8),
libeclipse-ui-console-java,
libeclipse-ui-editors-java,
libeclipse-ui-forms-java,
@@ -48,7 +48,7 @@
libicu4j-java,
libswt-gtk-4-java,
eclipse-debian-helper
-Standards-Version: 4.2.1
+Standards-Version: 4.3.0
Vcs-Git: https://salsa.debian.org/java-team/eclipse-jdt-ui.git
Vcs-Browser: https://salsa.debian.org/java-team/eclipse-jdt-ui
Homepage: https://www.eclipse.org/jdt/ui/
@@ -62,7 +62,7 @@
libeclipse-core-filebuffers-java,
libeclipse-core-resources-java,
libeclipse-core-runtime-java,
- libeclipse-jdt-core-java (>= 3.14),
+ libeclipse-jdt-core-java (>= 3.15),
libeclipse-jface-java,
libeclipse-jface-text-java,
libeclipse-text-java,
@@ -106,12 +106,14 @@
${misc:Depends},
${bundle:Depends},
libeclipse-core-expressions-java,
+ libeclipse-core-filebuffers-java,
+ libeclipse-core-filesystem-java,
libeclipse-core-jobs-java,
libeclipse-core-resources-java,
libeclipse-core-runtime-java,
- libeclipse-jdt-core-java,
+ libeclipse-jdt-core-java (>= 3.16),
libeclipse-jdt-launching-java,
- libeclipse-text-java,
+ libeclipse-text-java (>= 3.8),
libequinox-common-java,
libequinox-preferences-java,
libicu4j-java
@@ -269,10 +271,10 @@
libeclipse-debug-core-java,
libeclipse-debug-ui-java,
libeclipse-help-java,
- libeclipse-jdt-core-java (>= 3.15),
+ libeclipse-jdt-core-java (>= 3.16),
libeclipse-jdt-launching-java (>= 3.11),
libeclipse-jface-java (>= 3.14),
- libeclipse-jface-text-java (>= 3.13),
+ libeclipse-jface-text-java (>= 3.15),
libeclipse-search-java,
libeclipse-team-core-java,
libeclipse-team-ui-java,
diff -Nru eclipse-jdt-ui-4.9/LICENSE eclipse-jdt-ui-4.10/LICENSE
--- eclipse-jdt-ui-4.9/LICENSE 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/LICENSE 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,277 @@
+Eclipse Public License - v 2.0
+
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial content
+ Distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate from
+ and are Distributed by that particular Contributor. A Contribution
+ "originates" from a Contributor if it was added to the Program by
+ such Contributor itself or anyone acting on such Contributor's behalf.
+ Contributions do not include changes or additions to the Program that
+ are not Modified Works.
+
+"Contributor" means any person or entity that Distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Program" means the Contributions Distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement
+or any Secondary License (as applicable), including Contributors.
+
+"Derivative Works" shall mean any work, whether in Source Code or other
+form, that is based on (or derived from) the Program and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship.
+
+"Modified Works" shall mean any work in Source Code or other form that
+results from an addition to, deletion from, or modification of the
+contents of the Program, including, for purposes of clarity any new file
+in Source Code form that contains any contents of the Program. Modified
+Works shall not include works that contain only declarations,
+interfaces, types, classes, structures, or files of the Program solely
+in each case in order to link to, bind by name, or subclass the Program
+or Modified Works thereof.
+
+"Distribute" means the acts of a) distributing or b) making available
+in any manner that enables the transfer of a copy.
+
+"Source Code" means the form of a Program preferred for making
+modifications, including but not limited to software source code,
+documentation source, and configuration files.
+
+"Secondary License" means either the GNU General Public License,
+Version 2.0, or any later versions of that license, including any
+exceptions or additional permissions as identified by the initial
+Contributor.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare Derivative Works of, publicly display,
+ publicly perform, Distribute and sublicense the Contribution of such
+ Contributor, if any, and such Derivative Works.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in Source Code or other form. This patent license shall
+ apply to the combination of the Contribution and the Program if, at
+ the time the Contribution is added by the Contributor, such addition
+ of the Contribution causes such combination to be covered by the
+ Licensed Patents. The patent license shall not apply to any other
+ combinations which include the Contribution. No hardware per se is
+ licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the
+ rights and licenses granted hereunder, each Recipient hereby
+ assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party
+ patent license is required to allow Recipient to Distribute the
+ Program, it is Recipient's responsibility to acquire that license
+ before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+ e) Notwithstanding the terms of any Secondary License, no
+ Contributor makes additional grants to any Recipient (other than
+ those set forth in this Agreement) as a result of such Recipient's
+ receipt of the Program under the terms of a Secondary License
+ (if permitted under the terms of Section 3).
+
+3. REQUIREMENTS
+
+3.1 If a Contributor Distributes the Program in any form, then:
+
+ a) the Program must also be made available as Source Code, in
+ accordance with section 3.2, and the Contributor must accompany
+ the Program with a statement that the Source Code for the Program
+ is available under this Agreement, and informs Recipients how to
+ obtain it in a reasonable manner on or through a medium customarily
+ used for software exchange; and
+
+ b) the Contributor may Distribute the Program under a license
+ different than this Agreement, provided that such license:
+ i) effectively disclaims on behalf of all other Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+
+ ii) effectively excludes on behalf of all other Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+
+ iii) does not attempt to limit or alter the recipients' rights
+ in the Source Code under section 3.2; and
+
+ iv) requires any subsequent distribution of the Program by any
+ party to be under a license that satisfies the requirements
+ of this section 3.
+
+3.2 When the Program is Distributed as Source Code:
+
+ a) it must be made available under this Agreement, or if the
+ Program (i) is combined with other material in a separate file or
+ files made available under a Secondary License, and (ii) the initial
+ Contributor attached to the Source Code the notice described in
+ Exhibit A of this Agreement, then the Program may be made available
+ under the terms of such Secondary Licenses, and
+
+ b) a copy of this Agreement must be included with each copy of
+ the Program.
+
+3.3 Contributors may not remove or alter any copyright, patent,
+trademark, attribution notices, disclaimers of warranty, or limitations
+of liability ("notices") contained within the Program from any copy of
+the Program which they Distribute, provided that Contributors may add
+their own appropriate notices.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program,
+the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes
+the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every
+other Contributor ("Indemnified Contributor") against any losses,
+damages and costs (collectively "Losses") arising from claims, lawsuits
+and other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program
+in a commercial product offering. The obligations in this section do not
+apply to any claims or Losses relating to any actual or alleged
+intellectual property infringement. In order to qualify, an Indemnified
+Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control,
+and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay
+those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
+TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all
+risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs
+or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
+SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software
+or hardware) infringes such Recipient's patent(s), then such Recipient's
+rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign the
+responsibility to serve as the Agreement Steward to a suitable separate
+entity. Each new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+Distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to Distribute the Program (including its
+Contributions) under the new version.
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
+receives no rights or licenses to the intellectual property of any
+Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted
+under this Agreement are reserved. Nothing in this Agreement is intended
+to be enforceable by any entity that is not a Contributor or Recipient.
+No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A - Form of Secondary Licenses Notice
+
+"This Source Code may also be made available under the following
+Secondary Licenses when the conditions for such availability set forth
+in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
+version(s), and exceptions or additional permissions here}."
+
+ Simply including a copy of this Agreement, including this Exhibit A
+ is not sufficient to license the Source Code under Secondary Licenses.
+
+ If it is not possible or desirable to put the notice in a particular
+ file, then You may include the notice in a location (such as a LICENSE
+ file in a relevant directory) where a recipient would be likely to
+ look for such a notice.
+
+ You may add additional accurate notices of copyright ownership.
\ No newline at end of file
diff -Nru eclipse-jdt-ui-4.9/NOTICE eclipse-jdt-ui-4.10/NOTICE
--- eclipse-jdt-ui-4.9/NOTICE 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/NOTICE 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,35 @@
+# Notices for Eclipse Java development tools
+
+This content is produced and maintained by the Eclipse Java development tools
+project.
+
+* Project home: https://projects.eclipse.org/projects/eclipse.jdt
+
+## Trademarks
+
+Eclipse Java development tools, Java development tools, Eclipse JDT, and JDT are
+trademarks of the Eclipse Foundation.
+
+## Copyright
+
+All content is the property of the respective authors or their employers. For
+more information regarding authorship of content, please consult the listed
+source code repository logs.
+
+## Declared Project Licenses
+
+This program and the accompanying materials are made available under the terms
+of the Eclipse Public License v. 2.0 which is available at
+http://www.eclipse.org/legal/epl-2.0.
+
+SPDX-License-Identifier: EPL-2.0
+
+## Source Code
+
+The project maintains the following source code repositories:
+
+* http://git.eclipse.org/c/jdt/eclipse.jdt.core.binaries.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.core.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.git
+* http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git
\ No newline at end of file
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.astview/META-INF/MANIFEST.MF eclipse-jdt-ui-4.10/org.eclipse.jdt.astview/META-INF/MANIFEST.MF
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.astview/META-INF/MANIFEST.MF 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.astview/META-INF/MANIFEST.MF 2018-12-03 12:49:27.000000000 +0000
@@ -3,7 +3,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.astview; singleton:=true
-Bundle-Version: 1.3.200.qualifier
+Bundle-Version: 1.3.300.qualifier
Eclipse-SourceReferences: scm:git:git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git;path="org.eclipse.jdt.astview";tag=R4_4
Bundle-Activator: org.eclipse.jdt.astview.ASTViewPlugin
Bundle-Vendor: %providerName
@@ -11,7 +11,7 @@
Export-Package: org.eclipse.jdt.astview;x-internal:=true,
org.eclipse.jdt.astview.views;x-internal:=true
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.jdt.core;bundle-version="[3.14.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.15.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.14.0,4.0.0)",
org.eclipse.ui.ide,
org.eclipse.ui.views,
@@ -24,3 +24,4 @@
org.eclipse.core.expressions
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.eclipse.jdt.core.manipulation
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.astview/pom.xml eclipse-jdt-ui-4.10/org.eclipse.jdt.astview/pom.xml
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.astview/pom.xml 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.astview/pom.xml 2018-12-03 12:49:27.000000000 +0000
@@ -1,6 +1,6 @@
@@ -1740,8 +1741,15 @@
id="org.eclipse.jdt.ui.preferences.MembersOrderPreferencePage">
+
+
+
-
+
-
-
+
+
@@ -4982,7 +4992,7 @@
point="org.eclipse.ui.ide.markerResolution">
+ class="org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildpathProblemMarkerResolutionGenerator">
@@ -5512,6 +5522,12 @@
registryId="org.eclipse.jdt.ui.CompilationUnitEditor">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/pom.xml eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/pom.xml
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/pom.xml 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/pom.xml 2018-12-03 12:49:27.000000000 +0000
@@ -14,11 +14,11 @@
eclipse.jdt.uieclipse.jdt.ui
- 4.9.0-SNAPSHOT
+ 4.10.0-SNAPSHOTorg.eclipse.jdtorg.eclipse.jdt.ui
- 3.15.0-SNAPSHOT
+ 3.16.0-SNAPSHOTeclipse-plugin-warn:-deprecation,unavoidableGenericProblems
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/preview/formatter.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/preview/formatter.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/preview/formatter.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/preview/formatter.java 2018-12-03 12:49:27.000000000 +0000
@@ -594,10 +594,10 @@
{
@SuppressWarnings("unused") final @Positive int k;
}
- void foo() { ;; do {} while (false); for (;;) {} }
+ void foo() { ;; }
void empty(@SuppressWarnings("unused") final int i) { }}
-enum MyEnum { @Deprecated UNDEFINED(0) { }}enum EmptyEnum { }@interface EmptyAnnotation {
-}//--PREVIEW--END--section-newlines
+enum MyEnum { @Deprecated UNDEFINED(0) { }}
+//--PREVIEW--END--section-newlines
//--PREVIEW--START--section-newlines-controlstatements
class Example {
@@ -606,7 +606,6 @@
try { } catch (Exception e) { } finally { }
}
void foo2() {
- if (true) { return; }
if (true) { return; } else if (false) { return; } else { return; }
}
void foo(int state) {
@@ -625,6 +624,112 @@
//--PREVIEW--END--section-newlines-controlstatements-simpleloops
//--PREVIEW--END--section-newlines-controlstatements
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line
+class Example{
+ public void example() {
+ for (int i = 0; i < 10; i++) {
+ }
+ int a = 10;
+ while (a-- > 0) { System.out.println(a); }
+ do { a += 2;
+ System.out.println(a); } while(a < 50);
+ }
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line
+class Example {
+ public String example(int a) {
+ if (a < 0) {
+ throw new IllegalArgumentException(); }
+ if (a == 0) { return null; }
+ if (false) {}
+ if (a % 3 == 0) {
+ System.out.println("fizz"); }
+ if (a % 5 == 0) { System.out.println("buzz"); return ""; }
+ return Integer.toString(a);
+ }
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line
+class Example {
+ Runnable emptyLambda = () -> {};
+ Runnable emptyLambda2 = () -> {
+ };
+ Runnable tinyLambda = () -> { doSomething(); };
+ Runnable smallLambda = () -> { doFirstThing(); doSecondThing(); };
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_code_block_on_one_line
+class Example {
+ static {
+ }
+
+ void foo() {
+ if (true) {} else {}
+ synchronized(this) {}
+ try {} finally {}
+
+ labeled:{}
+ }
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_code_block_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_method_body_on_one_line
+public class Example {
+ private int something;
+ public int getSomething() { return something; }
+ public void setSomehing(int something) { this.something = something; }
+ public void doNoting() {}
+ public void doOneThing() { System.out.println();
+ }
+ public void doMoreThings() { something = 4; doOneThing(); doOneThing(); }
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_method_body_on_one_line
+
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line
+public class EmptyClass{}
+public class TinyClass{
+ int a; }
+public class SmallClass{ int a; String b; }
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line
+public class AnonymousClasses {
+ EmptyClass emptyAnonymous = new EmptyClass() {
+ };
+ TinyClass tinyAnonymous = new TinyClass() { String b; };
+ Object o = new SmallClass() { int a; int getA() { return a; } };
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line
+public enum EmptyEnum {}
+public enum TinyEnum{ A;
+}
+public enum SmallEnum{ VALUE(0); SmallEnum(int val) {}; }
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line
+public enum EnumConstants {
+ EMPTY {
+ },
+ TINY { int getVal() { return 2; }},
+ SMALL { int val = 3; int getVal() { return 3; }};
+ int getVal() { return 1; }
+}
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line
+
+//--PREVIEW--START--org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line
+public @interface EmptyInterface {}
+public @interface TinyInterface {
+ void run(); }
+public @interface SmallInteface { int toA(); String toB(); }
+//--PREVIEW--END--org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line
+
}
class LINE_WRAPING {
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/templates/default-templates.properties eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/templates/default-templates.properties
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/templates/default-templates.properties 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/templates/default-templates.properties 2018-12-03 12:49:27.000000000 +0000
@@ -68,6 +68,7 @@
Templates.arraymerge= merge two arrays into one
Templates.arrayadd= add an element to an array
Templates.static_final=static final field
+Templates.new_module=create module declaration
# Java Only stuff
CompilationUnitContextType.variable.description.file=Filename of compilation unit
@@ -187,4 +188,4 @@
SWTTemplates.griddata=new GridData for a Control
SWTTemplates.griddatafactory=using GridDataFactory for a Control
SWTTemplates.toolbar=new ToolBar
-SWTTemplates.toolitem=new ToolItem for a ToolBar
\ No newline at end of file
+SWTTemplates.toolitem=new ToolItem for a ToolBar
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/templates/default-templates.xml eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/templates/default-templates.xml
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/templates/default-templates.xml 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/templates/default-templates.xml 2018-12-03 12:49:27.000000000 +0000
@@ -226,4 +226,8 @@
${visibility:link('public ','protected ','','private ')}static final ${type:link(String,int)} ${NAME} = ${expr:link('""',0)};
+module ${name} {
+ ${cursor}
+}
+
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Mateusz Matela - [code manipulation] [dcr] toString() builder wizard - https://bugs.eclipse.org/bugs/show_bug.cgi?id=26070
+ * Pierre-Yves B. - Check whether enclosing instance implements hashCode and equals - https://bugs.eclipse.org/539900
*******************************************************************************/
package org.eclipse.jdt.internal.ui.actions;
@@ -173,6 +174,7 @@
public static String GenerateMethodAbstractAction_final_method_in_superclass_error;
public static String GenerateMethodAbstractAction_already_has_this_method_error;
public static String GenerateMethodAbstractAction_super_class;
+ public static String GenerateMethodAbstractAction_enclosing_class;
public static String GenerateHashCodeEqualsAction_field_type;
public static String GenerateHashCodeEqualsAction_equals;
public static String GenerateHashCodeEqualsAction_hashCode;
@@ -281,7 +283,7 @@
/**
* DO NOT REMOVE, used in a product, see https://bugs.eclipse.org/296836 .
- * @deprecated As of 3.6, replaced by {@link #OrganizeImportsAction_summary_added_singular} and {@link #OrganizeImportsAction_summary_added_plural}
+ * @deprecated As of 3.6, replaced by {@link #OrganizeImportsAction_summary_added_singular} and {@link #OrganizeImportsAction_summary_added_plural}
*/
@Deprecated
public static String OrganizeImportsAction_summary_added;
@@ -439,6 +441,8 @@
public static String CollapsAllAction_tooltip;
public static String CollapsAllAction_description;
+ public static String CreateModuleInfoAction_convert_message_compliance;
+ public static String CreateModuleInfoAction_convert_title;
public static String CreateModuleInfoAction_error_message_compliance;
public static String CreateModuleInfoAction_error_message_no_source_folder;
public static String CreateModuleInfoAction_error_title;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2017 IBM Corporation and others.
+# Copyright (c) 2000, 2018 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -12,6 +12,7 @@
# IBM Corporation - initial API and implementation
# Sebastian Davids - Bug 114276
# Mateusz Matela - [code manipulation] [dcr] toString() builder wizard - https://bugs.eclipse.org/bugs/show_bug.cgi?id=26070
+# Pierre-Yves B. - Check whether enclosing instance implements hashCode and equals - https://bugs.eclipse.org/539900
###############################################################################
OccurrencesSearchMenuAction_break_continue_target_label=&Break/Continue Targets
@@ -403,6 +404,7 @@
GenerateHashCodeEqualsAction_error_caption=Generate hashCode() and equals()
GenerateHashCodeEqualsAction_description=Generate implementations for hashCode() and equals()
GenerateMethodAbstractAction_super_class=super class ''{0}''
+GenerateMethodAbstractAction_enclosing_class=enclosing class ''{0}''
GenerateHashCodeEqualsAction_field_type=field type ''{0}''
GenerateHashCodeEqualsAction_tooltip=Generate implementations for hashCode() and equals()
GenerateHashCodeEqualsAction_equals=equals()
@@ -468,6 +470,8 @@
CollapsAllAction_tooltip= Collapse All
CollapsAllAction_description= Collapse All
+CreateModuleInfoAction_convert_message_compliance=Project requires compliance level of 9 or above. Do you want to change project compliance and JRE to {0}?
+CreateModuleInfoAction_convert_title=Create module-info.java
CreateModuleInfoAction_error_message_compliance=Project requires compliance level of 9 or above.
CreateModuleInfoAction_error_message_no_source_folder=No source folder exists in the project.
CreateModuleInfoAction_error_title=Create module-info.java
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddBlockCommentAction.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddBlockCommentAction.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddBlockCommentAction.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddBlockCommentAction.java 2018-12-03 12:49:27.000000000 +0000
@@ -19,6 +19,8 @@
import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.IAction;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPartitioningException;
import org.eclipse.jface.text.IDocument;
@@ -39,17 +41,19 @@
*/
public class AddBlockCommentAction extends BlockCommentAction {
+ private IAction action;
+
/**
* Creates a new instance.
*
* @param bundle the resource bundle
- * @param prefix a prefix to be prepended to the various resource keys
- * (described in ResourceAction constructor), or
- * null if none
+ * @param prefix a prefix to be prepended to the various resource keys (described in
+ * ResourceAction constructor), or null if none
* @param editor the text editor
*/
public AddBlockCommentAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
super(bundle, prefix, editor);
+ action= editor.getAction("Format"); //$NON-NLS-1$
}
/*
@@ -71,6 +75,10 @@
handleLastPartition(partition, edits, factory, selectionEndOffset);
executeEdits(edits);
+
+ if (action != null) {
+ action.run();
+ }
}
/**
@@ -79,8 +87,9 @@
* @param partition the partition under the start of the selection
* @param edits the list of edits to later execute
* @param factory the factory for edits
- * @param offset the start of the selection, which must lie inside
- * partition
+ * @param offset the start of the selection, which must lie inside partition
+ * @throws BadLocationException if accessing the document fails - this can only happen if the
+ * document gets modified concurrently
*/
private void handleFirstPartition(ITypedRegion partition, List edits, Edit.EditFactory factory, int offset) throws BadLocationException {
@@ -96,19 +105,18 @@
} else if (isSpecialPartition(partType)) {
// special types: include the entire partition
edits.add(factory.createEdit(partOffset, 0, getCommentStart()));
- } // javadoc: no mark, will only start after comment
+ } // javadoc: no mark, will only start after comment
}
/**
- * Handles partition boundaries within the selection. The end of the current
- * partition and the start of the next partition are examined for whether
- * they contain comment tokens that interfere with the created comment.
+ * Handles partition boundaries within the selection. The end of the current partition and the start
+ * of the next partition are examined for whether they contain comment tokens that interfere with
+ * the created comment.
*
- * Comment tokens are removed from interior multi-line comments. Javadoc
- * comments are left as is; instead, multi-line comment tokens are inserted
- * before and after Javadoc partitions to ensure that the entire selected
- * area is commented.
+ * Comment tokens are removed from interior multi-line comments. Javadoc comments are left as is;
+ * instead, multi-line comment tokens are inserted before and after Javadoc partitions to ensure
+ * that the entire selected area is commented.
*
*
* The next partition is returned.
@@ -119,12 +127,12 @@
* @param factory the edit factory
* @param docExtension the document to get the partitions from
* @return the next partition after the current
- * @throws BadLocationException if accessing the document fails - this can
- * only happen if the document gets modified concurrently
- * @throws BadPartitioningException if the document does not have a Java
- * partitioning
+ * @throws BadLocationException if accessing the document fails - this can only happen if the
+ * document gets modified concurrently
+ * @throws BadPartitioningException if the document does not have a Java partitioning
*/
- private ITypedRegion handleInteriorPartition(ITypedRegion partition, List edits, Edit.EditFactory factory, IDocumentExtension3 docExtension) throws BadPartitioningException, BadLocationException {
+ private ITypedRegion handleInteriorPartition(ITypedRegion partition, List edits, Edit.EditFactory factory, IDocumentExtension3 docExtension)
+ throws BadPartitioningException, BadLocationException {
// end of previous partition
String partType= partition.getType();
@@ -173,15 +181,16 @@
}
/**
- * Handles the partition under the end of the selection. For normal java
- * code, the comment end token is inserted at the selection end; if the
- * selection ends inside a special (i.e. string, character, line comment)
- * partition, the entire partition is included inside the comment.
+ * Handles the partition under the end of the selection. For normal java code, the comment end token
+ * is inserted at the selection end; if the selection ends inside a special (i.e. string, character,
+ * line comment) partition, the entire partition is included inside the comment.
*
* @param partition the partition under the selection end offset
* @param edits the list of edits to add to
* @param factory the edit factory
* @param endOffset the end offset of the selection
+ * @throws BadLocationException if accessing the document fails - this can only happen if the
+ * document gets modified concurrently
*/
private void handleLastPartition(ITypedRegion partition, List edits, Edit.EditFactory factory, int endOffset) throws BadLocationException {
@@ -199,12 +208,10 @@
/**
* Returns whether partType is special, i.e. a Java
- * String,Character, or
- * Line End Comment partition.
+ * String,Character, or Line End Comment partition.
*
* @param partType the partition type to check
- * @return true if partType is special,
- * false otherwise
+ * @return true if partType is special, false otherwise
*/
private boolean isSpecialPartition(String partType) {
return partType == IJavaPartitions.JAVA_CHARACTER
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CopyQualifiedNameAction.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CopyQualifiedNameAction.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CopyQualifiedNameAction.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CopyQualifiedNameAction.java 2018-12-03 12:49:27.000000000 +0000
@@ -73,12 +73,12 @@
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.TypeParameter;
import org.eclipse.jdt.core.dom.VariableDeclaration;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.ui.JavaElementLabels;
import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.actions.SelectionDispatchAction;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
@@ -302,7 +302,7 @@
if (element == null)
return null;
- CompilationUnit ast= SharedASTProvider.getAST(element, SharedASTProvider.WAIT_YES, null);
+ CompilationUnit ast= SharedASTProviderCore.getAST(element, SharedASTProviderCore.WAIT_YES, null);
if (ast == null)
return null;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java 2018-12-03 12:49:27.000000000 +0000
@@ -15,7 +15,11 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
@@ -24,6 +28,8 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -43,11 +49,17 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.Messages;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+
import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.util.ClasspathVMUtil;
import org.eclipse.jdt.internal.ui.wizards.NewModuleInfoWizard;
public class CreateModuleInfoAction implements IObjectActionDelegate {
@@ -116,8 +128,27 @@
try {
if (!JavaModelUtil.is9OrHigher(javaProject)) {
- MessageDialog.openError(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_error_title, ActionMessages.CreateModuleInfoAction_error_message_compliance);
- return;
+ IVMInstall install= ClasspathVMUtil.findRequiredOrGreaterVMInstall(JavaCore.VERSION_9, true, true);
+ if (install == null) {
+ MessageDialog.openError(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_error_title, ActionMessages.CreateModuleInfoAction_error_message_compliance);
+ return;
+ } else {
+ String compliance= ClasspathVMUtil.getVMInstallCompliance(install, false);
+ if (compliance != null) {
+ boolean val= MessageDialog.openQuestion(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_convert_title,
+ Messages.format(ActionMessages.CreateModuleInfoAction_convert_message_compliance, compliance));
+ if (!val) {
+ return;
+ } else {
+ updateJRE(javaProject, compliance);
+ updateComplianceSettings(javaProject, compliance);
+ }
+ }
+ else {
+ MessageDialog.openError(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_error_title, ActionMessages.CreateModuleInfoAction_error_message_compliance);
+ return;
+ }
+ }
}
IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots();
@@ -166,4 +197,24 @@
display= Display.getDefault();
return display;
}
+
+ private boolean updateJRE(IJavaProject project, String compliance) throws CoreException, JavaModelException {
+ IExecutionEnvironment bestEE= ClasspathVMUtil.findBestMatchingEE(compliance);
+ if (bestEE != null) {
+ IPath newPath= JavaRuntime.newJREContainerPath(bestEE);
+ boolean classpathUpdated= ClasspathVMUtil.updateClasspath(newPath, project, new NullProgressMonitor());
+ return !classpathUpdated;
+ }
+ return true;
+ }
+
+ private void updateComplianceSettings(IJavaProject project, String compliance) {
+ HashMap defaultOptions= new HashMap<>();
+ JavaCore.setComplianceOptions(compliance, defaultOptions);
+ Iterator> it= defaultOptions.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry pair= it.next();
+ project.setOption(pair.getKey(), pair.getValue());
+ }
+ }
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/GenerateConstructorUsingFieldsSelectionDialog.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/GenerateConstructorUsingFieldsSelectionDialog.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/GenerateConstructorUsingFieldsSelectionDialog.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/GenerateConstructorUsingFieldsSelectionDialog.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -47,7 +47,7 @@
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
+import org.eclipse.jdt.internal.core.manipulation.CodeTemplateContextType;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/BuildpathIndicatorLabelDecorator.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/BuildpathIndicatorLabelDecorator.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/BuildpathIndicatorLabelDecorator.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/BuildpathIndicatorLabelDecorator.java 2018-12-03 12:49:27.000000000 +0000
@@ -43,19 +43,19 @@
IResource resource= (IResource) element;
IProject project= resource.getProject();
if (project != null) {
- IJavaProject javaProject= JavaCore.create(project);
- if (javaProject != null) {
- if (javaProject.isOnClasspath(resource)) {
- IJavaElement javaElement= JavaCore.create(resource, javaProject);
- try {
+ try {
+ IJavaProject javaProject= JavaCore.create(project);
+ if (javaProject != null) {
+ if (javaProject.isOnClasspath(resource)) {
+ IJavaElement javaElement= JavaCore.create(resource, javaProject);
if (javaElement instanceof IPackageFragmentRoot
&& ((IPackageFragmentRoot)javaElement).getKind() != IPackageFragmentRoot.K_SOURCE) {
return JavaPluginImages.DESC_OVR_LIBRARY;
}
- } catch (JavaModelException e) {
- return null;
}
}
+ } catch (JavaModelException | IllegalStateException e) {
+ return null;
}
}
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/CompatibilityTemplateStore.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/CompatibilityTemplateStore.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/CompatibilityTemplateStore.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/CompatibilityTemplateStore.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -19,11 +19,12 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.text.templates.TemplatePersistenceData;
+
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OverrideMethodDialog.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OverrideMethodDialog.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OverrideMethodDialog.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OverrideMethodDialog.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -50,12 +50,12 @@
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2;
+import org.eclipse.jdt.internal.core.manipulation.CodeTemplateContextType;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2Core;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
@@ -302,7 +302,7 @@
IMethodBinding[] overridable= null;
if (binding != null) {
final IPackageBinding pack= binding.getPackage();
- final IMethodBinding[] methods= StubUtility2.getOverridableMethods(fUnit.getAST(), binding, false);
+ final IMethodBinding[] methods= StubUtility2Core.getOverridableMethods(fUnit.getAST(), binding, false);
List list= new ArrayList<>(methods.length);
for (int index= 0; index < methods.length; index++) {
final IMethodBinding cur= methods[index];
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dnd/JdtViewerDropAdapter.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - modified to use JdtViewerDropAdapterConstants
*******************************************************************************/
package org.eclipse.jdt.internal.ui.dnd;
@@ -27,6 +28,8 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jdt.internal.ui.JdtViewerDropAdapterConstants;
+
/**
* This adapter class provides generic drag-and-drop support for a viewer.
*
@@ -51,7 +54,7 @@
* slightly before the target.
* @see #getCurrentLocation()
*/
- public static final int LOCATION_BEFORE = 1;
+ public static final int LOCATION_BEFORE = JdtViewerDropAdapterConstants.LOCATION_BEFORE;
/**
* Constant describing the position of the cursor relative
@@ -59,7 +62,7 @@
* slightly after the target.
* @see #getCurrentLocation()
*/
- public static final int LOCATION_AFTER = 2;
+ public static final int LOCATION_AFTER = JdtViewerDropAdapterConstants.LOCATION_AFTER;
/**
* Constant describing the position of the cursor relative
@@ -67,7 +70,7 @@
* directly on the target.
* @see #getCurrentLocation()
*/
- public static final int LOCATION_ON = 3;
+ public static final int LOCATION_ON = JdtViewerDropAdapterConstants.LOCATION_ON;
/**
* Constant describing the position of the cursor relative
@@ -75,7 +78,7 @@
* over or near any valid target.
* @see #getCurrentLocation()
*/
- public static final int LOCATION_NONE = 4;
+ public static final int LOCATION_NONE = JdtViewerDropAdapterConstants.LOCATION_NONE;
/**
* The viewer to which this drop support has been added.
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantModifiersCleanUp.java 2018-12-03 12:49:27.000000000 +0000
@@ -25,6 +25,7 @@
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.Modifier;
@@ -139,7 +140,7 @@
TypeDeclaration typeDecl= ASTNodes.getParent(node, TypeDeclaration.class);
if (typeDecl != null && typeDecl.isInterface()) {
rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.ABSTRACT));
- if (!AnonymousClassDeclaration.class.isInstance(node.getParent())) {
+ if (!AnonymousClassDeclaration.class.isInstance(node.getParent()) && !EnumDeclaration.class.isInstance(node.getParent())) {
rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.PUBLIC));
}
} else if (typeDecl != null && Modifier.isFinal(typeDecl.getModifiers()) && Modifier.isFinal(node.getModifiers())) {
@@ -155,6 +156,15 @@
rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.STATIC));
}
return true;
+ }
+
+ @Override
+ public boolean visit(EnumDeclaration node) {
+ TypeDeclaration typeDecl= ASTNodes.getParent(node, TypeDeclaration.class);
+ if (typeDecl != null && Modifier.isStatic(node.getModifiers())) {
+ rewriteOperations.add(new RemoveModifiersOperation(node, Modifier.STATIC));
+ }
+ return true;
}
});
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/RedundantSemicolonsCleanUp.java 2018-12-03 12:49:27.000000000 +0000
@@ -36,6 +36,7 @@
import org.eclipse.jdt.core.dom.EmptyStatement;
import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.LambdaExpression;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
@@ -178,7 +179,9 @@
@Override
public boolean visit(Block node) {
- searchNode(node, contents, label, textedits);
+ if (!(node.getParent() instanceof LambdaExpression)) {
+ searchNode(node, contents, label, textedits);
+ }
return true;
}
});
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UnimplementedCodeCleanUp.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UnimplementedCodeCleanUp.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UnimplementedCodeCleanUp.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/UnimplementedCodeCleanUp.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,10 +28,10 @@
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.core.manipulation.CodeTemplateContext;
+import org.eclipse.jdt.internal.core.manipulation.CodeTemplateContextType;
import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
import org.eclipse.jdt.internal.corext.fix.UnimplementedCodeFix;
-import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContext;
-import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.ui.cleanup.CleanUpRequirements;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java 2018-12-03 12:49:27.000000000 +0000
@@ -349,6 +349,7 @@
public static final String JAVA_BASE_PREFERENCE_PAGE= PREFIX + "java_base_preference_page_context"; //$NON-NLS-1$
public static final String REFACTORING_PREFERENCE_PAGE= PREFIX + "refactoring_preference_page_context"; //$NON-NLS-1$
public static final String JAVA_EDITOR_PREFERENCE_PAGE= PREFIX + "java_editor_preference_page_context"; //$NON-NLS-1$
+ public static final String CODE_MINING_PREFERENCE_PAGE= PREFIX + "code_mining_preference_page_context"; //$NON-NLS-1$
public static final String SPELLING_CONFIGURATION_BLOCK= PREFIX + "spelling_configuration_block_context"; //$NON-NLS-1$
public static final String PROPERTIES_FILE_EDITOR_PREFERENCE_PAGE= PREFIX + "properties_file_editor_preference_page_context"; //$NON-NLS-1$
public static final String COMPILER_PREFERENCE_PAGE= PREFIX + "compiler_preference_page_context"; //$NON-NLS-1$
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaStatusConstants.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaStatusConstants.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaStatusConstants.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaStatusConstants.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.ui;
-
-import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider;
-import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
-import org.eclipse.jdt.internal.ui.javaeditor.saveparticipant.IPostSaveListener;
-
-/**
- * Defines status codes relevant to the Java UI plug-in. When a
- * Core exception is thrown, it contain a status object describing
- * the cause of the exception. The status objects originating from the
- * Java UI plug-in use the codes defined in this interface.
- */
-public interface IJavaStatusConstants {
-
- // Java UI status constants start at 10000 to make sure that we don't
- // collide with resource and java model constants.
-
- public static final int INTERNAL_ERROR= 10001;
-
- /**
- * Status constant indicating that an exception occurred on
- * storing or loading templates.
- */
- public static final int TEMPLATE_IO_EXCEPTION = 10002;
-
- /**
- * Status constant indicating that an validateEdit call has changed the
- * content of a file on disk.
- */
- public static final int VALIDATE_EDIT_CHANGED_CONTENT= 10003;
-
- /**
- * Status constant indicating that a ChangeAbortException has been
- * caught.
- */
- public static final int CHANGE_ABORTED= 10004;
-
- /**
- * Status constant indicating that an exception occurred while
- * parsing template file.
- */
- public static final int TEMPLATE_PARSE_EXCEPTION = 10005;
-
- /**
- * Status constant indicating that a problem occurred while notifying a post
- * save listener.
- *
- * @see IPostSaveListener
- * @since 3.3
- */
- public static final int EDITOR_POST_SAVE_NOTIFICATION= 10006;
-
- /**
- * Status constant indication that a problem occurred while calculating
- * the changed region during a save.
- *
- * @see CompilationUnitDocumentProvider
- * @since 3.4
- */
- public static final int EDITOR_CHANGED_REGION_CALCULATION= 10007;
-
- /**
- * Status constant indication that a problem occurred while opening an editor:
- * no editor input could be created. See {@link EditorUtility#openInEditor(Object, boolean)}.
- * @since 3.4
- */
- public static final int EDITOR_NO_EDITOR_INPUT= 10008;
-
- }
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java 2018-12-03 12:49:27.000000000 +0000
@@ -128,6 +128,7 @@
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
@@ -140,7 +141,6 @@
import org.eclipse.jdt.ui.JavaElementLabels;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds;
import org.eclipse.jdt.ui.actions.JdtActionConstants;
import org.eclipse.jdt.ui.actions.OpenAttachedJavadocAction;
@@ -1348,7 +1348,7 @@
if (monitor != null && monitor.isCanceled())
return null;
- CompilationUnit ast= SharedASTProvider.getAST(constantField.getTypeRoot(), SharedASTProvider.WAIT_NO, monitor);
+ CompilationUnit ast= SharedASTProviderCore.getAST(constantField.getTypeRoot(), SharedASTProviderCore.WAIT_NO, monitor);
if (ast != null) {
try {
if (constantField.isEnumConstant())
@@ -1399,7 +1399,7 @@
* @since 3.4
*/
private static Object getConstantValueFromActiveEditor(ITypeRoot activeType, IField field, ITextSelection selection, IProgressMonitor monitor) {
- CompilationUnit unit= SharedASTProvider.getAST(activeType, SharedASTProvider.WAIT_ACTIVE_ONLY, monitor);
+ CompilationUnit unit= SharedASTProviderCore.getAST(activeType, SharedASTProviderCore.WAIT_ACTIVE_ONLY, monitor);
if (unit == null)
return null;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/SourceView.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/SourceView.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/SourceView.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/SourceView.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -62,8 +62,8 @@
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.manipulation.StubUtility;
import org.eclipse.jdt.internal.core.manipulation.util.Strings;
-import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.ui.IContextMenuConstants;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/breadcrumb/BreadcrumbItemDropDown.java 2018-12-03 12:49:27.000000000 +0000
@@ -44,7 +44,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Tree;
@@ -59,8 +58,8 @@
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.util.Geometry;
import org.eclipse.jface.util.OpenStrategy;
+import org.eclipse.jface.util.Util;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -695,7 +694,7 @@
Point pt= new Point(x, rect.y + rect.height);
pt= fParentComposite.toDisplay(pt);
- Rectangle monitor= getClosestMonitor(shell.getDisplay(), pt).getClientArea();
+ Rectangle monitor= Util.getClosestMonitor(shell.getDisplay(), pt).getClientArea();
int overlap= (pt.x + width) - (monitor.x + monitor.width);
if (overlap > 0)
pt.x-= overlap;
@@ -707,41 +706,6 @@
}
/**
- * Returns the monitor whose client area contains the given point. If no monitor contains the
- * point, returns the monitor that is closest to the point.
- *
- * Copied from org.eclipse.jface.window.Window.getClosestMonitor(Display, Point)
- *
- *
- * @param display the display showing the monitors
- * @param point point to find (display coordinates)
- * @return the monitor closest to the given point
- */
- private static Monitor getClosestMonitor(Display display, Point point) {
- int closest= Integer.MAX_VALUE;
-
- Monitor[] monitors= display.getMonitors();
- Monitor result= monitors[0];
-
- for (int i= 0; i < monitors.length; i++) {
- Monitor current= monitors[i];
-
- Rectangle clientArea= current.getClientArea();
-
- if (clientArea.contains(point))
- return current;
-
- int distance= Geometry.distanceSquared(Geometry.centerPoint(clientArea), point);
- if (distance < closest) {
- closest= distance;
- result= current;
- }
- }
-
- return result;
- }
-
- /**
* Set the size of the given shell such that more content can be shown. The shell size does not
* exceed a user-configurable maximum.
*
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditor.java 2018-12-03 12:49:27.000000000 +0000
@@ -87,14 +87,15 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.ui.JavaElementLabels;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds;
import org.eclipse.jdt.ui.actions.RefactorActionGroup;
import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
@@ -103,7 +104,6 @@
import org.eclipse.jdt.internal.ui.JavaUIStatus;
import org.eclipse.jdt.internal.ui.actions.CompositeActionGroup;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
-import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
import org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock;
@@ -736,7 +736,7 @@
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
- CompilationUnit ast= SharedASTProvider.getAST(getInputJavaElement(), SharedASTProvider.WAIT_YES, null);
+ CompilationUnit ast= SharedASTProviderCore.getAST(getInputJavaElement(), SharedASTProviderCore.WAIT_YES, null);
if (fOverrideIndicatorManager != null)
fOverrideIndicatorManager.reconciled(ast, true, monitor);
if (fSemanticManager != null) {
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClipboardOperationAction.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClipboardOperationAction.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClipboardOperationAction.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClipboardOperationAction.java 2018-12-03 12:49:27.000000000 +0000
@@ -78,14 +78,14 @@
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
import org.eclipse.jdt.core.manipulation.ImportReferencesCollector;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
-import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.core.manipulation.StubUtility;
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.internal.ui.IJavaStatusConstants;
import org.eclipse.jdt.internal.ui.JavaPlugin;
@@ -444,7 +444,7 @@
private ClipboardData getClipboardData(ITypeRoot inputElement, int offset, int length) {
- CompilationUnit astRoot= SharedASTProvider.getAST(inputElement, SharedASTProvider.WAIT_ACTIVE_ONLY, null);
+ CompilationUnit astRoot= SharedASTProviderCore.getAST(inputElement, SharedASTProviderCore.WAIT_ACTIVE_ONLY, null);
if (astRoot == null) {
return null;
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/AbstractJavaElementLineHeaderCodeMining.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/AbstractJavaElementLineHeaderCodeMining.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/AbstractJavaElementLineHeaderCodeMining.java 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/AbstractJavaElementLineHeaderCodeMining.java 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2018 Angelo ZERR.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Angelo Zerr - [CodeMining] Provide Java References/Implementation CodeMinings - Bug 529127
+ */
+package org.eclipse.jdt.internal.ui.javaeditor.codemining;
+
+import java.util.function.Consumer;
+
+import org.eclipse.swt.events.MouseEvent;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.codemining.ICodeMiningProvider;
+import org.eclipse.jface.text.codemining.LineHeaderCodeMining;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.ISourceReference;
+import org.eclipse.jdt.core.JavaModelException;
+
+/**
+ * Abstract class for Java code mining.
+ *
+ * @since 3.16
+ */
+public abstract class AbstractJavaElementLineHeaderCodeMining extends LineHeaderCodeMining {
+
+ private final IJavaElement element;
+
+ public AbstractJavaElementLineHeaderCodeMining(IJavaElement element, IDocument document, ICodeMiningProvider provider,
+ Consumer action) throws JavaModelException, BadLocationException {
+ super(getLineNumber(element, document), document, provider, action);
+ this.element= element;
+ }
+
+ private static int getLineNumber(IJavaElement element, IDocument document)
+ throws JavaModelException, BadLocationException {
+ ISourceRange r= ((ISourceReference) element).getNameRange();
+ int offset= r.getOffset();
+ return document.getLineOfOffset(offset);
+ }
+
+ /**
+ * Returns the java element.
+ *
+ * @return the java element.
+ */
+ public IJavaElement getElement() {
+ return element;
+ }
+
+}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.java 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.java 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2018 Angelo ZERR.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Angelo Zerr - [code mining] 0 reference / implementation - Bug 541396
+ */
+package org.eclipse.jdt.internal.ui.javaeditor.codemining;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Helper class to get NLSed messages.
+ */
+final class JavaCodeMiningMessages extends NLS {
+
+ private static final String BUNDLE_NAME= JavaCodeMiningMessages.class.getName();
+
+
+ private JavaCodeMiningMessages() {
+ // Do not instantiate
+ }
+
+ public static String JavaReferenceCodeMining_label;
+
+ public static String JavaImplementationCodeMining_label;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JavaCodeMiningMessages.class);
+ }
+
+}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.properties eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.properties
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.properties 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaCodeMiningMessages.properties 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2018 Angelo ZERR.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Angelo Zerr - [code mining] 0 reference / implementation - Bug 541396
+###############################################################################
+
+JavaReferenceCodeMining_label={0,choice,0#0 references|1#1 reference|1<{0} references}
+JavaImplementationCodeMining_label={0,choice,0#0 implementations|1#1 implementation|1<{0} implementations}
\ No newline at end of file
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaElementCodeMiningProvider.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaElementCodeMiningProvider.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaElementCodeMiningProvider.java 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaElementCodeMiningProvider.java 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,161 @@
+/**
+ * Copyright (c) 2018 Angelo ZERR.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Angelo Zerr - [CodeMining] Provide Java References/Implementation CodeMinings - Bug 529127
+ */
+package org.eclipse.jdt.internal.ui.javaeditor.codemining;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.codemining.AbstractCodeMiningProvider;
+import org.eclipse.jface.text.codemining.ICodeMining;
+
+import org.eclipse.ui.texteditor.ITextEditor;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.JavaModelException;
+
+import org.eclipse.jdt.ui.PreferenceConstants;
+
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesPropertyTester;
+
+/**
+ * Java code mining provider to show code minings by using {@link IJavaElement}:
+ *
+ *
+ *
Show references
+ *
Show implementations
+ *
+ *
+ * @since 3.16
+ */
+public class JavaElementCodeMiningProvider extends AbstractCodeMiningProvider {
+
+ private final boolean showAtLeastOne;
+
+ private final boolean showReferences;
+
+ private final boolean showReferencesOnTypes;
+
+ private final boolean showReferencesOnFields;
+
+ private final boolean showReferencesOnMethods;
+
+ private final boolean showImplementations;
+
+ private final boolean editorEnabled;
+
+ public JavaElementCodeMiningProvider() {
+ editorEnabled= JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_CODEMINING_ENABLED);
+ showAtLeastOne= editorEnabled && JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_JAVA_CODEMINING_SHOW_CODEMINING_AT_LEAST_ONE);
+ showReferences= editorEnabled && JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_JAVA_CODEMINING_SHOW_REFERENCES);
+ showReferencesOnTypes= editorEnabled && JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_TYPES);
+ showReferencesOnFields= editorEnabled && JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_FIELDS);
+ showReferencesOnMethods= editorEnabled && JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_METHODS);
+ showImplementations= editorEnabled && JavaPreferencesPropertyTester.isEnabled(PreferenceConstants.EDITOR_JAVA_CODEMINING_SHOW_IMPLEMENTATIONS);
+ }
+
+ @Override
+ public CompletableFuture> provideCodeMinings(ITextViewer viewer,
+ IProgressMonitor monitor) {
+ if (!editorEnabled) {
+ return CompletableFuture.completedFuture(Collections.emptyList());
+ }
+ return CompletableFuture.supplyAsync(() -> {
+ monitor.isCanceled();
+ ITextEditor textEditor= super.getAdapter(ITextEditor.class);
+ ITypeRoot unit= EditorUtility.getEditorInputJavaElement(textEditor, true);
+ if (unit == null) {
+ return Collections.emptyList();
+ }
+ try {
+ IJavaElement[] elements= unit.getChildren();
+ List minings= new ArrayList<>(elements.length);
+ collectMinings(unit, textEditor, unit.getChildren(), minings, viewer, monitor);
+ monitor.isCanceled();
+ return minings;
+ } catch (JavaModelException e) {
+ // Should never occur
+ }
+ return Collections.emptyList();
+ });
+ }
+
+ /**
+ * Collect java code minings.
+ *
+ * @param unit the compilation unit
+ * @param textEditor the Java editor
+ * @param elements the java elements to track
+ * @param minings the current list of minings to update
+ * @param viewer the viewer
+ * @param monitor the monitor
+ * @throws JavaModelException thrown when java model error
+ */
+ private void collectMinings(ITypeRoot unit, ITextEditor textEditor, IJavaElement[] elements,
+ List minings, ITextViewer viewer, IProgressMonitor monitor) throws JavaModelException {
+
+ // Only Java editor is supported, see bug 541811
+ if(!(textEditor instanceof JavaEditor)) {
+ return;
+ }
+
+ // Don't worth to loop if none of mining types are requested
+ if (!(showReferences || showImplementations)) {
+ return;
+ }
+
+ for (IJavaElement element : elements) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ if (element.getElementType() == IJavaElement.TYPE) {
+ collectMinings(unit, textEditor, ((IType) element).getChildren(), minings, viewer, monitor);
+ } else if (!(element.getElementType() == IJavaElement.METHOD || element.getElementType() == IJavaElement.FIELD)) {
+ continue;
+ }
+ if (showReferences) {
+ try {
+ if ((showReferencesOnTypes && (element.getElementType() == IJavaElement.TYPE)) // Show references on types
+ || (showReferencesOnMethods && (element.getElementType() == IJavaElement.METHOD)) // Show references on methods
+ || (showReferencesOnFields && (element.getElementType() == IJavaElement.FIELD)) // Show references on fields
+ ) {
+ minings.add(new JavaReferenceCodeMining(element, (JavaEditor) textEditor, viewer.getDocument(),
+ this, showAtLeastOne));
+ }
+ } catch (BadLocationException e) {
+ // Should never occur
+ }
+ }
+ if (showImplementations) {
+ if (element instanceof IType) {
+ IType type= (IType) element;
+ if (type.isInterface() || type.isClass()) {
+ try {
+ minings.add(new JavaImplementationCodeMining(type, (JavaEditor) textEditor, viewer.getDocument(), this,
+ showAtLeastOne));
+ } catch (BadLocationException e) {
+ // Should never occur
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaImplementationCodeMining.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaImplementationCodeMining.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaImplementationCodeMining.java 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaImplementationCodeMining.java 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2018 Angelo ZERR.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Angelo Zerr - [CodeMining] Provide Java References/Implementation CodeMinings - Bug 529127
+ */
+package org.eclipse.jdt.internal.ui.javaeditor.codemining;
+
+import java.text.MessageFormat;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
+
+import org.eclipse.swt.events.MouseEvent;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.jface.viewers.StructuredSelection;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.codemining.ICodeMiningProvider;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+
+import org.eclipse.jdt.ui.actions.OpenTypeHierarchyAction;
+
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+
+/**
+ * Java implementation code mining.
+ *
+ * @since 3.16
+ */
+public class JavaImplementationCodeMining extends AbstractJavaElementLineHeaderCodeMining {
+
+ private final JavaEditor editor;
+
+ private final boolean showImplementationsAtLeastOne;
+
+ private Consumer action;
+
+ public JavaImplementationCodeMining(IType element, JavaEditor editor, IDocument document, ICodeMiningProvider provider,
+ boolean showImplementationsAtLeastOne) throws JavaModelException, BadLocationException {
+ super(element, document, provider, null);
+ this.editor= editor;
+ this.showImplementationsAtLeastOne= showImplementationsAtLeastOne;
+ }
+
+ @SuppressWarnings("boxing")
+ @Override
+ protected CompletableFuture doResolve(ITextViewer viewer, IProgressMonitor monitor) {
+ return CompletableFuture.runAsync(() -> {
+ try {
+ IJavaElement element= super.getElement();
+ long implCount= countImplementations((IType) element, monitor);
+ action= implCount > 0 ? e -> new OpenTypeHierarchyAction(editor).run(new StructuredSelection(element)) : null;
+ if (implCount == 0 && showImplementationsAtLeastOne) {
+ super.setLabel(""); //$NON-NLS-1$
+ } else {
+ super.setLabel(MessageFormat.format(JavaCodeMiningMessages.JavaImplementationCodeMining_label, implCount));
+ }
+ } catch (JavaModelException e) {
+ // Should never occur
+ }
+ });
+ }
+
+ @Override
+ public Consumer getAction() {
+ return action;
+ }
+
+ /**
+ * Return the count of implementation for the given java element type.
+ *
+ * @param type the java element type.
+ * @param monitor the monitor
+ * @return the count of implementation for the given java element type.
+ * @throws JavaModelException throws when Java error
+ */
+ private static long countImplementations(IType type, IProgressMonitor monitor) throws JavaModelException {
+ IType[] results= type.newTypeHierarchy(monitor).getAllSubtypes(type);
+ return Stream.of(results).filter(t -> t.getAncestor(IJavaElement.COMPILATION_UNIT) != null).count();
+ }
+
+}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaReferenceCodeMining.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaReferenceCodeMining.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaReferenceCodeMining.java 1970-01-01 00:00:00.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaReferenceCodeMining.java 2018-12-03 12:49:27.000000000 +0000
@@ -0,0 +1,142 @@
+/**
+ * Copyright (c) 2018 Angelo ZERR.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Angelo Zerr - [CodeMining] Provide Java References/Implementation CodeMinings - Bug 529127
+ */
+package org.eclipse.jdt.internal.ui.javaeditor.codemining;
+
+import java.text.MessageFormat;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Consumer;
+
+import org.eclipse.swt.events.MouseEvent;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.codemining.ICodeMiningProvider;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.SearchRequestor;
+
+import org.eclipse.jdt.ui.actions.FindReferencesAction;
+
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
+
+/**
+ * Java reference code mining.
+ *
+ * @since 3.16
+ */
+public class JavaReferenceCodeMining extends AbstractJavaElementLineHeaderCodeMining {
+
+ private final JavaEditor editor;
+
+ private final boolean showReferencesAtLeastOne;
+
+ private Consumer action;
+
+ public JavaReferenceCodeMining(IJavaElement element, JavaEditor editor, IDocument document,
+ ICodeMiningProvider provider, boolean showReferencesAtLeastOne)
+ throws JavaModelException, BadLocationException {
+ super(element, document, provider, null);
+ this.editor= editor;
+ this.showReferencesAtLeastOne= showReferencesAtLeastOne;
+ }
+
+ @SuppressWarnings("boxing")
+ @Override
+ protected CompletableFuture doResolve(ITextViewer viewer, IProgressMonitor monitor) {
+ return CompletableFuture.runAsync(() -> {
+ try {
+ monitor.isCanceled();
+ IJavaElement element = super.getElement();
+ long refCount= countReferences(element, monitor);
+ monitor.isCanceled();
+ action= refCount > 0 ? e -> new FindReferencesAction(editor).run(element) : null;
+ if (refCount == 0 && showReferencesAtLeastOne) {
+ super.setLabel(""); //$NON-NLS-1$
+ } else {
+ super.setLabel(MessageFormat.format(JavaCodeMiningMessages.JavaReferenceCodeMining_label, refCount));
+ }
+ } catch (JavaModelException e) {
+ // Should never occur
+ } catch (CoreException e) {
+ // Should never occur
+ }
+ });
+ }
+
+ @Override
+ public Consumer getAction() {
+ return action;
+ }
+
+ /**
+ * Return the number of references for the given java element.
+ *
+ * @param element the java element.
+ * @param monitor the monitor
+ * @return he number of references for the given java element.
+ * @throws JavaModelException throws when java error.
+ * @throws CoreException throws when java error.
+ */
+ private static long countReferences(IJavaElement element, IProgressMonitor monitor)
+ throws JavaModelException, CoreException {
+ if (element == null) {
+ return 0;
+ }
+ final AtomicLong count= new AtomicLong(0);
+ SearchPattern pattern= SearchPattern.createPattern(element, IJavaSearchConstants.REFERENCES);
+ SearchEngine engine= new SearchEngine();
+ engine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() },
+ createSearchScope(element), new SearchRequestor() {
+
+ @Override
+ public void acceptSearchMatch(SearchMatch match) throws CoreException {
+ Object o= match.getElement();
+ if (o instanceof IJavaElement) {
+ IJavaElement e= (IJavaElement)o;
+ if (e.getAncestor(IJavaElement.COMPILATION_UNIT) != null
+ || e.getAncestor(IJavaElement.CLASS_FILE) != null) {
+ count.incrementAndGet();
+ }
+ }
+ }
+ }, monitor);
+
+ return count.get();
+ }
+
+ /**
+ * Create Java workspace scope.
+ *
+ * @param element IJavaElement to search references for
+ *
+ * @return the Java workspace scope.
+ * @throws JavaModelException when java error.
+ */
+ private static IJavaSearchScope createSearchScope(IJavaElement element) throws JavaModelException {
+ JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
+ boolean isInsideJRE = factory.isInsideJRE(element);
+ IJavaSearchScope scope= factory.createWorkspaceScope(isInsideJRE);
+ return scope;
+ }
+}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningManager.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningManager.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningManager.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningManager.java 2018-12-03 12:49:27.000000000 +0000
@@ -58,8 +58,12 @@
*/
private void enable() {
if (fEditor != null) {
- fReconciler= new JavaCodeMiningReconciler();
- fReconciler.install(fEditor, fSourceViewer);
+ if (fReconciler != null) {
+ fReconciler.updateCodeMinings();
+ } else {
+ fReconciler= new JavaCodeMiningReconciler();
+ fReconciler.install(fEditor, fSourceViewer);
+ }
}
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningReconciler.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningReconciler.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningReconciler.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningReconciler.java 2018-12-03 12:49:27.000000000 +0000
@@ -16,7 +16,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.ISourceViewerExtension5;
import org.eclipse.jdt.core.dom.CompilationUnit;
@@ -45,8 +44,8 @@
/**
* Install this reconciler on the given editor.
- *
- * @param editor the editor
+ *
+ * @param editor the editor
* @param sourceViewer the source viewer
*/
public void install(JavaEditor editor, ISourceViewer sourceViewer) {
@@ -55,8 +54,8 @@
if (fEditor instanceof CompilationUnitEditor) {
((CompilationUnitEditor) fEditor).addReconcileListener(this);
- updateCodeMinings();
}
+ updateCodeMinings();
}
/**
@@ -73,9 +72,9 @@
/**
* Update Java code mining in the Java editor.
*/
- private void updateCodeMinings() {
- if (fSourceViewer instanceof ISourceViewerExtension5) {
- ((ISourceViewerExtension5) fSourceViewer).updateCodeMinings();
+ void updateCodeMinings() {
+ if (fSourceViewer instanceof JavaSourceViewer) {
+ ((JavaSourceViewer) fSourceViewer).doUpdateCodeMinings();
}
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java 2018-12-03 12:49:27.000000000 +0000
@@ -189,6 +189,7 @@
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.core.util.IModifierConstants;
import org.eclipse.jdt.internal.core.manipulation.search.IOccurrencesFinder;
@@ -199,7 +200,6 @@
import org.eclipse.jdt.ui.IContextMenuConstants;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds;
import org.eclipse.jdt.ui.actions.JavaSearchActionGroup;
import org.eclipse.jdt.ui.actions.OpenEditorActionGroup;
@@ -1219,7 +1219,7 @@
if (inputJavaElement != null) {
IProgressMonitor monitor = getProgressMonitor();
try {
- updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProvider.getAST(inputJavaElement, SharedASTProvider.WAIT_NO, monitor));
+ updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProviderCore.getAST(inputJavaElement, SharedASTProviderCore.WAIT_NO, monitor));
} finally {
monitor.done();
}
@@ -2426,7 +2426,7 @@
IProgressMonitor monitor = getProgressMonitor();
CompilationUnit ast;
try {
- ast= SharedASTProvider.getAST(inputJavaElement, SharedASTProvider.WAIT_NO /* DO NOT USE WAIT_ACTIVE_ONLY */ , monitor);
+ ast= SharedASTProviderCore.getAST(inputJavaElement, SharedASTProviderCore.WAIT_NO /* DO NOT USE WAIT_ACTIVE_ONLY */ , monitor);
} finally {
monitor.done();
}
@@ -2948,6 +2948,8 @@
}
if (affectsJavaCodeMining(event)) {
+ // It's a code mining preference, recompute the list of code mining providers.
+ installCodeMiningProviders();
if (isJavaCodeMiningEnabled()) {
installJavaCodeMining();
} else {
@@ -3402,7 +3404,7 @@
if (inputJavaElement != null) {
IProgressMonitor monitor = getProgressMonitor();
try {
- updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProvider.getAST(inputJavaElement, SharedASTProvider.WAIT_NO, monitor));
+ updateOccurrenceAnnotations((ITextSelection)fForcedMarkOccurrencesSelection, SharedASTProviderCore.getAST(inputJavaElement, SharedASTProviderCore.WAIT_NO, monitor));
} finally {
monitor.done();
}
@@ -3528,7 +3530,7 @@
IProgressMonitor monitor = getProgressMonitor();
try {
SubMonitor subMonitor= SubMonitor.convert(monitor, 2);
- CompilationUnit ast= SharedASTProvider.getAST(inputElement, SharedASTProvider.WAIT_ACTIVE_ONLY,
+ CompilationUnit ast= SharedASTProviderCore.getAST(inputElement, SharedASTProviderCore.WAIT_ACTIVE_ONLY,
subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE));
fOverrideIndicatorManager.reconciled(ast, true, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE));
} finally {
@@ -4284,6 +4286,15 @@
}
}
+ @Override
+ protected void installCodeMiningProviders() {
+ if (JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CODEMINING_ENABLED)) {
+ super.installCodeMiningProviders();
+ } else {
+ ((JavaSourceViewer) getSourceViewer()).resetCodeMinings();
+ }
+ }
+
/**
* Install Java code mining.
*
@@ -4314,6 +4325,9 @@
* @since 3.14
*/
boolean isJavaCodeMiningEnabled() {
+ if (!JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CODEMINING_ENABLED)) {
+ return false;
+ }
// check if there is a registered Java code mining.
ISourceViewer viewer= getViewer();
if (viewer instanceof ISourceViewerExtension5) {
@@ -4330,12 +4344,7 @@
* @since 3.14
*/
protected boolean affectsJavaCodeMining(PropertyChangeEvent event) {
- boolean isJavaCodeMiningPreference= isJavaCodeMiningPreference(event.getProperty());
- if (isJavaCodeMiningPreference) {
- // It's a code mining preference, recompute the list of code mining providers.
- installCodeMiningProviders();
- }
- return isJavaCodeMiningPreference;
+ return isJavaCodeMiningPreference(event.getProperty());
}
/**
@@ -4351,7 +4360,7 @@
* @since 3.14
*/
private boolean isJavaCodeMiningPreference(String property) {
- return property.startsWith(PreferenceConstants.EDITOR_JAVA_CODEMINING_PREFIX);
+ return PreferenceConstants.EDITOR_CODEMINING_ENABLED.equals(property) || property.startsWith(PreferenceConstants.EDITOR_JAVA_CODEMINING_PREFIX);
}
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementHyperlinkDetector.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementHyperlinkDetector.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementHyperlinkDetector.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementHyperlinkDetector.java 2018-12-03 12:49:27.000000000 +0000
@@ -43,6 +43,7 @@
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
import org.eclipse.jdt.core.dom.SwitchCase;
import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.core.manipulation.search.IOccurrencesFinder.OccurrenceLocation;
import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
@@ -50,7 +51,6 @@
import org.eclipse.jdt.internal.corext.util.CollectionsUtil;
import org.eclipse.jdt.internal.corext.util.Messages;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.actions.SelectionDispatchAction;
import org.eclipse.jdt.internal.ui.search.BreakContinueTargetFinder;
@@ -214,7 +214,7 @@
* @since 3.7
*/
public static OccurrenceLocation findBreakOrContinueTarget(ITypeRoot input, IRegion region) {
- CompilationUnit astRoot= SharedASTProvider.getAST(input, SharedASTProvider.WAIT_NO, null);
+ CompilationUnit astRoot= SharedASTProviderCore.getAST(input, SharedASTProviderCore.WAIT_NO, null);
if (astRoot == null)
return null;
@@ -255,7 +255,7 @@
* @since 3.14
*/
public static OccurrenceLocation findSwitchCaseTarget(ITypeRoot input, IRegion region) {
- CompilationUnit astRoot= SharedASTProvider.getAST(input, SharedASTProvider.WAIT_NO, null);
+ CompilationUnit astRoot= SharedASTProviderCore.getAST(input, SharedASTProviderCore.WAIT_NO, null);
if (astRoot == null) {
return null;
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java 2018-12-03 12:49:27.000000000 +0000
@@ -54,6 +54,7 @@
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SuperMethodInvocation;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
@@ -68,7 +69,6 @@
import org.eclipse.jdt.internal.corext.util.MethodOverrideTester;
import org.eclipse.jdt.ui.JavaElementLabels;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.actions.SelectionDispatchAction;
import org.eclipse.jdt.internal.ui.JavaPlugin;
@@ -178,7 +178,7 @@
}
ITypeRoot editorInput= EditorUtility.getEditorInputJavaElement(editor, false);
- CompilationUnit ast= SharedASTProvider.getAST(editorInput, SharedASTProvider.WAIT_ACTIVE_ONLY, null);
+ CompilationUnit ast= SharedASTProviderCore.getAST(editorInput, SharedASTProviderCore.WAIT_ACTIVE_ONLY, null);
if (ast == null) {
openQuickHierarchy(editor);
return;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaSourceViewer.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaSourceViewer.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaSourceViewer.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaSourceViewer.java 2018-12-03 12:49:27.000000000 +0000
@@ -715,4 +715,31 @@
return null;
}
+ @Override
+ public void updateCodeMinings() {
+ // Here we disable this method which is called by AbstractTextEditor#installCodeMiningProviders which updates code mining (draw minings in the UI)
+ // In JDT code mining case, the update code mining must be done when ICompilationUnit is reconciled (and not when editor is opened).
+ // The update code mining is done by JavaCodeMiningReconciler which calls doUpdateCodeMinings:
+ // - on install
+ // - when compilation unit is reconciled
+ }
+
+ /**
+ * Update java code minings.
+ *
+ * @since 3.16
+ */
+ void doUpdateCodeMinings() {
+ super.updateCodeMinings();
+ }
+
+ /**
+ * Reset the registered code mining providers.
+ *
+ * @since 3.16
+ */
+ void resetCodeMinings() {
+ super.setCodeMiningProviders(null);
+ doUpdateCodeMinings();
+ }
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTemplatesPage.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTemplatesPage.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTemplatesPage.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTemplatesPage.java 2018-12-03 12:49:27.000000000 +0000
@@ -44,6 +44,7 @@
import org.eclipse.ui.texteditor.templates.AbstractTemplatesPage;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType;
import org.eclipse.jdt.internal.corext.template.java.JavaContext;
@@ -51,6 +52,7 @@
import org.eclipse.jdt.internal.corext.template.java.JavaDocContext;
import org.eclipse.jdt.internal.corext.template.java.JavaDocContextType;
import org.eclipse.jdt.internal.corext.template.java.SWTContextType;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.ui.text.IJavaPartitions;
@@ -344,6 +346,10 @@
String[] ids= new String[] { JavaContextType.ID_ALL, JavaContextType.ID_MEMBERS, JavaContextType.ID_STATEMENTS, SWTContextType.ID_ALL, SWTContextType.ID_STATEMENTS, SWTContextType.ID_MEMBERS};
if (partition.equals(IJavaPartitions.JAVA_DOC))
ids= new String[] { JavaDocContextType.ID };
+ IJavaElement elem= EditorUtility.getEditorInputJavaElement(fJavaEditor, true);
+ if (elem != null && JavaModelUtil.MODULE_INFO_JAVA.equals(elem.getElementName())) {
+ ids= new String[] { JavaContextType.ID_MODULE };
+ }
return ids;
} catch (BadLocationException e) {
return new String[0];
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTextSelection.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTextSelection.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTextSelection.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaTextSelection.java 2018-12-03 12:49:27.000000000 +0000
@@ -27,12 +27,11 @@
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.corext.dom.Selection;
import org.eclipse.jdt.internal.corext.dom.SelectionAnalyzer;
-import org.eclipse.jdt.ui.SharedASTProvider;
-
import org.eclipse.jdt.internal.ui.actions.SelectionConverter;
/**
@@ -119,7 +118,7 @@
return fPartialAST;
fPartialASTRequested= true;
// long start= System.currentTimeMillis();
- fPartialAST= SharedASTProvider.getAST(fElement, SharedASTProvider.WAIT_YES, null);
+ fPartialAST= SharedASTProviderCore.getAST(fElement, SharedASTProviderCore.WAIT_YES, null);
// System.out.println("Time requesting partial AST: " + (System.currentTimeMillis() - start));
return fPartialAST;
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/NLSKeyHyperlinkDetector.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/NLSKeyHyperlinkDetector.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/NLSKeyHyperlinkDetector.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/NLSKeyHyperlinkDetector.java 2018-12-03 12:49:27.000000000 +0000
@@ -31,12 +31,12 @@
import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.corext.refactoring.nls.AccessorClassReference;
import org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper;
import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.SharedASTProvider;
@@ -65,7 +65,7 @@
if (javaElement == null)
return null;
- CompilationUnit ast= SharedASTProvider.getAST(javaElement, SharedASTProvider.WAIT_NO, null);
+ CompilationUnit ast= SharedASTProviderCore.getAST(javaElement, SharedASTProviderCore.WAIT_NO, null);
if (ast == null)
return null;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/OverrideIndicatorManager.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/OverrideIndicatorManager.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/OverrideIndicatorManager.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/OverrideIndicatorManager.java 2018-12-03 12:49:27.000000000 +0000
@@ -41,18 +41,18 @@
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
+import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
-import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels;
/**
* Manages the override and overwrite indicators for
@@ -100,7 +100,7 @@
* Opens and reveals the defining method.
*/
public void open() {
- CompilationUnit ast= SharedASTProvider.getAST(fJavaElement, SharedASTProvider.WAIT_ACTIVE_ONLY, null);
+ CompilationUnit ast= SharedASTProviderCore.getAST(fJavaElement, SharedASTProviderCore.WAIT_ACTIVE_ONLY, null);
if (ast != null) {
ASTNode node= ast.findDeclaringNode(fAstNodeKey);
if (node instanceof MethodDeclaration) {
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/selectionactions/StructureSelectionAction.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/selectionactions/StructureSelectionAction.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/selectionactions/StructureSelectionAction.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/selectionactions/StructureSelectionAction.java 2018-12-03 12:49:27.000000000 +0000
@@ -32,13 +32,12 @@
import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.internal.corext.dom.Selection;
import org.eclipse.jdt.internal.corext.dom.SelectionAnalyzer;
-import org.eclipse.jdt.ui.SharedASTProvider;
-
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
@@ -155,7 +154,7 @@
}
private static CompilationUnit getAST(ITypeRoot sr) {
- return SharedASTProvider.getAST(sr, SharedASTProvider.WAIT_YES, null);
+ return SharedASTProviderCore.getAST(sr, SharedASTProviderCore.WAIT_YES, null);
}
//-- helper methods for this class and subclasses
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlighting.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlighting.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlighting.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlighting.java 2018-12-03 12:49:27.000000000 +0000
@@ -25,7 +25,7 @@
/**
* Semantic highlighting
*/
-public abstract class SemanticHighlighting {
+public abstract class SemanticHighlighting extends SemanticHighlightingCore {
/**
* @return the preference key, will be augmented by a prefix and a suffix for each preference
@@ -76,41 +76,6 @@
*/
public abstract boolean isEnabledByDefault();
- /**
- * @return the display name
- */
- public abstract String getDisplayName();
-
- /**
- * Returns true iff the semantic highlighting consumes the semantic token.
- *
- * NOTE: Implementors are not allowed to keep a reference on the token or on any object
- * retrieved from the token.
- *
- *
- * @param token the semantic token for a {@link org.eclipse.jdt.core.dom.SimpleName}
- * @return true iff the semantic highlighting consumes the semantic token
- */
- public abstract boolean consumes(SemanticToken token);
-
- /**
- * Returns true iff the semantic highlighting consumes the
- * semantic token.
- *
- * NOTE: Implementors are not allowed to keep a reference on the token or on
- * any object retrieved from the token.
- *
- * @param token the semantic token for a
- * {@link org.eclipse.jdt.core.dom.NumberLiteral},
- * {@link org.eclipse.jdt.core.dom.BooleanLiteral} or
- * {@link org.eclipse.jdt.core.dom.CharacterLiteral}
- * @return true iff the semantic highlighting consumes the
- * semantic token
- */
- public boolean consumesLiteral(SemanticToken token) {
- return false;
- }
-
private String getThemeColorKey() {
return JavaUI.ID_PLUGIN + "." + getPreferenceKey() + "Highlighting"; //$NON-NLS-1$//$NON-NLS-2$
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingManager.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - use HighlightedPositionCore
*******************************************************************************/
package org.eclipse.jdt.internal.ui.javaeditor;
@@ -28,7 +29,6 @@
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextAttribute;
@@ -97,13 +97,7 @@
/**
* Highlighted Positions.
*/
- static class HighlightedPosition extends Position {
-
- /** Highlighting of the position */
- private Highlighting fStyle;
-
- /** Lock object */
- private Object fLock;
+ static class HighlightedPosition extends HighlightedPositionCore {
/**
* Initialize the styled positions with the given offset, length and foreground color.
@@ -114,9 +108,7 @@
* @param lock The lock object
*/
public HighlightedPosition(int offset, int length, Highlighting highlighting, Object lock) {
- super(offset, length);
- fStyle= highlighting;
- fLock= lock;
+ super(offset, length, highlighting, lock);
}
/**
@@ -124,10 +116,10 @@
*/
public StyleRange createStyleRange() {
int len= 0;
- if (fStyle.isEnabled())
+ if (getHighlighting().isEnabled())
len= getLength();
- TextAttribute textAttribute= fStyle.getTextAttribute();
+ TextAttribute textAttribute= getHighlighting().getTextAttribute();
int style= textAttribute.getStyle();
int fontStyle= style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
StyleRange styleRange= new StyleRange(getOffset(), len, textAttribute.getForeground(), textAttribute.getBackground(), fontStyle);
@@ -146,9 +138,7 @@
* @return true iff the given offset, length and highlighting are equal to the internal ones.
*/
public boolean isEqual(int off, int len, Highlighting highlighting) {
- synchronized (fLock) {
- return !isDeleted() && getOffset() == off && getLength() == len && fStyle == highlighting;
- }
+ return super.isEqual(off, len, highlighting);
}
/**
@@ -158,17 +148,14 @@
* @param len The range length
* @return true iff this position is not delete and contained in the given range.
*/
+ @Override
public boolean isContained(int off, int len) {
- synchronized (fLock) {
- return !isDeleted() && off <= getOffset() && off + len >= getOffset() + getLength();
- }
+ return super.isContained(off, len);
}
+ @Override
public void update(int off, int len) {
- synchronized (fLock) {
- super.setOffset(off);
- super.setLength(len);
- }
+ super.update(off, len);
}
/*
@@ -176,9 +163,7 @@
*/
@Override
public void setLength(int length) {
- synchronized (fLock) {
- super.setLength(length);
- }
+ super.setLength(length);
}
/*
@@ -186,9 +171,7 @@
*/
@Override
public void setOffset(int offset) {
- synchronized (fLock) {
- super.setOffset(offset);
- }
+ super.setOffset(offset);
}
/*
@@ -196,9 +179,7 @@
*/
@Override
public void delete() {
- synchronized (fLock) {
- super.delete();
- }
+ super.delete();
}
/*
@@ -206,16 +187,15 @@
*/
@Override
public void undelete() {
- synchronized (fLock) {
- super.undelete();
- }
+ super.undelete();
}
/**
* @return Returns the highlighting.
*/
+ @Override
public Highlighting getHighlighting() {
- return fStyle;
+ return (Highlighting)super.getHighlighting();
}
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingPresenter.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingPresenter.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingPresenter.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingPresenter.java 2018-12-03 12:49:27.000000000 +0000
@@ -25,7 +25,6 @@
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ISynchronizable;
import org.eclipse.jface.text.ITextInputListener;
@@ -45,206 +44,14 @@
*
* @since 3.0
*/
-public class SemanticHighlightingPresenter implements ITextPresentationListener, ITextInputListener, IDocumentListener {
-
- /**
- * Semantic highlighting position updater.
- */
- private class HighlightingPositionUpdater implements IPositionUpdater {
-
- /** The position category. */
- private final String fCategory;
-
- /**
- * Creates a new updater for the given category.
- *
- * @param category the new category.
- */
- public HighlightingPositionUpdater(String category) {
- fCategory= category;
- }
-
- /*
- * @see org.eclipse.jface.text.IPositionUpdater#update(org.eclipse.jface.text.DocumentEvent)
- */
- @Override
- public void update(DocumentEvent event) {
-
- int eventOffset= event.getOffset();
- int eventOldLength= event.getLength();
- int eventEnd= eventOffset + eventOldLength;
-
- try {
- Position[] positions= event.getDocument().getPositions(fCategory);
-
- for (int i= 0; i != positions.length; i++) {
-
- HighlightedPosition position= (HighlightedPosition) positions[i];
-
- // Also update deleted positions because they get deleted by the background thread and removed/invalidated only in the UI runnable
-// if (position.isDeleted())
-// continue;
-
- int offset= position.getOffset();
- int length= position.getLength();
- int end= offset + length;
-
- if (offset > eventEnd)
- updateWithPrecedingEvent(position, event);
- else if (end < eventOffset)
- updateWithSucceedingEvent(position, event);
- else if (offset <= eventOffset && end >= eventEnd)
- updateWithIncludedEvent(position, event);
- else if (offset <= eventOffset)
- updateWithOverEndEvent(position, event);
- else if (end >= eventEnd)
- updateWithOverStartEvent(position, event);
- else
- updateWithIncludingEvent(position, event);
- }
- } catch (BadPositionCategoryException e) {
- // ignore and return
- }
- }
-
- /**
- * Update the given position with the given event. The event precedes the position.
- *
- * @param position The position
- * @param event The event
- */
- private void updateWithPrecedingEvent(HighlightedPosition position, DocumentEvent event) {
- String newText= event.getText();
- int eventNewLength= newText != null ? newText.length() : 0;
- int deltaLength= eventNewLength - event.getLength();
-
- position.setOffset(position.getOffset() + deltaLength);
- }
-
- /**
- * Update the given position with the given event. The event succeeds the position.
- *
- * @param position The position
- * @param event The event
- */
- private void updateWithSucceedingEvent(HighlightedPosition position, DocumentEvent event) {
- }
-
- /**
- * Update the given position with the given event. The event is included by the position.
- *
- * @param position The position
- * @param event The event
- */
- private void updateWithIncludedEvent(HighlightedPosition position, DocumentEvent event) {
- int eventOffset= event.getOffset();
- String newText= event.getText();
- if (newText == null)
- newText= ""; //$NON-NLS-1$
- int eventNewLength= newText.length();
-
- int deltaLength= eventNewLength - event.getLength();
-
- int offset= position.getOffset();
- int length= position.getLength();
- int end= offset + length;
-
- int includedLength= 0;
- while (includedLength < eventNewLength && Character.isJavaIdentifierPart(newText.charAt(includedLength)))
- includedLength++;
- if (includedLength == eventNewLength)
- position.setLength(length + deltaLength);
- else {
- int newLeftLength= eventOffset - offset + includedLength;
-
- int excludedLength= eventNewLength;
- while (excludedLength > 0 && Character.isJavaIdentifierPart(newText.charAt(excludedLength - 1)))
- excludedLength--;
- int newRightOffset= eventOffset + excludedLength;
- int newRightLength= end + deltaLength - newRightOffset;
-
- if (newRightLength == 0) {
- position.setLength(newLeftLength);
- } else {
- if (newLeftLength == 0) {
- position.update(newRightOffset, newRightLength);
- } else {
- position.setLength(newLeftLength);
- addPositionFromUI(newRightOffset, newRightLength, position.getHighlighting());
- }
- }
- }
- }
-
- /**
- * Update the given position with the given event. The event overlaps with the end of the position.
- *
- * @param position The position
- * @param event The event
- */
- private void updateWithOverEndEvent(HighlightedPosition position, DocumentEvent event) {
- String newText= event.getText();
- if (newText == null)
- newText= ""; //$NON-NLS-1$
- int eventNewLength= newText.length();
-
- int includedLength= 0;
- while (includedLength < eventNewLength && Character.isJavaIdentifierPart(newText.charAt(includedLength)))
- includedLength++;
- position.setLength(event.getOffset() - position.getOffset() + includedLength);
- }
-
- /**
- * Update the given position with the given event. The event overlaps with the start of the position.
- *
- * @param position The position
- * @param event The event
- */
- private void updateWithOverStartEvent(HighlightedPosition position, DocumentEvent event) {
- int eventOffset= event.getOffset();
- int eventEnd= eventOffset + event.getLength();
-
- String newText= event.getText();
- if (newText == null)
- newText= ""; //$NON-NLS-1$
- int eventNewLength= newText.length();
-
- int excludedLength= eventNewLength;
- while (excludedLength > 0 && Character.isJavaIdentifierPart(newText.charAt(excludedLength - 1)))
- excludedLength--;
- int deleted= eventEnd - position.getOffset();
- int inserted= eventNewLength - excludedLength;
- position.update(eventOffset + excludedLength, position.getLength() - deleted + inserted);
- }
-
- /**
- * Update the given position with the given event. The event includes the position.
- *
- * @param position The position
- * @param event The event
- */
- private void updateWithIncludingEvent(HighlightedPosition position, DocumentEvent event) {
- position.delete();
- position.update(event.getOffset(), 0);
- }
- }
-
- /** Position updater */
- private IPositionUpdater fPositionUpdater= new HighlightingPositionUpdater(getPositionCategory());
+public class SemanticHighlightingPresenter extends SemanticHighlightingPresenterCore
+ implements ITextPresentationListener, ITextInputListener, IDocumentListener {
/** The source viewer this semantic highlighting reconciler is installed on */
private JavaSourceViewer fSourceViewer;
/** The background presentation reconciler */
private JavaPresentationReconciler fPresentationReconciler;
- /** UI's current highlighted positions - can contain null elements */
- private List fPositions= new ArrayList<>();
- /** UI position lock */
- private Object fPositionLock= new Object();
-
- /** true iff the current reconcile is canceled. */
- private boolean fIsCanceled= false;
-
/**
* Creates and returns a new highlighted position with the given offset, length and highlighting.
*
@@ -261,20 +68,15 @@
return new HighlightedPosition(offset, length, highlighting, fPositionUpdater);
}
- /**
- * Adds all current positions to the given list.
- *
- * NOTE: Called from background thread.
- *
- *
- * @param list The list
+ /*
+ * @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlightingPresenterCore#addPositionForEvent()
*/
- public void addAllPositions(List list) {
- synchronized (fPositionLock) {
- list.addAll(fPositions);
- }
+ @Override
+ protected void addPositionForEvent(DocumentEvent event, String category, int offset, int length, Object highlighting) {
+ addPositionFromUI(offset, length, (Highlighting)highlighting);
}
+
/**
* Create a text presentation in the background.
*
@@ -465,33 +267,6 @@
// }
/**
- * Returns true iff the positions contain the position.
- * @param positions the positions, must be ordered by offset but may overlap
- * @param position the position
- * @return true iff the positions contain the position
- */
- private boolean contain(List extends Position> positions, Position position) {
- return indexOf(positions, position) != -1;
- }
-
- /**
- * Returns index of the position in the positions, -1 if not found.
- * @param positions the positions, must be ordered by offset but may overlap
- * @param position the position
- * @return the index
- */
- private int indexOf(List extends Position> positions, Position position) {
- int index= computeIndexAtOffset(positions, position.getOffset());
- int size= positions.size();
- while (index < size) {
- if (positions.get(index) == position)
- return index;
- index++;
- }
- return -1;
- }
-
- /**
* Insert the given position in fPositions, s.t. the offsets remain in linear order.
*
* @param position The position for insertion
@@ -522,27 +297,6 @@
return j;
}
- /**
- * Returns the index of the first position with an offset equal or greater than the given offset.
- *
- * @param positions the positions, must be ordered by offset and must not overlap
- * @param offset the offset
- * @return the index of the last position with an offset equal or greater than the given offset
- */
- private int computeIndexAtOffset(List extends Position> positions, int offset) {
- int i= -1;
- int j= positions.size();
- while (j - i > 1) {
- int k= (i + j) >> 1;
- Position position= positions.get(k);
- if (position.getOffset() >= offset)
- j= k;
- else
- i= k;
- }
- return j;
- }
-
/*
* @see org.eclipse.jface.text.ITextPresentationListener#applyTextPresentation(org.eclipse.jface.text.TextPresentation)
*/
@@ -608,6 +362,7 @@
* NOTE: Also called from background thread.
*
*/
+ @Override
public boolean isCanceled() {
IDocument document= fSourceViewer != null ? fSourceViewer.getDocument() : null;
if (document == null)
@@ -623,6 +378,7 @@
*
* @param isCanceled true iff the current reconcile is canceled
*/
+ @Override
public void setCanceled(boolean isCanceled) {
IDocument document= fSourceViewer != null ? fSourceViewer.getDocument() : null;
if (document == null) {
@@ -779,7 +535,8 @@
/**
* @return The semantic reconciler position's category.
*/
- private String getPositionCategory() {
+ @Override
+ public String getPositionCategory() {
return toString();
}
}
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingReconciler.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingReconciler.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingReconciler.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightingReconciler.java 2018-12-03 12:49:27.000000000 +0000
@@ -36,20 +36,14 @@
import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.BooleanLiteral;
-import org.eclipse.jdt.core.dom.CharacterLiteral;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ConstructorInvocation;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.NumberLiteral;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
-
-import org.eclipse.jdt.internal.corext.dom.GenericVisitor;
-
-import org.eclipse.jdt.ui.SharedASTProvider;
+import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlightingManager.HighlightedPosition;
@@ -69,48 +63,14 @@
/**
* Collects positions from the AST.
*/
- private class PositionCollector extends GenericVisitor {
+ private class PositionCollector extends PositionCollectorCore {
/** The semantic token */
private SemanticToken fToken= new SemanticToken();
- /*
- * @see org.eclipse.jdt.internal.corext.dom.GenericVisitor#visitNode(org.eclipse.jdt.core.dom.ASTNode)
- */
- @Override
- protected boolean visitNode(ASTNode node) {
- if ((node.getFlags() & ASTNode.MALFORMED) == ASTNode.MALFORMED) {
- retainPositions(node.getStartPosition(), node.getLength());
- return false;
- }
- return true;
- }
- /*
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BooleanLiteral)
- */
@Override
- public boolean visit(BooleanLiteral node) {
- return visitLiteral(node);
- }
-
- /*
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CharacterLiteral)
- */
- @Override
- public boolean visit(CharacterLiteral node) {
- return visitLiteral(node);
- }
-
- /*
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.NumberLiteral)
- */
- @Override
- public boolean visit(NumberLiteral node) {
- return visitLiteral(node);
- }
-
- private boolean visitLiteral(Expression node) {
+ protected boolean visitLiteral(Expression node) {
fToken.update(node);
for (int i= 0, n= fJobSemanticHighlightings.length; i < n; i++) {
SemanticHighlighting semanticHighlighting= fJobSemanticHighlightings[i];
@@ -234,7 +194,8 @@
* @param offset The range offset
* @param length The range length
*/
- private void retainPositions(int offset, int length) {
+ @Override
+ protected void retainPositions(int offset, int length) {
// TODO: use binary search
for (int i= 0, n= fRemovedPositions.size(); i < n; i++) {
HighlightedPosition position= (HighlightedPosition) fRemovedPositions.get(i);
@@ -517,7 +478,7 @@
}
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
- CompilationUnit ast= SharedASTProvider.getAST(element, SharedASTProvider.WAIT_YES, monitor);
+ CompilationUnit ast= SharedASTProviderCore.getAST(element, SharedASTProviderCore.WAIT_YES, monitor);
reconciled(ast, false, monitor);
synchronized (fJobLock) {
// allow the job to be gc'ed
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java 2018-12-03 12:49:27.000000000 +0000
@@ -66,69 +66,69 @@
/**
* A named preference part that controls the highlighting of static final fields.
*/
- public static final String STATIC_FINAL_FIELD="staticFinalField"; //$NON-NLS-1$
+ public static final String STATIC_FINAL_FIELD= SemanticHighlightingsCore.STATIC_FINAL_FIELD;
/**
* A named preference part that controls the highlighting of static fields.
*/
- public static final String STATIC_FIELD="staticField"; //$NON-NLS-1$
+ public static final String STATIC_FIELD= SemanticHighlightingsCore.STATIC_FIELD;
/**
* A named preference part that controls the highlighting of fields.
*/
- public static final String FIELD="field"; //$NON-NLS-1$
+ public static final String FIELD= SemanticHighlightingsCore.FIELD;
/**
* A named preference part that controls the highlighting of method declarations.
*/
- public static final String METHOD_DECLARATION="methodDeclarationName"; //$NON-NLS-1$
+ public static final String METHOD_DECLARATION= SemanticHighlightingsCore.METHOD_DECLARATION;
/**
* A named preference part that controls the highlighting of static method invocations.
*/
- public static final String STATIC_METHOD_INVOCATION="staticMethodInvocation"; //$NON-NLS-1$
+ public static final String STATIC_METHOD_INVOCATION= SemanticHighlightingsCore.STATIC_METHOD_INVOCATION;
/**
* A named preference part that controls the highlighting of inherited method invocations.
*/
- public static final String INHERITED_METHOD_INVOCATION="inheritedMethodInvocation"; //$NON-NLS-1$
+ public static final String INHERITED_METHOD_INVOCATION= SemanticHighlightingsCore.INHERITED_METHOD_INVOCATION;
/**
* A named preference part that controls the highlighting of annotation element references.
* @since 3.1
*/
- public static final String ANNOTATION_ELEMENT_REFERENCE="annotationElementReference"; //$NON-NLS-1$
+ public static final String ANNOTATION_ELEMENT_REFERENCE= SemanticHighlightingsCore.ANNOTATION_ELEMENT_REFERENCE;
/**
* A named preference part that controls the highlighting of abstract method invocations.
*/
- public static final String ABSTRACT_METHOD_INVOCATION="abstractMethodInvocation"; //$NON-NLS-1$
+ public static final String ABSTRACT_METHOD_INVOCATION= SemanticHighlightingsCore.ABSTRACT_METHOD_INVOCATION;
/**
* A named preference part that controls the highlighting of local variables.
*/
- public static final String LOCAL_VARIABLE_DECLARATION="localVariableDeclaration"; //$NON-NLS-1$
+ public static final String LOCAL_VARIABLE_DECLARATION= SemanticHighlightingsCore.LOCAL_VARIABLE_DECLARATION;
/**
* A named preference part that controls the highlighting of local variables.
*/
- public static final String LOCAL_VARIABLE="localVariable"; //$NON-NLS-1$
+ public static final String LOCAL_VARIABLE= SemanticHighlightingsCore.LOCAL_VARIABLE;
/**
* A named preference part that controls the highlighting of parameter variables.
*/
- public static final String PARAMETER_VARIABLE="parameterVariable"; //$NON-NLS-1$
+ public static final String PARAMETER_VARIABLE= SemanticHighlightingsCore.PARAMETER_VARIABLE;
/**
* A named preference part that controls the highlighting of deprecated members.
*/
- public static final String DEPRECATED_MEMBER="deprecatedMember"; //$NON-NLS-1$
+ public static final String DEPRECATED_MEMBER= SemanticHighlightingsCore.DEPRECATED_MEMBER;
/**
* A named preference part that controls the highlighting of type parameters.
* @since 3.1
*/
- public static final String TYPE_VARIABLE="typeParameter"; //$NON-NLS-1$
+ public static final String TYPE_VARIABLE= SemanticHighlightingsCore.TYPE_VARIABLE;
/**
* A named preference part that controls the highlighting of methods
@@ -136,7 +136,7 @@
*
* @since 3.1
*/
- public static final String METHOD="method"; //$NON-NLS-1$
+ public static final String METHOD= SemanticHighlightingsCore.METHOD;
/**
* A named preference part that controls the highlighting of auto(un)boxed
@@ -144,68 +144,68 @@
*
* @since 3.1
*/
- public static final String AUTOBOXING="autoboxing"; //$NON-NLS-1$
+ public static final String AUTOBOXING= SemanticHighlightingsCore.AUTOBOXING;
/**
* A named preference part that controls the highlighting of classes.
*
* @since 3.2
*/
- public static final String CLASS="class"; //$NON-NLS-1$
+ public static final String CLASS= SemanticHighlightingsCore.CLASS;
/**
* A named preference part that controls the highlighting of enums.
*
* @since 3.2
*/
- public static final String ENUM="enum"; //$NON-NLS-1$
+ public static final String ENUM= SemanticHighlightingsCore.ENUM;
/**
* A named preference part that controls the highlighting of interfaces.
*
* @since 3.2
*/
- public static final String INTERFACE="interface"; //$NON-NLS-1$
+ public static final String INTERFACE= SemanticHighlightingsCore.INTERFACE;
/**
* A named preference part that controls the highlighting of annotations.
*
* @since 3.2
*/
- public static final String ANNOTATION="annotation"; //$NON-NLS-1$
+ public static final String ANNOTATION= SemanticHighlightingsCore.ANNOTATION;
/**
* A named preference part that controls the highlighting of type arguments.
*
* @since 3.2
*/
- public static final String TYPE_ARGUMENT="typeArgument"; //$NON-NLS-1$
+ public static final String TYPE_ARGUMENT= SemanticHighlightingsCore.TYPE_ARGUMENT;
/**
* A named preference part that controls the highlighting of numbers.
*
* @since 3.4
*/
- public static final String NUMBER="number"; //$NON-NLS-1$
+ public static final String NUMBER= SemanticHighlightingsCore.NUMBER;
/**
* A named preference part that controls the highlighting of abstract classes.
*
* @since 3.7
*/
- public static final String ABSTRACT_CLASS="abstractClass"; //$NON-NLS-1$
+ public static final String ABSTRACT_CLASS= SemanticHighlightingsCore.ABSTRACT_CLASS;
/**
* A named preference part that controls the highlighting of inherited fields.
*
* @since 3.8
*/
- public static final String INHERITED_FIELD="inheritedField"; //$NON-NLS-1$
+ public static final String INHERITED_FIELD= SemanticHighlightingsCore.INHERITED_FIELD;
/**
* A named preference part that controls the highlighting of 'var' keywords.
*/
- public static final String VAR_KEYWORD= "varKeyword"; //$NON-NLS-1$
+ public static final String VAR_KEYWORD= SemanticHighlightingsCore.VAR_KEYWORD;
/**
* Semantic highlightings
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticToken.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticToken.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticToken.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticToken.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jdt.internal.ui.javaeditor;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.IBinding;
-import org.eclipse.jdt.core.dom.SimpleName;
-
-/**
- * Semantic token
- */
-public final class SemanticToken {
-
- /** AST node */
- private SimpleName fNode;
- private Expression fLiteral;
-
- /** Binding */
- private IBinding fBinding;
- /** Is the binding resolved? */
- private boolean fIsBindingResolved= false;
-
- /** AST root */
- private CompilationUnit fRoot;
- private boolean fIsRootResolved= false;
-
- /**
- * @return Returns the binding, can be null.
- */
- public IBinding getBinding() {
- if (!fIsBindingResolved) {
- fIsBindingResolved= true;
- if (fNode != null)
- fBinding= fNode.resolveBinding();
- }
-
- return fBinding;
- }
-
- /**
- * @return the AST node (a {@link SimpleName})
- */
- public SimpleName getNode() {
- return fNode;
- }
-
- /**
- * @return the AST node (a Boolean-, Character- or NumberLiteral)
- */
- public Expression getLiteral() {
- return fLiteral;
- }
-
- /**
- * @return the AST root
- */
- public CompilationUnit getRoot() {
- if (!fIsRootResolved) {
- fIsRootResolved= true;
- fRoot= (CompilationUnit) (fNode != null ? fNode : fLiteral).getRoot();
- }
-
- return fRoot;
- }
-
- /**
- * Update this token with the given AST node.
- *
- * NOTE: Allowed to be used by {@link SemanticHighlightingReconciler} only.
- *
- *
- * @param node the AST simple name
- */
- void update(SimpleName node) {
- clear();
- fNode= node;
- }
-
- /**
- * Update this token with the given AST node.
- *
- * NOTE: Allowed to be used by {@link SemanticHighlightingReconciler} only.
- *
- *
+ *
* @since 3.0
*/
public static final String CODEGEN_IS_FOR_GETTERS= "org.eclipse.jdt.ui.gettersetter.use.is"; //$NON-NLS-1$
@@ -740,7 +743,7 @@
*
* Value is of type Boolean.
*
- *
+ *
* @since 3.8
*/
public final static String EDITOR_HIGHLIGHT_BRACKET_AT_CARET_LOCATION= "highlightBracketAtCaretLocation"; //$NON-NLS-1$
@@ -751,7 +754,7 @@
*
* Value is of type Boolean.
*
- *
+ *
* @since 3.8
*/
public final static String EDITOR_ENCLOSING_BRACKETS= "enclosingBrackets"; //$NON-NLS-1$
@@ -2989,6 +2992,18 @@
public final static String CODEASSIST_AUTOINSERT= "content_assist_autoinsert"; //$NON-NLS-1$
/**
+ * A named preference that controls if the Java code assist ignores the insertion trigger
+ * characters for completion proposals.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ * @see ContentAssistant#enableCompletionProposalTriggerChars(boolean)
+ */
+ public static final String CODEASSIST_DISABLE_COMPLETION_PROPOSAL_TRIGGER_CHARS= "content_assist_disable_completion_trigger_chars"; //$NON-NLS-1$
+
+ /**
* A named preference that controls if the Java code assist adds import
* statements.
*
@@ -3339,9 +3354,9 @@
*
rank= enabled ? cycleState : cycleState - 65535)
*
*
- *
+ *
*
- *
+ *
* @since 3.2
*/
public static final String CODEASSIST_CATEGORY_ORDER= "content_assist_category_order"; //$NON-NLS-1$
@@ -3423,7 +3438,7 @@
* Value is of type String: semicolon separated list of fully qualified type names
* appended with ".*" or "." + method name.
*
- *
+ *
* @since 3.6
*/
public static final String PREF_DEFAULT_EXPAND_WITH_CONSTRUCTORS_MEMBERS= "CallHierarchy.defaultExpandWithConstructorsMembers"; //$NON-NLS-1$
@@ -3434,7 +3449,7 @@
*
* Value is of type Boolean.
*
- *
+ *
* @since 3.6
*/
public static final String PREF_ANONYMOUS_EXPAND_WITH_CONSTRUCTORS= "CallHierarchy.anonymousExpandWithConstructors"; //$NON-NLS-1$
@@ -3780,6 +3795,77 @@
public final static String DECORATE_TEST_CODE_CONTAINER_ICONS= "decorateTestCodeContainerIcons"; //$NON-NLS-1$
/**
+ * A named preference that controls whether codemining is enabled in the Java editor.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_CODEMINING_ENABLED= "editor_codemining_enabled"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for "Only if there is at least one result".
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_JAVA_CODEMINING_SHOW_CODEMINING_AT_LEAST_ONE = "java.codemining.atLeastOne"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for "Show references" codemining.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_JAVA_CODEMINING_SHOW_REFERENCES = "java.codemining.references"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for "Show references" on types.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_TYPES= "java.codemining.references.onTypes"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for "Show references" on fields.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_FIELDS= "java.codemining.references.onFields"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for "Show references" on methods.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_METHODS= "java.codemining.references.onMethods"; //$NON-NLS-1$
+
+ /**
+ * A named preference that stores the value for "Show implementations"
+ * codemining.
+ *
+ * Value is of type Boolean.
+ *
+ *
+ * @since 3.16
+ */
+ public static final String EDITOR_JAVA_CODEMINING_SHOW_IMPLEMENTATIONS = "java.codemining.implementations"; //$NON-NLS-1$
+
+ /**
* Initializes the given preference store with the default values.
*
* @param store the preference store to be initialized
@@ -3935,6 +4021,7 @@
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 0);
store.setDefault(PreferenceConstants.CODEASSIST_AUTOINSERT, true);
+ store.setDefault(PreferenceConstants.CODEASSIST_DISABLE_COMPLETION_PROPOSAL_TRIGGER_CHARS, false);
// Set the value for the deprecated color constants
initializeDeprecatedColorConstants(store);
@@ -4114,6 +4201,16 @@
store.setValue(PREF_DEFAULT_EXPAND_WITH_CONSTRUCTORS_MEMBERS, ExpandWithConstructorsConfigurationBlock.serializeMembers(Arrays.asList(oldPrefStr)));
store.setToDefault(CallHierarchyContentProvider.OLD_PREF_DEFAULT_EXPAND_WITH_CONSTRUCTORS);
}
+
+ // Code minings preferences
+ store.setDefault(PreferenceConstants.EDITOR_CODEMINING_ENABLED, false);
+ store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_CODEMINING_AT_LEAST_ONE,
+ true);
+ store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_REFERENCES, true);
+ store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_TYPES, true);
+ store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_FIELDS, true);
+ store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_REFERENCES_ON_METHODS, true);
+ store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_IMPLEMENTATIONS, true);
}
/**
@@ -4240,7 +4337,7 @@
/**
* Initializes deprecated color constants.
- *
+ *
* @param store the preference store
* @since 3.6
*/
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/SharedASTProvider.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/SharedASTProvider.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/SharedASTProvider.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/SharedASTProvider.java 2018-12-03 12:49:27.000000000 +0000
@@ -33,7 +33,7 @@
*
Clients can make the following assumptions about the AST:
*
*
the AST has a {@link ITypeRoot} as source: {@link CompilationUnit#getTypeRoot()} is not null.
- *
the {@link AST#apiLevel() AST API level} is {@link AST#JLS10 API level 10} or higher
+ *
the {@link AST#apiLevel() AST API level} is {@link AST#JLS11 API level 11} or higher
*
the AST has bindings resolved ({@link AST#hasResolvedBindings()})
*
{@link AST#hasStatementsRecovery() statement} and {@link AST#hasBindingsRecovery() bindings}
* recovery are enabled
@@ -53,7 +53,9 @@
* @since 3.4
*
* @noinstantiate This class is not intended to be instantiated by clients.
+ * @deprecated Use {@link org.eclipse.jdt.core.manipulation.SharedASTProviderCore} instead.
*/
+@Deprecated
public final class SharedASTProvider {
/**
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ASTRewriteCorrectionProposal.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ASTRewriteCorrectionProposal.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ASTRewriteCorrectionProposal.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ASTRewriteCorrectionProposal.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,7 +28,7 @@
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
-import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.core.manipulation.StubUtility;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.JavaUIStatus;
diff -Nru eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ChangeCorrectionProposal.java eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ChangeCorrectionProposal.java
--- eclipse-jdt-ui-4.9/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ChangeCorrectionProposal.java 2018-08-30 10:15:15.000000000 +0000
+++ eclipse-jdt-ui-4.10/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/correction/ChangeCorrectionProposal.java 2018-12-03 12:49:27.000000000 +0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - change to extend ChangeCorrectionProposalCore
*******************************************************************************/
package org.eclipse.jdt.ui.text.java.correction;
@@ -23,7 +24,6 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
@@ -48,6 +48,8 @@
import org.eclipse.ltk.core.refactoring.RefactoringCore;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore;
+
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
@@ -66,13 +68,10 @@
*
* @since 3.8
*/
-public class ChangeCorrectionProposal implements IJavaCompletionProposal, ICommandAccess, ICompletionProposalExtension5, ICompletionProposalExtension6 {
+public class ChangeCorrectionProposal extends ChangeCorrectionProposalCore implements IJavaCompletionProposal, ICommandAccess, ICompletionProposalExtension5, ICompletionProposalExtension6 {
private static final NullChange COMPUTING_CHANGE= new NullChange("ChangeCorrectionProposal computing..."); //$NON-NLS-1$
- private Change fChange;
- private String fName;
- private int fRelevance;
private Image fImage;
private String fCommandId;
@@ -87,12 +86,7 @@
* is desired
*/
public ChangeCorrectionProposal(String name, Change change, int relevance, Image image) {
- if (name == null) {
- throw new IllegalArgumentException("Name must not be null"); //$NON-NLS-1$
- }
- fName= name;
- fChange= change;
- fRelevance= relevance;
+ super(name, change, relevance);
fImage= image;
fCommandId= null;
}
@@ -228,33 +222,6 @@
}
/*
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension5#getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
- StringBuilder buf= new StringBuilder();
- buf.append("