Eclipse 4.8 support
diff --git a/org.eclipse.ajdt.core.tests/src/org/eclipse/ajdt/core/tests/search/AbstractITDSearchTest.java b/org.eclipse.ajdt.core.tests/src/org/eclipse/ajdt/core/tests/search/AbstractITDSearchTest.java
index 8669fdb..922a2f0 100644
--- a/org.eclipse.ajdt.core.tests/src/org/eclipse/ajdt/core/tests/search/AbstractITDSearchTest.java
+++ b/org.eclipse.ajdt.core.tests/src/org/eclipse/ajdt/core/tests/search/AbstractITDSearchTest.java
@@ -47,7 +47,8 @@
public class AbstractITDSearchTest extends AJDTCoreTestCase {
class ITDAwareSearchRequestor extends SearchRequestor {
List<SearchMatch> matches = new ArrayList<SearchMatch>();
- public void acceptSearchMatch(SearchMatch match) throws CoreException {
+ @Override
+ public void acceptSearchMatch(SearchMatch match) throws CoreException {
// order matches by offset
for (int i = 0; i < matches.size(); i++) {
if (matches.get(i).getOffset() > match.getOffset()) {
@@ -65,7 +66,8 @@
public IJavaProject javaProject;
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
super.setUp();
javaProject = JavaCore.create(createPredefinedProject("DefaultEmptyProject"));
}
@@ -111,7 +113,7 @@
AspectJCoreTestPlugin.logInfo("About to create Search pattern in " + name);
SearchPattern pattern = SearchPattern.createPattern(elt, flags);
SearchEngine engine = new SearchEngine();
- JavaSearchScope scope = new JavaSearchScope();
+ JavaSearchScope scope = new JavaSearchScope(false);
scope.add(javaProject);
AspectJCoreTestPlugin.logInfo("About to perform search in " + name);
@@ -136,7 +138,7 @@
private String printMatches(List<SearchMatch> matches) {
StringBuffer sb = new StringBuffer();
for (Iterator<SearchMatch> matchIter = matches.iterator(); matchIter.hasNext();) {
- SearchMatch match = (SearchMatch) matchIter.next();
+ SearchMatch match = matchIter.next();
sb.append("\n\n" + match);
}
@@ -171,7 +173,7 @@
assertEquals("Wrong match location", contents.indexOf(matchName), match.getOffset());
assertEquals("Wrong match length", matchName.length(), match.getLength());
- match = (SearchMatch) matches.get(1);
+ match = matches.get(1);
assertEquals("Wrong match location", contents.lastIndexOf(matchName), match.getOffset());
assertEquals("Wrong match length", matchName.length(), match.getLength());
@@ -183,7 +185,7 @@
protected void assertDeclarationMatches(IMember declaration, List<SearchMatch> matches) throws JavaModelException {
boolean found = false;
for (Iterator<SearchMatch> searchIter = matches.iterator(); searchIter.hasNext();) {
- SearchMatch match = (SearchMatch) searchIter.next();
+ SearchMatch match = searchIter.next();
if (match.getElement().equals(declaration)) {
found = true;
assertDeclarationMatch(declaration, match);
diff --git a/org.eclipse.ajdt.core/src/org/eclipse/ajdt/core/parserbridge/ITDInserter.java b/org.eclipse.ajdt.core/src/org/eclipse/ajdt/core/parserbridge/ITDInserter.java
index 075a4b1..bdd24ec 100644
--- a/org.eclipse.ajdt.core/src/org/eclipse/ajdt/core/parserbridge/ITDInserter.java
+++ b/org.eclipse.ajdt.core/src/org/eclipse/ajdt/core/parserbridge/ITDInserter.java
@@ -18,6 +18,7 @@
import java.util.Map;
import org.aspectj.asm.IProgramElement;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.ajdt.core.AJLog;
import org.eclipse.ajdt.core.model.AJProjectModelFacade;
import org.eclipse.ajdt.core.model.AJProjectModelFactory;
@@ -121,15 +122,18 @@
this.env = env;
}
- public boolean visit(TypeDeclaration type, BlockScope blockScope) {
+ @Override
+ public boolean visit(TypeDeclaration type, BlockScope blockScope) {
augmentType(type);
return false; // no local/anonymous type
}
- public boolean visit(TypeDeclaration type, CompilationUnitScope compilationUnitScope) {
+ @Override
+ public boolean visit(TypeDeclaration type, CompilationUnitScope compilationUnitScope) {
augmentType(type);
return true;
}
- public boolean visit(TypeDeclaration memberType, ClassScope classScope) {
+ @Override
+ public boolean visit(TypeDeclaration memberType, ClassScope classScope) {
augmentType(memberType);
return true;
}
@@ -282,8 +286,8 @@
getParameterBindings(elt, ititAST.binding), new ReferenceBinding[0], ititAST.binding));
}
}
- ititAST.fields = (FieldDeclaration[]) fields.toArray(new FieldDeclaration[0]);
- ititAST.methods = (AbstractMethodDeclaration[]) methods.toArray(new MethodDeclaration[0]);
+ ititAST.fields = fields.toArray(new FieldDeclaration[0]);
+ ititAST.methods = methods.toArray(new MethodDeclaration[0]);
// figure out how to make type bindings and figure out method bindings
@@ -392,7 +396,7 @@
if (sig == null) {
String[] params = new String[method.getParameterTypes().size()];
for (int i = 0; i < params.length; i++) {
- params[i] = new String(Signature.getTypeErasure((char[]) method.getParameterTypes().get(i)));
+ params[i] = new String(Signature.getTypeErasure(method.getParameterTypes().get(i)));
}
sig = new ErasedTypeSignature(method.getCorrespondingTypeSignature(), params);
}
@@ -407,7 +411,7 @@
}
}
for (int i = 0; i < args.length; i++) {
- args[i] = new Argument(((String) pNames.get(i)).toCharArray(),
+ args[i] = new Argument(pNames.get(i).toCharArray(),
0,
createTypeReference(Signature.getElementType(sig.paramTypes[i])),
0);
@@ -428,9 +432,9 @@
}
}
for (int i = 0; i < args.length; i++) {
- args[i] = new Argument(((String) pNames.get(i)).toCharArray(),
+ args[i] = new Argument(pNames.get(i).toCharArray(),
0,
- createTypeReference(new String((char[]) method.getParameterTypes().get(i))),
+ createTypeReference(new String(method.getParameterTypes().get(i))),
0);
}
}
@@ -481,7 +485,7 @@
for (int i = 0; i < args.length; i++) {
args[i] = new Argument(pNames.get(i).toCharArray(),
0,
- createTypeReference(new String((char[]) constructor.getParameterTypes().get(i))),
+ createTypeReference(new String(constructor.getParameterTypes().get(i))),
0);
}
decl.arguments = args;
@@ -509,7 +513,7 @@
newSuper = newSuper.substring(0, genericsIndex);
}
newSuper = newSuper.replace('$', '.');
- return env.askForType(CharOperation.splitOn('.', newSuper.toCharArray()));
+ return env.askForType(CharOperation.splitOn('.', newSuper.toCharArray()),env.getModule(ModuleBinding.ANY));
}
private void addSuperInterfaces(IProgramElement ipe, TypeDeclaration decl) {
diff --git a/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/refactoring/ITDAccessorRenameParticipant.java b/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/refactoring/ITDAccessorRenameParticipant.java
index f3150c5..e0a8f4b 100644
--- a/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/refactoring/ITDAccessorRenameParticipant.java
+++ b/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/refactoring/ITDAccessorRenameParticipant.java
@@ -270,7 +270,7 @@
private List<SearchMatch> findReferences(IMember accessor) {
SearchPattern pattern = SearchPattern.createPattern(accessor, IJavaSearchConstants.REFERENCES);
SearchEngine engine = new SearchEngine();
- JavaSearchScope scope = new JavaSearchScope();
+ JavaSearchScope scope = new JavaSearchScope(false);
try {
scope.add(accessor.getJavaProject());
CollectingSearchRequestor requestor = new CollectingSearchRequestor();
diff --git a/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/search/ExtraITDFinder.java b/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/search/ExtraITDFinder.java
index c00ef70..e052d4b 100644
--- a/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/search/ExtraITDFinder.java
+++ b/org.eclipse.ajdt.core/src/org/eclipse/ajdt/internal/core/search/ExtraITDFinder.java
@@ -25,6 +25,7 @@
import org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit;
import org.aspectj.org.eclipse.jdt.core.dom.InterTypeFieldDeclaration;
import org.aspectj.org.eclipse.jdt.core.dom.InterTypeMethodDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
import org.eclipse.ajdt.core.ReflectionUtils;
import org.eclipse.ajdt.core.javaelements.AJCompilationUnit;
import org.eclipse.ajdt.core.javaelements.AspectElement;
@@ -48,7 +49,6 @@
import org.eclipse.jdt.internal.core.search.matching.FieldPattern;
import org.eclipse.jdt.internal.core.search.matching.MethodPattern;
import org.eclipse.jdt.internal.core.search.matching.PossibleMatch;
-import org.eclipse.jdt.internal.core.search.matching.TypeReferencePattern;
import org.eclipse.jdt.internal.core.search.matching.VariablePattern;
/**
@@ -249,9 +249,9 @@
return true;
}
if (resolver != null) {
+ LookupEnvironment env = ((LookupEnvironment) ReflectionUtils.getPrivateField(HierarchyResolver.class, "lookupEnvironment", resolver));
ReferenceBinding targetBinding =
- ((LookupEnvironment) ReflectionUtils.getPrivateField(HierarchyResolver.class, "lookupEnvironment", resolver)).
- askForType(CharOperation.splitOn('.', itdTargetTypeName));
+ env.askForType(CharOperation.splitOn('.', itdTargetTypeName),env.getModule(ModuleBinding.ANY));
if (targetBinding != null) {
return resolver.subOrSuperOfFocus(targetBinding);
}
diff --git a/org.eclipse.ajdt.releng/config46.ini b/org.eclipse.ajdt.releng/config46.ini
new file mode 100644
index 0000000..ea5ee7c
--- /dev/null
+++ b/org.eclipse.ajdt.releng/config46.ini
@@ -0,0 +1,16 @@
+# Equinox Aspects
+#osgi.bundles=org.aspectj.runtime@2:start,org.aspectj.weaver@2:start,reference\:file\:org.eclipse.equinox.weaving.aspectj_1.0.400.201604052120.jar@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+# this one works:
+# osgi.bundles=reference\:file\:org.eclipse.equinox.weaving.aspectj_1.0.400.201604052120.jar@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+# This one works:
+osgi.bundles=org.eclipse.equinox.weaving.aspectj@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20160504-1450.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+#osgi.bundles=reference\:file\:org.eclipse.equinox.weaving.aspectj@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
+#osgi.framework.extensions=reference\:file\:/Users/aclement/eclipses/e44m7/eclipse/plugins/org.eclipse.equinox.weaving.hook_1.1.0.I20140501-0200.jar
+#osgi.framework.extensions=reference\:file\:/Users/aclement/eclipses/e44/eclipse/plugins/org.eclipse.equinox.weaving.hook_1.1.100.weaving-hook-20140821.jar
+#osgi.framework.extensions=reference\:file\:/Users/aclement/eclipses/sts380_b199/sts-bundle/STS.app/Contents/Eclipse/plugins/org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar
+osgi.framework.extensions=org.eclipse.equinox.weaving.hook
+weaving.service.enabled=TRUE
+aj.weaving.verbose=true
+org.aspectj.weaver.showWeaveInfo=true
+org.aspectj.osgi.verbose=true
diff --git a/org.eclipse.ajdt.releng/config47.ini b/org.eclipse.ajdt.releng/config47.ini
new file mode 100644
index 0000000..bf15c2d
--- /dev/null
+++ b/org.eclipse.ajdt.releng/config47.ini
@@ -0,0 +1,16 @@
+# Equinox Aspects
+#osgi.bundles=org.aspectj.runtime@2:start,org.aspectj.weaver@2:start,reference\:file\:org.eclipse.equinox.weaving.aspectj_1.0.400.201604052120.jar@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+# this one works:
+# osgi.bundles=reference\:file\:org.eclipse.equinox.weaving.aspectj_1.0.400.201604052120.jar@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+# This one works:
+osgi.bundles=org.eclipse.equinox.weaving.aspectj@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.2.0.v20160929-1449.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.2.0.v20170110-1705.jar@1\:start
+#osgi.bundles=reference\:file\:org.eclipse.equinox.weaving.aspectj@2:start,reference\:file\:org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar@4,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.1.200.v20160504-1450.jar@1\:start
+org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
+#osgi.framework.extensions=reference\:file\:/Users/aclement/eclipses/e44m7/eclipse/plugins/org.eclipse.equinox.weaving.hook_1.1.0.I20140501-0200.jar
+#osgi.framework.extensions=reference\:file\:/Users/aclement/eclipses/e44/eclipse/plugins/org.eclipse.equinox.weaving.hook_1.1.100.weaving-hook-20140821.jar
+#osgi.framework.extensions=reference\:file\:/Users/aclement/eclipses/sts380_b199/sts-bundle/STS.app/Contents/Eclipse/plugins/org.eclipse.equinox.weaving.hook_1.1.200.v20150730-1648.jar
+osgi.framework.extensions=org.eclipse.equinox.weaving.hook
+weaving.service.enabled=TRUE
+aj.weaving.verbose=true
+org.aspectj.weaver.showWeaveInfo=true
+org.aspectj.osgi.verbose=true
diff --git a/org.eclipse.ajdt.ui/jdt-src/org/eclipse/ajdt/internal/ui/wizards/NewTypeWizardPage.java b/org.eclipse.ajdt.ui/jdt-src/org/eclipse/ajdt/internal/ui/wizards/NewTypeWizardPage.java
index 4b7f7dc..e87018d 100644
--- a/org.eclipse.ajdt.ui/jdt-src/org/eclipse/ajdt/internal/ui/wizards/NewTypeWizardPage.java
+++ b/org.eclipse.ajdt.ui/jdt-src/org/eclipse/ajdt/internal/ui/wizards/NewTypeWizardPage.java
@@ -71,7 +71,6 @@
import org.eclipse.jdt.internal.corext.dom.TokenScanner;
import org.eclipse.jdt.internal.corext.refactoring.StubTypeContext;
import org.eclipse.jdt.internal.corext.refactoring.TypeContextChecker;
-import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil;
import org.eclipse.jdt.internal.corext.template.java.JavaContext;
import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil;
import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
@@ -230,7 +229,7 @@
/* package */ void create(boolean needsSave, IProgressMonitor monitor) throws CoreException {
TextEdit edit= fImportsRewrite.rewriteImports(monitor);
- JavaElementUtil.applyEdit(fImportsRewrite.getCompilationUnit(), edit, needsSave, null);
+ JavaModelUtil.applyEdit(fImportsRewrite.getCompilationUnit(), edit, needsSave, null);
}
/* package */ void removeImport(String qualifiedName) {
@@ -282,10 +281,12 @@
this.interfaceName= interfaceName;
}
+ @Override
public int hashCode() {
return interfaceName.hashCode();
}
+ @Override
public boolean equals(Object obj) {
return obj != null && getClass().equals(obj.getClass()) && ((InterfaceWrapper) obj).interfaceName.equals(interfaceName);
}
@@ -298,10 +299,12 @@
fInterfaceImage= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_INTERFACE);
}
+ @Override
public String getText(Object element) {
return BasicElementLabels.getJavaElementName(((InterfaceWrapper) element).interfaceName);
}
+ @Override
public Image getImage(Object element) {
return fInterfaceImage;
}
@@ -769,6 +772,7 @@
JavaTypeCompletionProcessor superClassCompletionProcessor= new JavaTypeCompletionProcessor(false, false, true);
superClassCompletionProcessor.setCompletionContextRequestor(new CompletionContextRequestor() {
+ @Override
public StubTypeContext getStubTypeContext() {
return getSuperClassStubTypeContext();
}
@@ -792,7 +796,8 @@
tableViewer.setColumnProperties(new String[] {INTERFACE});
TableTextCellEditor cellEditor= new TableTextCellEditor(tableViewer, 0) {
- protected void doSetFocus() {
+ @Override
+ protected void doSetFocus() {
if (text != null) {
text.setFocus();
text.setSelection(text.getText().length());
@@ -804,6 +809,7 @@
};
JavaTypeCompletionProcessor superInterfaceCompletionProcessor= new JavaTypeCompletionProcessor(false, false, true);
superInterfaceCompletionProcessor.setCompletionContextRequestor(new CompletionContextRequestor() {
+ @Override
public StubTypeContext getStubTypeContext() {
return getSuperInterfacesStubTypeContext();
}
@@ -831,6 +837,7 @@
}
});
tableViewer.getTable().addKeyListener(new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.F2 && event.stateMask == 0) {
ISelection selection= tableViewer.getSelection();
@@ -1018,6 +1025,7 @@
/*
* @see org.eclipse.jdt.ui.wizards.NewContainerWizardPage#handleFieldChanged(String)
*/
+ @Override
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName.equals(CONTAINER)) {
@@ -1349,6 +1357,7 @@
/*
* @see org.eclipse.jdt.ui.wizards.NewContainerWizardPage#containerChanged()
*/
+ @Override
protected IStatus containerChanged() {
IStatus status= super.containerChanged();
IPackageFragmentRoot root= getPackageFragmentRoot();
@@ -2336,6 +2345,7 @@
* @deprecated Instead of file templates, the new type code template
* specifies the stub for a compilation unit.
*/
+ @Deprecated
protected String getFileComment(ICompilationUnit parentCU) {
return null;
}
@@ -2412,6 +2422,7 @@
* @return returns the template or <code>null</code>
* @deprecated Use getTypeComment(ICompilationUnit, String)
*/
+ @Deprecated
protected String getTypeComment(ICompilationUnit parentCU) {
if (StubUtility.doAddComments(parentCU.getJavaProject()))
return getTypeComment(parentCU, StubUtility.getLineDelimiterUsed(parentCU));
@@ -2424,6 +2435,7 @@
* @return returns the template or <code>null</code>
* @deprecated Use getTemplate(String,ICompilationUnit,int)
*/
+ @Deprecated
protected String getTemplate(String name, ICompilationUnit parentCU) {
return getTemplate(name, parentCU, 0);
}
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsAction.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsAction.java
index dd2e7d6..20ff1d5 100755
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsAction.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsAction.java
@@ -38,13 +38,14 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.manipulation.CoreASTProvider;
import org.eclipse.jdt.core.search.TypeNameMatch;
-import org.eclipse.jdt.internal.corext.ValidateEditException;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.util.History;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.corext.util.QualifiedTypeNameHistory;
+import org.eclipse.jdt.internal.corext.util.ValidateEditException;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
@@ -52,7 +53,6 @@
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.browsing.LogicalPackage;
import org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog;
-import org.eclipse.jdt.internal.ui.javaeditor.ASTProvider;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
@@ -174,6 +174,7 @@
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
+ @Override
public void selectionChanged(ITextSelection selection) {
setEnabled(getCompilationUnit(fEditor) != null);
}
@@ -181,6 +182,7 @@
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
+ @Override
public void selectionChanged(IStructuredSelection selection) {
setEnabled(isEnabled(selection));
}
@@ -289,6 +291,7 @@
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
+ @Override
public void run(ITextSelection selection) {
ICompilationUnit cu= getCompilationUnit(fEditor);
if (cu != null) {
@@ -305,6 +308,7 @@
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
+ @Override
public void run(IStructuredSelection selection) {
ICompilationUnit[] cus= getCompilationUnits(selection);
if (cus.length == 0)
@@ -463,14 +467,12 @@
fEditor= (JavaEditor) editor;
}
}
-
- CompilationUnit astRoot= JavaPlugin.getDefault().getASTProvider().getAST(cu, ASTProvider.WAIT_ACTIVE_ONLY, null);
-
+ CompilationUnit astRoot = CoreASTProvider.getInstance().getAST(cu, CoreASTProvider.WAIT_ACTIVE_ONLY, null);
AJOrganizeImportsOperation op= new AJOrganizeImportsOperation(cu, astRoot, settings.importIgnoreLowercase, !cu.isWorkingCopy(), true, createChooseImportQuery());
IRewriteTarget target= null;
if (fEditor != null) {
- target= (IRewriteTarget) fEditor.getAdapter(IRewriteTarget.class);
+ target= fEditor.getAdapter(IRewriteTarget.class);
if (target != null) {
target.beginCompoundChange();
}
@@ -534,6 +536,7 @@
ILabelProvider labelProvider= new TypeNameMatchLabelProvider(TypeNameMatchLabelProvider.SHOW_FULLYQUALIFIED);
MultiElementListSelectionDialog dialog= new MultiElementListSelectionDialog(getShell(), labelProvider) {
+ @Override
protected void handleSelectionChanged() {
super.handleSelectionChanged();
// show choices in editor
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsOperation.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsOperation.java
index 5a3c9cc..f312878 100644
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsOperation.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/actions/AJOrganizeImportsOperation.java
@@ -52,22 +52,21 @@
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.manipulation.ImportReferencesCollector;
+import org.eclipse.jdt.core.manipulation.TypeKinds;
+import org.eclipse.jdt.core.manipulation.TypeNameMatchCollector;
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.TypeNameMatch;
-import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationMessages;
-import org.eclipse.jdt.internal.corext.codemanipulation.ImportReferencesCollector;
+import org.eclipse.jdt.internal.core.manipulation.JavaManipulationMessages;
import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.corext.util.Strings;
-import org.eclipse.jdt.internal.corext.util.TypeNameMatchCollector;
-import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil;
import org.eclipse.jdt.internal.ui.text.correction.ASTResolving;
-import org.eclipse.jdt.internal.ui.text.correction.SimilarElementsRequestor;
import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.text.edits.TextEdit;
@@ -104,7 +103,7 @@
public void addInfo(TypeNameMatch info) {
for (int i= this.foundInfos.size() - 1; i >= 0; i--) {
- TypeNameMatch curr= (TypeNameMatch) this.foundInfos.get(i);
+ TypeNameMatch curr= this.foundInfos.get(i);
if (curr.getTypeContainerName().equals(info.getTypeContainerName())) {
return; // not added. already contains type with same name
}
@@ -255,7 +254,7 @@
for (i= 0; i < typesFound.size(); i++) {
TypeNameMatch curr= typesFound.get(i);
- UnresolvedTypeData data= (UnresolvedTypeData) fUnresolvedTypes.get(curr.getSimpleTypeName());
+ UnresolvedTypeData data= fUnresolvedTypes.get(curr.getSimpleTypeName());
if (data != null && isVisible(curr) && isOfKind(curr, data.typeKinds, is50OrHigher)) {
if (fAllowDefaultPackageImports || curr.getPackageName().length() > 0) {
data.addInfo(curr);
@@ -276,8 +275,8 @@
if (openChoices.isEmpty()) {
return false;
}
- fOpenChoices= (TypeNameMatch[][]) openChoices.toArray(new TypeNameMatch[openChoices.size()][]);
- fSourceRanges= (SourceRange[]) sourceRanges.toArray(new SourceRange[sourceRanges.size()]);
+ fOpenChoices= openChoices.toArray(new TypeNameMatch[openChoices.size()][]);
+ fSourceRanges= sourceRanges.toArray(new SourceRange[sourceRanges.size()]);
return true;
} finally {
monitor.done();
@@ -341,7 +340,7 @@
// nothing found
return null;
} else if (nFound == 1) {
- TypeNameMatch typeRef= (TypeNameMatch) typeRefsFound.get(0);
+ TypeNameMatch typeRef= typeRefsFound.get(0);
fImpStructure.addImport(typeRef.getFullyQualifiedName());
return null;
} else {
@@ -350,7 +349,7 @@
// multiple found, use old imports to find an entry
for (int i= 0; i < nFound; i++) {
- TypeNameMatch typeRef= (TypeNameMatch) typeRefsFound.get(i);
+ TypeNameMatch typeRef= typeRefsFound.get(i);
String fullName= typeRef.getFullyQualifiedName();
String containerName= typeRef.getTypeContainerName();
if (fOldSingleImports.contains(fullName)) {
@@ -371,22 +370,22 @@
return null;
}
// return the open choices
- return (TypeNameMatch[]) typeRefsFound.toArray(new TypeNameMatch[nFound]);
+ return typeRefsFound.toArray(new TypeNameMatch[nFound]);
}
}
private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
int flags= curr.getModifiers();
if (Flags.isAnnotation(flags)) {
- return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ANNOTATIONS) != 0);
+ return is50OrHigher && ((typeKinds & TypeKinds.ANNOTATIONS) != 0);
}
if (Flags.isEnum(flags)) {
- return is50OrHigher && ((typeKinds & SimilarElementsRequestor.ENUMS) != 0);
+ return is50OrHigher && ((typeKinds & TypeKinds.ENUMS) != 0);
}
if (Flags.isInterface(flags)) {
- return (typeKinds & SimilarElementsRequestor.INTERFACES) != 0;
+ return (typeKinds & TypeKinds.INTERFACES) != 0;
}
- return (typeKinds & SimilarElementsRequestor.CLASSES) != 0;
+ return (typeKinds & TypeKinds.CLASSES) != 0;
}
private boolean isVisible(TypeNameMatch curr) {
@@ -449,7 +448,7 @@
fNumberOfImportsAdded= 0;
fNumberOfImportsRemoved= 0;
- monitor.beginTask(Messages.format(CodeGenerationMessages.OrganizeImportsOperation_description, fCompilationUnit.getElementName()), 10);
+ monitor.beginTask(Messages.format(JavaManipulationMessages.OrganizeImportsOperation_description, fCompilationUnit.getElementName()), 10);
CompilationUnit astRoot= fASTRoot;
if (astRoot == null) {
@@ -497,7 +496,8 @@
}
TextEdit edit= importsRewrite.rewriteImports(new SubProgressMonitor(monitor, 3));
- JavaElementUtil.applyEdit(fCompilationUnit, edit, fDoSave, new SubProgressMonitor(monitor, 1));
+
+ JavaModelUtil.applyEdit(fCompilationUnit, edit, fDoSave, new SubProgressMonitor(monitor, 1));
determineImportDifferences(importsRewrite, oldSingleImports, oldDemandImports);
processor= null;
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/outline/AJOutlineInformationControl.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/outline/AJOutlineInformationControl.java
index adeda06..be1ed81 100755
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/outline/AJOutlineInformationControl.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/outline/AJOutlineInformationControl.java
@@ -50,6 +50,9 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.bindings.TriggerSequence;
+import org.eclipse.jface.bindings.keys.KeySequence;
+import org.eclipse.jface.bindings.keys.SWTKeySupport;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -70,8 +73,6 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.keys.KeySequence;
-import org.eclipse.ui.keys.SWTKeySupport;
// Copied from org.eclipse.jdt.internal.ui.text.JavaOutlineInformationControl
// to allow use of a decorating label provider which will make use of our registered
@@ -119,6 +120,7 @@
/*
* @see ILabelProvider#getText
*/
+ @Override
public String getText(Object element) {
String text= super.getText(element);
if (fShowDefiningType) {
@@ -139,6 +141,7 @@
/*
* @see org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider#getForeground(java.lang.Object)
*/
+ @Override
public Color getForeground(Object element) {
if (fOutlineContentProvider.isShowingInheritedMembers()) {
if (element instanceof IJavaElement) {
@@ -228,6 +231,7 @@
/**
* {@inheritDoc}
*/
+ @Override
protected Object[] getFilteredChildren(Object parent) {
Object[] result = getRawChildren(parent);
int unfilteredChildren= result.length;
@@ -243,6 +247,7 @@
/**
* {@inheritDoc}
*/
+ @Override
protected void internalExpandToLevel(Widget node, int level) {
if (!fIsFiltering && node instanceof Item) {
Item i= (Item) node;
@@ -312,6 +317,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Object[] getChildren(Object element) {
// AspectJ Change begin
if (element instanceof ICompilationUnit) {
@@ -350,6 +356,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
super.inputChanged(viewer, oldInput, newInput);
fTypeHierarchies.clear();
@@ -358,6 +365,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void dispose() {
super.dispose();
fTypeHierarchies.clear();
@@ -417,6 +425,7 @@
/*
* @see org.eclipse.jface.action.Action#run()
*/
+ @Override
public void run() {
setTopLevelTypeOnly(!fShowOnlyMainType);
}
@@ -449,6 +458,7 @@
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#getHierarchy(org.eclipse.jdt.core.IType)
*/
+ @Override
protected ITypeHierarchy getHierarchy(IType type) {
return getSuperTypeHierarchy(type);
}
@@ -456,6 +466,7 @@
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#isSortByDefiningType()
*/
+ @Override
public boolean isSortByDefiningType() {
return fSortByDefiningTypeAction.isChecked();
}
@@ -463,6 +474,7 @@
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#isSortAlphabetically()
*/
+ @Override
public boolean isSortAlphabetically() {
return fLexicalSortingAction.isChecked();
}
@@ -489,6 +501,7 @@
AspectJUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.LEXICAL_SORTING_BROWSING_ACTION);
}
+ @Override
public void run() {
valueChanged(isChecked(), true);
}
@@ -537,6 +550,7 @@
/*
* @see Action#actionPerformed
*/
+ @Override
public void run() {
BusyIndicator.showWhile(fOutlineViewer.getControl().getDisplay(), new Runnable() {
public void run() {
@@ -574,6 +588,7 @@
/**
* {@inheritDoc}
*/
+ @Override
protected Text createFilterText(Composite parent) {
Text text= super.createFilterText(parent);
text.addKeyListener(getKeyAdapter());
@@ -583,6 +598,7 @@
/**
* {@inheritDoc}
*/
+ @Override
protected TreeViewer createTreeViewer(Composite parent, int style) {
Tree tree= new Tree(parent, SWT.SINGLE | (style & ~SWT.MULTI));
GridData gd= new GridData(GridData.FILL_BOTH);
@@ -627,8 +643,9 @@
/**
* {@inheritDoc}
*/
+ @Override
protected String getStatusFieldText() {
- KeySequence[] sequences= getInvokingCommandKeySequences();
+ TriggerSequence[] sequences= getInvokingCommandKeySequences();
if (sequences == null || sequences.length == 0)
return ""; //$NON-NLS-1$
@@ -644,6 +661,7 @@
* @see org.eclipse.jdt.internal.ui.text.AbstractInformationControl#getId()
* @since 3.0
*/
+ @Override
protected String getId() {
return "org.eclipse.jdt.internal.ui.text.QuickOutline"; //$NON-NLS-1$
}
@@ -651,6 +669,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setInput(Object information) {
if (information == null || information instanceof String) {
inputChanged(null, null);
@@ -669,10 +688,14 @@
private KeyAdapter getKeyAdapter() {
if (fKeyAdapter == null) {
fKeyAdapter= new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent e) {
int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
KeySequence keySequence = KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator));
- KeySequence[] sequences= getInvokingCommandKeySequences();
+ TriggerSequence[] sequences = getInvokingCommandKeySequences();
+// int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
+// KeySequence keySequence = KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator));
+// KeySequence[] sequences= getInvokingCommandKeySequences();
if (sequences == null)
return;
for (int i= 0; i < sequences.length; i++) {
@@ -709,6 +732,7 @@
/*
* @see org.eclipse.jdt.internal.ui.text.AbstractInformationControl#fillViewMenu(org.eclipse.jface.action.IMenuManager)
*/
+ @Override
protected void fillViewMenu(IMenuManager viewMenu) {
super.fillViewMenu(viewMenu);
viewMenu.add(fShowOnlyMainTypeAction);
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/JavaCorrectionAssistant.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/JavaCorrectionAssistant.java
index bc806a7..fd65992 100755
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/JavaCorrectionAssistant.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/JavaCorrectionAssistant.java
@@ -17,10 +17,10 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.manipulation.CoreASTProvider;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.text.correction.QuickAssistLightBulbUpdater;
import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.SharedASTProvider;
import org.eclipse.jdt.ui.text.IColorManager;
import org.eclipse.jdt.ui.text.JavaTextTools;
import org.eclipse.jface.internal.text.html.HTMLTextPresenter;
@@ -110,6 +110,7 @@
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistant#install(org.eclipse.jface.text.ITextViewer)
*/
+ @Override
public void install(ISourceViewer sourceViewer) {
super.install(sourceViewer);
fViewer= sourceViewer;
@@ -123,6 +124,7 @@
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.ContentAssistant#uninstall()
*/
+ @Override
public void uninstall() {
if (fLightBulbUpdater != null) {
fLightBulbUpdater.uninstall();
@@ -145,6 +147,7 @@
*
* @see IQuickAssistAssistant#showPossibleQuickAssists()
*/
+ @Override
public String showPossibleQuickAssists() {
fPosition= null;
fCurrentAnnotations= null;
@@ -246,7 +249,7 @@
private static void ensureUpdatedAnnotations(ITextEditor editor) {
Object inputElement= editor.getEditorInput().getAdapter(IJavaElement.class);
if (inputElement instanceof ICompilationUnit) {
- JavaPlugin.getDefault().getASTProvider().getAST((ICompilationUnit) inputElement, SharedASTProvider.WAIT_ACTIVE_ONLY, null);
+ CoreASTProvider.getInstance().getAST((ICompilationUnit) inputElement, CoreASTProvider.WAIT_ACTIVE_ONLY, null);
}
}
@@ -302,6 +305,7 @@
/*
* @see org.eclipse.jface.text.contentassist.ContentAssistant#possibleCompletionsClosed()
*/
+ @Override
protected void possibleCompletionsClosed() {
super.possibleCompletionsClosed();
restorePosition();
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/UnresolvedElementsSubProcessor.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/UnresolvedElementsSubProcessor.java
index 27e685a..2393b25 100755
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/UnresolvedElementsSubProcessor.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/editor/quickfix/UnresolvedElementsSubProcessor.java
@@ -66,6 +66,7 @@
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.manipulation.TypeKinds;
import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.jdt.internal.corext.dom.ASTNodeFactory;
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
@@ -153,7 +154,7 @@
ASTNode parent= node.getParent();
StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
if (locationInParent == MethodInvocation.EXPRESSION_PROPERTY) {
- typeKind= SimilarElementsRequestor.CLASSES;
+ typeKind = TypeKinds.CLASSES;
} else if (locationInParent == FieldAccess.NAME_PROPERTY) {
Expression expression= ((FieldAccess) parent).getExpression();
if (expression != null) {
@@ -164,20 +165,20 @@
}
} else if (parent instanceof SimpleType) {
suggestVariableProposals= false;
- typeKind= SimilarElementsRequestor.REF_TYPES;
+ typeKind= TypeKinds.REF_TYPES;
} else if (parent instanceof QualifiedName) {
Name qualifier= ((QualifiedName) parent).getQualifier();
if (qualifier != node) {
binding= qualifier.resolveTypeBinding();
} else {
- typeKind= SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES;
+ typeKind= TypeKinds.REF_TYPES & ~TypeKinds.VARIABLES;
}
ASTNode outerParent= parent.getParent();
while (outerParent instanceof QualifiedName) {
outerParent= outerParent.getParent();
}
if (outerParent instanceof SimpleType) {
- typeKind= SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES;
+ typeKind= TypeKinds.REF_TYPES & ~TypeKinds.VARIABLES;
suggestVariableProposals= false;
}
} else if (locationInParent == SwitchCase.EXPRESSION_PROPERTY) {
@@ -197,11 +198,11 @@
binding= qualifierBinding;
} else {
node= qualifierName.getQualifier();
- typeKind= SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES;
+ typeKind= TypeKinds.REF_TYPES & ~TypeKinds.VARIABLES;
suggestVariableProposals= node.isSimpleName();
}
if (selectedNode.getParent() instanceof SimpleType) {
- typeKind= SimilarElementsRequestor.REF_TYPES & ~SimilarElementsRequestor.VARIABLES;
+ typeKind= TypeKinds.REF_TYPES & ~TypeKinds.VARIABLES;
suggestVariableProposals= false;
}
break;
@@ -229,7 +230,7 @@
// add type proposals
if (typeKind != 0) {
if (!JavaModelUtil.is50OrHigher(cu.getJavaProject())) {
- typeKind= typeKind & ~(SimilarElementsRequestor.ANNOTATIONS | SimilarElementsRequestor.ENUMS | SimilarElementsRequestor.VARIABLES);
+ typeKind= typeKind & ~(TypeKinds.ANNOTATIONS | TypeKinds.ENUMS | TypeKinds.VARIABLES);
}
int relevance= Character.isUpperCase(ASTNodes.getSimpleNameIdentifier(node).charAt(0)) ? 5 : -2;
@@ -611,7 +612,7 @@
// add all similar elements
for (int i= 0; i < elements.length; i++) {
SimilarElement elem= elements[i];
- if ((elem.getKind() & SimilarElementsRequestor.ALL_TYPES) != 0) {
+ if ((elem.getKind() & TypeKinds.ALL_TYPES) != 0) {
String fullName= elem.getName();
if (!fullName.equals(resolvedTypeName)) {
proposals.add(createTypeRefChangeProposal(cu, fullName, node, relevance, elements.length));
@@ -737,16 +738,16 @@
|| (enclosingType != null && !enclosingType.isReadOnly() && !enclosingType.getType(typeName).exists())) { // new member type
IJavaElement enclosing= enclosingPackage != null ? (IJavaElement) enclosingPackage : enclosingType;
- if ((kind & SimilarElementsRequestor.CLASSES) != 0) {
+ if ((kind & TypeKinds.CLASSES) != 0) {
proposals.add(new NewCUUsingWizardProposal(cu, node, NewCUUsingWizardProposal.K_CLASS, enclosing, rel+2));
}
- if ((kind & SimilarElementsRequestor.INTERFACES) != 0) {
+ if ((kind & TypeKinds.INTERFACES) != 0) {
proposals.add(new NewCUUsingWizardProposal(cu, node, NewCUUsingWizardProposal.K_INTERFACE, enclosing, rel+1));
}
- if ((kind & SimilarElementsRequestor.ENUMS) != 0) {
+ if ((kind & TypeKinds.ENUMS) != 0) {
proposals.add(new NewCUUsingWizardProposal(cu, node, NewCUUsingWizardProposal.K_ENUM, enclosing, rel));
}
- if (kind == SimilarElementsRequestor.ANNOTATIONS) { // only when in annotation
+ if (kind == TypeKinds.ANNOTATIONS) { // only when in annotation
proposals.add(new NewCUUsingWizardProposal(cu, node, NewCUUsingWizardProposal.K_ANNOTATION, enclosing, rel+4));
}
}
@@ -755,7 +756,7 @@
} while (node != null);
// type parameter proposals
- if (refNode.isSimpleName() && ((kind & SimilarElementsRequestor.VARIABLES) != 0)) {
+ if (refNode.isSimpleName() && ((kind & TypeKinds.VARIABLES) != 0)) {
CompilationUnit root= (CompilationUnit) refNode.getRoot();
String name= ((SimpleName) refNode).getIdentifier();
BodyDeclaration declaration= ASTResolving.findParentBodyDeclaration(refNode);
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/PushInRefactoring.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/PushInRefactoring.java
index aae4dc6..5017e65 100644
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/PushInRefactoring.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/PushInRefactoring.java
@@ -78,11 +78,11 @@
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
+import org.eclipse.jdt.core.manipulation.ImportReferencesCollector;
import org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner;
import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.internal.core.NameLookup;
import org.eclipse.jdt.internal.core.NameLookup.Answer;
-import org.eclipse.jdt.internal.corext.codemanipulation.ImportReferencesCollector;
import org.eclipse.jface.text.Region;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.ChangeDescriptor;
@@ -132,7 +132,7 @@
// does not handle imports for declare parents
void rewriteImports() throws CoreException {
// first check to see if this unit has been deleted.
- Change change = (Change) allChanges.get(unit);
+ Change change = allChanges.get(unit);
if (! (change instanceof TextFileChange)) {
return;
}
@@ -213,7 +213,7 @@
List<BodyDeclaration> bodyDecls = lastType.bodyDeclarations();
List<Type> extraSimpleNames = new LinkedList<Type>();
for (int i = bodyDecls.size()-1; i >= 0; i--) {
- BodyDeclaration decl = (BodyDeclaration) bodyDecls.get(i);
+ BodyDeclaration decl = bodyDecls.get(i);
if (decl.getNodeType() == ASTNode.FIELD_DECLARATION) {
FieldDeclaration fDecl = (FieldDeclaration) decl;
if (fDecl.fragments().size() == 1) {
@@ -284,7 +284,8 @@
}
- public RefactoringStatus checkFinalConditions(IProgressMonitor monitor)
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor monitor)
throws CoreException, OperationCanceledException {
final RefactoringStatus status = new RefactoringStatus();
try {
@@ -392,13 +393,14 @@
// this requestor performs the real work
ASTRequestor requestors = new ASTRequestor() {
- public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
+ @Override
+ public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
try {
// compute the imports that this itd adds to this unit
PerUnitInformation holder;
if (imports.containsKey(source)) {
- holder = (PerUnitInformation) imports.get(source);
+ holder = imports.get(source);
} else {
holder = new PerUnitInformation(source);
imports.put(source, holder);
@@ -412,7 +414,7 @@
// make the simplifying assumption that the CU that contains the
// ITD does not also contain a target type
// Bug 310020
- if (isCUnitContainingITD(source, (IMember) itdsForUnit.get(0))) {
+ if (isCUnitContainingITD(source, itdsForUnit.get(0))) {
// this is an AJCU.
rewriteAspectType(itdsForUnit, source, ast);
} else {
@@ -470,7 +472,7 @@
parser.setProject(project);
parser.setResolveBindings(true);
Collection<ICompilationUnit> collection= projects.get(project);
- parser.createASTs((ICompilationUnit[]) collection.toArray(
+ parser.createASTs(collection.toArray(
new ICompilationUnit[collection.size()]), new String[0],
requestors, new SubProgressMonitor(subMonitor, 1));
}
@@ -509,7 +511,7 @@
IType parentAspectType = (IType) itd.getParent();
int numRemovals;
if (removalStored.containsKey(parentAspectType)) {
- numRemovals = ((Integer) removalStored.get(parentAspectType)).intValue();
+ numRemovals = removalStored.get(parentAspectType).intValue();
removalStored.put(parentAspectType, new Integer(++numRemovals));
} else {
removalStored.put(parentAspectType, new Integer(1));
@@ -1047,7 +1049,8 @@
return unitToTypes;
}
- public RefactoringStatus checkInitialConditions(IProgressMonitor monitor)
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor monitor)
throws CoreException, OperationCanceledException {
if (monitor == null) {
monitor = new NullProgressMonitor();
@@ -1128,14 +1131,16 @@
}
- public Change createChange(IProgressMonitor monitor) throws CoreException,
+ @Override
+ public Change createChange(IProgressMonitor monitor) throws CoreException,
OperationCanceledException {
monitor.beginTask("Creating change...", 1);
try {
final Collection<Change> changes= allChanges.values();
- CompositeChange change= new CompositeChange(getName(), (Change[]) changes.toArray(new Change[changes.size()])) {
+ CompositeChange change= new CompositeChange(getName(), changes.toArray(new Change[changes.size()])) {
- public ChangeDescriptor getDescriptor() {
+ @Override
+ public ChangeDescriptor getDescriptor() {
return new RefactoringChangeDescriptor(createDescriptor());
}
@@ -1168,7 +1173,8 @@
}
- public String getName() {
+ @Override
+ public String getName() {
return "Push-In";
}
@@ -1206,7 +1212,7 @@
* @throws JavaModelException
*/
private IMember[] getTargets(List<IMember> itds) throws JavaModelException {
- AJProjectModelFacade model = getModel((IJavaElement) itds.get(0));
+ AJProjectModelFacade model = getModel(itds.get(0));
List<IMember> targets = new ArrayList<IMember>();
for (IMember itd : itds) {
@@ -1221,7 +1227,7 @@
targets.add((IMember) elt);
}
}
- return (IMember[]) targets.toArray(new IMember[targets.size()]);
+ return targets.toArray(new IMember[targets.size()]);
}
private boolean isEmptyEdit(TextEdit edit) {
diff --git a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/pullout/PullOutRefactoring.java b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/pullout/PullOutRefactoring.java
index 1e71d41..0156bc7 100644
--- a/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/pullout/PullOutRefactoring.java
+++ b/org.eclipse.ajdt.ui/src/org/eclipse/ajdt/internal/ui/refactoring/pullout/PullOutRefactoring.java
@@ -63,6 +63,7 @@
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.manipulation.ImportReferencesCollector;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
@@ -71,7 +72,6 @@
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.internal.corext.codemanipulation.ImportReferencesCollector;
import org.eclipse.jdt.internal.corext.refactoring.base.JavaStatusContext;
import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
diff --git a/pom.xml b/pom.xml
index 2377f28..78fca22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,21 @@
</profile>
<profile>
+ <id>e48</id>
+ <properties>
+ <platform.version>e48</platform.version>
+ <weaving.hook.version>1.2.0.v20160929-1449</weaving.hook.version>
+ </properties>
+ <repositories>
+ <repository>
+ <id>photon-releases</id>
+ <layout>p2</layout>
+ <url>http://download.eclipse.org/releases/photon/</url>
+ </repository>
+ </repositories>
+ </profile>
+
+ <profile>
<id>os-macosx</id>
<activation>
<os>