Remove redundant type specifications in dltk.ui.
Some small generifications and @see comments dropped too.
Change-Id: I20af54f40b8190c82cae3733e2a1378779fe109e
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs b/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs
index 1a53062..630f45f 100644
--- a/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/core/plugins/org.eclipse.dltk.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,13 +1,111 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java
index 451be0f..2988c2e 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* 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
@@ -38,8 +38,8 @@
* in order not to eagerly load refactoring classes during action
* initialization.
* </p>
- *
- *
+ *
+ *
*/
public final class RefactoringAvailabilityTester {
@@ -52,7 +52,7 @@
}
public static IModelElement[] getScriptElements(final Object[] elements) {
- List<IModelElement> result = new ArrayList<IModelElement>();
+ List<IModelElement> result = new ArrayList<>();
for (int index = 0; index < elements.length; index++) {
if (elements[index] instanceof IModelElement)
result.add((IModelElement) elements[index]);
@@ -61,7 +61,7 @@
}
public static IResource[] getResources(final Object[] elements) {
- List<IResource> result = new ArrayList<IResource>();
+ List<IResource> result = new ArrayList<>();
for (int index = 0; index < elements.length; index++) {
if (elements[index] instanceof IResource)
result.add((IResource) elements[index]);
@@ -225,8 +225,8 @@
return true;
}
- public static boolean isDeleteAvailable(final IStructuredSelection selection)
- throws ModelException {
+ public static boolean isDeleteAvailable(
+ final IStructuredSelection selection) throws ModelException {
if (!selection.isEmpty())
return isDeleteAvailable(selection.toArray());
return false;
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java
index d93ee4a..15cee8e 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java
@@ -40,14 +40,15 @@
fEntryToAdd = entryToAdd;
}
- public AddToBuildpathChange(IScriptProject project, String sourceFolderName) {
- this(project, DLTKCore.newSourceEntry(project.getPath().append(
- sourceFolderName)));
+ public AddToBuildpathChange(IScriptProject project,
+ String sourceFolderName) {
+ this(project, DLTKCore
+ .newSourceEntry(project.getPath().append(sourceFolderName)));
}
/**
* Adds a new project class path entry to the project.
- *
+ *
* @param project
* @param newProjectEntry
* (must be absolute <code>IPath</code>)
@@ -87,20 +88,20 @@
public boolean validateBuildpath() throws ModelException {
IScriptProject scriptProject = getScriptProject();
IBuildpathEntry[] newClasspathEntries = getNewBuildpathEntries();
- return BuildpathEntry.validateBuildpath(scriptProject,
- newClasspathEntries).isOK();
+ return BuildpathEntry
+ .validateBuildpath(scriptProject, newClasspathEntries).isOK();
}
private IBuildpathEntry[] getNewBuildpathEntries() throws ModelException {
IBuildpathEntry[] entries = getScriptProject().getRawBuildpath();
- List<IBuildpathEntry> cp = new ArrayList<IBuildpathEntry>(
- entries.length + 1);
+ List<IBuildpathEntry> cp = new ArrayList<>(entries.length + 1);
cp.addAll(Arrays.asList(entries));
cp.add(fEntryToAdd);
return cp.toArray(new IBuildpathEntry[cp.size()]);
}
- private static IBuildpathEntry createNewBuildpathEntry(int kind, IPath path) {
+ private static IBuildpathEntry createNewBuildpathEntry(int kind,
+ IPath path) {
switch (kind) {
case IBuildpathEntry.BPE_LIBRARY:
return DLTKCore.newLibraryEntry(path);
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java
index 9871f48..5033e8f 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -15,11 +15,12 @@
import org.eclipse.core.runtime.CoreException;
public class RefactoringProcessors {
-
- public static String[] getNatures(IProject[] projects) throws CoreException {
- Set<String> result = new HashSet<String>();
- for (int i= 0; i < projects.length; i++) {
- String[] pns= projects[i].getDescription().getNatureIds();
+
+ public static String[] getNatures(IProject[] projects)
+ throws CoreException {
+ Set<String> result = new HashSet<>();
+ for (int i = 0; i < projects.length; i++) {
+ String[] pns = projects[i].getDescription().getNatureIds();
for (int p = 0; p < pns.length; p++) {
result.add(pns[p]);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java
index c40ac5b..1de29da 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java
@@ -57,26 +57,27 @@
import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+public class RenameScriptFolderProcessor extends ScriptRenameProcessor
+ implements IReferenceUpdating, ITextUpdating, IQualifiedNameUpdating {
-public class RenameScriptFolderProcessor extends ScriptRenameProcessor implements IReferenceUpdating, ITextUpdating, IQualifiedNameUpdating {
-
- private static final String ID_RENAME_PACKAGE= "org.eclipse.dltk.ui.rename.script.folder"; //$NON-NLS-1$
- private static final String ATTRIBUTE_QUALIFIED= "qualified"; //$NON-NLS-1$
- private static final String ATTRIBUTE_REFERENCES= "references"; //$NON-NLS-1$
- private static final String ATTRIBUTE_TEXTUAL_MATCHES= "textual"; //$NON-NLS-1$
- private static final String ATTRIBUTE_PATTERNS= "patterns"; //$NON-NLS-1$
- private static final String ATTRIBUTE_HIERARCHICAL= "hierarchical"; //$NON-NLS-1$
+ private static final String ID_RENAME_PACKAGE = "org.eclipse.dltk.ui.rename.script.folder"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_QUALIFIED = "qualified"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_REFERENCES = "references"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_TEXTUAL_MATCHES = "textual"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_PATTERNS = "patterns"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_HIERARCHICAL = "hierarchical"; //$NON-NLS-1$
private IScriptFolder fPackage;
private TextChangeManager fChangeManager;
static {
if (DLTKCore.DEBUG) {
- System.err.println("TODO: RenameScriptFolderProcessor add import manager supprot code here..."); //$NON-NLS-1$
+ System.err.println(
+ "TODO: RenameScriptFolderProcessor add import manager supprot code here..."); //$NON-NLS-1$
}
}
- //private ImportsManager fImportsManager;
- //private QualifiedNameSearchResult fQualifiedNameSearchResult;
+ // private ImportsManager fImportsManager;
+ // private QualifiedNameSearchResult fQualifiedNameSearchResult;
private boolean fUpdateReferences;
private boolean fUpdateTextualMatches;
@@ -84,18 +85,21 @@
private String fFilePatterns;
private boolean fRenameSubpackages;
- public static final String IDENTIFIER= "org.eclipse.dltk.ui.renamePackageProcessor"; //$NON-NLS-1$
+ public static final String IDENTIFIER = "org.eclipse.dltk.ui.renamePackageProcessor"; //$NON-NLS-1$
/**
* Creates a new rename package processor.
- * @param fragment the package fragment, or <code>null</code> if invoked by scripting
+ *
+ * @param fragment
+ * the package fragment, or <code>null</code> if invoked by
+ * scripting
*/
public RenameScriptFolderProcessor(IScriptFolder fragment) {
- fPackage= fragment;
+ fPackage = fragment;
if (fPackage != null)
setNewElementName(fPackage.getElementName());
- fUpdateReferences= true;
- fUpdateTextualMatches= false;
+ fUpdateReferences = true;
+ fUpdateTextualMatches = false;
fRenameSubpackages = true;
}
@@ -110,7 +114,7 @@
}
@Override
- public String getProcessorName(){
+ public String getProcessorName() {
return RefactoringCoreMessages.RenamePackageRefactoring_name;
}
@@ -121,37 +125,45 @@
@Override
public Object[] getElements() {
- return new Object[] {fPackage};
+ return new Object[] { fPackage };
}
@Override
- protected RenameModifications computeRenameModifications() throws CoreException {
- RenameModifications result= new RenameModifications();
- result.rename(fPackage, new RenameArguments(getNewElementName(), getUpdateReferences()), fRenameSubpackages);
+ protected RenameModifications computeRenameModifications()
+ throws CoreException {
+ RenameModifications result = new RenameModifications();
+ result.rename(fPackage,
+ new RenameArguments(getNewElementName(), getUpdateReferences()),
+ fRenameSubpackages);
return result;
}
@Override
protected IFile[] getChangedFiles() throws CoreException {
- Set<IFile> combined = new HashSet<IFile>();
- combined.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllSourceModules())));
+ Set<IFile> combined = new HashSet<>();
+ combined.addAll(Arrays.asList(
+ ResourceUtil.getFiles(fChangeManager.getAllSourceModules())));
if (fRenameSubpackages) {
- IScriptFolder[] allPackages= ModelElementUtil.getPackageAndSubpackages(fPackage);
- for (int i= 0; i < allPackages.length; i++) {
- combined.addAll(Arrays.asList(ResourceUtil.getFiles(allPackages[i].getSourceModules())));
+ IScriptFolder[] allPackages = ModelElementUtil
+ .getPackageAndSubpackages(fPackage);
+ for (int i = 0; i < allPackages.length; i++) {
+ combined.addAll(Arrays.asList(ResourceUtil
+ .getFiles(allPackages[i].getSourceModules())));
}
} else {
- combined.addAll(Arrays.asList(ResourceUtil.getFiles(fPackage.getSourceModules())));
+ combined.addAll(Arrays.asList(
+ ResourceUtil.getFiles(fPackage.getSourceModules())));
}
if (DLTKCore.DEBUG) {
- System.err.println("TODO: RenameScriptFolderProcessor Add fQualifiedNameSearchResult suppor code"); //$NON-NLS-1$
+ System.err.println(
+ "TODO: RenameScriptFolderProcessor Add fQualifiedNameSearchResult suppor code"); //$NON-NLS-1$
}
-// if (fQualifiedNameSearchResult != null)
-// combined.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles()));
+ // if (fQualifiedNameSearchResult != null)
+ // combined.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles()));
return combined.toArray(new IFile[combined.size()]);
}
- //---- ITextUpdating -------------------------------------------------
+ // ---- ITextUpdating -------------------------------------------------
@Override
public boolean canEnableTextUpdating() {
@@ -165,10 +177,10 @@
@Override
public void setUpdateTextualMatches(boolean update) {
- fUpdateTextualMatches= update;
+ fUpdateTextualMatches = update;
}
- //---- IReferenceUpdating --------------------------------------
+ // ---- IReferenceUpdating --------------------------------------
@Override
public boolean canEnableUpdateReferences() {
@@ -177,15 +189,15 @@
@Override
public void setUpdateReferences(boolean update) {
- fUpdateReferences= update;
+ fUpdateReferences = update;
}
@Override
- public boolean getUpdateReferences(){
+ public boolean getUpdateReferences() {
return fUpdateReferences;
}
- //---- IQualifiedNameUpdating ----------------------------------
+ // ---- IQualifiedNameUpdating ----------------------------------
@Override
public boolean canEnableQualifiedNameUpdating() {
@@ -199,7 +211,7 @@
@Override
public void setUpdateQualifiedNames(boolean update) {
- fUpdateQualifiedNames= update;
+ fUpdateQualifiedNames = update;
}
@Override
@@ -210,10 +222,10 @@
@Override
public void setFilePatterns(String patterns) {
Assert.isNotNull(patterns);
- fFilePatterns= patterns;
+ fFilePatterns = patterns;
}
- //----
+ // ----
public boolean canEnableRenameSubpackages() throws ModelException {
return fPackage.hasSubfolders();
@@ -224,13 +236,13 @@
}
public void setRenameSubpackages(boolean rename) {
- fRenameSubpackages= rename;
+ fRenameSubpackages = rename;
}
- //---- IRenameProcessor ----------------------------------------------
+ // ---- IRenameProcessor ----------------------------------------------
@Override
- public final String getCurrentElementName(){
+ public final String getCurrentElementName() {
return fPackage.getElementName();
}
@@ -243,52 +255,62 @@
public RefactoringStatus checkNewElementName(String newName)
throws CoreException {
Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
- //RefactoringStatus result= Checks.checkPackageName(newName);
+ // RefactoringStatus result= Checks.checkPackageName(newName);
if (DLTKCore.DEBUG) {
- System.err.println("TODO: Add correct package name validation here..."); //$NON-NLS-1$
+ System.err.println(
+ "TODO: Add correct package name validation here..."); //$NON-NLS-1$
}
- //#replace begin
- RefactoringStatus result= new RefactoringStatus();
+ // #replace begin
+ RefactoringStatus result = new RefactoringStatus();
if ("".equals(newName)) //$NON-NLS-1$
- return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name);
- //#end
+ return RefactoringStatus.createFatalErrorStatus(
+ RefactoringCoreMessages.Checks_Choose_name);
+ // #end
if (Checks.isAlreadyNamed(fPackage, newName))
- result.addFatalError(RefactoringCoreMessages.RenamePackageRefactoring_another_name);
+ result.addFatalError(
+ RefactoringCoreMessages.RenamePackageRefactoring_another_name);
result.merge(checkPackageInCurrentRoot(newName));
return result;
}
@Override
- public Object getNewElement(){
- IModelElement parent= fPackage.getParent();
+ public Object getNewElement() {
+ IModelElement parent = fPackage.getParent();
if (!(parent instanceof IProjectFragment))
- return fPackage;//??
+ return fPackage;// ??
- IProjectFragment root= (IProjectFragment)parent;
+ IProjectFragment root = (IProjectFragment) parent;
return root.getScriptFolder(getNewElementName());
}
@Override
- public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException {
return new RefactoringStatus();
}
@Override
- protected RefactoringStatus doCheckFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException {
- try{
+ protected RefactoringStatus doCheckFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException {
+ try {
pm.beginTask("", 23 + (fUpdateQualifiedNames ? 10 : 0)); //$NON-NLS-1$
- pm.setTaskName(RefactoringCoreMessages.RenamePackageRefactoring_checking);
- RefactoringStatus result= new RefactoringStatus();
+ pm.setTaskName(
+ RefactoringCoreMessages.RenamePackageRefactoring_checking);
+ RefactoringStatus result = new RefactoringStatus();
result.merge(checkNewElementName(getNewElementName()));
pm.worked(1);
- //result.merge(checkForMainAndNativeMethods());
+ // result.merge(checkForMainAndNativeMethods());
pm.worked(2);
- if (fPackage.isReadOnly()){
- String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_Packagered_only, fPackage.getElementName());
+ if (fPackage.isReadOnly()) {
+ String message = Messages.format(
+ RefactoringCoreMessages.RenamePackageRefactoring_Packagered_only,
+ fPackage.getElementName());
result.addFatalError(message);
} else if (Resources.isReadOnly(fPackage.getResource())) {
- String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_resource_read_only, fPackage.getElementName());
+ String message = Messages.format(
+ RefactoringCoreMessages.RenamePackageRefactoring_resource_read_only,
+ fPackage.getElementName());
result.addError(message);
}
@@ -296,31 +318,38 @@
if (result.hasFatalError())
return result;
- fChangeManager= new TextChangeManager();
- //fImportsManager= new ImportsManager();
+ fChangeManager = new TextChangeManager();
+ // fImportsManager= new ImportsManager();
- SubProgressMonitor subPm= new SubProgressMonitor(pm, 16);
+ SubProgressMonitor subPm = new SubProgressMonitor(pm, 16);
if (fRenameSubpackages) {
- IScriptFolder[] allSubpackages= ModelElementUtil.getPackageAndSubpackages(fPackage);
+ IScriptFolder[] allSubpackages = ModelElementUtil
+ .getPackageAndSubpackages(fPackage);
subPm.beginTask("", allSubpackages.length); //$NON-NLS-1$
- for (int i= 0; i < allSubpackages.length; i++) {
- new PackageRenamer(allSubpackages[i], this, fChangeManager/*, fImportsManager*/).doRename(new SubProgressMonitor(subPm, 1), result);
+ for (int i = 0; i < allSubpackages.length; i++) {
+ new PackageRenamer(allSubpackages[i], this,
+ fChangeManager/* , fImportsManager */).doRename(
+ new SubProgressMonitor(subPm, 1), result);
}
subPm.done();
} else {
- new PackageRenamer(fPackage, this, fChangeManager/*, fImportsManager*/).doRename(subPm, result);
+ new PackageRenamer(fPackage, this,
+ fChangeManager/* , fImportsManager */).doRename(subPm,
+ result);
}
-// fImportsManager.rewriteImports(fChangeManager, new SubProgressMonitor(pm, 3));
+ // fImportsManager.rewriteImports(fChangeManager, new
+ // SubProgressMonitor(pm, 3));
if (DLTKCore.DEBUG) {
- System.err.println("TODO: Add updating of fUpdateQualifiedNames"); //$NON-NLS-1$
+ System.err
+ .println("TODO: Add updating of fUpdateQualifiedNames"); //$NON-NLS-1$
}
-// if (fUpdateQualifiedNames)
-// computeQualifiedNameMatches(new SubProgressMonitor(pm, 10));
+ // if (fUpdateQualifiedNames)
+ // computeQualifiedNameMatches(new SubProgressMonitor(pm, 10));
return result;
- } finally{
+ } finally {
pm.done();
}
}
@@ -330,15 +359,16 @@
}
/*
- * returns true if the new name is ok if the specified root.
- * if a package fragment with this name exists and has script resources,
- * then the name is not ok.
+ * returns true if the new name is ok if the specified root. if a package
+ * fragment with this name exists and has script resources, then the name is
+ * not ok.
*/
- public static boolean isPackageNameOkInRoot(String newName, IProjectFragment root) throws CoreException {
- IScriptFolder pack= root.getScriptFolder(newName);
- if (! pack.exists())
+ public static boolean isPackageNameOkInRoot(String newName,
+ IProjectFragment root) throws CoreException {
+ IScriptFolder pack = root.getScriptFolder(newName);
+ if (!pack.exists())
return true;
- else if (! pack.hasSubfolders()) //leaves are no good
+ else if (!pack.hasSubfolders()) // leaves are no good
return false;
else if (pack.containsScriptResources())
return false;
@@ -348,71 +378,86 @@
return true;
}
- private RefactoringStatus checkPackageInCurrentRoot(String newName) throws CoreException {
+ private RefactoringStatus checkPackageInCurrentRoot(String newName)
+ throws CoreException {
if (isPackageNameOkInRoot(newName, getProjectFragment()))
return null;
else
- return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenamePackageRefactoring_package_exists);
+ return RefactoringStatus.createFatalErrorStatus(
+ RefactoringCoreMessages.RenamePackageRefactoring_package_exists);
}
private IProjectFragment getProjectFragment() {
- return ((IProjectFragment)fPackage.getParent());
+ return ((IProjectFragment) fPackage.getParent());
}
- private RefactoringStatus checkPackageName(String newName) throws CoreException {
- RefactoringStatus status= new RefactoringStatus();
- IProjectFragment[] roots= fPackage.getScriptProject().getProjectFragments();
- Set topLevelTypeNames= getTopLevelTypeNames();
- for (int i= 0; i < roots.length; i++) {
- if (! isPackageNameOkInRoot(newName, roots[i])){
- String message= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_aleady_exists, new Object[]{getNewElementName(), roots[i].getElementName()});
+ private RefactoringStatus checkPackageName(String newName)
+ throws CoreException {
+ RefactoringStatus status = new RefactoringStatus();
+ IProjectFragment[] roots = fPackage.getScriptProject()
+ .getProjectFragments();
+ Set topLevelTypeNames = getTopLevelTypeNames();
+ for (int i = 0; i < roots.length; i++) {
+ if (!isPackageNameOkInRoot(newName, roots[i])) {
+ String message = Messages.format(
+ RefactoringCoreMessages.RenamePackageRefactoring_aleady_exists,
+ new Object[] { getNewElementName(),
+ roots[i].getElementName() });
status.merge(RefactoringStatus.createWarningStatus(message));
- status.merge(checkTypeNameConflicts(roots[i], newName, topLevelTypeNames));
+ status.merge(checkTypeNameConflicts(roots[i], newName,
+ topLevelTypeNames));
}
}
return status;
}
private Set getTopLevelTypeNames() throws CoreException {
- ISourceModule[] cus= fPackage.getSourceModules();
- Set result= new HashSet(2 * cus.length);
- for (int i= 0; i < cus.length; i++) {
+ ISourceModule[] cus = fPackage.getSourceModules();
+ Set result = new HashSet(2 * cus.length);
+ for (int i = 0; i < cus.length; i++) {
result.addAll(getTopLevelTypeNames(cus[i]));
}
return result;
}
- private static Collection getTopLevelTypeNames(ISourceModule iSourceModule) throws CoreException {
- IType[] types= iSourceModule.getTypes();
- List result= new ArrayList(types.length);
- for (int i= 0; i < types.length; i++) {
+ private static Collection getTopLevelTypeNames(ISourceModule iSourceModule)
+ throws CoreException {
+ IType[] types = iSourceModule.getTypes();
+ List result = new ArrayList(types.length);
+ for (int i = 0; i < types.length; i++) {
result.add(types[i].getElementName());
}
return result;
}
- private RefactoringStatus checkTypeNameConflicts(IProjectFragment root, String newName, Set topLevelTypeNames) throws CoreException {
- IScriptFolder otherPack= root.getScriptFolder(newName);
+ private RefactoringStatus checkTypeNameConflicts(IProjectFragment root,
+ String newName, Set topLevelTypeNames) throws CoreException {
+ IScriptFolder otherPack = root.getScriptFolder(newName);
if (fPackage.equals(otherPack))
return null;
- ISourceModule[] cus= otherPack.getSourceModules();
- RefactoringStatus result= new RefactoringStatus();
- for (int i= 0; i < cus.length; i++) {
+ ISourceModule[] cus = otherPack.getSourceModules();
+ RefactoringStatus result = new RefactoringStatus();
+ for (int i = 0; i < cus.length; i++) {
result.merge(checkTypeNameConflicts(cus[i], topLevelTypeNames));
}
return result;
}
- private RefactoringStatus checkTypeNameConflicts(ISourceModule iSourceModule, Set topLevelTypeNames) throws CoreException {
- RefactoringStatus result= new RefactoringStatus();
- IType[] types= iSourceModule.getTypes();
- String packageName= iSourceModule.getParent().getElementName();
- for (int i= 0; i < types.length; i++) {
- String name= types[i].getElementName();
- if (topLevelTypeNames.contains(name)){
- String[] keys= {packageName, name};
- String msg= Messages.format(RefactoringCoreMessages.RenamePackageRefactoring_contains_type, keys);
- RefactoringStatusContext context= ScriptStatusContext.create(types[i]);
+ private RefactoringStatus checkTypeNameConflicts(
+ ISourceModule iSourceModule, Set topLevelTypeNames)
+ throws CoreException {
+ RefactoringStatus result = new RefactoringStatus();
+ IType[] types = iSourceModule.getTypes();
+ String packageName = iSourceModule.getParent().getElementName();
+ for (int i = 0; i < types.length; i++) {
+ String name = types[i].getElementName();
+ if (topLevelTypeNames.contains(name)) {
+ String[] keys = { packageName, name };
+ String msg = Messages.format(
+ RefactoringCoreMessages.RenamePackageRefactoring_contains_type,
+ keys);
+ RefactoringStatusContext context = ScriptStatusContext
+ .create(types[i]);
result.addError(msg, context);
}
}
@@ -422,99 +467,156 @@
@Override
public Change createChange(IProgressMonitor monitor) throws CoreException {
try {
- monitor.beginTask(RefactoringCoreMessages.RenamePackageRefactoring_creating_change, 1);
- final Map arguments= new HashMap();
- String project= null;
- IScriptProject scriptProject= fPackage.getScriptProject();
+ monitor.beginTask(
+ RefactoringCoreMessages.RenamePackageRefactoring_creating_change,
+ 1);
+ final Map arguments = new HashMap();
+ String project = null;
+ IScriptProject scriptProject = fPackage.getScriptProject();
if (scriptProject != null)
- project= scriptProject.getElementName();
- final int flags= ScriptRefactoringDescriptor.ARCHIVE_IMPORTABLE | ScriptRefactoringDescriptor.ARCHIVE_REFACTORABLE | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
- final String description= Messages.format(RefactoringCoreMessages.RenamePackageProcessor_descriptor_description_short, fPackage.getElementName());
- final String header= Messages.format(RefactoringCoreMessages.RenamePackageProcessor_descriptor_description, new String[] { fPackage.getElementName(), getNewElementName()});
- final ScriptRefactoringDescriptorComment comment= new ScriptRefactoringDescriptorComment(this, header);
+ project = scriptProject.getElementName();
+ final int flags = ScriptRefactoringDescriptor.ARCHIVE_IMPORTABLE
+ | ScriptRefactoringDescriptor.ARCHIVE_REFACTORABLE
+ | RefactoringDescriptor.STRUCTURAL_CHANGE
+ | RefactoringDescriptor.MULTI_CHANGE;
+ final String description = Messages.format(
+ RefactoringCoreMessages.RenamePackageProcessor_descriptor_description_short,
+ fPackage.getElementName());
+ final String header = Messages.format(
+ RefactoringCoreMessages.RenamePackageProcessor_descriptor_description,
+ new String[] { fPackage.getElementName(),
+ getNewElementName() });
+ final ScriptRefactoringDescriptorComment comment = new ScriptRefactoringDescriptorComment(
+ this, header);
if (fRenameSubpackages)
- comment.addSetting(RefactoringCoreMessages.RenamePackageProcessor_rename_subpackages);
- final ScriptRefactoringDescriptor descriptor= new ScriptRefactoringDescriptor(ID_RENAME_PACKAGE, project, description, comment.asString(), arguments, flags);
- arguments.put(ScriptRefactoringDescriptor.ATTRIBUTE_INPUT, descriptor.elementToHandle(fPackage));
- arguments.put(ScriptRefactoringDescriptor.ATTRIBUTE_NAME, getNewElementName());
+ comment.addSetting(
+ RefactoringCoreMessages.RenamePackageProcessor_rename_subpackages);
+ final ScriptRefactoringDescriptor descriptor = new ScriptRefactoringDescriptor(
+ ID_RENAME_PACKAGE, project, description, comment.asString(),
+ arguments, flags);
+ arguments.put(ScriptRefactoringDescriptor.ATTRIBUTE_INPUT,
+ descriptor.elementToHandle(fPackage));
+ arguments.put(ScriptRefactoringDescriptor.ATTRIBUTE_NAME,
+ getNewElementName());
if (fFilePatterns != null && !"".equals(fFilePatterns)) //$NON-NLS-1$
arguments.put(ATTRIBUTE_PATTERNS, fFilePatterns);
- arguments.put(ATTRIBUTE_REFERENCES, Boolean.valueOf(fUpdateReferences).toString());
- arguments.put(ATTRIBUTE_QUALIFIED, Boolean.valueOf(fUpdateQualifiedNames).toString());
- arguments.put(ATTRIBUTE_TEXTUAL_MATCHES, Boolean.valueOf(fUpdateTextualMatches).toString());
- arguments.put(ATTRIBUTE_HIERARCHICAL, Boolean.valueOf(fRenameSubpackages).toString());
- final DynamicValidationRefactoringChange result= new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.RenamePackageRefactoring_change_name);
+ arguments.put(ATTRIBUTE_REFERENCES,
+ Boolean.valueOf(fUpdateReferences).toString());
+ arguments.put(ATTRIBUTE_QUALIFIED,
+ Boolean.valueOf(fUpdateQualifiedNames).toString());
+ arguments.put(ATTRIBUTE_TEXTUAL_MATCHES,
+ Boolean.valueOf(fUpdateTextualMatches).toString());
+ arguments.put(ATTRIBUTE_HIERARCHICAL,
+ Boolean.valueOf(fRenameSubpackages).toString());
+ final DynamicValidationRefactoringChange result = new DynamicValidationRefactoringChange(
+ descriptor,
+ RefactoringCoreMessages.RenamePackageRefactoring_change_name);
result.addAll(fChangeManager.getAllChanges());
- result.add(new RenameScriptFolderChange(null, fPackage, getNewElementName(), comment.asString(), fRenameSubpackages));
+ result.add(new RenameScriptFolderChange(null, fPackage,
+ getNewElementName(), comment.asString(),
+ fRenameSubpackages));
monitor.worked(1);
return result;
} finally {
- fChangeManager= null;
- //fImportsManager= null;
+ fChangeManager = null;
+ // fImportsManager= null;
monitor.done();
}
}
@Override
- public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException {
-// if (fQualifiedNameSearchResult != null) {
-// try {
-// return fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges));
-// } finally {
-// fQualifiedNameSearchResult= null;
-// }
-// } else {
- return null;
-// }
+ public Change postCreateChange(Change[] participantChanges,
+ IProgressMonitor pm) throws CoreException {
+ // if (fQualifiedNameSearchResult != null) {
+ // try {
+ // return
+ // fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges));
+ // } finally {
+ // fQualifiedNameSearchResult= null;
+ // }
+ // } else {
+ return null;
+ // }
}
public String getNewPackageName(String oldSubPackageName) {
- String oldPackageName= getPackage().getElementName();
- return getNewElementName() + oldSubPackageName.substring(oldPackageName.length());
+ String oldPackageName = getPackage().getElementName();
+ return getNewElementName()
+ + oldSubPackageName.substring(oldPackageName.length());
}
private static class PackageRenamer {
private final IScriptFolder fPackage;
private final RenameScriptFolderProcessor fProcessor;
-// private final TextChangeManager fTextChangeManager;
- //private final ImportsManager fImportsManager;
+ // private final TextChangeManager fTextChangeManager;
+ // private final ImportsManager fImportsManager;
- /** references to fPackage (can include star imports which also import namesake package fragments) */
- //private SearchResultGroup[] fOccurrences;
+ /**
+ * references to fPackage (can include star imports which also import
+ * namesake package fragments)
+ */
+ // private SearchResultGroup[] fOccurrences;
- /** References in CUs from fOccurrences and fPackage to types in namesake packages.
- * <p>These need an import with the old package name.
- * <p>- from fOccurrences (without namesakes): may have shared star import
- * (star-import not updated here, but for fOccurrences)
- * <p>- from fPackage: may have unimported references to types of namesake packages
- * <p>- both: may have unused imports of namesake packages.
- * <p>Mutable List of SearchResultGroup. */
- //private List fReferencesToTypesInNamesakes;
+ /**
+ * References in CUs from fOccurrences and fPackage to types in namesake
+ * packages.
+ * <p>
+ * These need an import with the old package name.
+ * <p>
+ * - from fOccurrences (without namesakes): may have shared star import
+ * (star-import not updated here, but for fOccurrences)
+ * <p>
+ * - from fPackage: may have unimported references to types of namesake
+ * packages
+ * <p>
+ * - both: may have unused imports of namesake packages.
+ * <p>
+ * Mutable List of SearchResultGroup.
+ */
+ // private List fReferencesToTypesInNamesakes;
- /** References in CUs from namesake packages to types in fPackage.
- * <p>These need an import with the new package name.
- * <p>Mutable List of SearchResultGroup. */
- //private List fReferencesToTypesInPackage;
+ /**
+ * References in CUs from namesake packages to types in fPackage.
+ * <p>
+ * These need an import with the new package name.
+ * <p>
+ * Mutable List of SearchResultGroup.
+ */
+ // private List fReferencesToTypesInPackage;
- public PackageRenamer(IScriptFolder pack, RenameScriptFolderProcessor processor, TextChangeManager textChangeManager/*, ImportsManager importsManager*/) {
- fPackage= pack;
- fProcessor= processor;
-// fTextChangeManager= textChangeManager;
- //fImportsManager= importsManager;
+ public PackageRenamer(IScriptFolder pack,
+ RenameScriptFolderProcessor processor,
+ TextChangeManager textChangeManager/*
+ * , ImportsManager
+ * importsManager
+ */) {
+ fPackage = pack;
+ fProcessor = processor;
+ // fTextChangeManager= textChangeManager;
+ // fImportsManager= importsManager;
}
- void doRename(IProgressMonitor pm, RefactoringStatus result) throws CoreException {
- pm.beginTask("", 16 + (fProcessor.getUpdateTextualMatches() ? 10 : 0)); //$NON-NLS-1$
- if (fProcessor.getUpdateReferences()){
- pm.setTaskName(RefactoringCoreMessages.RenamePackageRefactoring_searching);
- //fOccurrences= getReferences(new SubProgressMonitor(pm, 4), result);
- //fReferencesToTypesInNamesakes= getReferencesToTypesInNamesakes(new SubProgressMonitor(pm, 4), result);
- //fReferencesToTypesInPackage= getReferencesToTypesInPackage(new SubProgressMonitor(pm, 4), result);
- pm.setTaskName(RefactoringCoreMessages.RenamePackageRefactoring_checking);
+ void doRename(IProgressMonitor pm, RefactoringStatus result)
+ throws CoreException {
+ pm.beginTask("", //$NON-NLS-1$
+ 16 + (fProcessor.getUpdateTextualMatches() ? 10 : 0));
+ if (fProcessor.getUpdateReferences()) {
+ pm.setTaskName(
+ RefactoringCoreMessages.RenamePackageRefactoring_searching);
+ // fOccurrences= getReferences(new SubProgressMonitor(pm, 4),
+ // result);
+ // fReferencesToTypesInNamesakes=
+ // getReferencesToTypesInNamesakes(new SubProgressMonitor(pm,
+ // 4), result);
+ // fReferencesToTypesInPackage=
+ // getReferencesToTypesInPackage(new SubProgressMonitor(pm, 4),
+ // result);
+ pm.setTaskName(
+ RefactoringCoreMessages.RenamePackageRefactoring_checking);
result.merge(analyzeAffectedSourceModules());
pm.worked(1);
} else {
- //fOccurrences= new SearchResultGroup[0];
+ // fOccurrences= new SearchResultGroup[0];
pm.worked(13);
}
@@ -526,103 +628,135 @@
else
pm.worked(3);
- if (fProcessor.getUpdateTextualMatches() && fPackage.equals(fProcessor.getPackage())) {
- pm.subTask(RefactoringCoreMessages.RenamePackageRefactoring_searching_text);
- //addTextMatches(new SubProgressMonitor(pm, 10));
+ if (fProcessor.getUpdateTextualMatches()
+ && fPackage.equals(fProcessor.getPackage())) {
+ pm.subTask(
+ RefactoringCoreMessages.RenamePackageRefactoring_searching_text);
+ // addTextMatches(new SubProgressMonitor(pm, 10));
}
pm.done();
}
- private RefactoringStatus analyzeAffectedSourceModules() throws CoreException {
- //TODO: also for both fReferencesTo...; only check each CU once!
- RefactoringStatus result= new RefactoringStatus();
- //fOccurrences= Checks.excludeSourceModules(fOccurrences, result);
+
+ private RefactoringStatus analyzeAffectedSourceModules()
+ throws CoreException {
+ // TODO: also for both fReferencesTo...; only check each CU once!
+ RefactoringStatus result = new RefactoringStatus();
+ // fOccurrences= Checks.excludeSourceModules(fOccurrences, result);
if (result.hasFatalError())
return result;
- //result.merge(Checks.checkCompileErrorsInAffectedFiles(fOccurrences));
+ // result.merge(Checks.checkCompileErrorsInAffectedFiles(fOccurrences));
return result;
}
- private void addReferenceUpdates(IProgressMonitor pm) throws CoreException {
+ private void addReferenceUpdates(IProgressMonitor pm)
+ throws CoreException {
if (DLTKCore.DEBUG) {
System.err.println("TODO: Add search support code."); //$NON-NLS-1$
}
-// if (fReferencesToTypesInNamesakes.size() != 0) {
-// for (Iterator iter= fReferencesToTypesInNamesakes.iterator(); iter.hasNext();) {
-// //SearchResultGroup referencesToTypesInNamesakes= (SearchResultGroup) iter.next();
-// //addTypeImports(referencesToTypesInNamesakes);
-// pm.worked(1);
-// }
-// }
-// if (fReferencesToTypesInPackage.size() != 0) {
-// for (Iterator iter= fReferencesToTypesInPackage.iterator(); iter.hasNext();) {
-// //SearchResultGroup namesakeReferencesToPackage= (SearchResultGroup) iter.next();
-// //updateTypeImports(namesakeReferencesToPackage);
-// pm.worked(1);
-// }
-// }
+ // if (fReferencesToTypesInNamesakes.size() != 0) {
+ // for (Iterator iter= fReferencesToTypesInNamesakes.iterator();
+ // iter.hasNext();) {
+ // //SearchResultGroup referencesToTypesInNamesakes=
+ // (SearchResultGroup) iter.next();
+ // //addTypeImports(referencesToTypesInNamesakes);
+ // pm.worked(1);
+ // }
+ // }
+ // if (fReferencesToTypesInPackage.size() != 0) {
+ // for (Iterator iter= fReferencesToTypesInPackage.iterator();
+ // iter.hasNext();) {
+ // //SearchResultGroup namesakeReferencesToPackage=
+ // (SearchResultGroup) iter.next();
+ // //updateTypeImports(namesakeReferencesToPackage);
+ // pm.worked(1);
+ // }
+ // }
pm.done();
}
-// private static String cutOffInnerTypes(String reference) {
-// int dotPos= reference.indexOf('.'); // cut off inner types
-// if (dotPos != -1)
-// reference= reference.substring(0, dotPos);
-// return reference;
-// }
-//
-// private String getNewPackageName() {
-// return fProcessor.getNewPackageName(fPackage.getElementName());
-// }
+ // private static String cutOffInnerTypes(String reference) {
+ // int dotPos= reference.indexOf('.'); // cut off inner types
+ // if (dotPos != -1)
+ // reference= reference.substring(0, dotPos);
+ // return reference;
+ // }
+ //
+ // private String getNewPackageName() {
+ // return fProcessor.getNewPackageName(fPackage.getElementName());
+ // }
}
@Override
public RefactoringStatus initialize(RefactoringArguments arguments) {
if (arguments instanceof ScriptRefactoringArguments) {
- final ScriptRefactoringArguments extended= (ScriptRefactoringArguments) arguments;
- final String handle= extended.getAttribute(ScriptRefactoringDescriptor.ATTRIBUTE_INPUT);
+ final ScriptRefactoringArguments extended = (ScriptRefactoringArguments) arguments;
+ final String handle = extended
+ .getAttribute(ScriptRefactoringDescriptor.ATTRIBUTE_INPUT);
if (handle != null) {
- final IModelElement element= ScriptRefactoringDescriptor.handleToElement(extended.getProject(), handle, false);
- if (element == null || !element.exists() || element.getElementType() != IModelElement.SCRIPT_FOLDER)
- return ScriptableRefactoring.createInputFatalStatus(element, getRefactoring().getName(), ID_RENAME_PACKAGE);
+ final IModelElement element = ScriptRefactoringDescriptor
+ .handleToElement(extended.getProject(), handle, false);
+ if (element == null || !element.exists() || element
+ .getElementType() != IModelElement.SCRIPT_FOLDER)
+ return ScriptableRefactoring.createInputFatalStatus(element,
+ getRefactoring().getName(), ID_RENAME_PACKAGE);
else
- fPackage= (IScriptFolder) element;
+ fPackage = (IScriptFolder) element;
} else
- return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ScriptRefactoringDescriptor.ATTRIBUTE_INPUT));
- final String name= extended.getAttribute(ScriptRefactoringDescriptor.ATTRIBUTE_NAME);
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(
+ RefactoringCoreMessages.InitializableRefactoring_argument_not_exist,
+ ScriptRefactoringDescriptor.ATTRIBUTE_INPUT));
+ final String name = extended
+ .getAttribute(ScriptRefactoringDescriptor.ATTRIBUTE_NAME);
if (name != null && !"".equals(name)) //$NON-NLS-1$
setNewElementName(name);
else
- return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ScriptRefactoringDescriptor.ATTRIBUTE_NAME));
- final String patterns= extended.getAttribute(ATTRIBUTE_PATTERNS);
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(
+ RefactoringCoreMessages.InitializableRefactoring_argument_not_exist,
+ ScriptRefactoringDescriptor.ATTRIBUTE_NAME));
+ final String patterns = extended.getAttribute(ATTRIBUTE_PATTERNS);
if (patterns != null && !"".equals(patterns)) //$NON-NLS-1$
- fFilePatterns= patterns;
+ fFilePatterns = patterns;
else
- fFilePatterns= ""; //$NON-NLS-1$
- final String references= extended.getAttribute(ATTRIBUTE_REFERENCES);
+ fFilePatterns = ""; //$NON-NLS-1$
+ final String references = extended
+ .getAttribute(ATTRIBUTE_REFERENCES);
if (references != null) {
- fUpdateReferences= Boolean.valueOf(references).booleanValue();
+ fUpdateReferences = Boolean.valueOf(references).booleanValue();
} else
- return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ATTRIBUTE_REFERENCES));
- final String matches= extended.getAttribute(ATTRIBUTE_TEXTUAL_MATCHES);
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(
+ RefactoringCoreMessages.InitializableRefactoring_argument_not_exist,
+ ATTRIBUTE_REFERENCES));
+ final String matches = extended
+ .getAttribute(ATTRIBUTE_TEXTUAL_MATCHES);
if (matches != null) {
- fUpdateTextualMatches= Boolean.valueOf(matches).booleanValue();
+ fUpdateTextualMatches = Boolean.valueOf(matches).booleanValue();
} else
- return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ATTRIBUTE_TEXTUAL_MATCHES));
- final String qualified= extended.getAttribute(ATTRIBUTE_QUALIFIED);
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(
+ RefactoringCoreMessages.InitializableRefactoring_argument_not_exist,
+ ATTRIBUTE_TEXTUAL_MATCHES));
+ final String qualified = extended.getAttribute(ATTRIBUTE_QUALIFIED);
if (qualified != null) {
- fUpdateQualifiedNames= Boolean.valueOf(qualified).booleanValue();
+ fUpdateQualifiedNames = Boolean.valueOf(qualified)
+ .booleanValue();
} else
- return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ATTRIBUTE_QUALIFIED));
- final String hierarchical= extended.getAttribute(ATTRIBUTE_HIERARCHICAL);
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(
+ RefactoringCoreMessages.InitializableRefactoring_argument_not_exist,
+ ATTRIBUTE_QUALIFIED));
+ final String hierarchical = extended
+ .getAttribute(ATTRIBUTE_HIERARCHICAL);
if (hierarchical != null) {
- fRenameSubpackages= Boolean.valueOf(hierarchical).booleanValue();
+ fRenameSubpackages = Boolean.valueOf(hierarchical)
+ .booleanValue();
} else
- return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, ATTRIBUTE_HIERARCHICAL));
+ return RefactoringStatus.createFatalErrorStatus(Messages.format(
+ RefactoringCoreMessages.InitializableRefactoring_argument_not_exist,
+ ATTRIBUTE_HIERARCHICAL));
} else
- return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.InitializableRefactoring_inacceptable_arguments);
+ return RefactoringStatus.createFatalErrorStatus(
+ RefactoringCoreMessages.InitializableRefactoring_inacceptable_arguments);
return new RefactoringStatus();
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java
index a1d38a4..f7931f3 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -22,123 +22,123 @@
* This class contains methods for suggesting new names for variables or methods
* whose name consists at least partly of the name of their declaring type (or
* in case of methods, the return type or a parameter type).
- *
+ *
* The methods return the newly suggested method or variable name in case of a
* match, or null in case nothing matched.
- *
+ *
* In any case, prefixes and suffixes are removed from variable names. As method
* names have no configurable suffixes or prefixes, they are left unchanged. The
* remaining name is called "stripped element name".
- *
+ *
* After the match according to the strategy, prefixes and suffixes are
* reapplied to the names.
- *
+ *
* EXACT STRATEGY (always performed).
* ----------------------------------------------------------------
- *
+ *
* The stripped element name is directly compared with the type name:
- *
+ *
* a) the first character must match case-insensitive
- *
+ *
* b) all other characters must match case-sensitive
- *
+ *
* In case of a match, the new type name is returned (first character adapted,
* respectively). Suffixes/Prefixes are reapplied.
- *
+ *
* Note that this also matches fields with names like "SomeField", "fsomeField",
* and method names like "ScriptElement()".
- *
+ *
* EMBEDDED STRATEGY (performed second if chosen by user).
* ----------------------------------------------------------------
- *
+ *
* A search is performed in the stripped element name for the old type name:
- *
+ *
* a) the first character must match case-insensitive
- *
+ *
* b) all other characters must match case-sensitive
- *
+ *
* c) the stripped element name must end after the type name, or the next
* character must be a non-letter, or the next character must be upper cased.
- *
+ *
* In case of a match, the new type is inserted into the stripped element name,
* replacing the old type name, first character adapted to the correct case.
* Suffixes/Prefixes are reapplied.
- *
+ *
* Note that this also matches methods with names like "createmodelElement()" or
* fields like "fmodelElementCache".
- *
+ *
* SUFFIX STRATEGY (performed third if chosen by user)
* ----------------------------------------------------------------
- *
+ *
* The new and old type names are analyzed for "camel case suffixes", that is,
* substrings which begin with an uppercased letter. For example,
- * "SimpleScriptElement" is split into the three hunks "Simple",
- * "Script", and "Element". If one type name has more suffixes than the
- * other, both are stripped to the smaller size.
- *
+ * "SimpleScriptElement" is split into the three hunks "Simple", "Script", and
+ * "Element". If one type name has more suffixes than the other, both are
+ * stripped to the smaller size.
+ *
* Then, a search is performed in the stripped variable name hunks from back to
- * front. At least the last hunk must be found, others may then extend the match.
- * Each hunk must match like in the exact strategy, i.e.
- *
+ * front. At least the last hunk must be found, others may then extend the
+ * match. Each hunk must match like in the exact strategy, i.e.
+ *
* a) the first character must match case-insensitive
- *
+ *
* b) all other characters must match case-sensitive
- *
- * In case of a match, the matched hunks of the new type replace
- * the hunks of the old type. Suffixes/Prefixes are reapplied.
- *
+ *
+ * In case of a match, the matched hunks of the new type replace the hunks of
+ * the old type. Suffixes/Prefixes are reapplied.
+ *
* Note that numbers and other non-letter characters belong to the previous
- * camel case substring.
- *
- *
- *
- *
+ * camel case substring.
+ *
+ *
+ *
+ *
*/
public class RenamingNameSuggestor {
-
+
/*
* ADDITIONAL OPTIONS
* ----------------------------------------------------------------
- *
+ *
* There are two additional flags which may be set in this class to allow
* better matching of special cases:
- *
+ *
* a) Special treatment of leading "I"s in type names, i.e. interface names
- * like "IScriptElement". If the corresponding flag is set, leading "I"s are
- * stripped from type names if the second char is also uppercase to allow
- * exact matching of variable names like "modelElement" for type
- * "IScriptElement". Note that embedded matching already matches cases like
- * this.
- *
+ * like "IScriptElement". If the corresponding flag is set, leading "I"s are
+ * stripped from type names if the second char is also uppercase to allow
+ * exact matching of variable names like "modelElement" for type
+ * "IScriptElement". Note that embedded matching already matches cases like
+ * this.
+ *
* b) Special treatment of all-uppercase type names or all-uppercase type
- * name camel-case hunks, i.e. names like "AST" or "PersonalURL". If the
- * corresponding flag is set, the type name hunks will be transformed such
- * that variables like "fAst", "ast", "personalUrl", or "url" are found as
- * well. The target name will be transformed too if it is an
- * all-uppercase type name camel-case hunk as well.
- *
- * NOTE that in exact or embedded mode, the whole type name must be
- * all-uppercase to allow matching custom-lowercased variable names, i.e.
- * there are no attempts to "guess" which hunk of the new name should be lowercased
- * to match a partly lowercased variable name. In suffix mode, hunks of the
- * new type which are at the same position as in the old type will be
- * lowercased if necessary.
- *
- * c) Support for (english) plural forms. If the corresponding flag is set, the
- * suggestor will try to match variables which have plural forms of the
- * type name, for example "handies" for "Handy" or "phones" for "MobilePhone".
- * The target name will be transformed as well, i.e. conversion like
- * "fHandies" -> "fPhones" are supported.
- *
+ * name camel-case hunks, i.e. names like "AST" or "PersonalURL". If the
+ * corresponding flag is set, the type name hunks will be transformed such
+ * that variables like "fAst", "ast", "personalUrl", or "url" are found as
+ * well. The target name will be transformed too if it is an all-uppercase
+ * type name camel-case hunk as well.
+ *
+ * NOTE that in exact or embedded mode, the whole type name must be
+ * all-uppercase to allow matching custom-lowercased variable names, i.e.
+ * there are no attempts to "guess" which hunk of the new name should be
+ * lowercased to match a partly lowercased variable name. In suffix mode,
+ * hunks of the new type which are at the same position as in the old type
+ * will be lowercased if necessary.
+ *
+ * c) Support for (english) plural forms. If the corresponding flag is set,
+ * the suggestor will try to match variables which have plural forms of the
+ * type name, for example "handies" for "Handy" or "phones" for
+ * "MobilePhone". The target name will be transformed as well, i.e.
+ * conversion like "fHandies" -> "fPhones" are supported.
+ *
*/
- public static final int STRATEGY_EXACT= 1;
- public static final int STRATEGY_EMBEDDED= 2;
- public static final int STRATEGY_SUFFIX= 3;
-
- private static final String PLURAL_S= "s"; //$NON-NLS-1$
- private static final String PLURAL_IES= "ies"; //$NON-NLS-1$
- private static final String SINGULAR_Y= "y"; //$NON-NLS-1$
+ public static final int STRATEGY_EXACT = 1;
+ public static final int STRATEGY_EMBEDDED = 2;
+ public static final int STRATEGY_SUFFIX = 3;
+
+ private static final String PLURAL_S = "s"; //$NON-NLS-1$
+ private static final String PLURAL_IES = "ies"; //$NON-NLS-1$
+ private static final String SINGULAR_Y = "y"; //$NON-NLS-1$
private int fStrategy;
private String[] fFieldPrefixes;
@@ -149,7 +149,7 @@
private String[] fLocalSuffixes;
private String[] fArgumentPrefixes;
private String[] fArgumentSuffixes;
-
+
private boolean fExtendedInterfaceNameMatching;
private boolean fExtendedAllUpperCaseHunkMatching;
private boolean fExtendedPluralMatching;
@@ -162,35 +162,45 @@
Assert.isTrue(strategy >= 1 && strategy <= 3);
- fStrategy= strategy;
- fExtendedInterfaceNameMatching= true;
- fExtendedAllUpperCaseHunkMatching= true;
- fExtendedPluralMatching= true;
+ fStrategy = strategy;
+ fExtendedInterfaceNameMatching = true;
+ fExtendedAllUpperCaseHunkMatching = true;
+ fExtendedPluralMatching = true;
resetPrefixes();
}
- public String suggestNewFieldName(IScriptProject project, String oldFieldName, boolean isStatic, String oldTypeName, String newTypeName) {
+ public String suggestNewFieldName(IScriptProject project,
+ String oldFieldName, boolean isStatic, String oldTypeName,
+ String newTypeName) {
initializePrefixesAndSuffixes(project);
if (isStatic)
- return suggestNewVariableName(fStaticFieldPrefixes, fStaticFieldSuffixes, oldFieldName, oldTypeName, newTypeName);
+ return suggestNewVariableName(fStaticFieldPrefixes,
+ fStaticFieldSuffixes, oldFieldName, oldTypeName,
+ newTypeName);
else
- return suggestNewVariableName(fFieldPrefixes, fFieldSuffixes, oldFieldName, oldTypeName, newTypeName);
+ return suggestNewVariableName(fFieldPrefixes, fFieldSuffixes,
+ oldFieldName, oldTypeName, newTypeName);
}
- public String suggestNewLocalName(IScriptProject project, String oldLocalName, boolean isArgument, String oldTypeName, String newTypeName) {
+ public String suggestNewLocalName(IScriptProject project,
+ String oldLocalName, boolean isArgument, String oldTypeName,
+ String newTypeName) {
initializePrefixesAndSuffixes(project);
if (isArgument)
- return suggestNewVariableName(fArgumentPrefixes, fArgumentSuffixes, oldLocalName, oldTypeName, newTypeName);
+ return suggestNewVariableName(fArgumentPrefixes, fArgumentSuffixes,
+ oldLocalName, oldTypeName, newTypeName);
else
- return suggestNewVariableName(fLocalPrefixes, fLocalSuffixes, oldLocalName, oldTypeName, newTypeName);
+ return suggestNewVariableName(fLocalPrefixes, fLocalSuffixes,
+ oldLocalName, oldTypeName, newTypeName);
}
- public String suggestNewMethodName(String oldMethodName, String oldTypeName, String newTypeName) {
+ public String suggestNewMethodName(String oldMethodName, String oldTypeName,
+ String newTypeName) {
Assert.isNotNull(oldMethodName);
Assert.isNotNull(oldTypeName);
@@ -204,7 +214,8 @@
return match(oldTypeName, newTypeName, oldMethodName);
}
- public String suggestNewVariableName(String[] prefixes, String[] suffixes, String oldVariableName, String oldTypeName, String newTypeName) {
+ public String suggestNewVariableName(String[] prefixes, String[] suffixes,
+ String oldVariableName, String oldTypeName, String newTypeName) {
Assert.isNotNull(prefixes);
Assert.isNotNull(suffixes);
@@ -215,68 +226,88 @@
Assert.isTrue(oldTypeName.length() > 0);
Assert.isTrue(newTypeName.length() > 0);
- final String usedPrefix= findLongestPrefix(oldVariableName, prefixes);
- final String usedSuffix= findLongestSuffix(oldVariableName, suffixes);
- final String strippedVariableName= oldVariableName.substring(usedPrefix.length(), oldVariableName.length() - usedSuffix.length());
+ final String usedPrefix = findLongestPrefix(oldVariableName, prefixes);
+ final String usedSuffix = findLongestSuffix(oldVariableName, suffixes);
+ final String strippedVariableName = oldVariableName.substring(
+ usedPrefix.length(),
+ oldVariableName.length() - usedSuffix.length());
- String newVariableName= match(oldTypeName, newTypeName, strippedVariableName);
- return (newVariableName != null) ? usedPrefix + newVariableName + usedSuffix : null;
+ String newVariableName = match(oldTypeName, newTypeName,
+ strippedVariableName);
+ return (newVariableName != null)
+ ? usedPrefix + newVariableName + usedSuffix
+ : null;
}
// -------------------------------------- Match methods
- private String match(final String oldTypeName, final String newTypeName, final String strippedVariableName) {
+ private String match(final String oldTypeName, final String newTypeName,
+ final String strippedVariableName) {
- String oldType= oldTypeName;
- String newType= newTypeName;
+ String oldType = oldTypeName;
+ String newType = newTypeName;
- if (fExtendedInterfaceNameMatching && isInterfaceName(oldType) && isInterfaceName(newType)) {
- oldType= getInterfaceName(oldType);
- newType= getInterfaceName(newType);
+ if (fExtendedInterfaceNameMatching && isInterfaceName(oldType)
+ && isInterfaceName(newType)) {
+ oldType = getInterfaceName(oldType);
+ newType = getInterfaceName(newType);
}
- String newVariableName= matchDirect(oldType, newType, strippedVariableName);
+ String newVariableName = matchDirect(oldType, newType,
+ strippedVariableName);
- if (fExtendedPluralMatching && newVariableName == null && canPluralize(oldType))
- newVariableName= matchDirect(pluralize(oldType), pluralize(newType), strippedVariableName);
+ if (fExtendedPluralMatching && newVariableName == null
+ && canPluralize(oldType))
+ newVariableName = matchDirect(pluralize(oldType),
+ pluralize(newType), strippedVariableName);
return newVariableName;
}
- private String matchDirect(String oldType, String newType, final String strippedVariableName) {
+ private String matchDirect(String oldType, String newType,
+ final String strippedVariableName) {
/*
* Use all strategies applied by the user. Always start with exact
* matching.
- *
+ *
* Note that suffix matching may not match the whole type name if the
* new type name has a smaller camel case chunk count.
*/
- String newVariableName= exactMatch(oldType, newType, strippedVariableName);
+ String newVariableName = exactMatch(oldType, newType,
+ strippedVariableName);
if (newVariableName == null && fStrategy >= STRATEGY_EMBEDDED)
- newVariableName= embeddedMatch(oldType, newType, strippedVariableName);
+ newVariableName = embeddedMatch(oldType, newType,
+ strippedVariableName);
if (newVariableName == null && fStrategy >= STRATEGY_SUFFIX)
- newVariableName= suffixMatch(oldType, newType, strippedVariableName);
+ newVariableName = suffixMatch(oldType, newType,
+ strippedVariableName);
return newVariableName;
}
- private String exactMatch(final String oldTypeName, final String newTypeName, final String strippedVariableName) {
+ private String exactMatch(final String oldTypeName,
+ final String newTypeName, final String strippedVariableName) {
- String newName= exactDirectMatch(oldTypeName, newTypeName, strippedVariableName);
+ String newName = exactDirectMatch(oldTypeName, newTypeName,
+ strippedVariableName);
if (newName != null)
return newName;
- if (fExtendedAllUpperCaseHunkMatching && isUpperCaseCamelCaseHunk(oldTypeName)) {
- String oldTN= getFirstUpperRestLowerCased(oldTypeName);
- String newTN= isUpperCaseCamelCaseHunk(newTypeName) ? getFirstUpperRestLowerCased(newTypeName) : newTypeName;
- newName= exactDirectMatch(oldTN, newTN, strippedVariableName);
+ if (fExtendedAllUpperCaseHunkMatching
+ && isUpperCaseCamelCaseHunk(oldTypeName)) {
+ String oldTN = getFirstUpperRestLowerCased(oldTypeName);
+ String newTN = isUpperCaseCamelCaseHunk(newTypeName)
+ ? getFirstUpperRestLowerCased(newTypeName)
+ : newTypeName;
+ newName = exactDirectMatch(oldTN, newTN, strippedVariableName);
}
return newName;
}
- private String exactDirectMatch(final String oldTypeName, final String newTypeName, final String strippedVariableName) {
+ private String exactDirectMatch(final String oldTypeName,
+ final String newTypeName, final String strippedVariableName) {
if (strippedVariableName.equals(oldTypeName))
return newTypeName;
@@ -287,56 +318,68 @@
return null;
}
- private String embeddedMatch(String oldTypeName, String newTypeName, String strippedVariableName) {
+ private String embeddedMatch(String oldTypeName, String newTypeName,
+ String strippedVariableName) {
// possibility of a match?
- final String lowerCaseVariable= strippedVariableName.toLowerCase();
- final String lowerCaseOldTypeName= oldTypeName.toLowerCase();
- int presumedIndex= lowerCaseVariable.indexOf(lowerCaseOldTypeName);
+ final String lowerCaseVariable = strippedVariableName.toLowerCase();
+ final String lowerCaseOldTypeName = oldTypeName.toLowerCase();
+ int presumedIndex = lowerCaseVariable.indexOf(lowerCaseOldTypeName);
while (presumedIndex != -1) {
// it may be there
- final String presumedTypeName= strippedVariableName.substring(presumedIndex, presumedIndex + oldTypeName.length());
- final String prefix= strippedVariableName.substring(0, presumedIndex);
- final String suffix= strippedVariableName.substring(presumedIndex + oldTypeName.length());
+ final String presumedTypeName = strippedVariableName.substring(
+ presumedIndex, presumedIndex + oldTypeName.length());
+ final String prefix = strippedVariableName.substring(0,
+ presumedIndex);
+ final String suffix = strippedVariableName
+ .substring(presumedIndex + oldTypeName.length());
// can match at all? (depends on suffix)
if (startsNewHunk(suffix)) {
- String name= exactMatch(oldTypeName, newTypeName, presumedTypeName);
+ String name = exactMatch(oldTypeName, newTypeName,
+ presumedTypeName);
if (name != null)
return prefix + name + suffix;
}
// did not match -> find next occurrence
- presumedIndex= lowerCaseVariable.indexOf(lowerCaseOldTypeName, presumedIndex + 1);
+ presumedIndex = lowerCaseVariable.indexOf(lowerCaseOldTypeName,
+ presumedIndex + 1);
}
return null;
}
-
- private String suffixMatch(final String oldType, final String newType, final String strippedVariableName) {
+
+ private String suffixMatch(final String oldType, final String newType,
+ final String strippedVariableName) {
// get an array of all camel-cased elements from both types + the
// variable
- String[] suffixesOld= getSuffixes(oldType);
- String[] suffixesNew= getSuffixes(newType);
- String[] suffixesVar= getSuffixes(strippedVariableName);
+ String[] suffixesOld = getSuffixes(oldType);
+ String[] suffixesNew = getSuffixes(newType);
+ String[] suffixesVar = getSuffixes(strippedVariableName);
// get an equal-sized array of the last n camel-cased elements
- int min= Math.min(suffixesOld.length, suffixesNew.length);
- String[] suffixesOldEqual= new String[min];
- String[] suffixesNewEqual= new String[min];
- System.arraycopy(suffixesOld, suffixesOld.length - min, suffixesOldEqual, 0, min);
- System.arraycopy(suffixesNew, suffixesNew.length - min, suffixesNewEqual, 0, min);
+ int min = Math.min(suffixesOld.length, suffixesNew.length);
+ String[] suffixesOldEqual = new String[min];
+ String[] suffixesNewEqual = new String[min];
+ System.arraycopy(suffixesOld, suffixesOld.length - min,
+ suffixesOldEqual, 0, min);
+ System.arraycopy(suffixesNew, suffixesNew.length - min,
+ suffixesNewEqual, 0, min);
// find endIndex. endIndex is the index of the last hunk of the old type
// name in the variable name.
- int endIndex= -1;
- for (int j= suffixesVar.length - 1; j >= 0; j--) {
- String newHunkName= exactMatch(suffixesOldEqual[suffixesOldEqual.length - 1], suffixesNewEqual[suffixesNewEqual.length - 1], suffixesVar[j]);
+ int endIndex = -1;
+ for (int j = suffixesVar.length - 1; j >= 0; j--) {
+ String newHunkName = exactMatch(
+ suffixesOldEqual[suffixesOldEqual.length - 1],
+ suffixesNewEqual[suffixesNewEqual.length - 1],
+ suffixesVar[j]);
if (newHunkName != null) {
- endIndex= j;
+ endIndex = j;
break;
}
}
@@ -344,12 +387,12 @@
if (endIndex == -1)
return null; // last hunk not found -> no match
- int stepBack= 0;
- int lastSuffixMatched= -1;
- int hunkInVarName= -1;
- for (int i= suffixesOldEqual.length - 1; i >= 0; i--) {
+ int stepBack = 0;
+ int lastSuffixMatched = -1;
+ int hunkInVarName = -1;
+ for (int i = suffixesOldEqual.length - 1; i >= 0; i--) {
- hunkInVarName= endIndex - stepBack;
+ hunkInVarName = endIndex - stepBack;
stepBack++;
if (hunkInVarName < 0) {
@@ -358,43 +401,54 @@
}
// try to match this hunk:
- String newHunkName= exactMatch(suffixesOldEqual[i], suffixesNewEqual[i], suffixesVar[hunkInVarName]);
+ String newHunkName = exactMatch(suffixesOldEqual[i],
+ suffixesNewEqual[i], suffixesVar[hunkInVarName]);
if (newHunkName == null)
break; // only match complete suffixes
- suffixesVar[hunkInVarName]= newHunkName;
- lastSuffixMatched= i;
+ suffixesVar[hunkInVarName] = newHunkName;
+ lastSuffixMatched = i;
}
-
+
if (lastSuffixMatched == 0) {
// we have matched ALL type hunks in the variable name,
// insert any new prefixes of the new type name
- int newPrefixes= suffixesNew.length - suffixesNewEqual.length;
+ int newPrefixes = suffixesNew.length - suffixesNewEqual.length;
if (newPrefixes > 0) {
-
+
// Propagate lowercased start to the front
- if (Character.isLowerCase(suffixesVar[hunkInVarName].charAt(0)) && Character.isUpperCase(suffixesOldEqual[lastSuffixMatched].charAt(0))) {
- suffixesVar[hunkInVarName]= getUpperCased(suffixesVar[hunkInVarName]);
- suffixesNew[0]= getLowerCased(suffixesNew[0]);
+ if (Character.isLowerCase(suffixesVar[hunkInVarName].charAt(0))
+ && Character
+ .isUpperCase(suffixesOldEqual[lastSuffixMatched]
+ .charAt(0))) {
+ suffixesVar[hunkInVarName] = getUpperCased(
+ suffixesVar[hunkInVarName]);
+ suffixesNew[0] = getLowerCased(suffixesNew[0]);
}
-
- String[] newVariableName= new String[suffixesVar.length + newPrefixes];
- System.arraycopy(suffixesVar, 0, newVariableName, 0, hunkInVarName); // hunks before type name in variable name
- System.arraycopy(suffixesNew, 0, newVariableName, hunkInVarName, newPrefixes); // new hunks in new type name
- System.arraycopy(suffixesVar, hunkInVarName, newVariableName, hunkInVarName + newPrefixes, suffixesVar.length - hunkInVarName); // matched + rest hunks
- suffixesVar= newVariableName;
+
+ String[] newVariableName = new String[suffixesVar.length
+ + newPrefixes];
+ System.arraycopy(suffixesVar, 0, newVariableName, 0,
+ hunkInVarName); // hunks before type name in variable
+ // name
+ System.arraycopy(suffixesNew, 0, newVariableName, hunkInVarName,
+ newPrefixes); // new hunks in new type name
+ System.arraycopy(suffixesVar, hunkInVarName, newVariableName,
+ hunkInVarName + newPrefixes,
+ suffixesVar.length - hunkInVarName); // matched + rest
+ // hunks
+ suffixesVar = newVariableName;
}
}
- String varName= concat(suffixesVar);
+ String varName = concat(suffixesVar);
if (varName.equals(strippedVariableName))
return null; // no "silly suggestions"
else
return varName;
}
-
// ---------------- Helper methods
/**
@@ -417,13 +471,13 @@
if (hunk.length() < 2)
return false;
- for (int i= 0; i < hunk.length(); i++) {
+ for (int i = 0; i < hunk.length(); i++) {
if (!isLegalChar(hunk.charAt(i)))
return false;
}
return true;
}
-
+
/**
* False if the character is a letter and it is lowercase. True in all other
* cases.
@@ -437,28 +491,28 @@
/**
* Grab a list of camelCase-separated suffixes from the typeName, for
* example:
- *
+ *
* "ScriptElementName" => { "Script", "Element", "Name }
- *
+ *
* "ASTNode" => { "AST", "Node" }
- *
+ *
*/
private String[] getSuffixes(String typeName) {
- List<String> suffixes = new ArrayList<String>();
- DLTKWordIterator iterator= new DLTKWordIterator();
+ List<String> suffixes = new ArrayList<>();
+ DLTKWordIterator iterator = new DLTKWordIterator();
iterator.setText(typeName);
- int lastmatch= 0;
+ int lastmatch = 0;
int match;
- while ( (match= iterator.next()) != BreakIterator.DONE) {
+ while ((match = iterator.next()) != BreakIterator.DONE) {
suffixes.add(typeName.substring(lastmatch, match));
- lastmatch= match;
+ lastmatch = match;
}
return suffixes.toArray(new String[0]);
}
private String concat(String[] suffixesNewEqual) {
- StringBuffer returner= new StringBuffer();
- for (int j= 0; j < suffixesNewEqual.length; j++) {
+ StringBuffer returner = new StringBuffer();
+ for (int j = 0; j < suffixesNewEqual.length; j++) {
returner.append(suffixesNewEqual[j]);
}
return returner.toString();
@@ -470,7 +524,7 @@
else
return name.toLowerCase();
}
-
+
private String getUpperCased(String name) {
if (name.length() > 1)
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
@@ -480,13 +534,15 @@
private String getFirstUpperRestLowerCased(String name) {
if (name.length() > 1)
- return Character.toUpperCase(name.charAt(0)) + name.substring(1).toLowerCase();
+ return Character.toUpperCase(name.charAt(0))
+ + name.substring(1).toLowerCase();
else
return name.toLowerCase();
}
private boolean isInterfaceName(String typeName) {
- return ( (typeName.length() >= 2) && typeName.charAt(0) == 'I' && Character.isUpperCase(typeName.charAt(1)));
+ return ((typeName.length() >= 2) && typeName.charAt(0) == 'I'
+ && Character.isUpperCase(typeName.charAt(1)));
}
private String getInterfaceName(String typeName) {
@@ -494,13 +550,13 @@
}
private String findLongestPrefix(String name, String[] prefixes) {
- String usedPrefix= ""; //$NON-NLS-1$
- int bestLen= 0;
- for (int i= 0; i < prefixes.length; i++) {
+ String usedPrefix = ""; //$NON-NLS-1$
+ int bestLen = 0;
+ for (int i = 0; i < prefixes.length; i++) {
if (name.startsWith(prefixes[i])) {
if (prefixes[i].length() > bestLen) {
- bestLen= prefixes[i].length();
- usedPrefix= prefixes[i];
+ bestLen = prefixes[i].length();
+ usedPrefix = prefixes[i];
}
}
}
@@ -508,19 +564,19 @@
}
private String findLongestSuffix(String name, String[] suffixes) {
- String usedPrefix= ""; //$NON-NLS-1$
- int bestLen= 0;
- for (int i= 0; i < suffixes.length; i++) {
+ String usedPrefix = ""; //$NON-NLS-1$
+ int bestLen = 0;
+ for (int i = 0; i < suffixes.length; i++) {
if (name.endsWith(suffixes[i])) {
if (suffixes[i].length() > bestLen) {
- bestLen= suffixes[i].length();
- usedPrefix= suffixes[i];
+ bestLen = suffixes[i].length();
+ usedPrefix = suffixes[i];
}
}
}
return usedPrefix;
}
-
+
/**
* Returns true if the type name can be pluralized by a string operation.
* This is always the case if it does not already end with an "s".
@@ -531,41 +587,51 @@
private String pluralize(String typeName) {
if (typeName.endsWith(SINGULAR_Y))
- typeName= typeName.substring(0, typeName.length() - 1).concat(PLURAL_IES);
+ typeName = typeName.substring(0, typeName.length() - 1)
+ .concat(PLURAL_IES);
else if (!typeName.endsWith(PLURAL_S))
- typeName= typeName.concat(PLURAL_S);
+ typeName = typeName.concat(PLURAL_S);
return typeName;
}
private void resetPrefixes() {
- String[] empty= new String[0];
- fFieldPrefixes= empty;
- fFieldSuffixes= empty;
- fStaticFieldPrefixes= empty;
- fStaticFieldSuffixes= empty;
- fLocalPrefixes= empty;
- fLocalSuffixes= empty;
- fArgumentPrefixes= empty;
- fArgumentSuffixes= empty;
+ String[] empty = new String[0];
+ fFieldPrefixes = empty;
+ fFieldSuffixes = empty;
+ fStaticFieldPrefixes = empty;
+ fStaticFieldSuffixes = empty;
+ fLocalPrefixes = empty;
+ fLocalSuffixes = empty;
+ fArgumentPrefixes = empty;
+ fArgumentSuffixes = empty;
}
private void initializePrefixesAndSuffixes(IScriptProject project) {
if (DLTKCore.DEBUG) {
System.err.println("Add code assist code here..."); //$NON-NLS-1$
}
-// fFieldPrefixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_FIELD_PREFIXES);
-// fFieldSuffixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_FIELD_SUFFIXES);
-// fStaticFieldPrefixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_STATIC_FIELD_PREFIXES);
-// fStaticFieldSuffixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_STATIC_FIELD_SUFFIXES);
-// fLocalPrefixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_LOCAL_PREFIXES);
-// fLocalSuffixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_LOCAL_SUFFIXES);
-// fArgumentPrefixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_ARGUMENT_PREFIXES);
-// fArgumentSuffixes= readCommaSeparatedPreference(project, DLTKCore.CODEASSIST_ARGUMENT_SUFFIXES);
+ // fFieldPrefixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_FIELD_PREFIXES);
+ // fFieldSuffixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_FIELD_SUFFIXES);
+ // fStaticFieldPrefixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_STATIC_FIELD_PREFIXES);
+ // fStaticFieldSuffixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_STATIC_FIELD_SUFFIXES);
+ // fLocalPrefixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_LOCAL_PREFIXES);
+ // fLocalSuffixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_LOCAL_SUFFIXES);
+ // fArgumentPrefixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_ARGUMENT_PREFIXES);
+ // fArgumentSuffixes= readCommaSeparatedPreference(project,
+ // DLTKCore.CODEASSIST_ARGUMENT_SUFFIXES);
}
-// private String[] readCommaSeparatedPreference(IScriptProject project, String option) {
-// String list= project.getOption(option, true);
-// return list == null ? new String[0] : list.split(","); //$NON-NLS-1$
-// }
+ // private String[] readCommaSeparatedPreference(IScriptProject project,
+ // String option) {
+ // String list= project.getOption(option, true);
+ // return list == null ? new String[0] : list.split(","); //$NON-NLS-1$
+ // }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java
index 5f72956..4b5493f 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java
@@ -34,7 +34,6 @@
import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
-
public class CopyModifications extends RefactoringModifications {
private List fCopies;
@@ -42,115 +41,138 @@
private List fParticipantDescriptorFilter;
public CopyModifications() {
- fCopies= new ArrayList();
- fCopyArguments= new ArrayList();
- fParticipantDescriptorFilter= new ArrayList();
+ fCopies = new ArrayList();
+ fCopyArguments = new ArrayList();
+ fParticipantDescriptorFilter = new ArrayList();
}
public void copy(IResource resource, CopyArguments args) {
add(resource, args, null);
}
- public void copy(IModelElement element, CopyArguments javaArgs, CopyArguments resourceArgs) throws CoreException {
- switch(element.getElementType()) {
- case IModelElement.PROJECT_FRAGMENT:
- copy((IProjectFragment)element, javaArgs, resourceArgs);
- break;
- case IModelElement.SCRIPT_FOLDER:
- copy((IScriptFolder)element, javaArgs, resourceArgs);
- break;
- case IModelElement.SOURCE_MODULE:
- copy((ISourceModule)element, javaArgs, resourceArgs);
- break;
- default:
- add(element, javaArgs, null);
+ public void copy(IModelElement element, CopyArguments javaArgs,
+ CopyArguments resourceArgs) throws CoreException {
+ switch (element.getElementType()) {
+ case IModelElement.PROJECT_FRAGMENT:
+ copy((IProjectFragment) element, javaArgs, resourceArgs);
+ break;
+ case IModelElement.SCRIPT_FOLDER:
+ copy((IScriptFolder) element, javaArgs, resourceArgs);
+ break;
+ case IModelElement.SOURCE_MODULE:
+ copy((ISourceModule) element, javaArgs, resourceArgs);
+ break;
+ default:
+ add(element, javaArgs, null);
}
}
- public void copy(IProjectFragment sourceFolder, CopyArguments javaArgs, CopyArguments resourceArgs) {
+ public void copy(IProjectFragment sourceFolder, CopyArguments javaArgs,
+ CopyArguments resourceArgs) {
add(sourceFolder, javaArgs, null);
- ResourceMapping mapping= DLTKElementResourceMapping.create(sourceFolder);
+ ResourceMapping mapping = DLTKElementResourceMapping
+ .create(sourceFolder);
if (mapping != null) {
add(mapping, resourceArgs, null);
}
- IResource sourceResource= sourceFolder.getResource();
+ IResource sourceResource = sourceFolder.getResource();
if (sourceResource != null) {
- getResourceModifications().addCopyDelta(sourceResource, resourceArgs);
- IFile buildpath= getBuildpathFile((IResource) resourceArgs.getDestination());
+ getResourceModifications().addCopyDelta(sourceResource,
+ resourceArgs);
+ IFile buildpath = getBuildpathFile(
+ (IResource) resourceArgs.getDestination());
if (buildpath != null) {
getResourceModifications().addChanged(buildpath);
}
}
}
- public void copy(IScriptFolder pack, CopyArguments javaArgs, CopyArguments resourceArgs) throws CoreException {
+ public void copy(IScriptFolder pack, CopyArguments javaArgs,
+ CopyArguments resourceArgs) throws CoreException {
add(pack, javaArgs, null);
- ResourceMapping mapping= DLTKElementResourceMapping.create(pack);
+ ResourceMapping mapping = DLTKElementResourceMapping.create(pack);
if (mapping != null) {
add(mapping, resourceArgs, null);
}
- IProjectFragment scriptDestination= (IProjectFragment) javaArgs.getDestination();
+ IProjectFragment scriptDestination = (IProjectFragment) javaArgs
+ .getDestination();
if (scriptDestination.getResource() == null)
return;
- IScriptFolder newPack= scriptDestination.getScriptFolder(pack.getElementName());
- // Here we have a special case. When we copy a package into the same source
- // folder than the user will choose an "unused" name at the end which will
- // lead to the fact that we can copy the pack. Unfortunately we don't know
+ IScriptFolder newPack = scriptDestination
+ .getScriptFolder(pack.getElementName());
+ // Here we have a special case. When we copy a package into the same
+ // source
+ // folder than the user will choose an "unused" name at the end which
+ // will
+ // lead to the fact that we can copy the pack. Unfortunately we don't
+ // know
// the new name yet, so we use the current package name.
- if (!pack.hasSubfolders() && (!newPack.exists() || pack.equals(newPack))) {
+ if (!pack.hasSubfolders()
+ && (!newPack.exists() || pack.equals(newPack))) {
// we can do a simple move
- IContainer resourceDestination= newPack.getResource().getParent();
+ IContainer resourceDestination = newPack.getResource().getParent();
createIncludingParents(resourceDestination);
- getResourceModifications().addCopyDelta(pack.getResource(), resourceArgs);
+ getResourceModifications().addCopyDelta(pack.getResource(),
+ resourceArgs);
} else {
- IContainer resourceDestination= (IContainer) newPack.getResource();
+ IContainer resourceDestination = (IContainer) newPack.getResource();
createIncludingParents(resourceDestination);
- CopyArguments arguments= new CopyArguments(resourceDestination, resourceArgs.getExecutionLog());
- IResource[] resourcesToCopy= collectResourcesOfInterest(pack);
- for (int i= 0; i < resourcesToCopy.length; i++) {
- IResource toCopy= resourcesToCopy[i];
+ CopyArguments arguments = new CopyArguments(resourceDestination,
+ resourceArgs.getExecutionLog());
+ IResource[] resourcesToCopy = collectResourcesOfInterest(pack);
+ for (int i = 0; i < resourcesToCopy.length; i++) {
+ IResource toCopy = resourcesToCopy[i];
getResourceModifications().addCopyDelta(toCopy, arguments);
}
}
}
- public void copy(ISourceModule unit, CopyArguments javaArgs, CopyArguments resourceArgs) throws CoreException {
+ public void copy(ISourceModule unit, CopyArguments javaArgs,
+ CopyArguments resourceArgs) throws CoreException {
add(unit, javaArgs, null);
- ResourceMapping mapping= DLTKElementResourceMapping.create(unit);
+ ResourceMapping mapping = DLTKElementResourceMapping.create(unit);
if (mapping != null) {
add(mapping, resourceArgs, null);
}
if (unit.getResource() != null) {
- getResourceModifications().addCopyDelta(unit.getResource(), resourceArgs);
+ getResourceModifications().addCopyDelta(unit.getResource(),
+ resourceArgs);
}
}
@Override
public void buildDelta(IResourceChangeDescriptionFactory builder) {
- for (int i= 0; i < fCopies.size(); i++) {
- Object element= fCopies.get(i);
+ for (int i = 0; i < fCopies.size(); i++) {
+ Object element = fCopies.get(i);
if (element instanceof IResource) {
- ResourceModifications.buildCopyDelta(builder, (IResource) element, (CopyArguments) fCopyArguments.get(i));
+ ResourceModifications.buildCopyDelta(builder,
+ (IResource) element,
+ (CopyArguments) fCopyArguments.get(i));
}
}
getResourceModifications().buildDelta(builder);
}
@Override
- public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor owner, String[] natures, SharableParticipants shared) {
- List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
- for (int i= 0; i < fCopies.size(); i++) {
- result.addAll(Arrays.asList(ParticipantManager.loadCopyParticipants(status,
- owner, fCopies.get(i),
- (CopyArguments) fCopyArguments.get(i),
- (IParticipantDescriptorFilter) fParticipantDescriptorFilter.get(i),
- natures, shared)));
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ RefactoringProcessor owner, String[] natures,
+ SharableParticipants shared) {
+ List<RefactoringParticipant> result = new ArrayList<>();
+ for (int i = 0; i < fCopies.size(); i++) {
+ result.addAll(Arrays.asList(ParticipantManager.loadCopyParticipants(
+ status, owner, fCopies.get(i),
+ (CopyArguments) fCopyArguments.get(i),
+ (IParticipantDescriptorFilter) fParticipantDescriptorFilter
+ .get(i),
+ natures, shared)));
}
- result.addAll(Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
+ result.addAll(Arrays.asList(getResourceModifications()
+ .getParticipants(status, owner, natures, shared)));
return result.toArray(new RefactoringParticipant[result.size()]);
}
- private void add(Object element, RefactoringArguments args, IParticipantDescriptorFilter filter) {
+ private void add(Object element, RefactoringArguments args,
+ IParticipantDescriptorFilter filter) {
Assert.isNotNull(element);
Assert.isNotNull(args);
fCopies.add(element);
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java
index 411054e..a6e3a5f 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java
@@ -149,14 +149,14 @@
public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
RefactoringProcessor owner, String[] natures,
SharableParticipants shared) {
- List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
+ List<RefactoringParticipant> result = new ArrayList<>();
for (Iterator iter = fDelete.iterator(); iter.hasNext();) {
result.addAll(Arrays.asList(ParticipantManager
.loadDeleteParticipants(status, owner, iter.next(),
new DeleteArguments(), natures, shared)));
}
- result.addAll(Arrays.asList(getResourceModifications().getParticipants(
- status, owner, natures, shared)));
+ result.addAll(Arrays.asList(getResourceModifications()
+ .getParticipants(status, owner, natures, shared)));
return result.toArray(new RefactoringParticipant[result.size()]);
}
@@ -223,7 +223,8 @@
IResource member = members[m];
if (member instanceof IFile) {
IFile file = (IFile) member;
- if ("class".equals(file.getFileExtension()) && file.isDerived()) //$NON-NLS-1$
+ if ("class".equals(file.getFileExtension()) //$NON-NLS-1$
+ && file.isDerived())
continue;
IDLTKLanguageToolkit toolkit = DLTKLanguageManager
.getLanguageToolkit(pack);
@@ -231,8 +232,8 @@
System.err
.println("TODO: Additional Check required..."); //$NON-NLS-1$
}
- if (pack.isRootFolder()
- && (toolkit == null || (toolkit != null && (!DLTKContentTypeManager
+ if (pack.isRootFolder() && (toolkit == null
+ || (toolkit != null && (!DLTKContentTypeManager
.isValidResourceForContentType(toolkit,
file)))))
continue;
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java
index 0bbf134..57e0f13 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java
@@ -37,7 +37,6 @@
import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
import org.eclipse.ltk.core.refactoring.participants.ValidateEditChecker;
-
public class MoveModifications extends RefactoringModifications {
private List fMoves;
@@ -45,9 +44,9 @@
private List fParticipantDescriptorFilter;
public MoveModifications() {
- fMoves= new ArrayList();
- fMoveArguments= new ArrayList();
- fParticipantDescriptorFilter= new ArrayList();
+ fMoves = new ArrayList();
+ fMoveArguments = new ArrayList();
+ fParticipantDescriptorFilter = new ArrayList();
}
public void move(IResource resource, MoveArguments args) {
@@ -56,50 +55,56 @@
public void move(IProjectFragment sourceFolder, MoveArguments arguments) {
add(sourceFolder, arguments, null);
- IResource sourceResource= sourceFolder.getResource();
+ IResource sourceResource = sourceFolder.getResource();
if (sourceResource != null) {
getResourceModifications().addMove(sourceResource,
- new MoveArguments(getResourceDestination(arguments), arguments.getUpdateReferences()));
- IFile buildpath= getBuildpathFile(sourceResource);
+ new MoveArguments(getResourceDestination(arguments),
+ arguments.getUpdateReferences()));
+ IFile buildpath = getBuildpathFile(sourceResource);
if (buildpath != null) {
getResourceModifications().addChanged(buildpath);
}
- buildpath= getBuildpathFile(getResourceDestination(arguments));
+ buildpath = getBuildpathFile(getResourceDestination(arguments));
if (buildpath != null) {
getResourceModifications().addChanged(buildpath);
}
}
}
- public void move(IScriptFolder pack, MoveArguments args) throws CoreException {
+ public void move(IScriptFolder pack, MoveArguments args)
+ throws CoreException {
add(pack, args, null);
if (pack.getResource() == null)
return;
- IProjectFragment scriptDestination= (IProjectFragment) args.getDestination();
+ IProjectFragment scriptDestination = (IProjectFragment) args
+ .getDestination();
if (scriptDestination.getResource() == null)
return;
- IScriptFolder newPack= scriptDestination.getScriptFolder(pack.getElementName());
+ IScriptFolder newPack = scriptDestination
+ .getScriptFolder(pack.getElementName());
if (!pack.hasSubfolders() && !newPack.exists()) {
// we can do a simple move
- IContainer resourceDestination= newPack.getResource().getParent();
+ IContainer resourceDestination = newPack.getResource().getParent();
createIncludingParents(resourceDestination);
- getResourceModifications().addMove(
- pack.getResource(),
- new MoveArguments(resourceDestination, args.getUpdateReferences()));
+ getResourceModifications().addMove(pack.getResource(),
+ new MoveArguments(resourceDestination,
+ args.getUpdateReferences()));
} else {
- IContainer resourceSource= (IContainer)pack.getResource();
- IContainer resourceDestination= (IContainer) newPack.getResource();
+ IContainer resourceSource = (IContainer) pack.getResource();
+ IContainer resourceDestination = (IContainer) newPack.getResource();
createIncludingParents(resourceDestination);
- MoveArguments arguments= new MoveArguments(resourceDestination, args.getUpdateReferences());
- IResource[] resourcesToMove= collectResourcesOfInterest(pack);
- Set allMembers= new HashSet(Arrays.asList(resourceSource.members()));
- for (int i= 0; i < resourcesToMove.length; i++) {
- IResource toMove= resourcesToMove[i];
+ MoveArguments arguments = new MoveArguments(resourceDestination,
+ args.getUpdateReferences());
+ IResource[] resourcesToMove = collectResourcesOfInterest(pack);
+ Set allMembers = new HashSet(
+ Arrays.asList(resourceSource.members()));
+ for (int i = 0; i < resourcesToMove.length; i++) {
+ IResource toMove = resourcesToMove[i];
getResourceModifications().addMove(toMove, arguments);
allMembers.remove(toMove);
}
- for (Iterator iter= allMembers.iterator(); iter.hasNext();) {
- IResource element= (IResource) iter.next();
+ for (Iterator iter = allMembers.iterator(); iter.hasNext();) {
+ IResource element = (IResource) iter.next();
if (element instanceof IFile) {
getResourceModifications().addDelete(element);
iter.remove();
@@ -111,24 +116,29 @@
}
}
- public void move(ISourceModule unit, MoveArguments args) throws CoreException {
+ public void move(ISourceModule unit, MoveArguments args)
+ throws CoreException {
add(unit, args, null);
- IType[] types= unit.getTypes();
- for (int tt= 0; tt < types.length; tt++) {
+ IType[] types = unit.getTypes();
+ for (int tt = 0; tt < types.length; tt++) {
add(types[tt], args, null);
}
- IResource resourceDestination= getResourceDestination(args);
+ IResource resourceDestination = getResourceDestination(args);
if (resourceDestination != null && unit.getResource() != null) {
- getResourceModifications().addMove(unit.getResource(), new MoveArguments(resourceDestination, args.getUpdateReferences()));
+ getResourceModifications().addMove(unit.getResource(),
+ new MoveArguments(resourceDestination,
+ args.getUpdateReferences()));
}
}
@Override
public void buildDelta(IResourceChangeDescriptionFactory builder) {
- for (int i= 0; i < fMoves.size(); i++) {
- Object element= fMoves.get(i);
+ for (int i = 0; i < fMoves.size(); i++) {
+ Object element = fMoves.get(i);
if (element instanceof IResource) {
- ResourceModifications.buildMoveDelta(builder, (IResource) element, (MoveArguments) fMoveArguments.get(i));
+ ResourceModifications.buildMoveDelta(builder,
+ (IResource) element,
+ (MoveArguments) fMoveArguments.get(i));
}
}
getResourceModifications().buildDelta(builder);
@@ -136,33 +146,38 @@
@Override
public void buildValidateEdits(ValidateEditChecker checker) {
- for (Iterator iter= fMoves.iterator(); iter.hasNext();) {
- Object element= iter.next();
+ for (Iterator iter = fMoves.iterator(); iter.hasNext();) {
+ Object element = iter.next();
if (element instanceof ISourceModule) {
- ISourceModule unit= (ISourceModule)element;
- IResource resource= unit.getResource();
+ ISourceModule unit = (ISourceModule) element;
+ IResource resource = unit.getResource();
if (resource != null && resource.getType() == IResource.FILE) {
- checker.addFile((IFile)resource);
+ checker.addFile((IFile) resource);
}
}
}
}
@Override
- public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor owner, String[] natures, SharableParticipants shared) {
- List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
- for (int i= 0; i < fMoves.size(); i++) {
- result.addAll(Arrays.asList(ParticipantManager.loadMoveParticipants(status,
- owner, fMoves.get(i),
- (MoveArguments) fMoveArguments.get(i),
- (IParticipantDescriptorFilter) fParticipantDescriptorFilter.get(i),
- natures, shared)));
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ RefactoringProcessor owner, String[] natures,
+ SharableParticipants shared) {
+ List<RefactoringParticipant> result = new ArrayList<>();
+ for (int i = 0; i < fMoves.size(); i++) {
+ result.addAll(Arrays.asList(ParticipantManager.loadMoveParticipants(
+ status, owner, fMoves.get(i),
+ (MoveArguments) fMoveArguments.get(i),
+ (IParticipantDescriptorFilter) fParticipantDescriptorFilter
+ .get(i),
+ natures, shared)));
}
- result.addAll(Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
+ result.addAll(Arrays.asList(getResourceModifications()
+ .getParticipants(status, owner, natures, shared)));
return result.toArray(new RefactoringParticipant[result.size()]);
}
- private void add(Object element, RefactoringArguments args, IParticipantDescriptorFilter filter) {
+ private void add(Object element, RefactoringArguments args,
+ IParticipantDescriptorFilter filter) {
Assert.isNotNull(element);
Assert.isNotNull(args);
fMoves.add(element);
@@ -171,12 +186,13 @@
}
private IResource getResourceDestination(MoveArguments args) {
- Object genericDestination= args.getDestination();
- IResource resourceDestination= null;
+ Object genericDestination = args.getDestination();
+ IResource resourceDestination = null;
if (genericDestination instanceof IModelElement) {
- resourceDestination= ((IModelElement)genericDestination).getResource();
+ resourceDestination = ((IModelElement) genericDestination)
+ .getResource();
} else if (genericDestination instanceof IResource) {
- resourceDestination= (IResource)genericDestination;
+ resourceDestination = (IResource) genericDestination;
}
return resourceDestination;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java
index 0dea67e..ac322bf 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -26,38 +26,37 @@
import org.eclipse.dltk.internal.corext.refactoring.util.ResourceUtil;
import org.eclipse.dltk.internal.corext.util.Messages;
-
class OverwriteHelper {
private Object fDestination;
- private IFile[] fFiles= new IFile[0];
- private IFolder[] fFolders= new IFolder[0];
- private ISourceModule[] fCus= new ISourceModule[0];
- private IProjectFragment[] fRoots= new IProjectFragment[0];
- private IScriptFolder[] fScriptFolders= new IScriptFolder[0];
+ private IFile[] fFiles = new IFile[0];
+ private IFolder[] fFolders = new IFolder[0];
+ private ISourceModule[] fCus = new ISourceModule[0];
+ private IProjectFragment[] fRoots = new IProjectFragment[0];
+ private IScriptFolder[] fScriptFolders = new IScriptFolder[0];
public void setFiles(IFile[] files) {
Assert.isNotNull(files);
- fFiles= files;
+ fFiles = files;
}
public void setFolders(IFolder[] folders) {
Assert.isNotNull(folders);
- fFolders= folders;
+ fFolders = folders;
}
public void setCus(ISourceModule[] cus) {
Assert.isNotNull(cus);
- fCus= cus;
+ fCus = cus;
}
-
+
public void setProjectFragments(IProjectFragment[] roots) {
Assert.isNotNull(roots);
- fRoots= roots;
- }
+ fRoots = roots;
+ }
public void setPackages(IScriptFolder[] fragments) {
Assert.isNotNull(fragments);
- fScriptFolders= fragments;
+ fScriptFolders = fragments;
}
public IFile[] getFilesWithoutUnconfirmedOnes() {
@@ -80,110 +79,123 @@
return fScriptFolders;
}
- public void confirmOverwritting(IReorgQueries reorgQueries, IModelElement destination) {
+ public void confirmOverwritting(IReorgQueries reorgQueries,
+ IModelElement destination) {
Assert.isNotNull(destination);
- fDestination= destination;
+ fDestination = destination;
confirmOverwritting(reorgQueries);
}
- public void confirmOverwritting(IReorgQueries reorgQueries, IResource destination) {
+ public void confirmOverwritting(IReorgQueries reorgQueries,
+ IResource destination) {
Assert.isNotNull(destination);
Assert.isNotNull(reorgQueries);
- fDestination= destination;
+ fDestination = destination;
confirmOverwritting(reorgQueries);
}
-
+
private void confirmOverwritting(IReorgQueries reorgQueries) {
- IConfirmQuery overwriteQuery= reorgQueries.createYesYesToAllNoNoToAllQuery(RefactoringCoreMessages.OverwriteHelper_0, true, IReorgQueries.CONFIRM_OVERWRITTING);
- IConfirmQuery skipQuery= reorgQueries.createSkipQuery(RefactoringCoreMessages.OverwriteHelper_2, IReorgQueries.CONFIRM_SKIPPING);
+ IConfirmQuery overwriteQuery = reorgQueries
+ .createYesYesToAllNoNoToAllQuery(
+ RefactoringCoreMessages.OverwriteHelper_0, true,
+ IReorgQueries.CONFIRM_OVERWRITTING);
+ IConfirmQuery skipQuery = reorgQueries.createSkipQuery(
+ RefactoringCoreMessages.OverwriteHelper_2,
+ IReorgQueries.CONFIRM_SKIPPING);
confirmFileOverwritting(overwriteQuery);
confirmFolderOverwritting(skipQuery);
- confirmCuOverwritting(overwriteQuery);
- confirmProjectFragmentOverwritting(skipQuery);
- confirmPackageOverwritting(overwriteQuery);
+ confirmCuOverwritting(overwriteQuery);
+ confirmProjectFragmentOverwritting(skipQuery);
+ confirmPackageOverwritting(overwriteQuery);
}
- private void confirmProjectFragmentOverwritting(IConfirmQuery overwriteQuery) {
- List<IProjectFragment> toNotOverwrite = new ArrayList<IProjectFragment>(
- 1);
- for (int i= 0; i < fRoots.length; i++) {
- IProjectFragment root= fRoots[i];
- if (canOverwrite(root) && ! skip(root.getElementName(), overwriteQuery))
+ private void confirmProjectFragmentOverwritting(
+ IConfirmQuery overwriteQuery) {
+ List<IProjectFragment> toNotOverwrite = new ArrayList<>(1);
+ for (int i = 0; i < fRoots.length; i++) {
+ IProjectFragment root = fRoots[i];
+ if (canOverwrite(root)
+ && !skip(root.getElementName(), overwriteQuery))
toNotOverwrite.add(root);
}
IProjectFragment[] roots = toNotOverwrite
.toArray(new IProjectFragment[toNotOverwrite.size()]);
- fRoots= ArrayTypeConverter.toProjectFragmentArray(ReorgUtils.setMinus(fRoots, roots));
+ fRoots = ArrayTypeConverter
+ .toProjectFragmentArray(ReorgUtils.setMinus(fRoots, roots));
}
private void confirmCuOverwritting(IConfirmQuery overwriteQuery) {
- List<ISourceModule> cusToNotOverwrite = new ArrayList<ISourceModule>(1);
- for (int i= 0; i < fCus.length; i++) {
- ISourceModule cu= fCus[i];
- if (canOverwrite(cu) && ! overwrite(cu, overwriteQuery))
+ List<ISourceModule> cusToNotOverwrite = new ArrayList<>(1);
+ for (int i = 0; i < fCus.length; i++) {
+ ISourceModule cu = fCus[i];
+ if (canOverwrite(cu) && !overwrite(cu, overwriteQuery))
cusToNotOverwrite.add(cu);
}
ISourceModule[] cus = cusToNotOverwrite
.toArray(new ISourceModule[cusToNotOverwrite.size()]);
- fCus= ArrayTypeConverter.toCuArray(ReorgUtils.setMinus(fCus, cus));
+ fCus = ArrayTypeConverter.toCuArray(ReorgUtils.setMinus(fCus, cus));
}
private void confirmFolderOverwritting(IConfirmQuery overwriteQuery) {
- List<IFolder> foldersToNotOverwrite = new ArrayList<IFolder>(1);
- for (int i= 0; i < fFolders.length; i++) {
- IFolder folder= fFolders[i];
- if (canOverwrite(folder) && ! skip(folder.getName(), overwriteQuery))
- foldersToNotOverwrite.add(folder);
+ List<IFolder> foldersToNotOverwrite = new ArrayList<>(1);
+ for (int i = 0; i < fFolders.length; i++) {
+ IFolder folder = fFolders[i];
+ if (canOverwrite(folder) && !skip(folder.getName(), overwriteQuery))
+ foldersToNotOverwrite.add(folder);
}
IFolder[] folders = foldersToNotOverwrite
.toArray(new IFolder[foldersToNotOverwrite.size()]);
- fFolders= ArrayTypeConverter.toFolderArray(ReorgUtils.setMinus(fFolders, folders));
+ fFolders = ArrayTypeConverter
+ .toFolderArray(ReorgUtils.setMinus(fFolders, folders));
}
private void confirmFileOverwritting(IConfirmQuery overwriteQuery) {
- List<IFile> filesToNotOverwrite = new ArrayList<IFile>(1);
- for (int i= 0; i < fFiles.length; i++) {
- IFile file= fFiles[i];
- if (canOverwrite(file) && ! overwrite(file, overwriteQuery))
+ List<IFile> filesToNotOverwrite = new ArrayList<>(1);
+ for (int i = 0; i < fFiles.length; i++) {
+ IFile file = fFiles[i];
+ if (canOverwrite(file) && !overwrite(file, overwriteQuery))
filesToNotOverwrite.add(file);
}
IFile[] files = filesToNotOverwrite
.toArray(new IFile[filesToNotOverwrite.size()]);
- fFiles= ArrayTypeConverter.toFileArray(ReorgUtils.setMinus(fFiles, files));
+ fFiles = ArrayTypeConverter
+ .toFileArray(ReorgUtils.setMinus(fFiles, files));
}
- private void confirmPackageOverwritting(IConfirmQuery overwriteQuery){
- List<IScriptFolder> toNotOverwrite = new ArrayList<IScriptFolder>(1);
- for (int i= 0; i < fScriptFolders.length; i++) {
- IScriptFolder pack= fScriptFolders[i];
- if (canOverwrite(pack) && ! overwrite(pack, overwriteQuery))
+ private void confirmPackageOverwritting(IConfirmQuery overwriteQuery) {
+ List<IScriptFolder> toNotOverwrite = new ArrayList<>(1);
+ for (int i = 0; i < fScriptFolders.length; i++) {
+ IScriptFolder pack = fScriptFolders[i];
+ if (canOverwrite(pack) && !overwrite(pack, overwriteQuery))
toNotOverwrite.add(pack);
}
IScriptFolder[] packages = toNotOverwrite
.toArray(new IScriptFolder[toNotOverwrite.size()]);
- fScriptFolders= ArrayTypeConverter.toPackageArray(ReorgUtils.setMinus(fScriptFolders, packages));
+ fScriptFolders = ArrayTypeConverter
+ .toPackageArray(ReorgUtils.setMinus(fScriptFolders, packages));
}
private boolean canOverwrite(IScriptFolder pack) {
Assert.isTrue(fDestination instanceof IProjectFragment);
- IProjectFragment destination= (IProjectFragment)fDestination;
- return ! destination.equals(pack.getParent()) && destination.getScriptFolder(pack.getElementName()).exists();
+ IProjectFragment destination = (IProjectFragment) fDestination;
+ return !destination.equals(pack.getParent())
+ && destination.getScriptFolder(pack.getElementName()).exists();
}
private boolean canOverwrite(IResource resource) {
if (resource == null)
return false;
- IResource destinationResource= ResourceUtil.getResource(fDestination);
+ IResource destinationResource = ResourceUtil.getResource(fDestination);
if (destinationResource.equals(resource.getParent()))
return false;
if (destinationResource instanceof IContainer) {
- IContainer container= (IContainer)destinationResource;
- IResource member= container.findMember(resource.getName());
+ IContainer container = (IContainer) destinationResource;
+ IResource member = container.findMember(resource.getName());
if (member == null || !member.exists())
return false;
if (member instanceof IContainer) {
try {
- if (((IContainer)member).members().length == 0)
+ if (((IContainer) member).members().length == 0)
return false;
} catch (CoreException e) {
return true;
@@ -193,41 +205,50 @@
}
return false;
}
-
+
private boolean canOverwrite(IProjectFragment root) {
Assert.isTrue(fDestination instanceof IScriptProject);
- IScriptProject destination= (IScriptProject)fDestination;
- IFolder conflict= destination.getProject().getFolder(root.getElementName());
+ IScriptProject destination = (IScriptProject) fDestination;
+ IFolder conflict = destination.getProject()
+ .getFolder(root.getElementName());
try {
- return !destination.equals(root.getParent()) && conflict.exists() && conflict.members().length > 0;
+ return !destination.equals(root.getParent()) && conflict.exists()
+ && conflict.members().length > 0;
} catch (CoreException e) {
return true;
}
}
private boolean canOverwrite(ISourceModule cu) {
- if (fDestination instanceof IScriptFolder){
- IScriptFolder destination= (IScriptFolder)fDestination;
- return ! destination.equals(cu.getParent()) && destination.getSourceModule(cu.getElementName()).exists();
+ if (fDestination instanceof IScriptFolder) {
+ IScriptFolder destination = (IScriptFolder) fDestination;
+ return !destination.equals(cu.getParent()) && destination
+ .getSourceModule(cu.getElementName()).exists();
} else {
return canOverwrite(ReorgUtils.getResource(cu));
}
}
- private static boolean overwrite(IResource resource, IConfirmQuery overwriteQuery){
+ private static boolean overwrite(IResource resource,
+ IConfirmQuery overwriteQuery) {
return overwrite(resource.getName(), overwriteQuery);
}
- private static boolean overwrite(IModelElement element, IConfirmQuery overwriteQuery){
+ private static boolean overwrite(IModelElement element,
+ IConfirmQuery overwriteQuery) {
return overwrite(element.getElementName(), overwriteQuery);
}
- private static boolean overwrite(String name, IConfirmQuery overwriteQuery){
- String question= Messages.format(RefactoringCoreMessages.OverwriteHelper_1, name);
+ private static boolean overwrite(String name,
+ IConfirmQuery overwriteQuery) {
+ String question = Messages
+ .format(RefactoringCoreMessages.OverwriteHelper_1, name);
return overwriteQuery.confirm(question);
}
- private static boolean skip(String name, IConfirmQuery overwriteQuery){
- String question= Messages.format(RefactoringCoreMessages.OverwriteHelper_3, name);
+
+ private static boolean skip(String name, IConfirmQuery overwriteQuery) {
+ String question = Messages
+ .format(RefactoringCoreMessages.OverwriteHelper_3, name);
return overwriteQuery.confirm(question);
- }
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java
index 44ed685..9e7ed54 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -17,8 +16,6 @@
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IModelElement;
-
-
public class ParentChecker {
private IResource[] fResources;
private IModelElement[] fScriptElements;
@@ -26,23 +23,24 @@
public ParentChecker(IResource[] resources, IModelElement[] modelElements) {
Assert.isNotNull(resources);
Assert.isNotNull(modelElements);
- fResources= resources;
- fScriptElements= modelElements;
+ fResources = resources;
+ fScriptElements = modelElements;
}
-
+
public boolean haveCommonParent() {
return getCommonParent() != null;
}
-
- public Object getCommonParent(){
+
+ public Object getCommonParent() {
if (fScriptElements.length == 0 && fResources.length == 0)
return null;
- if (! resourcesHaveCommonParent() || ! modelElementsHaveCommonParent())
+ if (!resourcesHaveCommonParent() || !modelElementsHaveCommonParent())
return null;
- if (fScriptElements.length == 0){
- IResource commonResourceParent= getCommonResourceParent();
+ if (fScriptElements.length == 0) {
+ IResource commonResourceParent = getCommonResourceParent();
Assert.isNotNull(commonResourceParent);
- IModelElement convertedToScript= DLTKCore.create(commonResourceParent);
+ IModelElement convertedToScript = DLTKCore
+ .create(commonResourceParent);
if (convertedToScript != null && convertedToScript.exists())
return convertedToScript;
else
@@ -50,38 +48,37 @@
}
if (fResources.length == 0)
return getCommonScriptElementParent();
-
- IResource commonResourceParent= getCommonResourceParent();
- IModelElement commonScriptElementParent= getCommonScriptElementParent();
+
+ IResource commonResourceParent = getCommonResourceParent();
+ IModelElement commonScriptElementParent = getCommonScriptElementParent();
Assert.isNotNull(commonScriptElementParent);
Assert.isNotNull(commonResourceParent);
- IModelElement convertedToScript= DLTKCore.create(commonResourceParent);
- if (convertedToScript == null ||
- ! convertedToScript.exists() ||
- ! commonScriptElementParent.equals(convertedToScript))
+ IModelElement convertedToScript = DLTKCore.create(commonResourceParent);
+ if (convertedToScript == null || !convertedToScript.exists()
+ || !commonScriptElementParent.equals(convertedToScript))
return null;
- return commonScriptElementParent;
+ return commonScriptElementParent;
}
private IModelElement getCommonScriptElementParent() {
Assert.isNotNull(fScriptElements);
- Assert.isTrue(fScriptElements.length > 0);//safe - checked before
+ Assert.isTrue(fScriptElements.length > 0);// safe - checked before
return fScriptElements[0].getParent();
}
private IResource getCommonResourceParent() {
Assert.isNotNull(fResources);
- Assert.isTrue(fResources.length > 0);//safe - checked before
+ Assert.isTrue(fResources.length > 0);// safe - checked before
return fResources[0].getParent();
}
private boolean modelElementsHaveCommonParent() {
if (fScriptElements.length == 0)
return true;
- IModelElement firstParent= fScriptElements[0].getParent();
- Assert.isNotNull(firstParent); //this should never happen
- for (int i= 1; i < fScriptElements.length; i++) {
- if (! firstParent.equals(fScriptElements[i].getParent()))
+ IModelElement firstParent = fScriptElements[0].getParent();
+ Assert.isNotNull(firstParent); // this should never happen
+ for (int i = 1; i < fScriptElements.length; i++) {
+ if (!firstParent.equals(fScriptElements[i].getParent()))
return false;
}
return true;
@@ -90,38 +87,40 @@
private boolean resourcesHaveCommonParent() {
if (fResources.length == 0)
return true;
- IResource firstParent= fResources[0].getParent();
+ IResource firstParent = fResources[0].getParent();
Assert.isNotNull(firstParent);
- for (int i= 1; i < fResources.length; i++) {
- if (! firstParent.equals(fResources[i].getParent()))
+ for (int i = 1; i < fResources.length; i++) {
+ if (!firstParent.equals(fResources[i].getParent()))
return false;
}
return true;
}
-
- public IResource[] getResources(){
+
+ public IResource[] getResources() {
return fResources;
- }
-
- public IModelElement[] getScriptElements(){
+ }
+
+ public IModelElement[] getScriptElements() {
return fScriptElements;
}
- public void removeElementsWithAncestorsOnList(boolean removeOnlyScriptElements) {
- if (! removeOnlyScriptElements){
+ public void removeElementsWithAncestorsOnList(
+ boolean removeOnlyScriptElements) {
+ if (!removeOnlyScriptElements) {
removeResourcesDescendantsOfResources();
removeResourcesDescendantsOfScriptElements();
}
removeScriptElementsDescendantsOfScriptElements();
-// removeScriptElementsChildrenOfResources(); //this case is covered by removeUnconfirmedArchives
+ // removeScriptElementsChildrenOfResources(); //this case is covered by
+ // removeUnconfirmedArchives
}
-
+
private void removeResourcesDescendantsOfScriptElements() {
- List<IResource> subResources = new ArrayList<IResource>(3);
- for (int i= 0; i < fResources.length; i++) {
- IResource subResource= fResources[i];
- for (int j= 0; j < fScriptElements.length; j++) {
- IModelElement superElements= fScriptElements[j];
+ List<IResource> subResources = new ArrayList<>(3);
+ for (int i = 0; i < fResources.length; i++) {
+ IResource subResource = fResources[i];
+ for (int j = 0; j < fScriptElements.length; j++) {
+ IModelElement superElements = fScriptElements[j];
if (isDescendantOf(subResource, superElements))
subResources.add(subResource);
}
@@ -131,11 +130,11 @@
}
private void removeScriptElementsDescendantsOfScriptElements() {
- List<IModelElement> subElements = new ArrayList<IModelElement>(3);
- for (int i= 0; i < fScriptElements.length; i++) {
- IModelElement subElement= fScriptElements[i];
- for (int j= 0; j < fScriptElements.length; j++) {
- IModelElement superElement= fScriptElements[j];
+ List<IModelElement> subElements = new ArrayList<>(3);
+ for (int i = 0; i < fScriptElements.length; i++) {
+ IModelElement subElement = fScriptElements[i];
+ for (int j = 0; j < fScriptElements.length; j++) {
+ IModelElement superElement = fScriptElements[j];
if (isDescendantOf(subElement, superElement))
subElements.add(subElement);
}
@@ -145,11 +144,11 @@
}
private void removeResourcesDescendantsOfResources() {
- List<IResource> subResources = new ArrayList<IResource>(3);
- for (int i= 0; i < fResources.length; i++) {
- IResource subResource= fResources[i];
- for (int j= 0; j < fResources.length; j++) {
- IResource superResource= fResources[j];
+ List<IResource> subResources = new ArrayList<>(3);
+ for (int i = 0; i < fResources.length; i++) {
+ IResource subResource = fResources[i];
+ for (int j = 0; j < fResources.length; j++) {
+ IResource superResource = fResources[j];
if (isDescendantOf(subResource, superResource))
subResources.add(subResource);
}
@@ -158,38 +157,43 @@
subResources.toArray(new IResource[subResources.size()]));
}
- public static boolean isDescendantOf(IResource subResource, IModelElement superElement) {
- IResource parent= subResource.getParent();
- while(parent != null){
- IModelElement el= DLTKCore.create(parent);
+ public static boolean isDescendantOf(IResource subResource,
+ IModelElement superElement) {
+ IResource parent = subResource.getParent();
+ while (parent != null) {
+ IModelElement el = DLTKCore.create(parent);
if (el != null && el.exists() && el.equals(superElement))
return true;
- parent= parent.getParent();
+ parent = parent.getParent();
}
return false;
}
- public static boolean isDescendantOf(IModelElement subElement, IModelElement superElement) {
+ public static boolean isDescendantOf(IModelElement subElement,
+ IModelElement superElement) {
if (subElement.equals(superElement))
return false;
- IModelElement parent= subElement.getParent();
- while(parent != null){
+ IModelElement parent = subElement.getParent();
+ while (parent != null) {
if (parent.equals(superElement))
return true;
- parent= parent.getParent();
+ parent = parent.getParent();
}
return false;
}
- public static boolean isDescendantOf(IResource subResource, IResource superResource) {
- return ! subResource.equals(superResource) && superResource.getFullPath().isPrefixOf(subResource.getFullPath());
+ public static boolean isDescendantOf(IResource subResource,
+ IResource superResource) {
+ return !subResource.equals(superResource) && superResource.getFullPath()
+ .isPrefixOf(subResource.getFullPath());
}
private void removeFromSetToDelete(IResource[] resourcesToNotDelete) {
- fResources= ReorgUtils.setMinus(fResources, resourcesToNotDelete);
+ fResources = ReorgUtils.setMinus(fResources, resourcesToNotDelete);
}
-
+
private void removeFromSetToDelete(IModelElement[] elementsToNotDelete) {
- fScriptElements= ReorgUtils.setMinus(fScriptElements, elementsToNotDelete);
+ fScriptElements = ReorgUtils.setMinus(fScriptElements,
+ elementsToNotDelete);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java
index ae48571..69df012 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* 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
@@ -133,10 +133,10 @@
}
case IModelElement.FIELD:
return RefactoringCoreMessages.ReorgUtils_5;
- // case IModelElement.IMPORT_CONTAINER:
- // return RefactoringCoreMessages.ReorgUtils_6;
- // case IModelElement.IMPORT_DECLARATION:
- // return RefactoringCoreMessages.ReorgUtils_7;
+ // case IModelElement.IMPORT_CONTAINER:
+ // return RefactoringCoreMessages.ReorgUtils_6;
+ // case IModelElement.IMPORT_DECLARATION:
+ // return RefactoringCoreMessages.ReorgUtils_7;
case IModelElement.SCRIPT_PROJECT:
return RefactoringCoreMessages.ReorgUtils_9;
case IModelElement.METHOD:
@@ -178,19 +178,19 @@
}
case IModelElement.FIELD:
return new String[] { element.getElementName() };
- // case IModelElement.IMPORT_CONTAINER:
- // return new String[0];
- // case IModelElement.IMPORT_DECLARATION:
- // return new String[]{element.getElementName()};
+ // case IModelElement.IMPORT_CONTAINER:
+ // return new String[0];
+ // case IModelElement.IMPORT_DECLARATION:
+ // return new String[]{element.getElementName()};
case IModelElement.SCRIPT_PROJECT:
return new String[] { element.getElementName() };
case IModelElement.METHOD:
return new String[] { element.getElementName() };
- // case IModelElement.PACKAGE_DECLARATION:
- // if (ScriptElementUtil.isDefaultPackage(element))
- // return new String[0];
- // else
- // return new String[]{element.getElementName()};
+ // case IModelElement.PACKAGE_DECLARATION:
+ // if (ScriptElementUtil.isDefaultPackage(element))
+ // return new String[0];
+ // else
+ // return new String[]{element.getElementName()};
case IModelElement.SCRIPT_FOLDER:
return new String[] { element.getElementName() };
case IModelElement.PROJECT_FRAGMENT:
@@ -208,11 +208,12 @@
public static boolean isSourceFolder(IModelElement modelElement)
throws ModelException {
return (modelElement instanceof IProjectFragment)
- && ((IProjectFragment) modelElement).getKind() == IProjectFragment.K_SOURCE;
+ && ((IProjectFragment) modelElement)
+ .getKind() == IProjectFragment.K_SOURCE;
}
public static IResource[] getResources(List elements) {
- List<IResource> resources = new ArrayList<IResource>(elements.size());
+ List<IResource> resources = new ArrayList<>(elements.size());
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IResource)
@@ -229,20 +230,18 @@
}
public static IResource[] getResources(IModelElement[] elements) {
- List<IResource> resultArray = new ArrayList<IResource>();
+ List<IResource> resultArray = new ArrayList<>();
for (int i = 0; i < elements.length; i++) {
IResource res = ReorgUtils.getResource(elements[i]);
if (res != null) {
resultArray.add(res);
}
}
- return resultArray.toArray(new IResource[resultArray
- .size()]);
+ return resultArray.toArray(new IResource[resultArray.size()]);
}
public static IResource[] getNotLinked(IResource[] resources) {
- Collection<IResource> result = new ArrayList<IResource>(
- resources.length);
+ Collection<IResource> result = new ArrayList<>(resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource != null && !result.contains(resource)
@@ -253,8 +252,7 @@
}
public static IResource[] getNotNulls(IResource[] resources) {
- Collection<IResource> result = new ArrayList<IResource>(
- resources.length);
+ Collection<IResource> result = new ArrayList<>(resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource != null && !result.contains(resource))
@@ -277,7 +275,8 @@
return result;
}
- public static List getElementsOfType(IModelElement[] modelElements, int type) {
+ public static List getElementsOfType(IModelElement[] modelElements,
+ int type) {
List result = new ArrayList(modelElements.length);
for (int i = 0; i < modelElements.length; i++) {
if (isOfType(modelElements[i], type))
@@ -300,19 +299,18 @@
public static IModelElement[] setMinus(IModelElement[] setToRemoveFrom,
IModelElement[] elementsToRemove) {
- Set<IModelElement> setMinus = new HashSet<IModelElement>(
- setToRemoveFrom.length
- - setToRemoveFrom.length);
+ Set<IModelElement> setMinus = new HashSet<>(
+ setToRemoveFrom.length - setToRemoveFrom.length);
setMinus.addAll(Arrays.asList(setToRemoveFrom));
setMinus.removeAll(Arrays.asList(elementsToRemove));
- return setMinus.toArray(new IModelElement[setMinus
- .size()]);
+ return setMinus.toArray(new IModelElement[setMinus.size()]);
}
public static IModelElement[] union(IModelElement[] set1,
IModelElement[] set2) {
- List<IModelElement> union = new ArrayList<IModelElement>(
- set1.length + set2.length);// use lists to
+ List<IModelElement> union = new ArrayList<>(set1.length + set2.length);// use
+ // lists
+ // to
// avoid
// sequence
// problems
@@ -322,8 +320,7 @@
}
public static IResource[] union(IResource[] set1, IResource[] set2) {
- List<IResource> union = new ArrayList<IResource>(
- set1.length + set2.length);// use
+ List<IResource> union = new ArrayList<>(set1.length + set2.length);// use
// lists
// to
// avoid
@@ -343,27 +340,25 @@
public static IResource[] setMinus(IResource[] setToRemoveFrom,
IResource[] elementsToRemove) {
- Set<IResource> setMinus = new HashSet<IResource>(
- setToRemoveFrom.length
- - setToRemoveFrom.length);
+ Set<IResource> setMinus = new HashSet<>(
+ setToRemoveFrom.length - setToRemoveFrom.length);
setMinus.addAll(Arrays.asList(setToRemoveFrom));
setMinus.removeAll(Arrays.asList(elementsToRemove));
return setMinus.toArray(new IResource[setMinus.size()]);
}
public static IModelElement[] getModelElements(List elements) {
- List<IModelElement> resources = new ArrayList<IModelElement>(
- elements.size());
+ List<IModelElement> resources = new ArrayList<>(elements.size());
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IModelElement)
resources.add((IModelElement) element);
}
- return resources.toArray(new IModelElement[resources
- .size()]);
+ return resources.toArray(new IModelElement[resources.size()]);
}
- public static ISourceModule[] getSourceModules(IModelElement[] modelElements) {
+ public static ISourceModule[] getSourceModules(
+ IModelElement[] modelElements) {
ISourceModule[] result = new ISourceModule[modelElements.length];
for (int i = 0; i < modelElements.length; i++) {
result[i] = getSourceModule(modelElements[i]);
@@ -372,7 +367,7 @@
}
public static IWorkingSet[] getWorkingSets(List elements) {
- List<IWorkingSet> result = new ArrayList<IWorkingSet>(1);
+ List<IWorkingSet> result = new ArrayList<>(1);
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IWorkingSet) {
@@ -449,14 +444,16 @@
return false;
}
- public static boolean canBeDestinationForLinkedResources(IResource resource) {
+ public static boolean canBeDestinationForLinkedResources(
+ IResource resource) {
return resource.isAccessible() && resource instanceof IProject;
}
public static boolean canBeDestinationForLinkedResources(
IModelElement modelElement) {
if (modelElement instanceof IProjectFragment) {
- return isProjectFragmentCorrespondingToProject((IProjectFragment) modelElement);
+ return isProjectFragmentCorrespondingToProject(
+ (IProjectFragment) modelElement);
} else if (modelElement instanceof IScriptProject) {
return true;// XXX ???
} else
@@ -498,7 +495,8 @@
return false;
}
- public static boolean hasElementsOfType(IResource[] resources, int typeMask) {
+ public static boolean hasElementsOfType(IResource[] resources,
+ int typeMask) {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource != null && isOfType(resource, typeMask))
@@ -544,7 +542,8 @@
return false;
}
- public static boolean containsLinkedResources(IModelElement[] modelElements) {
+ public static boolean containsLinkedResources(
+ IModelElement[] modelElements) {
for (int i = 0; i < modelElements.length; i++) {
IResource res = getResource(modelElements[i]);
if (res != null && res.isLinked())
@@ -558,7 +557,8 @@
return getCorrespondingProjectFragment(scriptProject) != null;
}
- public static boolean areEqualInWorkspaceOrOnDisk(IResource r1, IResource r2) {
+ public static boolean areEqualInWorkspaceOrOnDisk(IResource r1,
+ IResource r2) {
if (r1 == null || r2 == null)
return false;
if (r1.equals(r2))
@@ -581,7 +581,8 @@
return true;
IResource packageResource = ResourceUtil.getResource(pack);
IResource packageRootResource = ResourceUtil.getResource(root);
- return isParentInWorkspaceOrOnDisk(packageResource, packageRootResource);
+ return isParentInWorkspaceOrOnDisk(packageResource,
+ packageRootResource);
}
public static boolean isParentInWorkspaceOrOnDisk(IProjectFragment root,
@@ -595,7 +596,8 @@
return true;
IResource packageResource = ResourceUtil.getResource(root);
IResource packageRootResource = ResourceUtil.getResource(scriptProject);
- return isParentInWorkspaceOrOnDisk(packageResource, packageRootResource);
+ return isParentInWorkspaceOrOnDisk(packageResource,
+ packageRootResource);
}
public static boolean isParentInWorkspaceOrOnDisk(ISourceModule cu,
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java
index 8456d86..82b005f 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java
@@ -147,7 +147,7 @@
.computeAffectedNaturs(fScriptElements);
String[] rNatures = ResourceProcessors
.computeAffectedNatures(fResources);
- Set<String> result = new HashSet<String>();
+ Set<String> result = new HashSet<>();
result.addAll(Arrays.asList(jNatures));
result.addAll(Arrays.asList(rNatures));
return result.toArray(new String[result.size()]);
@@ -397,7 +397,7 @@
*/
private void addSubPackages() throws ModelException {
- final Set<IModelElement> modelElements = new HashSet<IModelElement>();
+ final Set<IModelElement> modelElements = new HashSet<>();
for (int i = 0; i < fScriptElements.length; i++) {
if (fScriptElements[i] instanceof IScriptFolder) {
modelElements.addAll(
@@ -443,7 +443,7 @@
}
// new package list in the right sequence
- final List<IScriptFolder> allFragmentsToDelete = new ArrayList<IScriptFolder>();
+ final List<IScriptFolder> allFragmentsToDelete = new ArrayList<>();
for (Iterator outerIter = initialPackagesToDelete.iterator(); outerIter
.hasNext();) {
@@ -472,7 +472,7 @@
}
// Remove resources in deleted packages; and the packages as well
- final List<IModelElement> modelElements = new ArrayList<IModelElement>();
+ final List<IModelElement> modelElements = new ArrayList<>();
for (int i = 0; i < fScriptElements.length; i++) {
if (!(fScriptElements[i] instanceof IScriptFolder)) {
// remove children of deleted packages
@@ -486,7 +486,7 @@
modelElements.addAll(allFragmentsToDelete);
// Remove resources in deleted folders
- final List<IResource> resources = new ArrayList<IResource>();
+ final List<IResource> resources = new ArrayList<>();
for (int i = 0; i < fResources.length; i++) {
IResource parent = fResources[i];
if (parent.getType() == IResource.FILE)
@@ -567,7 +567,7 @@
private void removeUnconfirmedReferencedArchiveFiles(IConfirmQuery query)
throws ModelException, OperationCanceledException {
- List<IFile> filesToSkip = new ArrayList<IFile>(0);
+ List<IFile> filesToSkip = new ArrayList<>(0);
for (int i = 0; i < fResources.length; i++) {
IResource resource = fResources[i];
if (!(resource instanceof IFile))
@@ -594,7 +594,7 @@
private void removeUnconfirmedReferencedProjectFragments(
IConfirmQuery query)
throws ModelException, OperationCanceledException {
- List<IModelElement> rootsToSkip = new ArrayList<IModelElement>(0);
+ List<IModelElement> rootsToSkip = new ArrayList<>(0);
for (int i = 0; i < fScriptElements.length; i++) {
IModelElement element = fScriptElements[i];
if (!(element instanceof IProjectFragment))
@@ -627,7 +627,7 @@
IConfirmQuery query = fDeleteQueries.createYesYesToAllNoNoToAllQuery(
queryTitle, true,
IReorgQueries.CONFIRM_DELETE_FOLDERS_CONTAINING_SOURCE_FOLDERS);
- List<IResource> foldersToSkip = new ArrayList<IResource>(0);
+ List<IResource> foldersToSkip = new ArrayList<>(0);
for (int i = 0; i < fResources.length; i++) {
IResource resource = fResources[i];
if (resource instanceof IFolder) {
@@ -737,7 +737,7 @@
}
private Set<ISourceModule> getCusToEmpty() throws ModelException {
- Set<ISourceModule> result = new HashSet<ISourceModule>();
+ Set<ISourceModule> result = new HashSet<>();
for (int i = 0; i < fScriptElements.length; i++) {
IModelElement element = fScriptElements[i];
ISourceModule module = ReorgUtils.getSourceModule(element);
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/util/ModelElementUtil.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/util/ModelElementUtil.java
index d309a5d..2923086 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/util/ModelElementUtil.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/util/ModelElementUtil.java
@@ -39,7 +39,7 @@
public static IModelElement[] getElementsOfType(IModelElement[] elements,
int type) {
- Set<IModelElement> result = new HashSet<IModelElement>(elements.length);
+ Set<IModelElement> result = new HashSet<>(elements.length);
for (int i = 0; i < elements.length; i++) {
IModelElement element = elements[i];
if (element.getElementType() == type)
@@ -59,7 +59,7 @@
public static IMethod[] getAllConstructors(IType type)
throws ModelException {
- List<IMethod> result = new ArrayList<IMethod>();
+ List<IMethod> result = new ArrayList<>();
IMethod[] methods = type.getMethods();
for (int i = 0; i < methods.length; i++) {
IMethod iMethod = methods[i];
@@ -77,10 +77,10 @@
throws ModelException {
IBuildpathEntry cpe = root.getRawBuildpathEntry();
IScriptProject myProject = root.getScriptProject();
- IScriptProject[] allScriptProjects = DLTKCore.create(
- ResourcesPlugin.getWorkspace().getRoot()).getScriptProjects();
- List<IScriptProject> result = new ArrayList<IScriptProject>(
- allScriptProjects.length);
+ IScriptProject[] allScriptProjects = DLTKCore
+ .create(ResourcesPlugin.getWorkspace().getRoot())
+ .getScriptProjects();
+ List<IScriptProject> result = new ArrayList<>(allScriptProjects.length);
for (int i = 0; i < allScriptProjects.length; i++) {
IScriptProject project = allScriptProjects[i];
if (project.equals(myProject))
@@ -95,7 +95,7 @@
public static IMember[] merge(IMember[] a1, IMember[] a2) {
// Don't use hash sets since ordering is important for some
// refactorings.
- List<IMember> result = new ArrayList<IMember>(a1.length + a2.length);
+ List<IMember> result = new ArrayList<>(a1.length + a2.length);
for (int i = 0; i < a1.length; i++) {
IMember member = a1[i];
if (!result.contains(member))
@@ -126,7 +126,7 @@
return new IScriptFolder[] { pack };
IProjectFragment root = (IProjectFragment) pack.getParent();
IModelElement[] allPackages = root.getChildren();
- ArrayList<IScriptFolder> subpackages = new ArrayList<IScriptFolder>();
+ ArrayList<IScriptFolder> subpackages = new ArrayList<>();
subpackages.add(pack);
final IPath folderPath = pack.getPath();
for (int i = 0; i < allPackages.length; i++) {
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java
index f25ef26..832f699 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java
@@ -69,7 +69,8 @@
}
- private class MethodHistoryDeltaListener implements IElementChangedListener {
+ private class MethodHistoryDeltaListener
+ implements IElementChangedListener {
@Override
public void elementChanged(ElementChangedEvent event) {
if (processDelta(event.getDelta())) {
@@ -94,22 +95,22 @@
switch (elem.getElementType()) {
case IModelElement.SCRIPT_PROJECT:
- if (isRemoved
- || (isChanged && (delta.getFlags() & IModelElementDelta.F_CLOSED) != 0)) {
+ if (isRemoved || (isChanged && (delta.getFlags()
+ & IModelElementDelta.F_CLOSED) != 0)) {
return true;
}
return processChildrenDelta(delta);
case IModelElement.PROJECT_FRAGMENT:
- if (isRemoved
- || (isChanged && ((delta.getFlags() & IModelElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0 || (delta
- .getFlags() & IModelElementDelta.F_REMOVED_FROM_BUILDPATH) != 0))) {
+ if (isRemoved || (isChanged && ((delta.getFlags()
+ & IModelElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0
+ || (delta.getFlags()
+ & IModelElementDelta.F_REMOVED_FROM_BUILDPATH) != 0))) {
return true;
}
return processChildrenDelta(delta);
case IModelElement.METHOD:
- if (isRemoved
- || isChanged
- && (delta.getFlags() & IModelElementDelta.F_MODIFIERS) != 0) {
+ if (isRemoved || isChanged && (delta.getFlags()
+ & IModelElementDelta.F_MODIFIERS) != 0) {
return true;
}
return false;
@@ -125,9 +126,8 @@
return false;
}
- if (isRemoved
- || (isChanged && isUnknownStructuralChange(delta
- .getFlags()))) {
+ if (isRemoved || (isChanged
+ && isUnknownStructuralChange(delta.getFlags()))) {
return true;
}
return processChildrenDelta(delta);
@@ -255,7 +255,8 @@
// Fetching the timestamp might not be cheap (remote file system
// external Jars. So check if we alreay have one.
if (!fTimestampMapping.containsKey(info)) {
- fTimestampMapping.put(info, Long.valueOf(getContainerTimestamp(info)));
+ fTimestampMapping.put(info,
+ Long.valueOf(getContainerTimestamp(info)));
}
super.accessed(info);
}
@@ -268,8 +269,8 @@
public synchronized void replace(MethodNameMatch old,
MethodNameMatch newMatch) {
fTimestampMapping.remove(old);
- fTimestampMapping.put(newMatch, Long.valueOf(
- getContainerTimestamp(newMatch)));
+ fTimestampMapping.put(newMatch,
+ Long.valueOf(getContainerTimestamp(newMatch)));
super.remove(old);
super.accessed(newMatch);
}
@@ -289,11 +290,12 @@
public synchronized MethodNameMatch[] getFilteredTypeInfos(
MethodInfoFilter filter) {
Collection values = getValues();
- List<MethodNameMatch> result = new ArrayList<MethodNameMatch>();
+ List<MethodNameMatch> result = new ArrayList<>();
for (Iterator iter = values.iterator(); iter.hasNext();) {
MethodNameMatch method = (MethodNameMatch) iter.next();
if ((filter == null || filter.matchesHistoryElement(method))
- && !fMethodFilter.isFiltered(method.getFullyQualifiedName()))
+ && !fMethodFilter
+ .isFiltered(method.getFullyQualifiedName()))
result.add(method);
}
Collections.reverse(result);
@@ -331,10 +333,11 @@
// copy over the modifiers since they may have changed
int modifiers = sMethod.getFlags();
if (modifiers != type.getModifiers()) {
- replace(type, SearchEngine.createMethodNameMatch(
- sMethod, modifiers));
+ replace(type, SearchEngine
+ .createMethodNameMatch(sMethod, modifiers));
} else {
- fTimestampMapping.put(type, Long.valueOf(currentTimestamp));
+ fTimestampMapping.put(type,
+ Long.valueOf(currentTimestamp));
}
}
} catch (ModelException e) {
@@ -368,8 +371,8 @@
} else { // external JAR
IProjectFragment root = match.getProjectFragment();
if (root.exists()) {
- IFileInfo info = EFS.getLocalFileSystem().getStore(
- root.getPath()).fetchInfo();
+ IFileInfo info = EFS.getLocalFileSystem()
+ .getStore(root.getPath()).fetchInfo();
if (info.exists()) {
return info.getLastModified();
}
@@ -390,8 +393,8 @@
if (resource != null) {
ITextFileBufferManager manager = FileBuffers
.getTextFileBufferManager();
- ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(resource
- .getFullPath(), LocationKind.NORMALIZE);
+ ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(
+ resource.getFullPath(), LocationKind.NORMALIZE);
if (textFileBuffer != null) {
return textFileBuffer.isDirty();
}
@@ -420,8 +423,8 @@
} catch (NumberFormatException e) {
// take zero
}
- MethodNameMatch info = SearchEngine.createMethodNameMatch(
- (IMethod) element, modifiers);
+ MethodNameMatch info = SearchEngine
+ .createMethodNameMatch((IMethod) element, modifiers);
long timestamp = IResource.NULL_STAMP;
String timestampValue = type.getAttribute(NODE_TIMESTAMP);
if (timestampValue != null && timestampValue.length() > 0) {
@@ -442,12 +445,12 @@
MethodNameMatch method = (MethodNameMatch) object;
String handleId = method.getMethod().getHandleIdentifier();
typeElement.setAttribute(NODE_HANDLE, handleId);
- typeElement.setAttribute(NODE_MODIFIERS, Integer.toString(method
- .getModifiers()));
+ typeElement.setAttribute(NODE_MODIFIERS,
+ Integer.toString(method.getModifiers()));
Long timestamp = (Long) fTimestampMapping.get(method);
if (timestamp == null) {
- typeElement.setAttribute(NODE_TIMESTAMP, Long
- .toString(IResource.NULL_STAMP));
+ typeElement.setAttribute(NODE_TIMESTAMP,
+ Long.toString(IResource.NULL_STAMP));
} else {
typeElement.setAttribute(NODE_TIMESTAMP, timestamp.toString());
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenTypeHistory.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenTypeHistory.java
index fd1be0f..3a0ceab 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenTypeHistory.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenTypeHistory.java
@@ -56,7 +56,7 @@
// private IDLTKUILanguageToolkit fToolkit = null;
TypeFilter fTypeFilter = null;
- private static Map<IDLTKUILanguageToolkit, OpenTypeHistory> sToolkitHistory = new HashMap<IDLTKUILanguageToolkit, OpenTypeHistory>();
+ private static Map<IDLTKUILanguageToolkit, OpenTypeHistory> sToolkitHistory = new HashMap<>();
public static synchronized OpenTypeHistory getInstance(
IDLTKUILanguageToolkit toolkit) {
@@ -94,21 +94,22 @@
switch (elem.getElementType()) {
case IModelElement.SCRIPT_PROJECT:
- if (isRemoved
- || (isChanged && (delta.getFlags() & IModelElementDelta.F_CLOSED) != 0)) {
+ if (isRemoved || (isChanged && (delta.getFlags()
+ & IModelElementDelta.F_CLOSED) != 0)) {
return true;
}
return processChildrenDelta(delta);
case IModelElement.PROJECT_FRAGMENT:
- if (isRemoved
- || (isChanged && ((delta.getFlags() & IModelElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0 || (delta
- .getFlags() & IModelElementDelta.F_REMOVED_FROM_BUILDPATH) != 0))) {
+ if (isRemoved || (isChanged && ((delta.getFlags()
+ & IModelElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0
+ || (delta.getFlags()
+ & IModelElementDelta.F_REMOVED_FROM_BUILDPATH) != 0))) {
return true;
}
return processChildrenDelta(delta);
case IModelElement.TYPE:
- if (isChanged
- && (delta.getFlags() & IModelElementDelta.F_MODIFIERS) != 0) {
+ if (isChanged && (delta.getFlags()
+ & IModelElementDelta.F_MODIFIERS) != 0) {
return true;
}
// type children can be inner classes: fall through
@@ -124,9 +125,8 @@
return false;
}
- if (isRemoved
- || (isChanged && isUnknownStructuralChange(delta
- .getFlags()))) {
+ if (isRemoved || (isChanged
+ && isUnknownStructuralChange(delta.getFlags()))) {
return true;
}
return processChildrenDelta(delta);
@@ -198,7 +198,7 @@
super(FILENAME
+ toolkit.getCoreToolkit().getNatureId().replace('.', '_')
+ ".xml", NODE_ROOT, NODE_TYPE_INFO); //$NON-NLS-1$
- fTimestampMapping = new HashMap<TypeNameMatch, Long>();
+ fTimestampMapping = new HashMap<>();
fNeedsConsistencyCheck = true;
load();
fDeltaListener = new TypeHistoryDeltaListener();
@@ -255,7 +255,8 @@
// Fetching the timestamp might not be cheap (remote file system
// external Jars. So check if we alreay have one.
if (!fTimestampMapping.containsKey(info)) {
- fTimestampMapping.put(info, Long.valueOf(getContainerTimestamp(info)));
+ fTimestampMapping.put(info,
+ Long.valueOf(getContainerTimestamp(info)));
}
super.accessed(info);
}
@@ -265,10 +266,11 @@
return (TypeNameMatch) super.remove(info);
}
- public synchronized void replace(TypeNameMatch old, TypeNameMatch newMatch) {
+ public synchronized void replace(TypeNameMatch old,
+ TypeNameMatch newMatch) {
fTimestampMapping.remove(old);
- fTimestampMapping.put(newMatch, Long.valueOf(
- getContainerTimestamp(newMatch)));
+ fTimestampMapping.put(newMatch,
+ Long.valueOf(getContainerTimestamp(newMatch)));
super.remove(old);
super.accessed(newMatch);
}
@@ -288,7 +290,7 @@
public synchronized TypeNameMatch[] getFilteredTypeInfos(
TypeInfoFilter filter) {
Collection<?> values = getValues();
- List<TypeNameMatch> result = new ArrayList<TypeNameMatch>();
+ List<TypeNameMatch> result = new ArrayList<>();
for (Iterator<?> iter = values.iterator(); iter.hasNext();) {
TypeNameMatch type = (TypeNameMatch) iter.next();
if (type != null
@@ -336,7 +338,8 @@
replace(type, SearchEngine.createTypeNameMatch(jType,
modifiers));
} else {
- fTimestampMapping.put(type, Long.valueOf(currentTimestamp));
+ fTimestampMapping.put(type,
+ Long.valueOf(currentTimestamp));
}
}
} catch (ModelException e) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
index 900fd08..750d153 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -70,10 +70,10 @@
* The new build path entry that was generated upon calling a method of
* <code>BuildpathModifier</code>. The type indicates which kind of
* interaction was executed on this entry.
- *
+ *
* Note that the list does not contain elements of type
* <code>IBuildpathEntry</code>, but <code>BPListElement</code>
- *
+ *
* @param newEntries
* list of <code>BPListElement</code>
*/
@@ -92,7 +92,7 @@
/**
* Create a linked source folder.
- *
+ *
* @param query
* a query to create a linked source folder
* @param project
@@ -126,7 +126,7 @@
* handlet by the <code>
* Buildpathmodifier</code> itself using the return value of
* <code>FolderCreationQuery.getCreatedFolder()</code>.
- *
+ *
* @param folderQuery
* query to create the new folder
* @param outputQuery
@@ -172,7 +172,7 @@
/**
* Add a list of elements to the build path.
- *
+ *
* @param elements
* a list of elements to be added to the build path. An element
* must either be of type <code>IFolder</code>,
@@ -193,8 +193,8 @@
* @see BuildpathModifierQueries.OutputFolderQuery
*/
protected List addToBuildpath(List elements, IScriptProject project,
- IProgressMonitor monitor) throws OperationCanceledException,
- CoreException {
+ IProgressMonitor monitor)
+ throws OperationCanceledException, CoreException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
@@ -210,7 +210,7 @@
List<BPListElement> existingEntries = getExistingEntries(
project);
- List<BPListElement> newEntries = new ArrayList<BPListElement>();
+ List<BPListElement> newEntries = new ArrayList<>();
for (int i = 0; i < elements.size(); i++) {
Object element = elements.get(i);
BPListElement entry;
@@ -227,9 +227,9 @@
BuildPathBasePage.fixNestingConflicts(
newEntries
.toArray(new BPListElement[newEntries.size()]),
- existingEntries
- .toArray(new BPListElement[existingEntries
- .size()]), modifiedSourceEntries);
+ existingEntries.toArray(
+ new BPListElement[existingEntries.size()]),
+ modifiedSourceEntries);
setNewEntry(existingEntries, newEntries, project,
new SubProgressMonitor(monitor, 1));
@@ -254,8 +254,8 @@
return result;
} else {
StatusInfo rootStatus = new StatusInfo();
- rootStatus
- .setError(NewWizardMessages.BuildpathModifier_Error_NoNatures);
+ rootStatus.setError(
+ NewWizardMessages.BuildpathModifier_Error_NoNatures);
throw new CoreException(rootStatus);
}
} finally {
@@ -266,7 +266,7 @@
/**
* Add external archives (.zip files) to the buildpath. The method uses the
* query to find out which entries need to be added.
- *
+ *
* @param query
* the query to get the information which entries need to be
* added
@@ -277,7 +277,7 @@
* @return a list of <code>IProjectFragment</code>s representing the added
* archives or an empty list if no element was added.
* @throws CoreException
- *
+ *
* @see IAddArchivesQuery
*/
protected List addExternalArchives(IAddArchivesQuery query,
@@ -286,7 +286,7 @@
if (monitor == null)
monitor = new NullProgressMonitor();
IPath[] selected = query.doQuery();
- List<BPListElement> addedEntries = new ArrayList<BPListElement>();
+ List<BPListElement> addedEntries = new ArrayList<>();
try {
monitor.beginTask(
NewWizardMessages.BuildpathModifier_Monitor_AddToBuildpath,
@@ -299,7 +299,8 @@
}
monitor.worked(1);
- List<BPListElement> existingEntries = getExistingEntries(project);
+ List<BPListElement> existingEntries = getExistingEntries(
+ project);
setNewEntry(existingEntries, addedEntries, project,
new SubProgressMonitor(monitor, 1));
updateBuildpath(existingEntries, project,
@@ -309,8 +310,8 @@
for (int i = 0; i < addedEntries.size(); i++) {
IBuildpathEntry entry = addedEntries.get(i)
.getBuildpathEntry();
- IModelElement elem = project.findProjectFragment(entry
- .getPath());
+ IModelElement elem = project
+ .findProjectFragment(entry.getPath());
if (elem != null) {
result.add(elem);
}
@@ -327,7 +328,7 @@
/**
* Add libraries to the buildpath. The method uses the query to find out
* which entries need to be added.
- *
+ *
* @param query
* the query to get the information which entries need to be
* added
@@ -338,7 +339,7 @@
* @return a list of <code>BuildpathContainer</code>s representing the added
* archives or an empty list if no element was added.
* @throws CoreException
- *
+ *
* @see IAddArchivesQuery
*/
protected List<BuildPathContainer> addLibraries(IAddLibrariesQuery query,
@@ -348,7 +349,7 @@
monitor = new NullProgressMonitor();
IBuildpathEntry[] selected = query.doQuery(project,
project.getRawBuildpath());
- List<BPListElement> addedEntries = new ArrayList<BPListElement>();
+ List<BPListElement> addedEntries = new ArrayList<>();
try {
monitor.beginTask(
NewWizardMessages.BuildpathModifier_Monitor_AddToBuildpath,
@@ -356,18 +357,19 @@
if (selected != null) {
for (int i = 0; i < selected.length; i++) {
addedEntries.add(new BPListElement(project,
- IBuildpathEntry.BPE_CONTAINER, selected[i]
- .getPath(), null, false));
+ IBuildpathEntry.BPE_CONTAINER,
+ selected[i].getPath(), null, false));
}
monitor.worked(1);
- List<BPListElement> existingEntries = getExistingEntries(project);
+ List<BPListElement> existingEntries = getExistingEntries(
+ project);
setNewEntry(existingEntries, addedEntries, project,
new SubProgressMonitor(monitor, 1));
updateBuildpath(existingEntries, project,
new SubProgressMonitor(monitor, 1));
- List<BuildPathContainer> result = new ArrayList<BuildPathContainer>(
+ List<BuildPathContainer> result = new ArrayList<>(
addedEntries.size());
for (int i = 0; i < addedEntries.size(); i++) {
result.add(new BuildPathContainer(project, selected[i]));
@@ -378,7 +380,7 @@
} finally {
monitor.done();
}
- return new ArrayList<BuildPathContainer>();
+ return new ArrayList<>();
}
protected List addLibraryEntries(List resources, IScriptProject project,
@@ -392,17 +394,17 @@
4);
for (int i = 0; i < resources.size(); i++) {
IResource res = (IResource) resources.get(i);
- addedEntries.add(new BPListElement(project,
- IBuildpathEntry.BPE_LIBRARY, res.getFullPath(), res,
- false));
+ addedEntries.add(
+ new BPListElement(project, IBuildpathEntry.BPE_LIBRARY,
+ res.getFullPath(), res, false));
}
monitor.worked(1);
List existingEntries = getExistingEntries(project);
setNewEntry(existingEntries, addedEntries, project,
new SubProgressMonitor(monitor, 1));
- updateBuildpath(existingEntries, project, new SubProgressMonitor(
- monitor, 1));
+ updateBuildpath(existingEntries, project,
+ new SubProgressMonitor(monitor, 1));
List result = new ArrayList(addedEntries.size());
for (int i = 0; i < resources.size(); i++) {
@@ -422,7 +424,7 @@
/**
* Remove a list of elements to the build path.
- *
+ *
* @param query
* query to remove unused linked folders from the project
* @param elements
@@ -465,7 +467,8 @@
if (root.getKind() == IProjectFragment.K_BINARY) {
archiveRemoved = true;
res = removeFromBuildpath(root, existingEntries,
- project, new SubProgressMonitor(monitor, 1));
+ project,
+ new SubProgressMonitor(monitor, 1));
} else {
final IResource resource = root
.getCorrespondingResource();
@@ -495,17 +498,16 @@
new SubProgressMonitor(monitor, 1));
}
} else {
- res = removeFromBuildpath(root,
- existingEntries, project,
+ res = removeFromBuildpath(root, existingEntries,
+ project,
new SubProgressMonitor(monitor, 1));
}
}
} else {
archiveRemoved = true;
BuildPathContainer container = (BuildPathContainer) element;
- existingEntries
- .remove(BPListElement.createFromExisting(
- container.getBuildpathEntry(), project));
+ existingEntries.remove(BPListElement.createFromExisting(
+ container.getBuildpathEntry(), project));
}
}
if (res != null) {
@@ -514,8 +516,8 @@
}
- updateBuildpath(existingEntries, project, new SubProgressMonitor(
- monitor, 1));
+ updateBuildpath(existingEntries, project,
+ new SubProgressMonitor(monitor, 1));
fireEvent(existingEntries);
if (archiveRemoved && resultElements.size() == 0)
resultElements.add(project);
@@ -530,11 +532,11 @@
* inclusion filter for the corresponding <code>IProjectFragment</code>s
* need to be modified. All elements must be either be of type
* <code>IResource</code> or <code>IModelElement</code>.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param elements
* a list of elements to be included. The elements must be either
* of type <code>IResource</code> or <code>IModelElement</code>.
@@ -545,7 +547,7 @@
* @return a list of <code>IModelElement</code>s corresponding to the
* included ones.
* @throws ModelException
- *
+ *
* @see #exclude(List, IScriptProject, IProgressMonitor)
*/
protected List include(List elements, IScriptProject project,
@@ -573,13 +575,13 @@
if (root != null) {
BPListElement entry = getBuildpathEntry(existingEntries,
root);
- include(resource, entry, project, new SubProgressMonitor(
- monitor, 1));
+ include(resource, entry, project,
+ new SubProgressMonitor(monitor, 1));
}
}
- updateBuildpath(existingEntries, project, new SubProgressMonitor(
- monitor, 4));
+ updateBuildpath(existingEntries, project,
+ new SubProgressMonitor(monitor, 4));
List scriptElements = getCorrespondingElements(resources, project);
return scriptElements;
} finally {
@@ -591,11 +593,11 @@
* Exclude a list of <code>IModelElement</code>s. This means that the
* exclusion filter for the corresponding <code>IProjectFragment</code>s
* needs to be modified.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param scriptElements
* list of script elements to be excluded
* @param project
@@ -630,8 +632,8 @@
}
}
- updateBuildpath(existingEntries, project, new SubProgressMonitor(
- monitor, 4));
+ updateBuildpath(existingEntries, project,
+ new SubProgressMonitor(monitor, 4));
return resources;
} finally {
monitor.done();
@@ -641,11 +643,11 @@
/**
* Inverse operation to include. The <code>IModelElement</code>s in the list
* will be removed from their fragment roots inclusion filter.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param scriptElements
* a list of <code>IModelElements</code> to be unincluded
* @param project
@@ -654,7 +656,7 @@
* progress monitor, can be <code>null</code>
* @return a list of elements representing unexcluded elements
* @throws ModelException
- *
+ *
* @see #include(List, IScriptProject, IProgressMonitor)
*/
protected List unInclude(List scriptElements, IScriptProject project,
@@ -678,8 +680,8 @@
new SubProgressMonitor(monitor, 1));
}
- updateBuildpath(existingEntries, project, new SubProgressMonitor(
- monitor, 4));
+ updateBuildpath(existingEntries, project,
+ new SubProgressMonitor(monitor, 4));
List result = getCorrespondingElements(scriptElements, project);
return result;
} finally {
@@ -691,11 +693,11 @@
* Inverse operation to <code>exclude</code>. The list of elements of type
* <code>IResource</code> will be removed from the exclusion filters of
* their parent roots.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param elements
* list of <code>IResource</code>s to be unexcluded
* @param project
@@ -704,7 +706,7 @@
* progress monitor, can be <code>null</code>
* @return an object representing the unexcluded element
* @throws ModelException
- *
+ *
* @see #exclude(List, IScriptProject, IProgressMonitor)
* @see #unExclude(List, IScriptProject, IProgressMonitor)
*/
@@ -724,8 +726,8 @@
new SubProgressMonitor(monitor, 1));
if (root != null) {
BPListElement entry = getBuildpathEntry(entries, root);
- unExclude(resource, entry, project, new SubProgressMonitor(
- monitor, 1));
+ unExclude(resource, entry, project,
+ new SubProgressMonitor(monitor, 1));
}
}
@@ -741,7 +743,7 @@
/**
* Edit the filters of a given <code>IModelElement</code> by using the
* passed <code>IInclusionExclusionQuery</code>.
- *
+ *
* @param element
* the script element to edit the filters on. Must be either of
* type <code>IScriptProject</code> or
@@ -784,18 +786,19 @@
}
/**
- * Reset a list of elements. The elements can be either of type <li>
- * <code>IScriptProject</code></li> <li><code>IProjectFragment</code></li>
+ * Reset a list of elements. The elements can be either of type
+ * <li><code>IScriptProject</code></li>
+ * <li><code>IProjectFragment</code></li>
* <li><code>BPListElementAttribute</code></li><br>
- *
+ *
* Depending on the element, resetting performs two different operations:
* <li>On <code>IScriptProject</code> or <code>IProjectFragment</code>, the
* inclusion and exclusion filters are reset. Only entries in the filters
* that correspond to either source folders or output folders will not be
- * removed (to prevent damage on the project layout)</li> <li>On
- * <code>BPListElementAttribute</code>, the output location of the given
- * attribute is reset to the default output location.</li>
- *
+ * removed (to prevent damage on the project layout)</li>
+ * <li>On <code>BPListElementAttribute</code>, the output location of the
+ * given attribute is reset to the default output location.</li>
+ *
* @param project
* the script project
* @param monitor
@@ -847,7 +850,7 @@
/**
* Get the <code>IBuildpathEntry</code> from the project and convert it into
* a list of <code>BPListElement</code>s.
- *
+ *
* @param project
* the script project to get it's build path entries from
* @return a list of <code>BPListElement</code>s corresponding to the build
@@ -857,7 +860,7 @@
public static List<BPListElement> getExistingEntries(IScriptProject project)
throws ModelException {
IBuildpathEntry[] buildpathEntries = project.getRawBuildpath();
- ArrayList<BPListElement> newBuildPath = new ArrayList<BPListElement>();
+ ArrayList<BPListElement> newBuildPath = new ArrayList<>();
for (int i = 0; i < buildpathEntries.length; i++) {
IBuildpathEntry curr = buildpathEntries[i];
newBuildPath.add(BPListElement.createFromExisting(curr, project));
@@ -870,7 +873,7 @@
* the root in the list of elements and return it. If no one can be found,
* the roots <code>BuildpathEntry</code> is converted to a
* <code>BPListElement</code> and returned.
- *
+ *
* @param elements
* a list of <code>BPListElements</code>
* @param root
@@ -900,7 +903,7 @@
* For a given <code>IResource</code>, try to convert it into a
* <code>IProjectFragment</code> if possible or return <code>null</code> if
* no fragment root could be created.
- *
+ *
* @param resource
* the resource to be converted
* @return the <code>resource<code> as
@@ -916,7 +919,7 @@
/**
* Get the source folder of a given <code>IResource</code> element, starting
* with the resource's parent.
- *
+ *
* @param resource
* the resource to get the fragment root from
* @param project
@@ -958,7 +961,7 @@
/**
* Get the <code>IBuildpathEntry</code> for the given path by looking up all
* build path entries on the project
- *
+ *
* @param path
* the path to find a build path entry for
* @param project
@@ -982,7 +985,7 @@
/**
* Check whether the current selection is the project's default output
* folder or not
- *
+ *
* @param attrib
* the attribute to be checked
* @return <code>true</code> if is the default output folder,
@@ -996,7 +999,7 @@
* Determines whether the current selection (of type
* <code>ISourceModule</code> or <code>IScriptFolder</code>) is on the
* inclusion filter of it's parent source folder.
- *
+ *
* @param selection
* the current script element
* @param project
@@ -1014,17 +1017,18 @@
monitor = new NullProgressMonitor();
try {
monitor.beginTask(
- NewWizardMessages.BuildpathModifier_Monitor_ContainsPath, 4);
+ NewWizardMessages.BuildpathModifier_Monitor_ContainsPath,
+ 4);
IProjectFragment root = (IProjectFragment) selection
.getAncestor(IModelElement.PROJECT_FRAGMENT);
IBuildpathEntry entry = root.getRawBuildpathEntry();
if (entry == null)
return false;
return contains(
- selection.getPath().removeFirstSegments(
- root.getPath().segmentCount()),
- entry.getInclusionPatterns(), new SubProgressMonitor(
- monitor, 2));
+ selection.getPath()
+ .removeFirstSegments(root.getPath().segmentCount()),
+ entry.getInclusionPatterns(),
+ new SubProgressMonitor(monitor, 2));
} finally {
monitor.done();
}
@@ -1032,7 +1036,7 @@
/**
* Find out whether the <code>IResource</code> excluded or not.
- *
+ *
* @param resource
* the resource to be checked
* @param project
@@ -1049,14 +1053,13 @@
String fragmentName = getName(resource.getFullPath(), root.getPath());
fragmentName = completeName(project, fragmentName);
IBuildpathEntry entry = root.getRawBuildpathEntry();
- return entry != null
- && contains(new Path(fragmentName),
- entry.getExclusionPatterns(), null);
+ return entry != null && contains(new Path(fragmentName),
+ entry.getExclusionPatterns(), null);
}
/**
* Find out whether one of the <code>IResource</code>'s parents is excluded.
- *
+ *
* @param resource
* check the resources parents whether they are excluded or not
* @param project
@@ -1073,8 +1076,8 @@
if (root == null) {
return true;
}
- IPath path = resource.getFullPath().removeFirstSegments(
- root.getPath().segmentCount());
+ IPath path = resource.getFullPath()
+ .removeFirstSegments(root.getPath().segmentCount());
IBuildpathEntry entry = root.getRawBuildpathEntry();
if (entry == null)
return true; // there is no build path entry, this is equal to the
@@ -1121,7 +1124,7 @@
/**
* Check whether the <code>IScriptProject</code> is a source folder
- *
+ *
* @param project
* the project to test
* @return <code>true</code> if <code>project</code> is a source folder
@@ -1136,7 +1139,7 @@
/**
* Check whether the <code>IScriptFolder</code> corresponds to the project's
* default fragment.
- *
+ *
* @param fragment
* the package fragment to be checked
* @return <code>true</code> if is the default package fragment,
@@ -1149,7 +1152,7 @@
/**
* Determines whether the inclusion filter of the element's source folder is
* empty or not
- *
+ *
* @return <code>true</code> if the inclusion filter is empty,
* <code>false</code> otherwise.
* @throws ModelException
@@ -1179,7 +1182,7 @@
* Check whether the input paramenter of type <code>
* IProjectFragment</code> has either it's inclusion or exclusion filter or
* both set (that means they are not empty).
- *
+ *
* @param root
* the fragment root to be inspected
* @return <code>true</code> inclusion or exclusion filter set,
@@ -1201,7 +1204,7 @@
/**
* Add a resource to the build path.
- *
+ *
* @param resource
* the resource to be added to the build path
* @param project
@@ -1215,8 +1218,8 @@
*/
public static BPListElement addToBuildpath(IResource resource,
List existingEntries, List newEntries, IScriptProject project,
- IProgressMonitor monitor) throws OperationCanceledException,
- CoreException {
+ IProgressMonitor monitor)
+ throws OperationCanceledException, CoreException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
@@ -1236,7 +1239,7 @@
/**
* Check whether the provided file is an archive (.zip).
- *
+ *
* @param file
* the file to be checked
* @param project
@@ -1257,7 +1260,7 @@
/**
* Add a script element to the build path.
- *
+ *
* @param scriptElement
* element to be added to the build path
* @param project
@@ -1271,8 +1274,8 @@
*/
public static BPListElement addToBuildpath(IModelElement scriptElement,
List existingEntries, List newEntries, IScriptProject project,
- IProgressMonitor monitor) throws OperationCanceledException,
- CoreException {
+ IProgressMonitor monitor)
+ throws OperationCanceledException, CoreException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
@@ -1290,7 +1293,7 @@
/**
* Remove the script project from the build path
- *
+ *
* @param project
* the project to be removed
* @param existingEntries
@@ -1313,7 +1316,7 @@
/**
* Remove a given <code>IProjectFragment</code> from the build path.
- *
+ *
* @param root
* the <code>IProjectFragment</code> to be removed from the build
* path
@@ -1327,8 +1330,8 @@
* progress monitor, can be <code>null</code>
* @return returns the <code>IResource</code> that has been removed from the
* build path; is of type <code>IFile</code> if the root was an
- * archive, otherwise <code>IFolder</code> or
- * <code>null<code> for external archives.
+ * archive, otherwise <code>IFolder</code> or <code>null<code> for
+ * external archives.
*/
public static IResource removeFromBuildpath(IProjectFragment root,
List existingEntries, IScriptProject project,
@@ -1353,7 +1356,7 @@
/**
* Remove <code>path</code> from inclusion/exlusion filters in all
* <code>existingEntries</code>
- *
+ *
* @param path
* the path to remove
* @param project
@@ -1382,8 +1385,7 @@
IPath[] exlusions = (IPath[]) element
.getAttribute(BPListElement.EXCLUSION);
if (exlusions != null) {
- List<IPath> exlusionList = new ArrayList<IPath>(
- exlusions.length);
+ List<IPath> exlusionList = new ArrayList<>(exlusions.length);
for (int i = 0; i < exlusions.length; i++) {
if (!exlusions[i].equals(path)) {
exlusionList.add(exlusions[i]);
@@ -1398,8 +1400,7 @@
IPath[] inclusion = (IPath[]) element
.getAttribute(BPListElement.INCLUSION);
if (inclusion != null) {
- List<IPath> inclusionList = new ArrayList<IPath>(
- inclusion.length);
+ List<IPath> inclusionList = new ArrayList<>(inclusion.length);
for (int i = 0; i < inclusion.length; i++) {
if (!inclusion[i].equals(path)) {
inclusionList.add(inclusion[i]);
@@ -1421,11 +1422,11 @@
* Include the given <code>IResource</code>. This means that the inclusion
* filter for the corresponding <code>IProjectFragment</code> needs to be
* modified.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param resource
* the element to be included
* @param entry
@@ -1435,9 +1436,9 @@
* the script project
* @param monitor
* progress monitor, can be <code>null</code>
- *
+ *
* @throws ModelException
- *
+ *
* @see #exclude(List, IScriptProject, IProgressMonitor)
*/
private void include(IResource resource, BPListElement entry,
@@ -1456,17 +1457,15 @@
IPath[] newIncludedPath = new IPath[includedPath.length + 1];
String completedName = completeName(project, name);
IPath relPath = new Path(completedName);
- if (!contains(relPath, includedPath, new SubProgressMonitor(
- monitor, 2))) {
+ if (!contains(relPath, includedPath,
+ new SubProgressMonitor(monitor, 2))) {
System.arraycopy(includedPath, 0, newIncludedPath, 0,
includedPath.length);
newIncludedPath[includedPath.length] = relPath;
entry.setAttribute(BPListElement.INCLUSION, newIncludedPath);
- entry.setAttribute(
- BPListElement.EXCLUSION,
- remove(relPath, (IPath[]) entry
- .getAttribute(BPListElement.EXCLUSION),
- new SubProgressMonitor(monitor, 2)));
+ entry.setAttribute(BPListElement.EXCLUSION, remove(relPath,
+ (IPath[]) entry.getAttribute(BPListElement.EXCLUSION),
+ new SubProgressMonitor(monitor, 2)));
}
} finally {
monitor.done();
@@ -1476,7 +1475,7 @@
/**
* Exclude an element with a given name and absolute path from the build
* path.
- *
+ *
* @param name
* the name of the element to be excluded
* @param fullPath
@@ -1510,11 +1509,9 @@
excludedPath.length);
newExcludedPath[excludedPath.length] = path;
entry.setAttribute(BPListElement.EXCLUSION, newExcludedPath);
- entry.setAttribute(
- BPListElement.INCLUSION,
- remove(path, (IPath[]) entry
- .getAttribute(BPListElement.INCLUSION),
- new SubProgressMonitor(monitor, 4)));
+ entry.setAttribute(BPListElement.INCLUSION, remove(path,
+ (IPath[]) entry.getAttribute(BPListElement.INCLUSION),
+ new SubProgressMonitor(monitor, 4)));
}
result = fullPath == null ? null : getResource(fullPath, project);
} finally {
@@ -1526,15 +1523,15 @@
/**
* Exclude an object at a given path. This means that the exclusion filter
* for the corresponding <code>IProjectFragment</code> needs to be modified.
- *
+ *
* First, the fragment root needs to be found. To do so, the new entries are
* and the existing entries are traversed for a match and the entry with the
* path is removed from one of those lists.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param path
* absolute path of an object to be excluded
* @param existingEntries
@@ -1571,8 +1568,8 @@
elem = existingElem;
}
exclude(path.removeFirstSegments(path.segmentCount() - i)
- .toString(), null, elem, project, new SubProgressMonitor(
- monitor, 1));
+ .toString(), null, elem, project,
+ new SubProgressMonitor(monitor, 1));
} finally {
monitor.done();
}
@@ -1582,11 +1579,11 @@
* Exclude a <code>IModelElement</code>. This means that the exclusion
* filter for the corresponding <code>IProjectFragment</code>s need to be
* modified.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param scriptElement
* the script element to be excluded
* @param entry
@@ -1596,7 +1593,7 @@
* the script project
* @param monitor
* progress monitor, can be <code>null</code>
- *
+ *
* @return the resulting <code>IResource<code>
* @throws ModelException
*/
@@ -1618,11 +1615,11 @@
* Inverse operation to <code>include</code>. The provided
* <code>IModelElement</code> will be removed from the inclusion filters of
* it's root.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param scriptElement
* the script element to be unincluded
* @param entry
@@ -1633,7 +1630,7 @@
* @param monitor
* progress monitor, can be <code>null</code>
* @throws ModelException
- *
+ *
* @see #include(List, IScriptProject, IProgressMonitor)
*/
private void unInclude(IModelElement scriptElement, BPListElement entry,
@@ -1661,11 +1658,11 @@
/**
* Inverse operation to <code>exclude</code>. The resource removed from it's
* fragment roots exlusion filter.
- *
+ *
* Note: the <code>IModelElement</code>'s fragment (if there is one) is not
* allowed to be excluded! However, inclusion (or simply no filter) on the
* parent fragment is allowed.
- *
+ *
* @param resource
* the resource to be unexcluded
* @param entry
@@ -1676,7 +1673,7 @@
* @param monitor
* progress monitor, can be <code>null</code>
* @throws ModelException
- *
+ *
* @see #exclude(List, IScriptProject, IProgressMonitor)
*/
public static void unExclude(IResource resource, BPListElement entry,
@@ -1703,7 +1700,7 @@
/**
* Resets inclusion and exclusion filters for the given
* <code>IModelElement</code>
- *
+ *
* @param element
* element to reset it's filters
* @param entry
@@ -1721,11 +1718,11 @@
monitor = new NullProgressMonitor();
try {
monitor.beginTask(
- NewWizardMessages.BuildpathModifier_Monitor_ResetFilters, 3);
+ NewWizardMessages.BuildpathModifier_Monitor_ResetFilters,
+ 3);
List<IPath> exclusionList = getFoldersOnBP(element.getPath(),
- project,
- new SubProgressMonitor(monitor, 2));
+ project, new SubProgressMonitor(monitor, 2));
IPath[] exclusions = exclusionList
.toArray(new IPath[exclusionList.size()]);
@@ -1741,7 +1738,7 @@
* the provided <code>BPListElement</code> in the list of elements and
* return it. If no one can be found, the provided
* <code>BPListElement</code> is returned.
- *
+ *
* @param elements
* a list of <code>BPListElements</code>
* @param cpElement
@@ -1755,8 +1752,8 @@
public static BPListElement getBuildpathEntry(List elements,
BPListElement cpElement) throws ModelException {
for (int i = 0; i < elements.size(); i++) {
- if (((BPListElement) elements.get(i)).getPath().equals(
- cpElement.getPath()))
+ if (((BPListElement) elements.get(i)).getPath()
+ .equals(cpElement.getPath()))
return (BPListElement) elements.get(i);
}
elements.add(cpElement);
@@ -1765,7 +1762,7 @@
/**
* For a given path, find the corresponding element in the list.
- *
+ *
* @param path
* the path to found an entry for
* @param elements
@@ -1789,7 +1786,7 @@
* entry. For example, this can be necessary after having edited some
* filters on a build path entry, which can happen when including or
* excluding an object.
- *
+ *
* @param newEntries
* a list of <code>BPListElements</code> that should be used as
* build path entries for the project.
@@ -1812,7 +1809,8 @@
if (!status.isOK())
throw new ModelException(status);
- project.setRawBuildpath(entries, new SubProgressMonitor(monitor, 2));
+ project.setRawBuildpath(entries,
+ new SubProgressMonitor(monitor, 2));
fireEvent(newEntries);
} finally {
monitor.done();
@@ -1831,7 +1829,8 @@
if (!status.isOK())
throw new ModelException(status);
- project.setRawBuildpath(entries, new SubProgressMonitor(monitor, 2));
+ project.setRawBuildpath(entries,
+ new SubProgressMonitor(monitor, 2));
} finally {
monitor.done();
}
@@ -1840,11 +1839,12 @@
/**
* For a given list of entries, find out what representation they will have
* in the project and return a list with corresponding elements.
- *
+ *
* @param entries
* a list of entries to find an appropriate representation for.
- * The list can contain elements of two types: <li>
- * <code>IResource</code></li> <li><code>IModelElement</code></li>
+ * The list can contain elements of two types:
+ * <li><code>IResource</code></li>
+ * <li><code>IModelElement</code></li>
* @param project
* the script project
* @return a list of elements corresponding to the passed entries.
@@ -1875,7 +1875,7 @@
/**
* Returns for the given absolute path the corresponding resource, this is
* either element of type <code>IFile</code> or <code>IFolder</code>.
- *
+ *
* @param path
* an absolute path to a resource
* @param project
@@ -1889,7 +1889,7 @@
/**
* Find out whether the provided path equals to one in the array.
- *
+ *
* @param path
* path to find an equivalent for
* @param paths
@@ -1924,9 +1924,9 @@
/**
* Add a '/' at the end of the name if it does not end with extension.
- *
+ *
* XXX this method does nothing, use {@link #completeName(IPath, String)}
- *
+ *
* @param name
* append '/' at the end if necessary
* @return modified string
@@ -1937,7 +1937,7 @@
System.err.println("Add Buildpath name completion here"); //$NON-NLS-1$
}
// if (!DLTKCore.isScriptLikeFileName(name)) {
- // name= name + "/"; //$NON-NLS-1$
+ // name= name + "/"; //$NON-NLS-1$
// name= name.replace('.', '/');
// return name;
// }
@@ -1946,10 +1946,10 @@
/**
* Add a '/' at the end of the name if it does not end with extension.
- *
+ *
* XXX this method incorrectly finds from project, use
* {@link #completeName(IPath, String)}
- *
+ *
* @param project
* - the project containing the resource
* @param name
@@ -1971,7 +1971,7 @@
/**
* Add a '/' at the end of the name if it maps to a folder.
- *
+ *
* @param fullPath
* - the project containing the resource
* @param name
@@ -1981,7 +1981,7 @@
private static String completeName(IPath fullPath, String name) {
// Try to locate the resource in the workspace
IResource resource = ResourcesPlugin.getWorkspace().getRoot()
- .findMember(fullPath); //$NON-NLS-1$
+ .findMember(fullPath); // $NON-NLS-1$
// If the resource is a folder and does not end with "/" add it
if (resource != null && resource.getType() == IResource.FOLDER
&& !name.endsWith("/")) { //$NON-NLS-1$
@@ -1994,9 +1994,9 @@
* Removes <code>path</code> out of the set of given <code>
* paths</code>. If the path is not contained, then the initially provided
* array of paths is returned.
- *
+ *
* Only the first occurrence will be removed.
- *
+ *
* @param path
* path to be removed
* @param paths
@@ -2034,11 +2034,11 @@
* Find all folders that are on the build path and <code>path</code> is a
* prefix of those folders path entry, that is, all folders which are a
* subfolder of <code>path</code>.
- *
+ *
* For example, if <code>path</code>=/MyProject/src then all folders having
* a path like /MyProject/src/*, where * can be any valid string are
* returned if they are also on the project's build path.
- *
+ *
* @param path
* absolute path
* @param project
@@ -2053,7 +2053,7 @@
IProgressMonitor monitor) throws ModelException {
if (monitor == null)
monitor = new NullProgressMonitor();
- List<IPath> srcFolders = new ArrayList<IPath>();
+ List<IPath> srcFolders = new ArrayList<>();
IBuildpathEntry[] cpEntries = project.getRawBuildpath();
for (int i = 0; i < cpEntries.length; i++) {
IPath cpPath = cpEntries[i].getPath();
@@ -2066,9 +2066,8 @@
/**
* Returns a string corresponding to the <code>path</code> with the
- * <code>rootPath<code>'s number of segments
- * removed
- *
+ * <code>rootPath<code>'s number of segments removed
+ *
* @param path
* path to remove segments
* @param rootPath
@@ -2083,7 +2082,7 @@
* Sets and validates the new entries. Note that the elments of the list
* containing the new entries will be added to the list of existing entries
* (therefore, there is no return list for this method).
- *
+ *
* @param existingEntries
* a list of existing buildpath entries
* @param newEntries
@@ -2115,7 +2114,7 @@
/**
* Convert a list of <code>BPListElement</code>s to an array of
* <code>IBuildpathEntry</code>.
- *
+ *
* @param list
* the list to be converted
* @return an array containing build path entries corresponding to the list
@@ -2133,10 +2132,10 @@
* Validate the new entry in the context of the existing entries.
* Furthermore, check if exclusion filters need to be applied and do so if
* necessary.
- *
+ *
* If validation was successfull, add the new entry to the list of existing
* entries.
- *
+ *
* @param entry
* the entry to be validated and added to the list of existing
* entries.
@@ -2152,17 +2151,16 @@
IPath path = entry.getPath();
// IPath projPath= project.getProject().getFullPath();
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IStatus validate = workspaceRoot.getWorkspace().validatePath(
- path.toString(), IResource.FOLDER);
+ IStatus validate = workspaceRoot.getWorkspace()
+ .validatePath(path.toString(), IResource.FOLDER);
StatusInfo rootStatus = new StatusInfo();
rootStatus.setOK();
boolean isExternal = isExternalArchiveOrLibrary(entry, project);
if (!isExternal && validate.matches(IStatus.ERROR)
&& !project.getPath().equals(path)) {
- rootStatus
- .setError(Messages
- .format(NewWizardMessages.NewSourceFolderWizardPage_error_InvalidRootName,
- validate.getMessage()));
+ rootStatus.setError(Messages.format(
+ NewWizardMessages.NewSourceFolderWizardPage_error_InvalidRootName,
+ validate.getMessage()));
throw new CoreException(rootStatus);
} else {
if (!isExternal && !project.getPath().equals(path)) {
@@ -2170,18 +2168,18 @@
if (res != null) {
if (res.getType() != IResource.FOLDER
&& res.getType() != IResource.FILE) {
- rootStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_NotAFolder);
+ rootStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_NotAFolder);
throw new CoreException(rootStatus);
}
} else {
URI projLocation = project.getProject().getLocationURI();
if (projLocation != null) {
- IFileStore store = EFS.getStore(projLocation).getChild(
- path);
+ IFileStore store = EFS.getStore(projLocation)
+ .getChild(path);
if (store.fetchInfo().exists()) {
- rootStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExistingDifferentCase);
+ rootStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExistingDifferentCase);
throw new CoreException(rootStatus);
}
}
@@ -2193,8 +2191,8 @@
if (curr.getEntryKind() == IBuildpathEntry.BPE_SOURCE) {
if (path.equals(curr.getPath())
&& !project.getPath().equals(path)) {
- rootStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExisting);
+ rootStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExisting);
throw new CoreException(rootStatus);
}
}
@@ -2216,8 +2214,8 @@
}
if (isSourceFolder(project) || project.getPath().equals(path)) {
- rootStatus
- .setWarning(NewWizardMessages.NewSourceFolderWizardPage_warning_ReplaceSF);
+ rootStatus.setWarning(
+ NewWizardMessages.NewSourceFolderWizardPage_warning_ReplaceSF);
return;
}
@@ -2232,9 +2230,8 @@
BPListElement[] elements = (BPListElement[]) existingEntries
.toArray(new BPListElement[length]);
int i = 0;
- while (i < length
- && elements[i].getBuildpathEntry().getEntryKind() != entry
- .getBuildpathEntry().getEntryKind()) {
+ while (i < length && elements[i].getBuildpathEntry()
+ .getEntryKind() != entry.getBuildpathEntry().getEntryKind()) {
i++;
}
if (i < length) {
@@ -2276,7 +2273,7 @@
/**
* Test if the provided kind is of type
* <code>IBuildpathEntry.BPE_SOURCE</code>
- *
+ *
* @param entry
* the buildpath entry to be compared with the provided type
* @param kind
@@ -2292,9 +2289,9 @@
/**
* Event fired whenever build pathentries changed. The event parameter
* corresponds to the a <code>List</code> of <code>BPListElement</code>s
- *
+ *
* @param newEntries
- *
+ *
* @see #addToBuildpath(List, IScriptProject, OutputFolderQuery,
* IProgressMonitor)
* @see #removeFromBuildpath(IRemoveLinkedFolderQuery, List, IScriptProject,
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java
index 1926bee..d2638cc 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
*
- * (report 36180: Callers/Callees view)
*******************************************************************************/
package org.eclipse.dltk.internal.corext.callhierarchy;
@@ -28,196 +27,203 @@
import org.eclipse.dltk.ui.DLTKUIPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
-
public class CallHierarchy {
- private static final String PREF_USE_IMPLEMENTORS= "PREF_USE_IMPLEMENTORS"; //$NON-NLS-1$
- private static final String PREF_USE_FILTERS = "PREF_USE_FILTERS"; //$NON-NLS-1$
- private static final String PREF_FILTERS_LIST = "PREF_FILTERS_LIST"; //$NON-NLS-1$
+ private static final String PREF_USE_IMPLEMENTORS = "PREF_USE_IMPLEMENTORS"; //$NON-NLS-1$
+ private static final String PREF_USE_FILTERS = "PREF_USE_FILTERS"; //$NON-NLS-1$
+ private static final String PREF_FILTERS_LIST = "PREF_FILTERS_LIST"; //$NON-NLS-1$
- private static final String DEFAULT_IGNORE_FILTERS = "java.*,javax.*"; //$NON-NLS-1$
- private static CallHierarchy fgInstance;
- private IDLTKSearchScope fSearchScope;
- private StringMatcher[] fFilters;
+ private static final String DEFAULT_IGNORE_FILTERS = "java.*,javax.*"; //$NON-NLS-1$
+ private static CallHierarchy fgInstance;
+ private IDLTKSearchScope fSearchScope;
+ private StringMatcher[] fFilters;
- public static CallHierarchy getDefault() {
- if (fgInstance == null) {
- fgInstance = new CallHierarchy();
- }
+ public static CallHierarchy getDefault() {
+ if (fgInstance == null) {
+ fgInstance = new CallHierarchy();
+ }
- return fgInstance;
- }
+ return fgInstance;
+ }
- public boolean isSearchUsingImplementorsEnabled() {
- IPreferenceStore settings = DLTKUIPlugin.getDefault().getPreferenceStore();
+ public boolean isSearchUsingImplementorsEnabled() {
+ IPreferenceStore settings = DLTKUIPlugin.getDefault()
+ .getPreferenceStore();
- return settings.getBoolean(PREF_USE_IMPLEMENTORS);
- }
+ return settings.getBoolean(PREF_USE_IMPLEMENTORS);
+ }
- public void setSearchUsingImplementorsEnabled(boolean enabled) {
- IPreferenceStore settings = DLTKUIPlugin.getDefault().getPreferenceStore();
+ public void setSearchUsingImplementorsEnabled(boolean enabled) {
+ IPreferenceStore settings = DLTKUIPlugin.getDefault()
+ .getPreferenceStore();
- settings.setValue(PREF_USE_IMPLEMENTORS, enabled);
- }
+ settings.setValue(PREF_USE_IMPLEMENTORS, enabled);
+ }
- public Collection getImplementingMethods(IMethod method) {
- if (isSearchUsingImplementorsEnabled()) {
- IModelElement[] result = Implementors.getInstance().searchForImplementors(new IModelElement[] {
- method
- }, new NullProgressMonitor());
+ public Collection getImplementingMethods(IMethod method) {
+ if (isSearchUsingImplementorsEnabled()) {
+ IModelElement[] result = Implementors.getInstance()
+ .searchForImplementors(new IModelElement[] { method },
+ new NullProgressMonitor());
- if ((result != null) && (result.length > 0)) {
- return Arrays.asList(result);
- }
- }
+ if ((result != null) && (result.length > 0)) {
+ return Arrays.asList(result);
+ }
+ }
- return new ArrayList(0);
- }
+ return new ArrayList(0);
+ }
- public MethodWrapper getCallerRoot(IMethod method) {
- return new CallerMethodWrapper(null, new MethodCall(method));
- }
+ public MethodWrapper getCallerRoot(IMethod method) {
+ return new CallerMethodWrapper(null, new MethodCall(method));
+ }
- public MethodWrapper getCalleeRoot(IMethod method) {
- return new CalleeMethodWrapper(null, new MethodCall(method));
- }
+ public MethodWrapper getCalleeRoot(IMethod method) {
+ return new CalleeMethodWrapper(null, new MethodCall(method));
+ }
- public static CallLocation getCallLocation(Object element) {
- CallLocation callLocation = null;
+ public static CallLocation getCallLocation(Object element) {
+ CallLocation callLocation = null;
- if (element instanceof MethodWrapper) {
- MethodWrapper methodWrapper = (MethodWrapper) element;
- MethodCall methodCall = methodWrapper.getMethodCall();
+ if (element instanceof MethodWrapper) {
+ MethodWrapper methodWrapper = (MethodWrapper) element;
+ MethodCall methodCall = methodWrapper.getMethodCall();
- if (methodCall != null) {
- callLocation = methodCall.getFirstCallLocation();
- }
- } else if (element instanceof CallLocation) {
- callLocation = (CallLocation) element;
- }
+ if (methodCall != null) {
+ callLocation = methodCall.getFirstCallLocation();
+ }
+ } else if (element instanceof CallLocation) {
+ callLocation = (CallLocation) element;
+ }
- return callLocation;
- }
+ return callLocation;
+ }
- public IDLTKSearchScope getSearchScope(IDLTKLanguageToolkit toolkit) {
- if (fSearchScope == null) {
- fSearchScope= SearchEngine.createWorkspaceScope(toolkit);
- }
+ public IDLTKSearchScope getSearchScope(IDLTKLanguageToolkit toolkit) {
+ if (fSearchScope == null) {
+ fSearchScope = SearchEngine.createWorkspaceScope(toolkit);
+ }
- return fSearchScope;
- }
+ return fSearchScope;
+ }
- public void setSearchScope(IDLTKSearchScope searchScope) {
- this.fSearchScope = searchScope;
- }
+ public void setSearchScope(IDLTKSearchScope searchScope) {
+ this.fSearchScope = searchScope;
+ }
- /**
- * Checks whether the fully qualified name is ignored by the set filters.
- *
- * @param fullyQualifiedName
- *
- * @return True if the fully qualified name is ignored.
- */
- public boolean isIgnored(String fullyQualifiedName) {
- if ((getIgnoreFilters() != null) && (getIgnoreFilters().length > 0)) {
- for (int i = 0; i < getIgnoreFilters().length; i++) {
- String fullyQualifiedName1 = fullyQualifiedName;
+ /**
+ * Checks whether the fully qualified name is ignored by the set filters.
+ *
+ * @param fullyQualifiedName
+ *
+ * @return True if the fully qualified name is ignored.
+ */
+ public boolean isIgnored(String fullyQualifiedName) {
+ if ((getIgnoreFilters() != null) && (getIgnoreFilters().length > 0)) {
+ for (int i = 0; i < getIgnoreFilters().length; i++) {
+ String fullyQualifiedName1 = fullyQualifiedName;
- if (getIgnoreFilters()[i].match(fullyQualifiedName1)) {
- return true;
- }
- }
- }
+ if (getIgnoreFilters()[i].match(fullyQualifiedName1)) {
+ return true;
+ }
+ }
+ }
- return false;
- }
+ return false;
+ }
- public boolean isFilterEnabled() {
- IPreferenceStore settings = DLTKUIPlugin.getDefault().getPreferenceStore();
- return settings.getBoolean(PREF_USE_FILTERS);
- }
+ public boolean isFilterEnabled() {
+ IPreferenceStore settings = DLTKUIPlugin.getDefault()
+ .getPreferenceStore();
+ return settings.getBoolean(PREF_USE_FILTERS);
+ }
- public void setFilterEnabled(boolean filterEnabled) {
- IPreferenceStore settings = DLTKUIPlugin.getDefault().getPreferenceStore();
- settings.setValue(PREF_USE_FILTERS, filterEnabled);
- }
-
- /**
- * Returns the current filters as a string.
- */
- public String getFilters() {
- IPreferenceStore settings = DLTKUIPlugin.getDefault().getPreferenceStore();
+ public void setFilterEnabled(boolean filterEnabled) {
+ IPreferenceStore settings = DLTKUIPlugin.getDefault()
+ .getPreferenceStore();
+ settings.setValue(PREF_USE_FILTERS, filterEnabled);
+ }
- return settings.getString(PREF_FILTERS_LIST);
- }
+ /**
+ * Returns the current filters as a string.
+ */
+ public String getFilters() {
+ IPreferenceStore settings = DLTKUIPlugin.getDefault()
+ .getPreferenceStore();
- public void setFilters(String filters) {
- fFilters = null;
+ return settings.getString(PREF_FILTERS_LIST);
+ }
- IPreferenceStore settings = DLTKUIPlugin.getDefault().getPreferenceStore();
- settings.setValue(PREF_FILTERS_LIST, filters);
- }
+ public void setFilters(String filters) {
+ fFilters = null;
- /**
- * Returns filters for packages which should not be included in the search results.
- *
- * @return StringMatcher[]
- */
- private StringMatcher[] getIgnoreFilters() {
- if (fFilters == null) {
- String filterString = null;
+ IPreferenceStore settings = DLTKUIPlugin.getDefault()
+ .getPreferenceStore();
+ settings.setValue(PREF_FILTERS_LIST, filters);
+ }
- if (isFilterEnabled()) {
- filterString = getFilters();
+ /**
+ * Returns filters for packages which should not be included in the search
+ * results.
+ *
+ * @return StringMatcher[]
+ */
+ private StringMatcher[] getIgnoreFilters() {
+ if (fFilters == null) {
+ String filterString = null;
- if (filterString == null) {
- filterString = DEFAULT_IGNORE_FILTERS;
- }
- }
+ if (isFilterEnabled()) {
+ filterString = getFilters();
- if (filterString != null) {
- fFilters = parseList(filterString);
- } else {
- fFilters = null;
- }
- }
+ if (filterString == null) {
+ filterString = DEFAULT_IGNORE_FILTERS;
+ }
+ }
- return fFilters;
- }
+ if (filterString != null) {
+ fFilters = parseList(filterString);
+ } else {
+ fFilters = null;
+ }
+ }
- /**
- * Parses the comma separated string into an array of StringMatcher objects
- *
- * @return list
- */
- private static StringMatcher[] parseList(String listString) {
- List<StringMatcher> list = new ArrayList<StringMatcher>(10);
- StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$
+ return fFilters;
+ }
- while (tokenizer.hasMoreTokens()) {
- String textFilter = tokenizer.nextToken().trim();
- list.add(new StringMatcher(textFilter, false, false));
- }
+ /**
+ * Parses the comma separated string into an array of StringMatcher objects
+ *
+ * @return list
+ */
+ private static StringMatcher[] parseList(String listString) {
+ List<StringMatcher> list = new ArrayList<>(10);
+ StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$
+
+ while (tokenizer.hasMoreTokens()) {
+ String textFilter = tokenizer.nextToken().trim();
+ list.add(new StringMatcher(textFilter, false, false));
+ }
return list.toArray(new StringMatcher[list.size()]);
- }
-
- public static boolean arePossibleInputElements(List elements) {
+ }
+
+ public static boolean arePossibleInputElements(List elements) {
if (elements.size() < 1)
return false;
- for (Iterator iter= elements.iterator(); iter.hasNext();) {
- if (! isPossibleInputElement(iter.next()))
+ for (Iterator iter = elements.iterator(); iter.hasNext();) {
+ if (!isPossibleInputElement(iter.next()))
return false;
}
return true;
}
- public static boolean isPossibleInputElement(Object element){
- if (! (element instanceof IMember))
- return false;
-
- if (element instanceof IType) {
+
+ public static boolean isPossibleInputElement(Object element) {
+ if (!(element instanceof IMember))
+ return false;
+
+ if (element instanceof IType) {
return false;
}
-
- return true;
- }
+
+ return true;
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java
index a406105..bacebdc 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -31,7 +31,6 @@
import org.eclipse.dltk.internal.ui.DLTKUIStatus;
import org.eclipse.dltk.ui.DLTKUIPlugin;
-
public class Resources {
private Resources() {
@@ -39,140 +38,154 @@
/**
* Checks if the given resource is in sync with the underlying file system.
- *
- * @param resource the resource to be checked
+ *
+ * @param resource
+ * the resource to be checked
* @return IStatus status describing the check's result. If <code>status.
* isOK()</code> returns <code>true</code> then the resource is in sync
*/
public static IStatus checkInSync(IResource resource) {
- return checkInSync(new IResource[] {resource});
+ return checkInSync(new IResource[] { resource });
}
-
+
/**
* Checks if the given resources are in sync with the underlying file
* system.
- *
- * @param resources the resources to be checked
+ *
+ * @param resources
+ * the resources to be checked
* @return IStatus status describing the check's result. If <code>status.
* isOK() </code> returns <code>true</code> then the resources are in sync
*/
public static IStatus checkInSync(IResource[] resources) {
- IStatus result= null;
- for (int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
+ IStatus result = null;
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
if (!resource.isSynchronized(IResource.DEPTH_INFINITE)) {
- result= addOutOfSync(result, resource);
- }
+ result = addOutOfSync(result, resource);
+ }
}
if (result != null)
return result;
- return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
+ null);
}
/**
* Makes the given resource committable. Committable means that it is
* writeable and that its content hasn't changed by calling
* <code>validateEdit</code> for the given resource on <tt>IWorkspace</tt>.
- *
- * @param resource the resource to be checked
- * @param context the context passed to <code>validateEdit</code>
- * @return status describing the method's result. If <code>status.isOK()</code> returns <code>true</code> then the resources are committable.
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
+ *
+ * @param resource
+ * the resource to be checked
+ * @param context
+ * the context passed to <code>validateEdit</code>
+ * @return status describing the method's result. If
+ * <code>status.isOK()</code> returns <code>true</code> then the
+ * resources are committable.
+ *
+ * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
+ * java.lang.Object)
*/
public static IStatus makeCommittable(IResource resource, Object context) {
return makeCommittable(new IResource[] { resource }, context);
}
-
+
/**
* Makes the given resources committable. Committable means that all
* resources are writeable and that the content of the resources hasn't
* changed by calling <code>validateEdit</code> for a given file on
* <tt>IWorkspace</tt>.
- *
- * @param resources the resources to be checked
- * @param context the context passed to <code>validateEdit</code>
+ *
+ * @param resources
+ * the resources to be checked
+ * @param context
+ * the context passed to <code>validateEdit</code>
* @return IStatus status describing the method's result. If <code>status.
* isOK()</code> returns <code>true</code> then the add resources are
- * committable
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
+ * committable
+ *
+ * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
+ * java.lang.Object)
*/
- public static IStatus makeCommittable(IResource[] resources, Object context) {
- List<IFile> readOnlyFiles = new ArrayList<IFile>();
- for (int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (resource.getType() == IResource.FILE && isReadOnly(resource))
+ public static IStatus makeCommittable(IResource[] resources,
+ Object context) {
+ List<IFile> readOnlyFiles = new ArrayList<>();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (resource.getType() == IResource.FILE && isReadOnly(resource))
readOnlyFiles.add((IFile) resource);
}
if (readOnlyFiles.size() == 0)
- return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
-
- Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
- IStatus status= ResourcesPlugin.getWorkspace().validateEdit(
+ return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK,
+ "", null); //$NON-NLS-1$
+
+ Map oldTimeStamps = createModificationStampMap(readOnlyFiles);
+ IStatus status = ResourcesPlugin.getWorkspace().validateEdit(
readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]),
context);
if (!status.isOK())
return status;
-
- IStatus modified= null;
- Map newTimeStamps= createModificationStampMap(readOnlyFiles);
- for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
- IFile file= (IFile) iter.next();
+
+ IStatus modified = null;
+ Map newTimeStamps = createModificationStampMap(readOnlyFiles);
+ for (Iterator iter = oldTimeStamps.keySet().iterator(); iter
+ .hasNext();) {
+ IFile file = (IFile) iter.next();
if (!oldTimeStamps.get(file).equals(newTimeStamps.get(file)))
- modified= addModified(modified, file);
+ modified = addModified(modified, file);
}
- if (modified != null)
+ if (modified != null)
return modified;
- return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
+ return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
+ null);
}
- private static Map createModificationStampMap(List files){
- Map map= new HashMap();
- for (Iterator iter= files.iterator(); iter.hasNext(); ) {
- IFile file= (IFile)iter.next();
+ private static Map createModificationStampMap(List files) {
+ Map map = new HashMap();
+ for (Iterator iter = files.iterator(); iter.hasNext();) {
+ IFile file = (IFile) iter.next();
map.put(file, Long.valueOf(file.getModificationStamp()));
}
return map;
}
-
+
private static IStatus addModified(IStatus status, IFile file) {
- IStatus entry= DLTKUIStatus.createError(
- IModelStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
- Messages.format(CorextMessages.Resources_fileModified, file.getFullPath().toString()),
- null);
+ IStatus entry = DLTKUIStatus.createError(
+ IModelStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
+ Messages.format(CorextMessages.Resources_fileModified,
+ file.getFullPath().toString()),
+ null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
- ((MultiStatus)status).add(entry);
+ ((MultiStatus) status).add(entry);
return status;
} else {
- MultiStatus result= new MultiStatus(DLTKUIPlugin.PLUGIN_ID,
- IModelStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
- CorextMessages.Resources_modifiedResources, null);
+ MultiStatus result = new MultiStatus(DLTKUIPlugin.PLUGIN_ID,
+ IModelStatusConstants.VALIDATE_EDIT_CHANGED_CONTENT,
+ CorextMessages.Resources_modifiedResources, null);
result.add(status);
result.add(entry);
return result;
}
- }
+ }
private static IStatus addOutOfSync(IStatus status, IResource resource) {
- IStatus entry= new Status(
- IStatus.ERROR,
- ResourcesPlugin.PI_RESOURCES,
- IResourceStatus.OUT_OF_SYNC_LOCAL,
- Messages.format(CorextMessages.Resources_outOfSync, resource.getFullPath().toString()),
- null);
+ IStatus entry = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES,
+ IResourceStatus.OUT_OF_SYNC_LOCAL,
+ Messages.format(CorextMessages.Resources_outOfSync,
+ resource.getFullPath().toString()),
+ null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
- ((MultiStatus)status).add(entry);
+ ((MultiStatus) status).add(entry);
return status;
} else {
- MultiStatus result= new MultiStatus(
- ResourcesPlugin.PI_RESOURCES,
- IResourceStatus.OUT_OF_SYNC_LOCAL,
- CorextMessages.Resources_outOfSyncResources, null);
+ MultiStatus result = new MultiStatus(ResourcesPlugin.PI_RESOURCES,
+ IResourceStatus.OUT_OF_SYNC_LOCAL,
+ CorextMessages.Resources_outOfSyncResources, null);
result.add(status);
result.add(entry);
return result;
@@ -180,53 +193,58 @@
}
/**
- * This method is used to generate a list of local locations to
- * be used in DnD for file transfers.
- *
- * @param resources the array of resources to get the local
- * locations for
+ * This method is used to generate a list of local locations to be used in
+ * DnD for file transfers.
+ *
+ * @param resources
+ * the array of resources to get the local locations for
* @return the local locations
*/
public static String[] getLocationOSStrings(IResource[] resources) {
- List<String> result = new ArrayList<String>(resources.length);
- for (int i= 0; i < resources.length; i++) {
- IPath location= resources[i].getLocation();
+ List<String> result = new ArrayList<>(resources.length);
+ for (int i = 0; i < resources.length; i++) {
+ IPath location = resources[i].getLocation();
if (location != null)
result.add(location.toOSString());
}
return result.toArray(new String[result.size()]);
}
-
+
/**
- * Returns the location of the given resource. For local
- * resources this is the OS path in the local file system. For
- * remote resource this is the URI.
- *
- * @param resource the resource
- * @return the location string or <code>null</code> if the
- * location URI of the resource is <code>null</code>
+ * Returns the location of the given resource. For local resources this is
+ * the OS path in the local file system. For remote resource this is the
+ * URI.
+ *
+ * @param resource
+ * the resource
+ * @return the location string or <code>null</code> if the location URI of
+ * the resource is <code>null</code>
*/
public static String getLocationString(IResource resource) {
- URI uri= resource.getLocationURI();
+ URI uri = resource.getLocationURI();
if (uri == null)
return null;
return EFS.SCHEME_FILE.equalsIgnoreCase(uri.getScheme())
- ? new File(uri).getAbsolutePath()
- : uri.toString();
+ ? new File(uri).getAbsolutePath()
+ : uri.toString();
}
-
+
public static boolean isReadOnly(IResource resource) {
- ResourceAttributes resourceAttributes = resource.getResourceAttributes();
- if (resourceAttributes == null) // not supported on this platform for this resource
+ ResourceAttributes resourceAttributes = resource
+ .getResourceAttributes();
+ if (resourceAttributes == null) // not supported on this platform for
+ // this resource
return false;
return resourceAttributes.isReadOnly();
}
-
+
static void setReadOnly(IResource resource, boolean readOnly) {
- ResourceAttributes resourceAttributes = resource.getResourceAttributes();
- if (resourceAttributes == null) // not supported on this platform for this resource
+ ResourceAttributes resourceAttributes = resource
+ .getResourceAttributes();
+ if (resourceAttributes == null) // not supported on this platform for
+ // this resource
return;
-
+
resourceAttributes.setReadOnly(readOnly);
try {
resource.setResourceAttributes(resourceAttributes);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/StandardModelElementContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/StandardModelElementContentProvider.java
index 7bd489a..173ea9b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/StandardModelElementContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/StandardModelElementContentProvider.java
@@ -161,8 +161,7 @@
final IModelContentProvider[] providers = UIModelProviderManager
.getContentProviders(getToolkitID(element));
if (providers.length > 0) {
- final List<Object> elements = new ArrayList<Object>(
- children.length + 2);
+ final List<Object> elements = new ArrayList<>(children.length + 2);
Collections.addAll(elements, children);
for (int i = 0; i < providers.length; i++) {
providers[i].provideModelChanges(element, elements, this);
@@ -315,7 +314,7 @@
throws ModelException {
IModelElement[] fragments = root.getChildren();
- List<IModelElement> newFragments = new ArrayList<IModelElement>();
+ List<IModelElement> newFragments = new ArrayList<>();
for (int i = 0; i < fragments.length; ++i) {
if (fragments[i] instanceof IScriptFolder) {
IScriptFolder scriptFolder = ((IScriptFolder) fragments[i]);
@@ -359,7 +358,7 @@
return NO_CHILDREN;
IProjectFragment[] roots = project.getProjectFragments();
- List<Object> list = new ArrayList<Object>(roots.length);
+ List<Object> list = new ArrayList<>(roots.length);
// filter out package fragments that correspond to projects and
// replace them with the package fragments directly
for (int i = 0; i < roots.length; i++) {
@@ -429,7 +428,7 @@
if (javaProject == null || !javaProject.exists())
return members;
boolean isFolderOnClasspath = javaProject.isOnBuildpath(folder);
- List<Object> nonJavaResources = new ArrayList<Object>();
+ List<Object> nonJavaResources = new ArrayList<>();
// Can be on classpath but as a member of non-java resource folder
for (int i = 0; i < members.length; i++) {
IResource member = members[i];
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/UIModelProviderManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/UIModelProviderManager.java
index 32fd31e..886fcb1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/UIModelProviderManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/UIModelProviderManager.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
*
* 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
+ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* xored software, Inc. - initial API and Implementation (Andrei Sobolev)
@@ -56,7 +56,7 @@
contentProviders = initializeProviders(contentProviderManager);
}
if (lang == null) {
- List<IModelContentProvider> providers = new ArrayList<IModelContentProvider>();
+ List<IModelContentProvider> providers = new ArrayList<>();
for (List<IModelContentProvider> elements : contentProviders
.values()) {
providers.addAll(elements);
@@ -76,7 +76,7 @@
labelProviders = initializeProviders(labelProviderManager);
}
if (lang == null) {
- List<ILabelProvider> providers = new ArrayList<ILabelProvider>();
+ List<ILabelProvider> providers = new ArrayList<>();
for (List<ILabelProvider> elements : labelProviders.values()) {
providers.addAll(elements);
}
@@ -95,7 +95,7 @@
compareProviders = initializeProviders(compareProviderManager);
}
if (lang == null) {
- List<IModelCompareProvider> providers = new ArrayList<IModelCompareProvider>();
+ List<IModelCompareProvider> providers = new ArrayList<>();
for (List<IModelCompareProvider> elements : compareProviders
.values()) {
providers.addAll(elements);
@@ -112,15 +112,15 @@
private synchronized static <T> Map<String, List<T>> initializeProviders(
SimpleClassDLTKExtensionManager manager) {
- Map<String, List<T>> providers = new HashMap<String, List<T>>();
+ Map<String, List<T>> providers = new HashMap<>();
ElementInfo[] infos = manager.getElementInfos();
- Map<String, List<ElementInfo>> langToElementList = new HashMap<String, List<ElementInfo>>();
+ Map<String, List<ElementInfo>> langToElementList = new HashMap<>();
// Fill element names and sort elements by language
for (int i = 0; i < infos.length; i++) {
String langauge = infos[i].getConfig().getAttribute(LANGUAGE);
List<ElementInfo> elements = langToElementList.get(langauge);
if (elements == null) {
- elements = new ArrayList<ElementInfo>();
+ elements = new ArrayList<>();
langToElementList.put(langauge, elements);
}
elements.add(infos[i]);
@@ -131,16 +131,16 @@
List<ElementInfo> elements = entry.getValue();
// Contains map for all ids
- Set<String> allIds = new HashSet<String>();
+ Set<String> allIds = new HashSet<>();
for (ElementInfo info : elements) {
allIds.add(info.getConfig().getAttribute(ID));
}
// Final IModelProvider elements
- List<T> result = new ArrayList<T>();
+ List<T> result = new ArrayList<>();
// Contains names for added elements
- Set<String> added = new HashSet<String>();
+ Set<String> added = new HashSet<>();
// Process elements and keep dependencies
- List<ElementInfo> toProcess = new ArrayList<ElementInfo>(elements);
+ List<ElementInfo> toProcess = new ArrayList<>(elements);
while (!toProcess.isEmpty()) {
ElementInfo info = toProcess.remove(0);
String requires = info.getConfig().getAttribute(REQUIRES);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenActionUtil.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenActionUtil.java
index 7097630..94f04c3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenActionUtil.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenActionUtil.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.actions;
@@ -32,8 +31,8 @@
/**
* Opens the editor on the given element and subsequently selects it.
*/
- public static void open(Object element) throws ModelException,
- PartInitException {
+ public static void open(Object element)
+ throws ModelException, PartInitException {
open(element, true);
}
@@ -54,7 +53,7 @@
public static List<IModelElement> filterResolveResults(
IModelElement[] codeResolveResults) {
int nResults = codeResolveResults.length;
- List<IModelElement> refs = new ArrayList<IModelElement>(nResults);
+ List<IModelElement> refs = new ArrayList<>(nResults);
for (int i = 0; i < nResults; i++) {
if (codeResolveResults[i] instanceof ISourceReference)
refs.add(codeResolveResults[i]);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java
index ba71d85..3662d4e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/OpenModelElementWithMenu.java
@@ -65,8 +65,7 @@
private IEditorRegistry registry = PlatformUI.getWorkbench()
.getEditorRegistry();
- static Hashtable<ImageDescriptor, Image> imageCache = new Hashtable<ImageDescriptor, Image>(
- 11);
+ static Hashtable<ImageDescriptor, Image> imageCache = new Hashtable<>(11);
/**
* The id of this action.
@@ -250,7 +249,7 @@
// Check that we don't add it twice. This is possible
// if the same editor goes to two mappings.
- ArrayList<IEditorDescriptor> alreadyMapped = new ArrayList<IEditorDescriptor>();
+ ArrayList<IEditorDescriptor> alreadyMapped = new ArrayList<>();
if (preferredEditor != null) {
createMenuItem(menu, preferredEditor, preferredEditor);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
index e088d92..bbdafa9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
@@ -100,14 +100,14 @@
}
/**
- * Returns the shortcut assigned to the sub menu or <code>null</code> if
- * no short cut is assigned.
+ * Returns the shortcut assigned to the sub menu or <code>null</code> if no
+ * short cut is assigned.
*
* @return the shortcut as a human readable string or <code>null</code>
*/
private String getShortcutString() {
- IBindingService bindingService = PlatformUI
- .getWorkbench().getAdapter(IBindingService.class);
+ IBindingService bindingService = PlatformUI.getWorkbench()
+ .getAdapter(IBindingService.class);
if (bindingService == null)
return null;
return bindingService
@@ -139,10 +139,10 @@
clientArea.y + clientArea.height / 2);
}
Rectangle shellArea = focus.getShell().getClientArea();
- if (!shellArea.contains(focus.getShell().toControl(
- focus.toDisplay(result)))) {
- result = new Point(shellArea.x + shellArea.width / 2, shellArea.y
- + shellArea.height / 2);
+ if (!shellArea.contains(
+ focus.getShell().toControl(focus.toDisplay(result)))) {
+ result = new Point(shellArea.x + shellArea.width / 2,
+ shellArea.y + shellArea.height / 2);
}
return focus.toDisplay(result);
}
@@ -187,9 +187,11 @@
Rectangle bounds = items[0].getBounds();
Rectangle intersect = clientArea.intersection(bounds);
if (intersect != null && intersect.height == bounds.height) {
- return new Point(Math.max(0, bounds.x
- + getAvarageCharWith(tree) * CHAR_INDENT), bounds.y
- + bounds.height);
+ return new Point(
+ Math.max(0,
+ bounds.x + getAvarageCharWith(tree)
+ * CHAR_INDENT),
+ bounds.y + bounds.height);
} else {
return null;
}
@@ -199,8 +201,9 @@
rectangles[i] = items[i].getBounds();
}
Point cursorLocation = tree.getDisplay().getCursorLocation();
- Point result = findBestLocation(getIncludedPositions(rectangles,
- clientArea), tree.toControl(cursorLocation));
+ Point result = findBestLocation(
+ getIncludedPositions(rectangles, clientArea),
+ tree.toControl(cursorLocation));
if (result != null)
result.x = result.x + getAvarageCharWith(tree) * CHAR_INDENT;
return result;
@@ -229,9 +232,12 @@
Rectangle iBounds = items[0].getImageBounds(0);
Rectangle intersect = clientArea.intersection(bounds);
if (intersect != null && intersect.height == bounds.height) {
- return new Point(Math.max(0, bounds.x + iBounds.width
- + getAvarageCharWith(table) * CHAR_INDENT), bounds.y
- + bounds.height);
+ return new Point(
+ Math.max(0,
+ bounds.x + iBounds.width
+ + getAvarageCharWith(table)
+ * CHAR_INDENT),
+ bounds.y + bounds.height);
} else {
return null;
}
@@ -243,11 +249,12 @@
}
Rectangle iBounds = items[0].getImageBounds(0);
Point cursorLocation = table.getDisplay().getCursorLocation();
- Point result = findBestLocation(getIncludedPositions(rectangles,
- clientArea), table.toControl(cursorLocation));
+ Point result = findBestLocation(
+ getIncludedPositions(rectangles, clientArea),
+ table.toControl(cursorLocation));
if (result != null)
- result.x = result.x + iBounds.width + getAvarageCharWith(table)
- * CHAR_INDENT;
+ result.x = result.x + iBounds.width
+ + getAvarageCharWith(table) * CHAR_INDENT;
return result;
}
}
@@ -255,13 +262,13 @@
private Point[] getIncludedPositions(Rectangle[] rectangles,
Rectangle widgetBounds) {
- List<Point> result = new ArrayList<Point>();
+ List<Point> result = new ArrayList<>();
for (int i = 0; i < rectangles.length; i++) {
Rectangle rectangle = rectangles[i];
Rectangle intersect = widgetBounds.intersection(rectangle);
if (intersect != null && intersect.height == rectangle.height) {
- result.add(new Point(intersect.x, intersect.y
- + intersect.height));
+ result.add(
+ new Point(intersect.x, intersect.y + intersect.height));
}
}
return result.toArray(new Point[result.size()]);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java
index 15589bb..ac1ebc2 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/RefreshAction.java
@@ -78,7 +78,7 @@
// in selection
}
- ArrayList<IResource> allResources = new ArrayList<IResource>(
+ ArrayList<IResource> allResources = new ArrayList<>(
selectedResources);
addWorkingSetResources(allResources);
return allResources;
@@ -114,10 +114,10 @@
Throwable targetException = e.getTargetException();
if (targetException instanceof CoreException)
throw (CoreException) targetException;
- throw new CoreException(
- new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID,
- ActionMessages.RefreshAction_error_workbenchaction_message,
- targetException));
+ throw new CoreException(new Status(IStatus.ERROR,
+ DLTKUIPlugin.PLUGIN_ID,
+ ActionMessages.RefreshAction_error_workbenchaction_message,
+ targetException));
} catch (InterruptedException e) {
throw new OperationCanceledException();
}
@@ -177,7 +177,7 @@
private void performRefresh(IStructuredSelection selection,
IProgressMonitor monitor)
- throws CoreException, OperationCanceledException {
+ throws CoreException, OperationCanceledException {
monitor.beginTask(ActionMessages.RefreshAction_progressMessage, 2);
WrappedWorkbenchRefreshAction workbenchAction = new WrappedWorkbenchRefreshAction(
@@ -190,7 +190,7 @@
private void refreshScriptElements(IStructuredSelection selection,
SubProgressMonitor monitor) throws CoreException {
Object[] selectedElements = selection.toArray();
- ArrayList<IModelElement> modelElements = new ArrayList<IModelElement>();
+ ArrayList<IModelElement> modelElements = new ArrayList<>();
for (int i = 0; i < selectedElements.length; i++) {
Object curr = selectedElements[i];
if (curr instanceof IProjectFragment) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/SelectionConverter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/SelectionConverter.java
index dcddfb0..db3f0d1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/SelectionConverter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/SelectionConverter.java
@@ -141,13 +141,14 @@
*
*/
public static IModelElement[] codeResolveForked(IEditorPart editor,
- boolean primaryOnly) throws InvocationTargetException,
- InterruptedException {
+ boolean primaryOnly)
+ throws InvocationTargetException, InterruptedException {
return performForkedCodeResolve(getInput(editor, primaryOnly),
getTextSelection(editor));
}
- public static Object[] resolveForked(IEditorPart editor, boolean primaryOnly)
+ public static Object[] resolveForked(IEditorPart editor,
+ boolean primaryOnly)
throws InvocationTargetException, InterruptedException {
return performForkedResolve(getInput(editor, primaryOnly),
getTextSelection(editor));
@@ -239,8 +240,8 @@
}
private static Object[] performForkedResolve(final IModelElement input,
- final ITextSelection selection) throws InvocationTargetException,
- InterruptedException {
+ final ITextSelection selection)
+ throws InvocationTargetException, InterruptedException {
final class CodeResolveRunnable implements IRunnableWithProgress {
Object[] result;
@@ -269,8 +270,8 @@
if (input instanceof ISourceModule) {
ScriptModelUtil.reconcile((ISourceModule) input);
}
- IModelElement[] elements = ((ICodeAssist) input).codeSelect(
- selection.getOffset(), selection.getLength());
+ IModelElement[] elements = ((ICodeAssist) input)
+ .codeSelect(selection.getOffset(), selection.getLength());
if (elements != null && elements.length > 0)
return elements;
}
@@ -286,8 +287,9 @@
if (input instanceof ISourceModule) {
ScriptModelUtil.reconcile((ISourceModule) input);
}
- Object[] elements = filterElements(((ICodeAssist) input)
- .codeSelectAll(selection.getOffset(), selection.getLength()));
+ Object[] elements = filterElements(
+ ((ICodeAssist) input).codeSelectAll(selection.getOffset(),
+ selection.getLength()));
if (elements != null && elements.length > 0)
return elements;
}
@@ -304,7 +306,7 @@
public static Object[] filterElements(Iterable<Object> selection) {
if (selection == null)
return ScriptModelUtil.NO_ELEMENTS;
- final List<Object> output = new ArrayList<Object>();
+ final List<Object> output = new ArrayList<>();
for (final Object element : selection) {
if (element instanceof IModelElement) {
output.add(element);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java
index 4c2ec4c..fba2363 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/refactoring/RefactorActionGroup.java
@@ -161,8 +161,8 @@
protected UndoRedoActionGroup fUndoRedoActionGroup;
- private final List<SelectionDispatchAction> fActions = new ArrayList<SelectionDispatchAction>();
- private final List<ContributedRefactoringAction> fContributedActions = new ArrayList<ContributedRefactoringAction>();
+ private final List<SelectionDispatchAction> fActions = new ArrayList<>();
+ private final List<ContributedRefactoringAction> fContributedActions = new ArrayList<>();
private static final String QUICK_MENU_ID = "org.eclipse.dltk.ui.edit.text.script.refactor.quickMenu"; //$NON-NLS-1$
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java
index 3e08abc..cec2e82 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java
@@ -17,8 +17,8 @@
import org.eclipse.dltk.core.IScriptProject;
/**
- * Contains a list of package fragments with the same name
- * but residing in different source folders of a unique script project.
+ * Contains a list of package fragments with the same name but residing in
+ * different source folders of a unique script project.
*/
public class LogicalPackage extends PlatformObject {
@@ -26,56 +26,56 @@
private String fName;
private IScriptProject fScriptProject;
- public LogicalPackage(IScriptFolder fragment){
- fPackages = new HashSet<IScriptFolder>();
- fScriptProject= fragment.getScriptProject();
+ public LogicalPackage(IScriptFolder fragment) {
+ fPackages = new HashSet<>();
+ fScriptProject = fragment.getScriptProject();
add(fragment);
- fName= fragment.getElementName();
+ fName = fragment.getElementName();
}
- public IScriptProject getScriptProject(){
+ public IScriptProject getScriptProject() {
return fScriptProject;
}
- public IScriptFolder[] getFragments(){
+ public IScriptFolder[] getFragments() {
return fPackages.toArray(new IScriptFolder[fPackages.size()]);
}
- public void add(IScriptFolder fragment){
- Assert.isTrue(fragment != null && fScriptProject.equals(fragment.getScriptProject()));
+ public void add(IScriptFolder fragment) {
+ Assert.isTrue(fragment != null
+ && fScriptProject.equals(fragment.getScriptProject()));
fPackages.add(fragment);
}
- public void remove(IScriptFolder fragment){
+ public void remove(IScriptFolder fragment) {
fPackages.remove(fragment);
}
- public boolean contains(IScriptFolder fragment){
+ public boolean contains(IScriptFolder fragment) {
return fPackages.contains(fragment);
}
- public String getElementName(){
+ public String getElementName() {
return fName;
}
- public int size(){
+ public int size() {
return fPackages.size();
}
/**
- * Returns true if the given fragment has the same name and
- * resides inside the same project as the other fragments in
- * the LogicalPackage.
+ * Returns true if the given fragment has the same name and resides inside
+ * the same project as the other fragments in the LogicalPackage.
*
* @param fragment
* @return boolean
*/
public boolean belongs(IScriptFolder fragment) {
- if(fragment==null)
+ if (fragment == null)
return false;
- if(fScriptProject.equals(fragment.getScriptProject())){
+ if (fScriptProject.equals(fragment.getScriptProject())) {
return fName.equals(fragment.getElementName());
}
@@ -83,23 +83,24 @@
}
@Override
- public boolean equals(Object o){
+ public boolean equals(Object o) {
if (!(o instanceof LogicalPackage))
return false;
- LogicalPackage lp= (LogicalPackage)o;
+ LogicalPackage lp = (LogicalPackage) o;
if (!fScriptProject.equals(lp.getScriptProject()))
return false;
- IScriptFolder[] fragments= lp.getFragments();
+ IScriptFolder[] fragments = lp.getFragments();
if (fragments.length != getFragments().length)
return false;
- //this works because a LogicalPackage cannot contain the same IScriptFolder twice
- for (int i= 0; i < fragments.length; i++) {
- IScriptFolder fragment= fragments[i];
- if(!fPackages.contains(fragment))
+ // this works because a LogicalPackage cannot contain the same
+ // IScriptFolder twice
+ for (int i = 0; i < fragments.length; i++) {
+ IScriptFolder fragment = fragments[i];
+ if (!fPackages.contains(fragment))
return false;
}
@@ -108,14 +109,17 @@
@Override
public int hashCode() {
- IScriptFolder[] fragments= getFragments();
- return fScriptProject.hashCode() + getHash(fragments, fragments.length-1);
+ IScriptFolder[] fragments = getFragments();
+ return fScriptProject.hashCode()
+ + getHash(fragments, fragments.length - 1);
}
private int getHash(IScriptFolder[] fragments, int index) {
if (index <= 0)
return fragments[0].hashCode() * 17;
- else return fragments[index].hashCode() * 17 + getHash(fragments, index-1);
+ else
+ return fragments[index].hashCode() * 17
+ + getHash(fragments, index - 1);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
index f67bd3e..54b167e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
@@ -124,8 +124,7 @@
IModelElement[] elements = resolveModelElements();
if (elements == null)
return;
- List<IModelElement> candidates = new ArrayList<IModelElement>(
- elements.length);
+ List<IModelElement> candidates = new ArrayList<>(elements.length);
for (int i = 0; i < elements.length; i++) {
IModelElement[] resolvedElements = CallHierarchyUI
.getCandidates(elements[i]);
@@ -196,7 +195,7 @@
if (!ActionUtil.isProcessable(getShell(), element))
return;
- List<IModelElement> result = new ArrayList<IModelElement>(1);
+ List<IModelElement> result = new ArrayList<>(1);
IStatus status = compileCandidates(result, element);
if (status.isOK()) {
run(result.toArray(new IModelElement[result.size()]));
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java
index 1b9634e..43831a8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java
@@ -30,19 +30,18 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionGroup;
-
public abstract class SearchScopeActionGroup extends ActionGroup {
- private static final String TAG_SEARCH_SCOPE_TYPE= "search_scope_type"; //$NON-NLS-1$
- private static final String TAG_SELECTED_WORKING_SET= "working_set"; //$NON-NLS-1$
+ private static final String TAG_SEARCH_SCOPE_TYPE = "search_scope_type"; //$NON-NLS-1$
+ private static final String TAG_SELECTED_WORKING_SET = "working_set"; //$NON-NLS-1$
private static final String TAG_WORKING_SET_COUNT = "working_set_count"; //$NON-NLS-1$
- private static final String DIALOGSTORE_SCOPE_TYPE= "SearchScopeActionGroup.search_scope_type"; //$NON-NLS-1$
- private static final String DIALOGSTORE_SELECTED_WORKING_SET= "SearchScopeActionGroup.working_set"; //$NON-NLS-1$
+ private static final String DIALOGSTORE_SCOPE_TYPE = "SearchScopeActionGroup.search_scope_type"; //$NON-NLS-1$
+ private static final String DIALOGSTORE_SELECTED_WORKING_SET = "SearchScopeActionGroup.working_set"; //$NON-NLS-1$
- static final int SEARCH_SCOPE_TYPE_WORKSPACE= 1;
- static final int SEARCH_SCOPE_TYPE_PROJECT= 2;
- static final int SEARCH_SCOPE_TYPE_HIERARCHY= 3;
- static final int SEARCH_SCOPE_TYPE_WORKING_SET= 4;
+ static final int SEARCH_SCOPE_TYPE_WORKSPACE = 1;
+ static final int SEARCH_SCOPE_TYPE_PROJECT = 2;
+ static final int SEARCH_SCOPE_TYPE_HIERARCHY = 3;
+ static final int SEARCH_SCOPE_TYPE_WORKING_SET = 4;
private SearchScopeAction fSelectedAction = null;
private String[] fSelectedWorkingSetNames = null;
@@ -53,9 +52,10 @@
private SearchScopeWorkspaceAction fSearchScopeWorkspaceAction;
private SelectWorkingSetAction fSelectWorkingSetAction;
- public SearchScopeActionGroup(CallHierarchyViewPart view, IDialogSettings dialogSettings) {
- this.fView= view;
- this.fDialogSettings= dialogSettings;
+ public SearchScopeActionGroup(CallHierarchyViewPart view,
+ IDialogSettings dialogSettings) {
+ this.fView = view;
+ this.fDialogSettings = dialogSettings;
createActions();
}
@@ -81,7 +81,8 @@
protected void setActiveWorkingSets(IWorkingSet[] sets) {
if (sets != null) {
fSelectedWorkingSetNames = getWorkingSetNames(sets);
- fSelectedAction = new SearchScopeWorkingSetAction(this, sets, getScopeDescription(sets));
+ fSelectedAction = new SearchScopeWorkingSetAction(this, sets,
+ getScopeDescription(sets));
} else {
fSelectedWorkingSetNames = null;
fSelectedAction = null;
@@ -89,9 +90,9 @@
}
private String[] getWorkingSetNames(IWorkingSet[] sets) {
- String[] result= new String[sets.length];
+ String[] result = new String[sets.length];
for (int i = 0; i < sets.length; i++) {
- result[i]= sets[i].getName();
+ result[i] = sets[i].getName();
}
return result;
}
@@ -108,9 +109,10 @@
if (workingSetNames == null) {
return null;
}
- Set<IWorkingSet> workingSets = new HashSet<IWorkingSet>(2);
- for (int j= 0; j < workingSetNames.length; j++) {
- IWorkingSet workingSet= getWorkingSetManager().getWorkingSet(workingSetNames[j]);
+ Set<IWorkingSet> workingSets = new HashSet<>(2);
+ for (int j = 0; j < workingSetNames.length; j++) {
+ IWorkingSet workingSet = getWorkingSetManager()
+ .getWorkingSet(workingSetNames[j]);
if (workingSet != null) {
workingSets.add(workingSet);
}
@@ -122,25 +124,32 @@
/**
* Sets the new search scope type.
*
- * @param newSelection New action which should be the checked one
- * @param ignoreUnchecked Ignores actions which are unchecked (necessary since both the old and the new action fires).
+ * @param newSelection
+ * New action which should be the checked one
+ * @param ignoreUnchecked
+ * Ignores actions which are unchecked (necessary since both the
+ * old and the new action fires).
*/
- protected void setSelected(SearchScopeAction newSelection, boolean ignoreUnchecked) {
+ protected void setSelected(SearchScopeAction newSelection,
+ boolean ignoreUnchecked) {
if (!ignoreUnchecked || newSelection.isChecked()) {
if (newSelection instanceof SearchScopeWorkingSetAction) {
- fSelectedWorkingSetNames = getWorkingSetNames(((SearchScopeWorkingSetAction) newSelection).getWorkingSets());
+ fSelectedWorkingSetNames = getWorkingSetNames(
+ ((SearchScopeWorkingSetAction) newSelection)
+ .getWorkingSets());
} else {
fSelectedWorkingSetNames = null;
}
if (newSelection != null) {
- fSelectedAction= newSelection;
+ fSelectedAction = newSelection;
} else {
- fSelectedAction= fSearchScopeWorkspaceAction;
+ fSelectedAction = fSearchScopeWorkspaceAction;
}
fDialogSettings.put(DIALOGSTORE_SCOPE_TYPE, getSearchScopeType());
- fDialogSettings.put(DIALOGSTORE_SELECTED_WORKING_SET, fSelectedWorkingSetNames);
+ fDialogSettings.put(DIALOGSTORE_SELECTED_WORKING_SET,
+ fSelectedWorkingSetNames);
}
}
@@ -150,7 +159,7 @@
protected IWorkingSetManager getWorkingSetManager() {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
+ .getWorkingSetManager();
return workingSetManager;
}
@@ -173,7 +182,8 @@
public void fillContextMenu(IMenuManager menu) {
menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
- MenuManager javaSearchMM = new MenuManager(CallHierarchyMessages.SearchScopeActionGroup_searchScope,
+ MenuManager javaSearchMM = new MenuManager(
+ CallHierarchyMessages.SearchScopeActionGroup_searchScope,
IContextMenuConstants.GROUP_SEARCH);
javaSearchMM.setRemoveAllWhenShown(true);
@@ -184,18 +194,19 @@
}
private Action[] getActions() {
- List<Action> actions = new ArrayList<Action>(
+ List<Action> actions = new ArrayList<>(
SearchUtil.LRU_WORKINGSET_LIST_SIZE + 4);
addAction(actions, fSearchScopeWorkspaceAction);
addAction(actions, fSearchScopeProjectAction);
addAction(actions, fSearchScopeHierarchyAction);
addAction(actions, fSelectWorkingSetAction);
- Iterator iter= SearchUtil.getLRUWorkingSets().sortedIterator();
+ Iterator iter = SearchUtil.getLRUWorkingSets().sortedIterator();
while (iter.hasNext()) {
- IWorkingSet[] workingSets= (IWorkingSet[])iter.next();
+ IWorkingSet[] workingSets = (IWorkingSet[]) iter.next();
String description = SearchUtil.toString(workingSets);
- SearchScopeWorkingSetAction workingSetAction = new SearchScopeWorkingSetAction(this, workingSets, description);
+ SearchScopeWorkingSetAction workingSetAction = new SearchScopeWorkingSetAction(
+ this, workingSets, description);
if (isSelectedWorkingSet(workingSets)) {
workingSetAction.setChecked(true);
@@ -225,7 +236,7 @@
private int getCheckedActionCount(Action[] result) {
// Ensure that exactly one action is selected
- int checked= 0;
+ int checked = 0;
for (int i = 0; i < result.length; i++) {
Action action = result[i];
if (action.isChecked()) {
@@ -253,57 +264,66 @@
int searchScopeType;
try {
- searchScopeType= fDialogSettings.getInt(DIALOGSTORE_SCOPE_TYPE);
+ searchScopeType = fDialogSettings.getInt(DIALOGSTORE_SCOPE_TYPE);
} catch (NumberFormatException e) {
- searchScopeType= SEARCH_SCOPE_TYPE_WORKSPACE;
+ searchScopeType = SEARCH_SCOPE_TYPE_WORKSPACE;
}
- String[] workingSetNames= fDialogSettings.getArray(DIALOGSTORE_SELECTED_WORKING_SET);
- setSelected(getSearchScopeAction(searchScopeType, workingSetNames), false);
+ String[] workingSetNames = fDialogSettings
+ .getArray(DIALOGSTORE_SELECTED_WORKING_SET);
+ setSelected(getSearchScopeAction(searchScopeType, workingSetNames),
+ false);
}
public void saveState(IMemento memento) {
- int type= getSearchScopeType();
+ int type = getSearchScopeType();
memento.putInteger(TAG_SEARCH_SCOPE_TYPE, type);
if (type == SEARCH_SCOPE_TYPE_WORKING_SET) {
- memento.putInteger(TAG_WORKING_SET_COUNT, fSelectedWorkingSetNames.length);
+ memento.putInteger(TAG_WORKING_SET_COUNT,
+ fSelectedWorkingSetNames.length);
for (int i = 0; i < fSelectedWorkingSetNames.length; i++) {
String workingSetName = fSelectedWorkingSetNames[i];
- memento.putString(TAG_SELECTED_WORKING_SET+i, workingSetName);
+ memento.putString(TAG_SELECTED_WORKING_SET + i, workingSetName);
}
}
}
public void restoreState(IMemento memento) {
- String[] workingSetNames= null;
- Integer scopeType= memento.getInteger(TAG_SEARCH_SCOPE_TYPE);
+ String[] workingSetNames = null;
+ Integer scopeType = memento.getInteger(TAG_SEARCH_SCOPE_TYPE);
if (scopeType != null) {
if (scopeType.intValue() == SEARCH_SCOPE_TYPE_WORKING_SET) {
- Integer workingSetCount= memento.getInteger(TAG_WORKING_SET_COUNT);
+ Integer workingSetCount = memento
+ .getInteger(TAG_WORKING_SET_COUNT);
if (workingSetCount != null) {
workingSetNames = new String[workingSetCount.intValue()];
for (int i = 0; i < workingSetCount.intValue(); i++) {
- workingSetNames[i]= memento.getString(TAG_SELECTED_WORKING_SET+i);
+ workingSetNames[i] = memento
+ .getString(TAG_SELECTED_WORKING_SET + i);
}
}
}
- setSelected(getSearchScopeAction(scopeType.intValue(), workingSetNames), false);
+ setSelected(
+ getSearchScopeAction(scopeType.intValue(), workingSetNames),
+ false);
}
}
- private SearchScopeAction getSearchScopeAction(int searchScopeType, String[] workingSetNames) {
+ private SearchScopeAction getSearchScopeAction(int searchScopeType,
+ String[] workingSetNames) {
switch (searchScopeType) {
- case SEARCH_SCOPE_TYPE_WORKSPACE:
- return fSearchScopeWorkspaceAction;
- case SEARCH_SCOPE_TYPE_PROJECT:
- return fSearchScopeProjectAction;
- case SEARCH_SCOPE_TYPE_HIERARCHY:
- return fSearchScopeHierarchyAction;
- case SEARCH_SCOPE_TYPE_WORKING_SET:
- IWorkingSet[] workingSets= getWorkingSets(workingSetNames);
- if (workingSets != null && workingSets.length > 0) {
- return new SearchScopeWorkingSetAction(this, workingSets, getScopeDescription(workingSets));
- }
- return null;
+ case SEARCH_SCOPE_TYPE_WORKSPACE:
+ return fSearchScopeWorkspaceAction;
+ case SEARCH_SCOPE_TYPE_PROJECT:
+ return fSearchScopeProjectAction;
+ case SEARCH_SCOPE_TYPE_HIERARCHY:
+ return fSearchScopeHierarchyAction;
+ case SEARCH_SCOPE_TYPE_WORKING_SET:
+ IWorkingSet[] workingSets = getWorkingSets(workingSetNames);
+ if (workingSets != null && workingSets.length > 0) {
+ return new SearchScopeWorkingSetAction(this, workingSets,
+ getScopeDescription(workingSets));
+ }
+ return null;
}
return null;
}
@@ -316,17 +336,22 @@
}
private String getScopeDescription(IWorkingSet[] workingSets) {
- return Messages.format(CallHierarchyMessages.WorkingSetScope, new String[] {SearchUtil.toString(workingSets)});
+ return Messages.format(CallHierarchyMessages.WorkingSetScope,
+ new String[] { SearchUtil.toString(workingSets) });
}
/**
- * Determines whether the specified working sets correspond to the currently selected working sets.
+ * Determines whether the specified working sets correspond to the currently
+ * selected working sets.
+ *
* @param workingSets
- * @return Returns true if the specified working sets correspond to the currently selected working sets
+ * @return Returns true if the specified working sets correspond to the
+ * currently selected working sets
*/
private boolean isSelectedWorkingSet(IWorkingSet[] workingSets) {
- if (fSelectedWorkingSetNames != null && fSelectedWorkingSetNames.length == workingSets.length) {
- Set workingSetNames= new HashSet(workingSets.length);
+ if (fSelectedWorkingSetNames != null
+ && fSelectedWorkingSetNames.length == workingSets.length) {
+ Set<String> workingSetNames = new HashSet<>(workingSets.length);
for (int i = 0; i < workingSets.length; i++) {
workingSetNames.add(workingSets[i].getName());
}
@@ -346,4 +371,3 @@
return null;
}
}
-
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java
index 94d860b..b113fa9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
*
-
- * (report 36180: Callers/Callees view)
*******************************************************************************/
package org.eclipse.dltk.internal.ui.callhierarchy;
@@ -27,69 +25,77 @@
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
-
public class SearchUtil {
-
+
// LRU working sets
- public static int LRU_WORKINGSET_LIST_SIZE= 3;
+ public static int LRU_WORKINGSET_LIST_SIZE = 3;
private static LRUWorkingSetsList fgLRUWorkingSets;
// Settings store
- private static final String DIALOG_SETTINGS_KEY= "CallHierarchySearchScope"; //$NON-NLS-1$
- private static final String STORE_LRU_WORKING_SET_NAMES= "lastUsedWorkingSetNames"; //$NON-NLS-1$
+ private static final String DIALOG_SETTINGS_KEY = "CallHierarchySearchScope"; //$NON-NLS-1$
+ private static final String STORE_LRU_WORKING_SET_NAMES = "lastUsedWorkingSetNames"; //$NON-NLS-1$
private static IDialogSettings fgSettingsStore;
-
+
/**
* Updates the LRU list of working sets.
- *
- * @param workingSets the workings sets to be added to the LRU list
+ *
+ * @param workingSets
+ * the workings sets to be added to the LRU list
*/
public static void updateLRUWorkingSets(IWorkingSet[] workingSets) {
if (workingSets == null || workingSets.length < 1)
return;
-
+
SearchUtil.getLRUWorkingSets().add(workingSets);
SearchUtil.saveState();
}
-
+
private static void saveState() {
IWorkingSet[] workingSets;
- Iterator iter= SearchUtil.fgLRUWorkingSets.iterator();
- int i= 0;
+ Iterator iter = SearchUtil.fgLRUWorkingSets.iterator();
+ int i = 0;
while (iter.hasNext()) {
- workingSets= (IWorkingSet[])iter.next();
- String[] names= new String[workingSets.length];
- for (int j= 0; j < workingSets.length; j++)
- names[j]= workingSets[j].getName();
- SearchUtil.fgSettingsStore.put(SearchUtil.STORE_LRU_WORKING_SET_NAMES + i, names);
+ workingSets = (IWorkingSet[]) iter.next();
+ String[] names = new String[workingSets.length];
+ for (int j = 0; j < workingSets.length; j++)
+ names[j] = workingSets[j].getName();
+ SearchUtil.fgSettingsStore
+ .put(SearchUtil.STORE_LRU_WORKING_SET_NAMES + i, names);
i++;
}
}
-
+
public static LRUWorkingSetsList getLRUWorkingSets() {
if (SearchUtil.fgLRUWorkingSets == null) {
restoreState();
}
return SearchUtil.fgLRUWorkingSets;
}
-
+
static void restoreState() {
- SearchUtil.fgLRUWorkingSets= new LRUWorkingSetsList(SearchUtil.LRU_WORKINGSET_LIST_SIZE);
- SearchUtil.fgSettingsStore= DLTKUIPlugin.getDefault().getDialogSettings().getSection(SearchUtil.DIALOG_SETTINGS_KEY);
+ SearchUtil.fgLRUWorkingSets = new LRUWorkingSetsList(
+ SearchUtil.LRU_WORKINGSET_LIST_SIZE);
+ SearchUtil.fgSettingsStore = DLTKUIPlugin.getDefault()
+ .getDialogSettings().getSection(SearchUtil.DIALOG_SETTINGS_KEY);
if (SearchUtil.fgSettingsStore == null)
- SearchUtil.fgSettingsStore= DLTKUIPlugin.getDefault().getDialogSettings().addNewSection(SearchUtil.DIALOG_SETTINGS_KEY);
-
- boolean foundLRU= false;
- for (int i= SearchUtil.LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
- String[] lruWorkingSetNames= SearchUtil.fgSettingsStore.getArray(SearchUtil.STORE_LRU_WORKING_SET_NAMES + i);
+ SearchUtil.fgSettingsStore = DLTKUIPlugin.getDefault()
+ .getDialogSettings()
+ .addNewSection(SearchUtil.DIALOG_SETTINGS_KEY);
+
+ boolean foundLRU = false;
+ for (int i = SearchUtil.LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
+ String[] lruWorkingSetNames = SearchUtil.fgSettingsStore
+ .getArray(SearchUtil.STORE_LRU_WORKING_SET_NAMES + i);
if (lruWorkingSetNames != null) {
- Set<IWorkingSet> workingSets = new HashSet<IWorkingSet>(2);
- for (int j= 0; j < lruWorkingSetNames.length; j++) {
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[j]);
+ Set<IWorkingSet> workingSets = new HashSet<>(2);
+ for (int j = 0; j < lruWorkingSetNames.length; j++) {
+ IWorkingSet workingSet = PlatformUI.getWorkbench()
+ .getWorkingSetManager()
+ .getWorkingSet(lruWorkingSetNames[j]);
if (workingSet != null) {
workingSets.add(workingSet);
}
}
- foundLRU= true;
+ foundLRU = true;
if (!workingSets.isEmpty())
SearchUtil.fgLRUWorkingSets.add(workingSets
.toArray(new IWorkingSet[workingSets.size()]));
@@ -99,21 +105,29 @@
// try old preference format
restoreFromOldFormat();
}
-
+
private static void restoreFromOldFormat() {
- SearchUtil.fgLRUWorkingSets= new LRUWorkingSetsList(SearchUtil.LRU_WORKINGSET_LIST_SIZE);
- SearchUtil.fgSettingsStore= DLTKUIPlugin.getDefault().getDialogSettings().getSection(SearchUtil.DIALOG_SETTINGS_KEY);
+ SearchUtil.fgLRUWorkingSets = new LRUWorkingSetsList(
+ SearchUtil.LRU_WORKINGSET_LIST_SIZE);
+ SearchUtil.fgSettingsStore = DLTKUIPlugin.getDefault()
+ .getDialogSettings().getSection(SearchUtil.DIALOG_SETTINGS_KEY);
if (SearchUtil.fgSettingsStore == null)
- SearchUtil.fgSettingsStore= DLTKUIPlugin.getDefault().getDialogSettings().addNewSection(SearchUtil.DIALOG_SETTINGS_KEY);
-
- boolean foundLRU= false;
- String[] lruWorkingSetNames= SearchUtil.fgSettingsStore.getArray(SearchUtil.STORE_LRU_WORKING_SET_NAMES);
+ SearchUtil.fgSettingsStore = DLTKUIPlugin.getDefault()
+ .getDialogSettings()
+ .addNewSection(SearchUtil.DIALOG_SETTINGS_KEY);
+
+ boolean foundLRU = false;
+ String[] lruWorkingSetNames = SearchUtil.fgSettingsStore
+ .getArray(SearchUtil.STORE_LRU_WORKING_SET_NAMES);
if (lruWorkingSetNames != null) {
- for (int i= lruWorkingSetNames.length - 1; i >= 0; i--) {
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[i]);
+ for (int i = lruWorkingSetNames.length - 1; i >= 0; i--) {
+ IWorkingSet workingSet = PlatformUI.getWorkbench()
+ .getWorkingSetManager()
+ .getWorkingSet(lruWorkingSetNames[i]);
if (workingSet != null) {
- foundLRU= true;
- SearchUtil.fgLRUWorkingSets.add(new IWorkingSet[]{workingSet});
+ foundLRU = true;
+ SearchUtil.fgLRUWorkingSets
+ .add(new IWorkingSet[] { workingSet });
}
}
}
@@ -121,40 +135,47 @@
// save in new format
saveState();
}
-
+
public static String toString(IWorkingSet[] workingSets) {
Arrays.sort(workingSets, new WorkingSetComparator());
- String result= ""; //$NON-NLS-1$
+ String result = ""; //$NON-NLS-1$
if (workingSets != null && workingSets.length > 0) {
- boolean firstFound= false;
- for (int i= 0; i < workingSets.length; i++) {
- String workingSetName= workingSets[i].getLabel();
+ boolean firstFound = false;
+ for (int i = 0; i < workingSets.length; i++) {
+ String workingSetName = workingSets[i].getLabel();
if (firstFound)
- result= Messages.format(CallHierarchyMessages.SearchUtil_workingSetConcatenation, new String[] {result, workingSetName});
+ result = Messages.format(
+ CallHierarchyMessages.SearchUtil_workingSetConcatenation,
+ new String[] { result, workingSetName });
else {
- result= workingSetName;
- firstFound= true;
+ result = workingSetName;
+ firstFound = true;
}
}
}
return result;
}
+
/**
- * This helper method with Object as parameter is needed to prevent the loading
- * of the Search plug-in: the Interpreter verifies the method call and hence loads the
- * types used in the method signature, eventually triggering the loading of
- * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
+ * This helper method with Object as parameter is needed to prevent the
+ * loading of the Search plug-in: the Interpreter verifies the method call
+ * and hence loads the types used in the method signature, eventually
+ * triggering the loading of a plug-in (in this case ISearchQuery results in
+ * Search plug-in being loaded).
*/
public static void runQueryInBackground(Object query) {
- NewSearchUI.runQueryInBackground((ISearchQuery)query);
+ NewSearchUI.runQueryInBackground((ISearchQuery) query);
}
+
/**
- * This helper method with Object as parameter is needed to prevent the loading
- * of the Search plug-in: the Interpreter verifies the method call and hence loads the
- * types used in the method signature, eventually triggering the loading of
- * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
+ * This helper method with Object as parameter is needed to prevent the
+ * loading of the Search plug-in: the Interpreter verifies the method call
+ * and hence loads the types used in the method signature, eventually
+ * triggering the loading of a plug-in (in this case ISearchQuery results in
+ * Search plug-in being loaded).
*/
- public static IStatus runQueryInForeground(IRunnableContext context, Object query) {
- return NewSearchUI.runQueryInForeground(context, (ISearchQuery)query);
+ public static IStatus runQueryInForeground(IRunnableContext context,
+ Object query) {
+ return NewSearchUI.runQueryInForeground(context, (ISearchQuery) query);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/ColoringConfigurationModelCollector.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/ColoringConfigurationModelCollector.java
index 258e611..2c64636 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/ColoringConfigurationModelCollector.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/ColoringConfigurationModelCollector.java
@@ -20,9 +20,9 @@
import org.eclipse.dltk.ui.coloring.IColoringPreferenceKey;
import org.eclipse.swt.graphics.RGB;
-public class ColoringConfigurationModelCollector extends
- AbstractColoringPreferenceRequestor implements
- IColoringCategoryConstants {
+public class ColoringConfigurationModelCollector
+ extends AbstractColoringPreferenceRequestor
+ implements IColoringCategoryConstants {
private String category = sCoreCategory;
@@ -51,12 +51,14 @@
}
- private final List<Item> entries = new ArrayList<Item>();
+ private final List<Item> entries = new ArrayList<>();
@Override
public void addPreference(IColoringPreferenceKey key, String name,
- RGB color, EnablementStyle enablementStyle, FontStyle... fontStyles) {
- entries.add(new Item(name, key.getColorKey(), category, enablementStyle));
+ RGB color, EnablementStyle enablementStyle,
+ FontStyle... fontStyles) {
+ entries.add(
+ new Item(name, key.getColorKey(), category, enablementStyle));
}
public String[][] getColorListModel() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/DefaultPreferenceRequestor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/DefaultPreferenceRequestor.java
index 2bbcaf8..8eaae81 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/DefaultPreferenceRequestor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/coloring/DefaultPreferenceRequestor.java
@@ -24,8 +24,8 @@
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;
-public class DefaultPreferenceRequestor extends
- AbstractColoringPreferenceRequestor {
+public class DefaultPreferenceRequestor
+ extends AbstractColoringPreferenceRequestor {
private final IPreferenceStore store;
private final String natureId;
@@ -35,11 +35,12 @@
this.natureId = natureId;
}
- private Set<String> processedKeys = new HashSet<String>();
+ private Set<String> processedKeys = new HashSet<>();
@Override
public void addPreference(IColoringPreferenceKey key, String name,
- RGB color, EnablementStyle enablementStyle, FontStyle... fontStyles) {
+ RGB color, EnablementStyle enablementStyle,
+ FontStyle... fontStyles) {
if (!processedKeys.add(key.getColorKey())) {
DLTKUIPlugin.warn("Duplicate color preference " + key.getColorKey()
+ " in " + natureId);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java
index 9f7446d..c3cbd3a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java
@@ -101,14 +101,13 @@
public SearchRequestor(MethodInfoFilter filter,
MethodFilter MethodFilter) {
super();
- fResult = new ArrayList<MethodNameMatch>(2048);
+ fResult = new ArrayList<>(2048);
fFilter = filter;
fMethodFilter = MethodFilter;
}
public MethodNameMatch[] getResult() {
- return fResult
- .toArray(new MethodNameMatch[fResult.size()]);
+ return fResult.toArray(new MethodNameMatch[fResult.size()]);
}
public void cancel() {
@@ -152,13 +151,12 @@
return -1;
if (leftCategory > rightCategory)
return +1;
- int result = compareName(leftInfo.getSimpleMethodName(), rightInfo
- .getSimpleMethodName());
+ int result = compareName(leftInfo.getSimpleMethodName(),
+ rightInfo.getSimpleMethodName());
if (result != 0)
return result;
- result = compareTypeContainerName(
- leftInfo.getMethodContainerName(), rightInfo
- .getMethodContainerName());
+ result = compareTypeContainerName(leftInfo.getMethodContainerName(),
+ rightInfo.getMethodContainerName());
if (result != 0)
return result;
@@ -201,8 +199,8 @@
private int compareContainerName(MethodNameMatch leftType,
MethodNameMatch rightType) {
- return fLabelProvider.getContainerName(leftType).compareTo(
- fLabelProvider.getContainerName(rightType));
+ return fLabelProvider.getContainerName(leftType)
+ .compareTo(fLabelProvider.getContainerName(rightType));
}
private int getCamelCaseCategory(MethodNameMatch type) {
@@ -215,7 +213,8 @@
private int getElementTypeCategory(MethodNameMatch type) {
try {
- if (type.getProjectFragment().getKind() == IProjectFragment.K_SOURCE)
+ if (type.getProjectFragment()
+ .getKind() == IProjectFragment.K_SOURCE)
return 0;
} catch (ModelException e) {
// TODO Auto-generated catch block
@@ -232,16 +231,15 @@
private String[] fVMNames;
public MethodInfoLabelProvider() {
- List<String> locations = new ArrayList<String>();
- List<String> labels = new ArrayList<String>();
+ List<String> locations = new ArrayList<>();
+ List<String> labels = new ArrayList<>();
IInterpreterInstallType[] installs = ScriptRuntime
- .getInterpreterInstallTypes(fToolkit.getCoreToolkit()
- .getNatureId());
+ .getInterpreterInstallTypes(
+ fToolkit.getCoreToolkit().getNatureId());
for (int i = 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
- fInstallLocations = locations
- .toArray(new String[locations.size()]);
+ fInstallLocations = locations.toArray(new String[locations.size()]);
fVMNames = labels.toArray(new String[labels.size()]);
}
@@ -251,8 +249,8 @@
if (installType != null) {
IInterpreterInstall[] installs = installType
.getInterpreterInstalls();
- final boolean isMac = Platform.OS_MACOSX.equals(Platform
- .getOS());
+ final boolean isMac = Platform.OS_MACOSX
+ .equals(Platform.getOS());
for (int i = 0; i < installs.length; i++) {
final IInterpreterInstall install = installs[i];
final String label = getFormattedLabel(install.getName());
@@ -271,9 +269,9 @@
// on MacOS X install locations end in an additional
// "/Home" segment; remove it
if (isMac && filePath.endsWith(HOME_SUFFIX))
- filePath = filePath.substring(0, filePath
- .length()
- - (HOME_SUFFIX.length() - 1));
+ filePath = filePath.substring(0,
+ filePath.length()
+ - (HOME_SUFFIX.length() - 1));
locations.add(filePath);
labels.add(label);
}
@@ -383,25 +381,26 @@
public ImageDescriptor getImageDescriptor(Object element) {
MethodNameMatch method = (MethodNameMatch) element;
- return ScriptElementImageProvider.getMethodImageDescriptor(method
- .getModifiers());
+ return ScriptElementImageProvider
+ .getMethodImageDescriptor(method.getModifiers());
}
- private String getTypeContainerName(MethodNameMatch info, int infoLevel) {
+ private String getTypeContainerName(MethodNameMatch info,
+ int infoLevel) {
// String result= info.getTypeContainerName();
String result = ""; //$NON-NLS-1$
IDLTKUILanguageToolkit toolkit = DLTKUILanguageManager
.getLanguageToolkit(info.getMethod());
if (toolkit != null) {
ScriptElementLabels labels = toolkit.getScriptElementLabels();
- result = labels
- .getElementLabel(
- info.getMethod(),
- ScriptElementLabels.T_CONTAINER_QUALIFIED
- | (infoLevel > 0 ? ScriptElementLabels.APPEND_FILE
- : 0)
- | (infoLevel > 1 ? ScriptElementLabels.CU_POST_QUALIFIED
- : 0));
+ result = labels.getElementLabel(info.getMethod(),
+ ScriptElementLabels.T_CONTAINER_QUALIFIED
+ | (infoLevel > 0
+ ? ScriptElementLabels.APPEND_FILE
+ : 0)
+ | (infoLevel > 1
+ ? ScriptElementLabels.CU_POST_QUALIFIED
+ : 0));
}
if (result.length() > 0)
return result;
@@ -425,7 +424,8 @@
ScriptElementLabels labels = fToolkit.getScriptElementLabels();
labels.getProjectFragmentLabel(root,
ScriptElementLabels.ROOT_QUALIFIED
- | ScriptElementLabels.ROOT_VARIABLE, buf);
+ | ScriptElementLabels.ROOT_VARIABLE,
+ buf);
return buf.toString();
}
@@ -469,7 +469,8 @@
private double fWorked;
private boolean fDone;
- public ProgressMonitor(IProgressMonitor monitor, MethodInfoViewer viewer) {
+ public ProgressMonitor(IProgressMonitor monitor,
+ MethodInfoViewer viewer) {
super(monitor);
fViewer = viewer;
}
@@ -513,13 +514,10 @@
} else if (fTotalWork == 0) {
return fName;
} else {
- return Messages
- .format(
- DLTKUIMessages.TypeInfoViewer_progress_label,
- new Object[] {
- fName,
- Integer.valueOf(
- (int) ((fWorked * 100) / fTotalWork)) });
+ return Messages.format(
+ DLTKUIMessages.TypeInfoViewer_progress_label,
+ new Object[] { fName, Integer.valueOf(
+ (int) ((fWorked * 100) / fTotalWork)) });
}
}
}
@@ -598,8 +596,8 @@
Set matchIdsInHistory, ProgressMonitor monitor)
throws CoreException;
- private void internalRun(ProgressMonitor monitor) throws CoreException,
- InterruptedException {
+ private void internalRun(ProgressMonitor monitor)
+ throws CoreException, InterruptedException {
if (monitor.isCanceled())
throw new OperationCanceledException();
@@ -617,8 +615,8 @@
MethodNameMatch[] matchingTypes = fHistory
.getFilteredTypeInfos(fFilter);
if (matchingTypes.length > 0) {
- Arrays.sort(matchingTypes, new MethodInfoComparator(
- fLabelProvider, fFilter));
+ Arrays.sort(matchingTypes,
+ new MethodInfoComparator(fLabelProvider, fFilter));
type = matchingTypes[0];
int i = 1;
while (type != null) {
@@ -626,8 +624,8 @@
: matchingTypes[i];
elements.add(type);
filteredMatches.add(type);
- imageDescriptors.add(fLabelProvider
- .getImageDescriptor(type));
+ imageDescriptors
+ .add(fLabelProvider.getImageDescriptor(type));
labels.add(fLabelProvider.getText(last, type, next));
last = type;
type = next;
@@ -641,7 +639,8 @@
if ((fMode & INDEX) == 0) {
return;
}
- MethodNameMatch[] result = getSearchResult(filteredMatches, monitor);
+ MethodNameMatch[] result = getSearchResult(filteredMatches,
+ monitor);
fViewer.fExpectedItemCount += result.length;
if (result.length == 0) {
return;
@@ -659,9 +658,9 @@
elements.clear();
imageDescriptors.clear();
labels.clear();
- int delta = Math.min(nextIndex == 1 ? fViewer
- .getNumberOfVisibleItems() : 10, result.length
- - processed);
+ int delta = Math.min(
+ nextIndex == 1 ? fViewer.getNumberOfVisibleItems() : 10,
+ result.length - processed);
if (delta == 0)
break;
processed = processed + delta;
@@ -670,8 +669,8 @@
: result[nextIndex];
elements.add(type);
labels.add(fLabelProvider.getText(last, type, next));
- imageDescriptors.add(fLabelProvider
- .getImageDescriptor(type));
+ imageDescriptors
+ .add(fLabelProvider.getImageDescriptor(type));
last = type;
type = next;
nextIndex++;
@@ -708,7 +707,8 @@
filteredMatches.add(matchingTypes[i]);
}
- MethodNameMatch[] result = getSearchResult(filteredMatches, monitor);
+ MethodNameMatch[] result = getSearchResult(filteredMatches,
+ monitor);
if (monitor.isCanceled())
throw new OperationCanceledException();
@@ -718,7 +718,8 @@
private IStatus canceled(Exception e, boolean removePendingItems) {
fViewer.searchJobCanceled(fTicket, removePendingItems);
return new Status(IStatus.CANCEL, DLTKUIPlugin.getPluginId(),
- IStatus.CANCEL, DLTKUIMessages.TypeInfoViewer_job_cancel, e);
+ IStatus.CANCEL, DLTKUIMessages.TypeInfoViewer_job_cancel,
+ e);
}
private IStatus ok() {
@@ -754,36 +755,38 @@
long start = System.currentTimeMillis();
fReqestor.setHistory(matchIdsInHistory);
- monitor
- .setTaskName(DLTKUIMessages.TypeInfoViewer_searchJob_taskName);
+ monitor.setTaskName(
+ DLTKUIMessages.TypeInfoViewer_searchJob_taskName);
- IMethod[] methods = new ModelAccess().findMethods(fFilter
- .getNamePattern(), ModelAccess.convertSearchRule(fFilter
- .getSearchFlags()), 0, 0, fScope, monitor);
+ IMethod[] methods = new ModelAccess().findMethods(
+ fFilter.getNamePattern(),
+ ModelAccess.convertSearchRule(fFilter.getSearchFlags()), 0,
+ 0, fScope, monitor);
if (methods != null) {
for (IMethod method : methods) {
- fReqestor
- .acceptMethodNameMatch(new DLTKSearchMethodNameMatch(
- method, method.getFlags()));
+ fReqestor.acceptMethodNameMatch(
+ new DLTKSearchMethodNameMatch(method,
+ method.getFlags()));
}
} else {
// consider primary working copies during searching
SearchEngine engine = new SearchEngine((WorkingCopyOwner) null);
- engine.searchAllMethodNames(fFilter.getNamePattern()
- .toCharArray(), fFilter.getSearchFlags(), fElementKind,
- fScope, fReqestor,
+ engine.searchAllMethodNames(
+ fFilter.getNamePattern().toCharArray(),
+ fFilter.getSearchFlags(), fElementKind, fScope,
+ fReqestor,
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
}
if (DEBUG)
- System.out
- .println("Time needed until search has finished: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$
+ System.out.println("Time needed until search has finished: " //$NON-NLS-1$
+ + (System.currentTimeMillis() - start));
MethodNameMatch[] result = fReqestor.getResult();
- Arrays.sort(result, new MethodInfoComparator(fLabelProvider,
- fFilter));
+ Arrays.sort(result,
+ new MethodInfoComparator(fLabelProvider, fFilter));
if (DEBUG)
- System.out
- .println("Time needed until sort has finished: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$
+ System.out.println("Time needed until sort has finished: " //$NON-NLS-1$
+ + (System.currentTimeMillis() - start));
fViewer.rememberResult(fTicket, result);
return result;
}
@@ -802,7 +805,7 @@
@Override
protected MethodNameMatch[] getSearchResult(Set filteredHistory,
ProgressMonitor monitor) throws CoreException {
- List<MethodNameMatch> result = new ArrayList<MethodNameMatch>(2048);
+ List<MethodNameMatch> result = new ArrayList<>(2048);
for (int i = 0; i < fLastResult.length; i++) {
MethodNameMatch type = fLastResult[i];
if (filteredHistory.contains(type))
@@ -814,8 +817,8 @@
MethodNameMatch[] types = result
.toArray(new MethodNameMatch[result.size()]);
if (fFilter.isCamelCasePattern()) {
- Arrays.sort(types, new MethodInfoComparator(fLabelProvider,
- fFilter));
+ Arrays.sort(types,
+ new MethodInfoComparator(fLabelProvider, fFilter));
}
return types;
}
@@ -836,18 +839,20 @@
@Override
protected IStatus doRun(ProgressMonitor monitor) {
try {
- monitor
- .setTaskName(DLTKUIMessages.TypeInfoViewer_syncJob_taskName);
- new SearchEngine().searchAllTypeNames(
- null,
- 0, // make sure we search a concrete name. This is
- // faster
- // according to Kent
+ monitor.setTaskName(
+ DLTKUIMessages.TypeInfoViewer_syncJob_taskName);
+ new SearchEngine().searchAllTypeNames(null, 0, // make sure we
+ // search a
+ // concrete
+ // name. This is
+ // faster
+ // according to
+ // Kent
"_______________".toCharArray(), //$NON-NLS-1$
SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE,
- IDLTKSearchConstants.TYPE, SearchEngine
- .createWorkspaceScope(fToolkit),
+ IDLTKSearchConstants.TYPE,
+ SearchEngine.createWorkspaceScope(fToolkit),
new NopTypeNameRequestor(),
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
@@ -888,7 +893,8 @@
public void initialize(GC gc) {
fSeparatorWidth = gc.getAdvanceWidth(SEPARATOR);
- fMessage = " " + DLTKUIMessages.TypeInfoViewer_separator_message + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ fMessage = " " + DLTKUIMessages.TypeInfoViewer_separator_message //$NON-NLS-1$
+ + " "; //$NON-NLS-1$
fMessageLength = gc.textExtent(fMessage).x;
}
}
@@ -1023,7 +1029,8 @@
fLastLabels[i] = item.getText();
Object data = item.getData();
if (data instanceof MethodNameMatch) {
- String qualifiedText = getQualifiedText((MethodNameMatch) data);
+ String qualifiedText = getQualifiedText(
+ (MethodNameMatch) data);
if (qualifiedText.length() > fLastLabels[i].length())
item.setText(qualifiedText);
}
@@ -1120,8 +1127,7 @@
public MethodNameMatch[] getSelection() {
TableItem[] items = fTable.getSelection();
- List<MethodNameMatch> result = new ArrayList<MethodNameMatch>(
- items.length);
+ List<MethodNameMatch> result = new ArrayList<>(items.length);
for (int i = 0; i < items.length; i++) {
Object data = items[i].getData();
if (data instanceof MethodNameMatch) {
@@ -1188,7 +1194,8 @@
fLastLabels = null;
fExpectedItemCount = 0;
fDashLineIndex = -1;
- MethodInfoFilter filter = (fMethodInfoFilter != null) ? fMethodInfoFilter
+ MethodInfoFilter filter = (fMethodInfoFilter != null)
+ ? fMethodInfoFilter
: new MethodInfoFilter("*", fSearchScope, fElementKind); //$NON-NLS-1$
if (VIRTUAL) {
fHistoryMatches = fHistory.getFilteredTypeInfos(filter);
@@ -1414,9 +1421,8 @@
private void scheduleSearchJob(int mode) {
fSearchJobTicket++;
- if (fLastCompletedFilter != null
- && fMethodInfoFilter
- .isSubFilter(fLastCompletedFilter.getText())) {
+ if (fLastCompletedFilter != null && fMethodInfoFilter
+ .isSubFilter(fLastCompletedFilter.getText())) {
fSearchJob = new CachedResultJob(fSearchJobTicket,
fLastCompletedResult, this, fMethodInfoFilter, fHistory,
fNumberOfVisibleItems, mode);
@@ -1438,7 +1444,8 @@
});
}
- private void searchJobCanceled(int ticket, final boolean removePendingItems) {
+ private void searchJobCanceled(int ticket,
+ final boolean removePendingItems) {
syncExec(ticket, () -> {
if (removePendingItems) {
shortenTable();
@@ -1508,8 +1515,8 @@
fillDashLine(item);
} else {
item.setData(type);
- item.setImage(fImageManager.get(fLabelProvider
- .getImageDescriptor(type)));
+ item.setImage(
+ fImageManager.get(fLabelProvider.getImageDescriptor(type)));
item.setText(fLabelProvider.getText(getTypeInfo(index - 1), type,
getTypeInfo(index + 1)));
item.setForeground(null);
@@ -1619,10 +1626,10 @@
private void fillDashLine(TableItem item) {
Rectangle bounds = item.getImageBounds(0);
Rectangle area = fTable.getBounds();
- boolean willHaveScrollBar = fExpectedItemCount + 1 > fNumberOfVisibleItems;
- item
- .setText(fDashLine.getText(area.width - bounds.x - bounds.width
- - fTableWidthDelta
+ boolean willHaveScrollBar = fExpectedItemCount
+ + 1 > fNumberOfVisibleItems;
+ item.setText(fDashLine
+ .getText(area.width - bounds.x - bounds.width - fTableWidthDelta
- (willHaveScrollBar ? fScrollbarWidth : 0)));
item.setImage(fSeparatorIcon);
item.setForeground(fDashLineColor);
@@ -1655,11 +1662,11 @@
private Color computeDashLineColor() {
Color fg = fTable.getForeground();
- int fGray = (int) (0.3 * fg.getRed() + 0.59 * fg.getGreen() + 0.11 * fg
- .getBlue());
+ int fGray = (int) (0.3 * fg.getRed() + 0.59 * fg.getGreen()
+ + 0.11 * fg.getBlue());
Color bg = fTable.getBackground();
- int bGray = (int) (0.3 * bg.getRed() + 0.59 * bg.getGreen() + 0.11 * bg
- .getBlue());
+ int bGray = (int) (0.3 * bg.getRed() + 0.59 * bg.getGreen()
+ + 0.11 * bg.getBlue());
int gray = (int) ((fGray + bGray) * 0.66);
return new Color(fDisplay, gray, gray, gray);
}
@@ -1672,8 +1679,8 @@
}
private String getQualifiedText(MethodNameMatch type) {
- return fFullyQualifySelection ? fLabelProvider
- .getFullyQualifiedText(type) : fLabelProvider
- .getQualifiedText(type);
+ return fFullyQualifySelection
+ ? fLabelProvider.getFullyQualifiedText(type)
+ : fLabelProvider.getQualifiedText(type);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeInfoViewer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeInfoViewer.java
index 6b3b524..6417cc2 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeInfoViewer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeInfoViewer.java
@@ -107,7 +107,7 @@
public SearchRequestor(TypeInfoFilter filter, TypeFilter typeFilter) {
super();
- fResult = new ArrayList<TypeNameMatch>(2048);
+ fResult = new ArrayList<>(2048);
fFilter = filter;
fTypeFilter = typeFilter;
}
@@ -137,8 +137,8 @@
}
}
- protected static class TypeInfoComparator implements
- Comparator<TypeNameMatch> {
+ protected static class TypeInfoComparator
+ implements Comparator<TypeNameMatch> {
private TypeInfoLabelProvider fLabelProvider;
private TypeInfoFilter fFilter;
@@ -173,8 +173,9 @@
rightInfo.getTypeQualifiedName());
if (result != 0)
return result;
- result = compareTypeContainerName(leftInfo.getType().getPath()
- .lastSegment(), rightInfo.getType().getPath().lastSegment());
+ result = compareTypeContainerName(
+ leftInfo.getType().getPath().lastSegment(),
+ rightInfo.getType().getPath().lastSegment());
if (result != 0)
return result;
@@ -217,8 +218,8 @@
private int compareContainerName(TypeNameMatch leftType,
TypeNameMatch rightType) {
- return fLabelProvider.getContainerName(leftType).compareTo(
- fLabelProvider.getContainerName(rightType));
+ return fLabelProvider.getContainerName(leftType)
+ .compareTo(fLabelProvider.getContainerName(rightType));
}
private int getCamelCaseCategory(TypeNameMatch type) {
@@ -231,7 +232,8 @@
private int getElementTypeCategory(TypeNameMatch type) {
try {
- if (type.getProjectFragment().getKind() == IProjectFragment.K_SOURCE)
+ if (type.getProjectFragment()
+ .getKind() == IProjectFragment.K_SOURCE)
return 0;
} catch (ModelException e) {
// TODO Auto-generated catch block
@@ -246,17 +248,17 @@
private ITypeInfoImageProvider fProviderExtension;
private TypeInfoRequestorAdapter fAdapter = new TypeInfoRequestorAdapter();
- private Map<String, String> fLib2Name = new HashMap<String, String>();
+ private Map<String, String> fLib2Name = new HashMap<>();
private String[] fInstallLocations;
private String[] fVMNames;
public TypeInfoLabelProvider(ITypeInfoImageProvider extension) {
fProviderExtension = extension;
- List<String> locations = new ArrayList<String>();
- List<String> labels = new ArrayList<String>();
+ List<String> locations = new ArrayList<>();
+ List<String> labels = new ArrayList<>();
IInterpreterInstallType[] installs = ScriptRuntime
- .getInterpreterInstallTypes(fToolkit.getCoreToolkit()
- .getNatureId());
+ .getInterpreterInstallTypes(
+ fToolkit.getCoreToolkit().getNatureId());
for (int i = 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
@@ -269,8 +271,8 @@
if (installType != null) {
IInterpreterInstall[] installs = installType
.getInterpreterInstalls();
- final boolean isMac = Platform.OS_MACOSX.equals(Platform
- .getOS());
+ final boolean isMac = Platform.OS_MACOSX
+ .equals(Platform.getOS());
for (int i = 0; i < installs.length; i++) {
final IInterpreterInstall install = installs[i];
final String label = getFormattedLabel(install.getName());
@@ -289,8 +291,7 @@
// on MacOS X install locations end in an additional
// "/Home" segment; remove it
if (isMac && filePath.endsWith(HOME_SUFFIX))
- filePath = filePath.substring(
- 0,
+ filePath = filePath.substring(0,
filePath.length()
- (HOME_SUFFIX.length() - 1));
locations.add(filePath);
@@ -408,7 +409,7 @@
return descriptor;
}
return ScriptElementImageProvider.getTypeImageDescriptor(
- /* isInnerType(type), false, */type.getModifiers(), false);
+ /* isInnerType(type), false, */type.getModifiers(), false);
}
private String getTypeContainerName(TypeNameMatch info, int infoLevel) {
@@ -418,15 +419,15 @@
.getLanguageToolkit(info.getType());
if (toolkit != null) {
ScriptElementLabels labels = toolkit.getScriptElementLabels();
- result = labels
- .getElementLabel(
- info.getType(),
- ScriptElementLabels.T_CONTAINER_QUALIFIED
- | (infoLevel > 0 ? ScriptElementLabels.APPEND_FILE
- : 0)
- | (infoLevel > 1 ? ScriptElementLabels.CU_POST_QUALIFIED
+ result = labels.getElementLabel(info.getType(),
+ ScriptElementLabels.T_CONTAINER_QUALIFIED
+ | (infoLevel > 0
+ ? ScriptElementLabels.APPEND_FILE
+ : 0)
+ | (infoLevel > 1
+ ? ScriptElementLabels.CU_POST_QUALIFIED
| ScriptElementLabels.APPEND_ROOT_PATH
- : 0));
+ : 0));
}
if (result.length() > 0)
return result;
@@ -450,7 +451,8 @@
ScriptElementLabels labels = fToolkit.getScriptElementLabels();
labels.getProjectFragmentLabel(root,
ScriptElementLabels.ROOT_QUALIFIED
- | ScriptElementLabels.ROOT_VARIABLE, buf);
+ | ScriptElementLabels.ROOT_VARIABLE,
+ buf);
return buf.toString();
}
@@ -494,7 +496,8 @@
private double fWorked;
private boolean fDone;
- public ProgressMonitor(IProgressMonitor monitor, TypeInfoViewer viewer) {
+ public ProgressMonitor(IProgressMonitor monitor,
+ TypeInfoViewer viewer) {
super(monitor);
fViewer = viewer;
}
@@ -538,12 +541,10 @@
} else if (fTotalWork == 0) {
return fName;
} else {
- return Messages
- .format(DLTKUIMessages.TypeInfoViewer_progress_label,
- new Object[] {
- fName,
- Integer.valueOf(
- (int) ((fWorked * 100) / fTotalWork)) });
+ return Messages.format(
+ DLTKUIMessages.TypeInfoViewer_progress_label,
+ new Object[] { fName, Integer.valueOf(
+ (int) ((fWorked * 100) / fTotalWork)) });
}
}
}
@@ -622,8 +623,8 @@
Set<TypeNameMatch> matchIdsInHistory, ProgressMonitor monitor)
throws CoreException;
- private void internalRun(ProgressMonitor monitor) throws CoreException,
- InterruptedException {
+ private void internalRun(ProgressMonitor monitor)
+ throws CoreException, InterruptedException {
if (monitor.isCanceled())
throw new OperationCanceledException();
@@ -633,16 +634,16 @@
TypeNameMatch last = null;
TypeNameMatch type = null;
TypeNameMatch next = null;
- List<TypeNameMatch> elements = new ArrayList<TypeNameMatch>();
- List<ImageDescriptor> imageDescriptors = new ArrayList<ImageDescriptor>();
- List<String> labels = new ArrayList<String>();
- Set<TypeNameMatch> filteredMatches = new HashSet<TypeNameMatch>();
+ List<TypeNameMatch> elements = new ArrayList<>();
+ List<ImageDescriptor> imageDescriptors = new ArrayList<>();
+ List<String> labels = new ArrayList<>();
+ Set<TypeNameMatch> filteredMatches = new HashSet<>();
TypeNameMatch[] matchingTypes = fHistory
.getFilteredTypeInfos(fFilter);
if (matchingTypes.length > 0) {
- Arrays.sort(matchingTypes, new TypeInfoComparator(
- fLabelProvider, fFilter));
+ Arrays.sort(matchingTypes,
+ new TypeInfoComparator(fLabelProvider, fFilter));
type = matchingTypes[0];
int i = 1;
while (type != null) {
@@ -650,8 +651,8 @@
: matchingTypes[i];
elements.add(type);
filteredMatches.add(type);
- imageDescriptors.add(fLabelProvider
- .getImageDescriptor(type));
+ imageDescriptors
+ .add(fLabelProvider.getImageDescriptor(type));
labels.add(fLabelProvider.getText(last, type, next));
last = type;
type = next;
@@ -683,9 +684,9 @@
elements.clear();
imageDescriptors.clear();
labels.clear();
- int delta = Math
- .min(nextIndex == 1 ? fViewer.getNumberOfVisibleItems()
- : 10, result.length - processed);
+ int delta = Math.min(
+ nextIndex == 1 ? fViewer.getNumberOfVisibleItems() : 10,
+ result.length - processed);
if (delta == 0)
break;
processed = processed + delta;
@@ -694,8 +695,8 @@
: result[nextIndex];
elements.add(type);
labels.add(fLabelProvider.getText(last, type, next));
- imageDescriptors.add(fLabelProvider
- .getImageDescriptor(type));
+ imageDescriptors
+ .add(fLabelProvider.getImageDescriptor(type));
last = type;
type = next;
nextIndex++;
@@ -727,7 +728,7 @@
if ((fMode & INDEX) == 0)
return;
- Set<TypeNameMatch> filteredMatches = new HashSet<TypeNameMatch>(
+ Set<TypeNameMatch> filteredMatches = new HashSet<>(
matchingTypes.length * 2);
for (int i = 0; i < matchingTypes.length; i++) {
filteredMatches.add(matchingTypes[i]);
@@ -743,7 +744,8 @@
private IStatus canceled(Exception e, boolean removePendingItems) {
fViewer.searchJobCanceled(fTicket, removePendingItems);
return new Status(IStatus.CANCEL, DLTKUIPlugin.getPluginId(),
- IStatus.CANCEL, DLTKUIMessages.TypeInfoViewer_job_cancel, e);
+ IStatus.CANCEL, DLTKUIMessages.TypeInfoViewer_job_cancel,
+ e);
}
private IStatus ok() {
@@ -780,15 +782,16 @@
long start = System.currentTimeMillis();
fReqestor.setHistory(matchIdsInHistory);
- monitor.setTaskName(DLTKUIMessages.TypeInfoViewer_searchJob_taskName);
+ monitor.setTaskName(
+ DLTKUIMessages.TypeInfoViewer_searchJob_taskName);
- MatchRule searchRule = ModelAccess.convertSearchRule(fFilter
- .getSearchFlags());
+ MatchRule searchRule = ModelAccess
+ .convertSearchRule(fFilter.getSearchFlags());
IType[] types = new ModelAccess().findTypes(
fFilter.getNamePattern(), searchRule, 0,
Modifiers.AccNameSpace, fScope, monitor);
if (searchRule == MatchRule.CAMEL_CASE) {
- Set<IType> result = new HashSet<IType>();
+ Set<IType> result = new HashSet<>();
if (types != null) {
result.addAll(Arrays.asList(types));
}
@@ -802,34 +805,36 @@
if (types != null) {
result.addAll(Arrays.asList(types));
}
- types = result.size() == 0 ? null : result
- .toArray(new IType[result.size()]);
+ types = result.size() == 0 ? null
+ : result.toArray(new IType[result.size()]);
}
if (types != null) {
for (IType type : types) {
- fReqestor.acceptTypeNameMatch(new DLTKSearchTypeNameMatch(
- type, type.getFlags()));
+ fReqestor.acceptTypeNameMatch(
+ new DLTKSearchTypeNameMatch(type, type.getFlags()));
}
} else {
// consider primary working copies during searching
SearchEngine engine = new SearchEngine((WorkingCopyOwner) null);
String packPattern = fFilter.getPackagePattern();
- engine.searchAllTypeNames(packPattern == null ? null
- : packPattern.toCharArray(), fFilter.getPackageFlags(),
- fFilter.getNamePattern().toCharArray(), fFilter
- .getSearchFlags(), fElementKind, fScope,
+ engine.searchAllTypeNames(
+ packPattern == null ? null : packPattern.toCharArray(),
+ fFilter.getPackageFlags(),
+ fFilter.getNamePattern().toCharArray(),
+ fFilter.getSearchFlags(), fElementKind, fScope,
fReqestor,
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
}
if (DEBUG)
- System.out
- .println("Time needed until search has finished: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$
+ System.out.println("Time needed until search has finished: " //$NON-NLS-1$
+ + (System.currentTimeMillis() - start));
TypeNameMatch[] result = fReqestor.getResult();
- Arrays.sort(result, new TypeInfoComparator(fLabelProvider, fFilter));
+ Arrays.sort(result,
+ new TypeInfoComparator(fLabelProvider, fFilter));
if (DEBUG)
- System.out
- .println("Time needed until sort has finished: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$
+ System.out.println("Time needed until sort has finished: " //$NON-NLS-1$
+ + (System.currentTimeMillis() - start));
fViewer.rememberResult(fTicket, result);
return result;
}
@@ -849,7 +854,7 @@
protected TypeNameMatch[] getSearchResult(
Set<TypeNameMatch> filteredHistory, ProgressMonitor monitor)
throws CoreException {
- List<TypeNameMatch> result = new ArrayList<TypeNameMatch>(2048);
+ List<TypeNameMatch> result = new ArrayList<>(2048);
for (int i = 0; i < fLastResult.length; i++) {
TypeNameMatch type = fLastResult[i];
if (filteredHistory.contains(type))
@@ -858,11 +863,11 @@
result.add(type);
}
// we have to sort if the filter is a camel case filter.
- TypeNameMatch[] types = result.toArray(new TypeNameMatch[result
- .size()]);
+ TypeNameMatch[] types = result
+ .toArray(new TypeNameMatch[result.size()]);
if (fFilter.isCamelCasePattern()) {
- Arrays.sort(types, new TypeInfoComparator(fLabelProvider,
- fFilter));
+ Arrays.sort(types,
+ new TypeInfoComparator(fLabelProvider, fFilter));
}
return types;
}
@@ -883,10 +888,9 @@
@Override
protected IStatus doRun(ProgressMonitor monitor) {
try {
- monitor.setTaskName(DLTKUIMessages.TypeInfoViewer_syncJob_taskName);
- new SearchEngine().searchAllTypeNames(
- null,
- 0,
+ monitor.setTaskName(
+ DLTKUIMessages.TypeInfoViewer_syncJob_taskName);
+ new SearchEngine().searchAllTypeNames(null, 0,
// make sure we search a concrete name. This is faster
// according to Kent
"_______________".toCharArray(), //$NON-NLS-1$
@@ -934,7 +938,8 @@
public void initialize(GC gc) {
fSeparatorWidth = gc.getAdvanceWidth(SEPARATOR);
- fMessage = " " + DLTKUIMessages.TypeInfoViewer_separator_message + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ fMessage = " " + DLTKUIMessages.TypeInfoViewer_separator_message //$NON-NLS-1$
+ + " "; //$NON-NLS-1$
fMessageLength = gc.textExtent(fMessage).x;
}
}
@@ -1018,7 +1023,8 @@
fSearchScope = scope;
fElementKind = elementKind;
fFilterExtension = filterExtension;
- fSearchPatternProcessor = searchPatternProcessor != null ? searchPatternProcessor
+ fSearchPatternProcessor = searchPatternProcessor != null
+ ? searchPatternProcessor
: DLTKLanguageManager.getSearchPatternProcessor(
toolkit.getCoreToolkit(), true);
fFullyQualifySelection = (flags & SWT.MULTI) != 0;
@@ -1026,7 +1032,7 @@
| SWT.FLAT | flags | (VIRTUAL ? SWT.VIRTUAL : SWT.NONE));
fTable.setFont(parent.getFont());
fLabelProvider = new TypeInfoLabelProvider(imageExtension);
- fItems = new ArrayList<TableItem>(500);
+ fItems = new ArrayList<>(500);
fTable.setHeaderVisible(false);
addPopupMenu();
fTable.addControlListener(new ControlAdapter() {
@@ -1078,7 +1084,8 @@
fLastLabels[i] = item.getText();
Object data = item.getData();
if (data instanceof TypeNameMatch) {
- String qualifiedText = getQualifiedText((TypeNameMatch) data);
+ String qualifiedText = getQualifiedText(
+ (TypeNameMatch) data);
if (qualifiedText.length() > fLastLabels[i].length())
item.setText(qualifiedText);
}
@@ -1175,7 +1182,7 @@
public TypeNameMatch[] getSelection() {
TableItem[] items = fTable.getSelection();
- List<TypeNameMatch> result = new ArrayList<TypeNameMatch>(items.length);
+ List<TypeNameMatch> result = new ArrayList<>(items.length);
for (int i = 0; i < items.length; i++) {
Object data = items[i].getData();
if (data instanceof TypeNameMatch) {
@@ -1243,9 +1250,8 @@
fExpectedItemCount = 0;
fDashLineIndex = -1;
TypeInfoFilter filter = (fTypeInfoFilter != null) ? fTypeInfoFilter
- : new TypeInfoFilter(
- fToolkit,
- "*", fSearchScope, fElementKind, fFilterExtension, fSearchPatternProcessor); //$NON-NLS-1$
+ : new TypeInfoFilter(fToolkit, "*", fSearchScope, fElementKind, //$NON-NLS-1$
+ fFilterExtension, fSearchPatternProcessor);
if (VIRTUAL) {
fHistoryMatches = fHistory.getFilteredTypeInfos(filter);
fExpectedItemCount = fHistoryMatches.length;
@@ -1473,8 +1479,8 @@
private void scheduleSearchJob(int mode) {
fSearchJobTicket++;
- if (fLastCompletedFilter != null
- && fTypeInfoFilter.isSubFilter(fLastCompletedFilter.getText())) {
+ if (fLastCompletedFilter != null && fTypeInfoFilter
+ .isSubFilter(fLastCompletedFilter.getText())) {
fSearchJob = new CachedResultJob(fSearchJobTicket,
fLastCompletedResult, this, fTypeInfoFilter, fHistory,
fNumberOfVisibleItems, mode);
@@ -1496,7 +1502,8 @@
});
}
- private void searchJobCanceled(int ticket, final boolean removePendingItems) {
+ private void searchJobCanceled(int ticket,
+ final boolean removePendingItems) {
syncExec(ticket, () -> {
if (removePendingItems) {
shortenTable();
@@ -1566,8 +1573,8 @@
fillDashLine(item);
} else {
item.setData(type);
- item.setImage(fImageManager.get(fLabelProvider
- .getImageDescriptor(type)));
+ item.setImage(
+ fImageManager.get(fLabelProvider.getImageDescriptor(type)));
item.setText(fLabelProvider.getText(getTypeInfo(index - 1), type,
getTypeInfo(index + 1)));
item.setForeground(null);
@@ -1677,9 +1684,11 @@
private void fillDashLine(TableItem item) {
Rectangle bounds = item.getImageBounds(0);
Rectangle area = fTable.getBounds();
- boolean willHaveScrollBar = fExpectedItemCount + 1 > fNumberOfVisibleItems;
- item.setText(fDashLine.getText(area.width - bounds.x - bounds.width
- - fTableWidthDelta - (willHaveScrollBar ? fScrollbarWidth : 0)));
+ boolean willHaveScrollBar = fExpectedItemCount
+ + 1 > fNumberOfVisibleItems;
+ item.setText(fDashLine
+ .getText(area.width - bounds.x - bounds.width - fTableWidthDelta
+ - (willHaveScrollBar ? fScrollbarWidth : 0)));
item.setImage(fSeparatorIcon);
item.setForeground(fDashLineColor);
item.setData(fDashLine);
@@ -1711,11 +1720,11 @@
private Color computeDashLineColor() {
Color fg = fTable.getForeground();
- int fGray = (int) (0.3 * fg.getRed() + 0.59 * fg.getGreen() + 0.11 * fg
- .getBlue());
+ int fGray = (int) (0.3 * fg.getRed() + 0.59 * fg.getGreen()
+ + 0.11 * fg.getBlue());
Color bg = fTable.getBackground();
- int bGray = (int) (0.3 * bg.getRed() + 0.59 * bg.getGreen() + 0.11 * bg
- .getBlue());
+ int bGray = (int) (0.3 * bg.getRed() + 0.59 * bg.getGreen()
+ + 0.11 * bg.getBlue());
int gray = (int) ((fGray + bGray) * 0.66);
return new Color(fDisplay, gray, gray, gray);
}
@@ -1728,8 +1737,8 @@
}
private String getQualifiedText(TypeNameMatch type) {
- return fFullyQualifySelection ? fLabelProvider
- .getFullyQualifiedText(type) : fLabelProvider
- .getQualifiedText(type);
+ return fFullyQualifySelection
+ ? fLabelProvider.getFullyQualifiedText(type)
+ : fLabelProvider.getQualifiedText(type);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeSelectionDialog2.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeSelectionDialog2.java
index 712af3f..5261b05 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeSelectionDialog2.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/TypeSelectionDialog2.java
@@ -84,12 +84,9 @@
if (text == null || text.length() == 0) {
getShell().setText(fTitle);
} else {
- getShell()
- .setText(
- Messages
- .format(
- DLTKUIMessages.TypeSelectionDialog2_title_format,
- new String[] { fTitle, text }));
+ getShell().setText(Messages.format(
+ DLTKUIMessages.TypeSelectionDialog2_title_format,
+ new String[] { fTitle, text }));
}
}
}
@@ -185,21 +182,17 @@
IStatus.ERROR, "", null); //$NON-NLS-1$
} else {
if (fValidator != null) {
- List<IType> jElements = new ArrayList<IType>();
+ List<IType> jElements = new ArrayList<>();
for (int i = 0; i < selection.length; i++) {
IType type = selection[i].getType();
if (type != null) {
jElements.add(type);
} else {
- status = new Status(
- IStatus.ERROR,
- DLTKUIPlugin.getPluginId(),
- IStatus.ERROR,
- Messages
- .format(
- DLTKUIMessages.TypeSelectionDialog_error_type_doesnot_exist,
- selection[i]
- .getFullyQualifiedName()),
+ status = new Status(IStatus.ERROR,
+ DLTKUIPlugin.getPluginId(), IStatus.ERROR,
+ Messages.format(
+ DLTKUIMessages.TypeSelectionDialog_error_type_doesnot_exist,
+ selection[i].getFullyQualifiedName()),
null);
break;
}
@@ -236,8 +229,9 @@
if (selection instanceof ITextSelection) {
String text = ((ITextSelection) selection).getText();
setInitialFilter(text);
- }else if (selection instanceof IStructuredSelection) {
- Object object = ((IStructuredSelection) selection).getFirstElement();
+ } else if (selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection) selection)
+ .getFirstElement();
if (object instanceof IModelElement) {
IModelElement element = (IModelElement) object;
String text = element.getElementName();
@@ -253,9 +247,8 @@
if (text != null) {
text = text.trim();
if (text.length() > 0 /*
- * TODO: Add validate source type
- * call
- */) {
+ * TODO: Add validate source type call
+ */) {
setFilter(text);
}
}
@@ -326,8 +319,8 @@
setResult(result);
}
- private void ensureConsistency() throws InvocationTargetException,
- InterruptedException {
+ private void ensureConsistency()
+ throws InvocationTargetException, InterruptedException {
// we only have to ensure history consistency here since the search
// engine
// takes care of working copies.
@@ -342,14 +335,14 @@
}
OpenTypeHistory history = OpenTypeHistory.getInstance(fToolkit);
if (fgFirstTime || history.isEmpty()) {
- monitor
- .beginTask(
- DLTKUIMessages.TypeSelectionDialog_progress_consistency,
- 100);
+ monitor.beginTask(
+ DLTKUIMessages.TypeSelectionDialog_progress_consistency,
+ 100);
if (history.needConsistencyCheck()) {
- refreshSearchIndices(new SubProgressMonitor(monitor, 90));
- history.checkConsistency(new SubProgressMonitor(
- monitor, 10));
+ refreshSearchIndices(
+ new SubProgressMonitor(monitor, 90));
+ history.checkConsistency(
+ new SubProgressMonitor(monitor, 10));
} else {
refreshSearchIndices(monitor);
}
@@ -369,17 +362,15 @@
private void refreshSearchIndices(IProgressMonitor monitor)
throws InvocationTargetException {
try {
- new SearchEngine().searchAllTypeNames(
- null,
- 0,
+ new SearchEngine().searchAllTypeNames(null, 0,
// make sure we search a concrete name. This is
// faster according to Kent
"_______________".toCharArray(), //$NON-NLS-1$
SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE,
- IDLTKSearchConstants.FIELD, SearchEngine
- .createWorkspaceScope(fToolkit
- .getCoreToolkit()),
+ IDLTKSearchConstants.FIELD,
+ SearchEngine.createWorkspaceScope(
+ fToolkit.getCoreToolkit()),
new NopTypeNameRequestor(),
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
index 955036f..442b77b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
@@ -9,6 +9,7 @@
package org.eclipse.dltk.internal.ui.dnd;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -34,27 +35,26 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.part.ResourceTransfer;
-
/**
* A drag adapter that transfers the current selection as </code>
- * IResource</code>. Only those elements in the selection are part
- * of the transfer which can be converted into an <code>IResource
+ * IResource</code>. Only those elements in the selection are part of the
+ * transfer which can be converted into an <code>IResource
* </code>.
*/
-public class ResourceTransferDragAdapter extends DragSourceAdapter implements TransferDragSourceListener {
+public class ResourceTransferDragAdapter extends DragSourceAdapter
+ implements TransferDragSourceListener {
private ISelectionProvider fProvider;
- private static final List EMPTY_LIST= new ArrayList(0);
-
/**
* Creates a new ResourceTransferDragAdapter for the given selection
* provider.
*
- * @param provider the selection provider to access the viewer's selection
+ * @param provider
+ * the selection provider to access the viewer's selection
*/
public ResourceTransferDragAdapter(ISelectionProvider provider) {
- fProvider= provider;
+ fProvider = provider;
}
@Override
@@ -64,13 +64,13 @@
@Override
public void dragStart(DragSourceEvent event) {
- event.doit= convertSelection().size() > 0;
+ event.doit = convertSelection().size() > 0;
}
@Override
public void dragSetData(DragSourceEvent event) {
List<IResource> resources = convertSelection();
- event.data= resources.toArray(new IResource[resources.size()]);
+ event.data = resources.toArray(new IResource[resources.size()]);
}
@Override
@@ -84,17 +84,18 @@
}
private List<IResource> convertSelection() {
- ISelection s= fProvider.getSelection();
+ ISelection s = fProvider.getSelection();
if (!(s instanceof IStructuredSelection))
- return EMPTY_LIST;
- IStructuredSelection selection= (IStructuredSelection)s;
- List<IResource> result = new ArrayList<IResource>(selection.size());
- for (Iterator iter= selection.iterator(); iter.hasNext();) {
- Object element= iter.next();
- IResource resource= null;
+ return Collections.emptyList();
+ IStructuredSelection selection = (IStructuredSelection) s;
+ List<IResource> result = new ArrayList<>(selection.size());
+ for (Iterator iter = selection.iterator(); iter.hasNext();) {
+ Object element = iter.next();
+ IResource resource = null;
if (element instanceof IModelElement) {
- // don't use IAdaptable as for members only the top level type adapts
- resource= ((IModelElement) element).getResource();
+ // don't use IAdaptable as for members only the top level type
+ // adapts
+ resource = ((IModelElement) element).getResource();
} else if (element instanceof IAdaptable) {
resource = ((IAdaptable) element).getAdapter(IResource.class);
}
@@ -105,11 +106,10 @@
}
private void handleFinishedDropMove(DragSourceEvent event) {
- MultiStatus status= new MultiStatus(
- DLTKUIPlugin.PLUGIN_ID,
- IModelStatusConstants.INTERNAL_ERROR,
- DLTKUIMessages.ResourceTransferDragAdapter_cannot_delete_resource,
- null);
+ MultiStatus status = new MultiStatus(DLTKUIPlugin.PLUGIN_ID,
+ IModelStatusConstants.INTERNAL_ERROR,
+ DLTKUIMessages.ResourceTransferDragAdapter_cannot_delete_resource,
+ null);
List<IResource> resources = convertSelection();
for (Iterator<IResource> iter = resources.iterator(); iter.hasNext();) {
IResource resource = iter.next();
@@ -120,13 +120,12 @@
}
}
if (status.getChildren().length > 0) {
- Shell parent= SWTUtil.getShell(event.widget);
- ErrorDialog error= new ErrorDialog(parent,
- DLTKUIMessages.ResourceTransferDragAdapter_moving_resource,
- DLTKUIMessages.ResourceTransferDragAdapter_cannot_delete_files,
- status, IStatus.ERROR);
+ Shell parent = SWTUtil.getShell(event.widget);
+ ErrorDialog error = new ErrorDialog(parent,
+ DLTKUIMessages.ResourceTransferDragAdapter_moving_resource,
+ DLTKUIMessages.ResourceTransferDragAdapter_cannot_delete_files,
+ status, IStatus.ERROR);
error.open();
}
}
}
-
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java
index bac2c09..c6910c8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java
@@ -8,9 +8,7 @@
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
-
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -33,32 +31,31 @@
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-
-
-public class BasicSourceModuleEditorActionContributor extends BasicScriptEditorActionContributor {
+public class BasicSourceModuleEditorActionContributor
+ extends BasicScriptEditorActionContributor {
/**
* A menu listener that can remove itself from the menu it listens to.
*
*/
- private final class MenuListener implements IMenuListener {
- private final IMenuManager fMenu;
+ private final class MenuListener implements IMenuListener {
+ private final IMenuManager fMenu;
public MenuListener(IMenuManager menu) {
- fMenu= menu;
- }
+ fMenu = menu;
+ }
@Override
public void menuAboutToShow(IMenuManager manager) {
- for (int i= 0; i < fSpecificAssistActions.length; i++) {
- fSpecificAssistActions[i].update();
- }
- }
+ for (int i = 0; i < fSpecificAssistActions.length; i++) {
+ fSpecificAssistActions[i].update();
+ }
+ }
public void dispose() {
fMenu.removeMenuListener(this);
}
- }
+ }
protected RetargetAction fRetargetContentAssist;
protected RetargetTextEditorAction fContentAssist;
@@ -70,27 +67,44 @@
private MenuListener fContentAssistMenuListener;
-
public BasicSourceModuleEditorActionContributor() {
- fRetargetContentAssist= new RetargetAction(DLTKActionConstants.CONTENT_ASSIST, ScriptEditorMessages.ContentAssistProposal_label);
- fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- fRetargetContentAssist.setImageDescriptor(DLTKPluginImages.DESC_ELCL_CODE_ASSIST);
- fRetargetContentAssist.setDisabledImageDescriptor(DLTKPluginImages.DESC_DLCL_CODE_ASSIST);
+ fRetargetContentAssist = new RetargetAction(
+ DLTKActionConstants.CONTENT_ASSIST,
+ ScriptEditorMessages.ContentAssistProposal_label);
+ fRetargetContentAssist.setActionDefinitionId(
+ ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ fRetargetContentAssist
+ .setImageDescriptor(DLTKPluginImages.DESC_ELCL_CODE_ASSIST);
+ fRetargetContentAssist.setDisabledImageDescriptor(
+ DLTKPluginImages.DESC_DLCL_CODE_ASSIST);
markAsPartListener(fRetargetContentAssist);
- fContentAssist= new RetargetTextEditorAction(ScriptEditorMessages.getBundleForConstructedKeys(), "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- fContentAssist.setImageDescriptor(DLTKPluginImages.DESC_ELCL_CODE_ASSIST);
- fContentAssist.setDisabledImageDescriptor(DLTKPluginImages.DESC_DLCL_CODE_ASSIST);
+ fContentAssist = new RetargetTextEditorAction(
+ ScriptEditorMessages.getBundleForConstructedKeys(),
+ "ContentAssistProposal."); //$NON-NLS-1$
+ fContentAssist.setActionDefinitionId(
+ ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ fContentAssist
+ .setImageDescriptor(DLTKPluginImages.DESC_ELCL_CODE_ASSIST);
+ fContentAssist.setDisabledImageDescriptor(
+ DLTKPluginImages.DESC_DLCL_CODE_ASSIST);
- fContextInformation= new RetargetTextEditorAction(ScriptEditorMessages.getBundleForConstructedKeys(), "ContentAssistContextInformation."); //$NON-NLS-1$
- fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
+ fContextInformation = new RetargetTextEditorAction(
+ ScriptEditorMessages.getBundleForConstructedKeys(),
+ "ContentAssistContextInformation."); //$NON-NLS-1$
+ fContextInformation.setActionDefinitionId(
+ ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
- fQuickAssistAction= new RetargetTextEditorAction(ScriptEditorMessages.getBundleForConstructedKeys(), "CorrectionAssistProposal."); //$NON-NLS-1$
- fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
+ fQuickAssistAction = new RetargetTextEditorAction(
+ ScriptEditorMessages.getBundleForConstructedKeys(),
+ "CorrectionAssistProposal."); //$NON-NLS-1$
+ fQuickAssistAction.setActionDefinitionId(
+ ITextEditorActionDefinitionIds.QUICK_ASSIST);
- fChangeEncodingAction= new RetargetTextEditorAction(ScriptEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction."); //$NON-NLS-1$
+ fChangeEncodingAction = new RetargetTextEditorAction(
+ ScriptEditorMessages.getBundleForConstructedKeys(),
+ "Editor.ChangeEncodingAction."); //$NON-NLS-1$
}
@Override
@@ -100,18 +114,24 @@
if (fContentAssistMenuListener != null)
fContentAssistMenuListener.dispose();
- IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ IMenuManager editMenu = menu
+ .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(fChangeEncodingAction);
- IMenuManager caMenu= new MenuManager(ScriptEditorMessages.BasicEditorActionContributor_specific_content_assist_menu, "specific_content_assist"); //$NON-NLS-1$
- editMenu.insertAfter(ITextEditorActionConstants.GROUP_ASSIST, caMenu);
+ IMenuManager caMenu = new MenuManager(
+ ScriptEditorMessages.BasicEditorActionContributor_specific_content_assist_menu,
+ "specific_content_assist"); //$NON-NLS-1$
+ editMenu.insertAfter(ITextEditorActionConstants.GROUP_ASSIST,
+ caMenu);
caMenu.add(fRetargetContentAssist);
- Collection descriptors= CompletionProposalComputerRegistry.getDefault().getProposalCategories();
- List<SpecificContentAssistAction> specificAssistActions = new ArrayList<SpecificContentAssistAction>(
+ List<CompletionProposalCategory> descriptors = CompletionProposalComputerRegistry
+ .getDefault().getProposalCategories();
+ List<SpecificContentAssistAction> specificAssistActions = new ArrayList<>(
descriptors.size());
- for (Iterator it= descriptors.iterator(); it.hasNext();) {
- final CompletionProposalCategory cat= (CompletionProposalCategory) it.next();
+ for (Iterator<CompletionProposalCategory> it = descriptors
+ .iterator(); it.hasNext();) {
+ final CompletionProposalCategory cat = it.next();
if (cat.hasComputers()) {
SpecificContentAssistAction caAction = new SpecificContentAssistAction(
cat);
@@ -123,13 +143,14 @@
new SpecificContentAssistAction[specificAssistActions
.size()]);
if (fSpecificAssistActions.length > 0) {
- fContentAssistMenuListener= new MenuListener(caMenu);
+ fContentAssistMenuListener = new MenuListener(caMenu);
caMenu.addMenuListener(fContentAssistMenuListener);
}
caMenu.add(new Separator("context_info")); //$NON-NLS-1$
caMenu.add(fContextInformation);
- editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fQuickAssistAction);
+ editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST,
+ fQuickAssistAction);
}
}
@@ -137,47 +158,56 @@
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
- ITextEditor textEditor= null;
+ ITextEditor textEditor = null;
if (part instanceof ITextEditor)
- textEditor= (ITextEditor) part;
+ textEditor = (ITextEditor) part;
- fContentAssist.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
- fContextInformation.setAction(getAction(textEditor, "ContentAssistContextInformation")); //$NON-NLS-1$
- fQuickAssistAction.setAction(getAction(textEditor, ITextEditorActionConstants.QUICK_ASSIST));
+ fContentAssist
+ .setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
+ fContextInformation.setAction(
+ getAction(textEditor, "ContentAssistContextInformation")); //$NON-NLS-1$
+ fQuickAssistAction.setAction(
+ getAction(textEditor, ITextEditorActionConstants.QUICK_ASSIST));
if (fSpecificAssistActions != null) {
- for (int i= 0; i < fSpecificAssistActions.length; i++) {
- SpecificContentAssistAction assistAction= fSpecificAssistActions[i];
+ for (int i = 0; i < fSpecificAssistActions.length; i++) {
+ SpecificContentAssistAction assistAction = fSpecificAssistActions[i];
assistAction.setActiveEditor(part);
}
}
- fChangeEncodingAction.setAction(getAction(textEditor, ITextEditorActionConstants.CHANGE_ENCODING));
+ fChangeEncodingAction.setAction(getAction(textEditor,
+ ITextEditorActionConstants.CHANGE_ENCODING));
- IActionBars actionBars= getActionBars();
- actionBars.setGlobalActionHandler(DLTKActionConstants.SHIFT_RIGHT, getAction(textEditor, "ShiftRight")); //$NON-NLS-1$
- actionBars.setGlobalActionHandler(DLTKActionConstants.SHIFT_LEFT, getAction(textEditor, "ShiftLeft")); //$NON-NLS-1$
+ IActionBars actionBars = getActionBars();
+ actionBars.setGlobalActionHandler(DLTKActionConstants.SHIFT_RIGHT,
+ getAction(textEditor, "ShiftRight")); //$NON-NLS-1$
+ actionBars.setGlobalActionHandler(DLTKActionConstants.SHIFT_LEFT,
+ getAction(textEditor, "ShiftLeft")); //$NON-NLS-1$
- actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), getAction(textEditor, IDEActionFactory.ADD_TASK.getId()));
- actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(textEditor, IDEActionFactory.BOOKMARK.getId()));
+ actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(),
+ getAction(textEditor, IDEActionFactory.ADD_TASK.getId()));
+ actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(),
+ getAction(textEditor, IDEActionFactory.BOOKMARK.getId()));
}
@Override
public void init(IActionBars bars, IWorkbenchPage page) {
super.init(bars, page);
// register actions that have a dynamic editor.
- bars.setGlobalActionHandler(DLTKActionConstants.CONTENT_ASSIST, fContentAssist);
+ bars.setGlobalActionHandler(DLTKActionConstants.CONTENT_ASSIST,
+ fContentAssist);
}
@Override
public void dispose() {
if (fRetargetContentAssist != null) {
fRetargetContentAssist.dispose();
- fRetargetContentAssist= null;
+ fRetargetContentAssist = null;
}
if (fContentAssistMenuListener != null) {
fContentAssistMenuListener.dispose();
- fContentAssistMenuListener= null;
+ fContentAssistMenuListener = null;
}
super.dispose();
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BracketInserter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BracketInserter.java
index 1b441ca..17307e7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BracketInserter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BracketInserter.java
@@ -31,8 +31,8 @@
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.ui.texteditor.link.EditorLinkedModeUI;
-public abstract class BracketInserter implements VerifyKeyListener,
- ILinkedModeListener {
+public abstract class BracketInserter
+ implements VerifyKeyListener, ILinkedModeListener {
protected final ScriptEditor editor;
protected boolean fCloseBrackets = true;
@@ -40,7 +40,7 @@
protected boolean fCloseAngularBrackets = true;
protected final String CATEGORY;
protected IPositionUpdater fUpdater;
- protected Stack<BracketLevel> fBracketLevelStack = new Stack<BracketLevel>();
+ protected Stack<BracketLevel> fBracketLevelStack = new Stack<>();
protected BracketInserter(ScriptEditor editor) {
this.editor = editor;
@@ -128,29 +128,28 @@
final IDocument document = sourceViewer.getDocument();
if (document instanceof IDocumentExtension) {
IDocumentExtension extension = (IDocumentExtension) document;
- extension.registerPostNotificationReplace(null,
- (d, owner) -> {
- if ((level.fFirstPosition.isDeleted
- || level.fFirstPosition.length == 0)
- && !level.fSecondPosition.isDeleted
- && level.fSecondPosition.offset == level.fFirstPosition.offset) {
- try {
- document.replace(level.fSecondPosition.offset,
- level.fSecondPosition.length, ""); //$NON-NLS-1$
- } catch (BadLocationException e1) {
- DLTKUIPlugin.log(e1);
- }
- }
+ extension.registerPostNotificationReplace(null, (d, owner) -> {
+ if ((level.fFirstPosition.isDeleted
+ || level.fFirstPosition.length == 0)
+ && !level.fSecondPosition.isDeleted
+ && level.fSecondPosition.offset == level.fFirstPosition.offset) {
+ try {
+ document.replace(level.fSecondPosition.offset,
+ level.fSecondPosition.length, ""); //$NON-NLS-1$
+ } catch (BadLocationException e1) {
+ DLTKUIPlugin.log(e1);
+ }
+ }
- if (fBracketLevelStack.size() == 0) {
- document.removePositionUpdater(fUpdater);
- try {
- document.removePositionCategory(CATEGORY);
- } catch (BadPositionCategoryException e2) {
- DLTKUIPlugin.log(e2);
- }
- }
- });
+ if (fBracketLevelStack.size() == 0) {
+ document.removePositionUpdater(fUpdater);
+ try {
+ document.removePositionCategory(CATEGORY);
+ } catch (BadPositionCategoryException e2) {
+ DLTKUIPlugin.log(e2);
+ }
+ }
+ });
}
}
@@ -165,8 +164,8 @@
protected void insertBrackets(final IDocument document, final int offset,
final int length, final char character, final char closingCharacter)
throws BadLocationException, BadPositionCategoryException {
- document.replace(offset, length, new String(new char[] { character,
- closingCharacter }));
+ document.replace(offset, length,
+ new String(new char[] { character, closingCharacter }));
BracketLevel level = new ScriptEditor.BracketLevel();
fBracketLevelStack.push(level);
@@ -205,8 +204,8 @@
level.fUI.enter();
IRegion newSelection = level.fUI.getSelectedRegion();
- sourceViewer.setSelectedRange(newSelection.getOffset(), newSelection
- .getLength());
+ sourceViewer.setSelectedRange(newSelection.getOffset(),
+ newSelection.getLength());
}
/**
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/DocumentAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/DocumentAdapter.java
index de2b576..ad06f23 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/DocumentAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/DocumentAdapter.java
@@ -42,131 +42,177 @@
import org.eclipse.jface.text.ISynchronizable;
import org.eclipse.swt.widgets.Display;
-
-
/**
- * Adapts <code>IDocument</code> to <code>IBuffer</code>. Uses the
- * same algorithm as the text widget to determine the buffer's line delimiter.
- * All text inserted into the buffer is converted to this line delimiter.
- * This class is <code>public</code> for test purposes only.
+ * Adapts <code>IDocument</code> to <code>IBuffer</code>. Uses the same
+ * algorithm as the text widget to determine the buffer's line delimiter. All
+ * text inserted into the buffer is converted to this line delimiter. This class
+ * is <code>public</code> for test purposes only.
*/
public class DocumentAdapter implements IBuffer, IDocumentListener {
- /**
- * Internal implementation of a NULL instanceof IBuffer.
- */
- static private class NullBuffer implements IBuffer {
- @Override
- public void addBufferChangedListener(IBufferChangedListener listener) {}
- @Override
- public void append(char[] text) {}
- @Override
- public void append(String text) {}
- @Override
- public void close() {}
- @Override
- public char getChar(int position) { return 0; }
- @Override
- public char[] getCharacters() { return null; }
- @Override
- public String getContents() { return null; }
- @Override
- public int getLength() { return 0; }
- @Override
- public IOpenable getOwner() { return null; }
- @Override
- public String getText(int offset, int length) { return null; }
- @Override
- public IResource getUnderlyingResource() { return null; }
- @Override
- public boolean hasUnsavedChanges() { return false; }
- @Override
- public boolean isClosed() { return false; }
- @Override
- public boolean isReadOnly() { return true; }
- @Override
- public void removeBufferChangedListener(IBufferChangedListener listener) {}
- @Override
- public void replace(int position, int length, char[] text) {}
- @Override
- public void replace(int position, int length, String text) {}
- @Override
- public void save(IProgressMonitor progress, boolean force) throws ModelException {}
- @Override
- public void setContents(char[] contents) {}
- @Override
- public void setContents(String contents) {}
+ /**
+ * Internal implementation of a NULL instanceof IBuffer.
+ */
+ static private class NullBuffer implements IBuffer {
+ @Override
+ public void addBufferChangedListener(IBufferChangedListener listener) {
}
+ @Override
+ public void append(char[] text) {
+ }
- /** NULL implementing <code>IBuffer</code> */
- public final static IBuffer NULL= new NullBuffer();
+ @Override
+ public void append(String text) {
+ }
- /*
- *
- */
- private IPath fPath;
+ @Override
+ public void close() {
+ }
+ @Override
+ public char getChar(int position) {
+ return 0;
+ }
- /**
- * Executes a document set content call in the ui thread.
- */
- protected class DocumentSetCommand implements Runnable {
+ @Override
+ public char[] getCharacters() {
+ return null;
+ }
- private String fContents;
+ @Override
+ public String getContents() {
+ return null;
+ }
- @Override
- public void run() {
- fDocument.set(fContents);
- }
+ @Override
+ public int getLength() {
+ return 0;
+ }
- public void set(String contents) {
- fContents= contents;
- //Display.getDefault().syncExec(this);
- DocumentAdapter.run(this);
+ @Override
+ public IOpenable getOwner() {
+ return null;
+ }
+
+ @Override
+ public String getText(int offset, int length) {
+ return null;
+ }
+
+ @Override
+ public IResource getUnderlyingResource() {
+ return null;
+ }
+
+ @Override
+ public boolean hasUnsavedChanges() {
+ return false;
+ }
+
+ @Override
+ public boolean isClosed() {
+ return false;
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ @Override
+ public void removeBufferChangedListener(
+ IBufferChangedListener listener) {
+ }
+
+ @Override
+ public void replace(int position, int length, char[] text) {
+ }
+
+ @Override
+ public void replace(int position, int length, String text) {
+ }
+
+ @Override
+ public void save(IProgressMonitor progress, boolean force)
+ throws ModelException {
+ }
+
+ @Override
+ public void setContents(char[] contents) {
+ }
+
+ @Override
+ public void setContents(String contents) {
+ }
+ }
+
+ /** NULL implementing <code>IBuffer</code> */
+ public final static IBuffer NULL = new NullBuffer();
+
+ /*
+ *
+ */
+ private IPath fPath;
+
+ /**
+ * Executes a document set content call in the ui thread.
+ */
+ protected class DocumentSetCommand implements Runnable {
+
+ private String fContents;
+
+ @Override
+ public void run() {
+ fDocument.set(fContents);
+ }
+
+ public void set(String contents) {
+ fContents = contents;
+ // Display.getDefault().syncExec(this);
+ DocumentAdapter.run(this);
+ }
+ }
+
+ /**
+ * Executes a document replace call in the ui thread.
+ */
+ protected class DocumentReplaceCommand implements Runnable {
+
+ private int fOffset;
+ private int fLength;
+ private String fText;
+
+ @Override
+ public void run() {
+ try {
+ fDocument.replace(fOffset, fLength, fText);
+ } catch (BadLocationException x) {
+ // ignore
}
}
- /**
- * Executes a document replace call in the ui thread.
- */
- protected class DocumentReplaceCommand implements Runnable {
-
- private int fOffset;
- private int fLength;
- private String fText;
-
- @Override
- public void run() {
- try {
- fDocument.replace(fOffset, fLength, fText);
- } catch (BadLocationException x) {
- // ignore
- }
- }
-
- public void replace(int offset, int length, String text) {
- fOffset= offset;
- fLength= length;
- fText= text;
- Display.getDefault().syncExec(this);
- }
+ public void replace(int offset, int length, String text) {
+ fOffset = offset;
+ fLength = length;
+ fText = text;
+ Display.getDefault().syncExec(this);
}
+ }
- private static final boolean DEBUG_LINE_DELIMITERS= true;
+ private static final boolean DEBUG_LINE_DELIMITERS = true;
private IOpenable fOwner;
private IFile fFile;
private ITextFileBuffer fTextFileBuffer;
private IDocument fDocument;
- private DocumentSetCommand fSetCmd= new DocumentSetCommand();
- private DocumentReplaceCommand fReplaceCmd= new DocumentReplaceCommand();
+ private DocumentSetCommand fSetCmd = new DocumentSetCommand();
+ private DocumentReplaceCommand fReplaceCmd = new DocumentReplaceCommand();
private Set<String> fLegalLineDelimiters;
- private List<IBufferChangedListener> fBufferListeners = new ArrayList<IBufferChangedListener>(
- 3);
+ private List<IBufferChangedListener> fBufferListeners = new ArrayList<>(3);
private IStatus fStatus;
/** @since 4.0 */
@@ -180,13 +226,14 @@
*/
public DocumentAdapter(IOpenable owner, IFile file) {
- fOwner= owner;
- fFile= file;
- fPath= fFile.getFullPath();
+ fOwner = owner;
+ fFile = file;
+ fPath = fFile.getFullPath();
fLocationKind = LocationKind.IFILE;
initialize();
}
+
/**
* Constructs a new document adapter.
*
@@ -195,8 +242,8 @@
public DocumentAdapter(IOpenable owner, IPath path) {
Assert.isLegal(path != null);
- fOwner= owner;
- fPath= path;
+ fOwner = owner;
+ fPath = path;
fLocationKind = LocationKind.NORMALIZE;
initialize();
@@ -225,23 +272,25 @@
}
private void initialize() {
- ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
+ ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
try {
if (fFileStore != null) {
manager.connectFileStore(fFileStore, new NullProgressMonitor());
fTextFileBuffer = manager
.getFileStoreTextFileBuffer(fFileStore);
} else {
- manager.connect(fPath, fLocationKind, new NullProgressMonitor());
+ manager.connect(fPath, fLocationKind,
+ new NullProgressMonitor());
fTextFileBuffer = manager.getTextFileBuffer(fPath,
fLocationKind);
}
- fDocument= fTextFileBuffer.getDocument();
+ fDocument = fTextFileBuffer.getDocument();
} catch (CoreException x) {
- fStatus= x.getStatus();
- fDocument= manager.createEmptyDocument(fPath, LocationKind.NORMALIZE);
+ fStatus = x.getStatus();
+ fDocument = manager.createEmptyDocument(fPath,
+ LocationKind.NORMALIZE);
if (fDocument instanceof ISynchronizable)
- ((ISynchronizable)fDocument).setLockObject(new Object());
+ ((ISynchronizable) fDocument).setLockObject(new Object());
}
fDocument.addPrenotifiedDocumentListener(this);
}
@@ -304,12 +353,13 @@
if (isClosed())
return;
- IDocument d= fDocument;
- fDocument= null;
+ IDocument d = fDocument;
+ fDocument = null;
d.removePrenotifiedDocumentListener(this);
if (fTextFileBuffer != null) {
- ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
+ ITextFileBufferManager manager = FileBuffers
+ .getTextFileBufferManager();
try {
if (fFileStore != null)
manager.disconnectFileStore(fFileStore,
@@ -320,7 +370,7 @@
} catch (CoreException x) {
// ignore
}
- fTextFileBuffer= null;
+ fTextFileBuffer = null;
}
fireBufferChanged(new BufferChangedEvent(this, 0, 0, null));
@@ -338,7 +388,7 @@
@Override
public char[] getCharacters() {
- String content= getContents();
+ String content = getContents();
return content == null ? null : content.toCharArray();
}
@@ -383,7 +433,7 @@
@Override
public boolean isReadOnly() {
- IResource resource= getUnderlyingResource();
+ IResource resource = getUnderlyingResource();
return resource == null ? true
: resource.getResourceAttributes().isReadOnly();
}
@@ -402,7 +452,8 @@
}
@Override
- public void save(IProgressMonitor progress, boolean force) throws ModelException {
+ public void save(IProgressMonitor progress, boolean force)
+ throws ModelException {
try {
if (fTextFileBuffer != null)
fTextFileBuffer.commit(progress, force);
@@ -418,7 +469,7 @@
@Override
public void setContents(String contents) {
- int oldLength= fDocument.getLength();
+ int oldLength = fDocument.getLength();
if (contents == null) {
@@ -437,16 +488,15 @@
}
}
-
private void validateLineDelimiters(String contents) {
if (fLegalLineDelimiters == null) {
// collect all line delimiters in the document
- HashSet<String> existingDelimiters = new HashSet<String>();
+ HashSet<String> existingDelimiters = new HashSet<>();
- for (int i= fDocument.getNumberOfLines() - 1; i >= 0; i-- ) {
+ for (int i = fDocument.getNumberOfLines() - 1; i >= 0; i--) {
try {
- String curr= fDocument.getLineDelimiter(i);
+ String curr = fDocument.getLineDelimiter(i);
if (curr != null) {
existingDelimiters.add(curr);
}
@@ -457,24 +507,24 @@
if (existingDelimiters.isEmpty()) {
return; // first insertion of a line delimiter: no test
}
- fLegalLineDelimiters= existingDelimiters;
+ fLegalLineDelimiters = existingDelimiters;
}
- DefaultLineTracker tracker= new DefaultLineTracker();
+ DefaultLineTracker tracker = new DefaultLineTracker();
tracker.set(contents);
- int lines= tracker.getNumberOfLines();
+ int lines = tracker.getNumberOfLines();
if (lines <= 1)
return;
- for (int i= 0; i < lines; i++) {
+ for (int i = 0; i < lines; i++) {
try {
- String curr= tracker.getLineDelimiter(i);
+ String curr = tracker.getLineDelimiter(i);
if (curr != null && !fLegalLineDelimiters.contains(curr)) {
StringBuffer buf = new StringBuffer(
"WARNING: DocumentAdapter added new line delimiter to code: "); //$NON-NLS-1$
- for (int k= 0; k < curr.length(); k++) {
+ for (int k = 0; k < curr.length(); k++) {
if (k > 0)
buf.append(' ');
buf.append((int) curr.charAt(k));
@@ -497,12 +547,13 @@
@Override
public void documentChanged(DocumentEvent event) {
- fireBufferChanged(new BufferChangedEvent(this, event.getOffset(), event.getLength(), event.getText()));
+ fireBufferChanged(new BufferChangedEvent(this, event.getOffset(),
+ event.getLength(), event.getText()));
}
private void fireBufferChanged(BufferChangedEvent event) {
if (fBufferListeners != null && fBufferListeners.size() > 0) {
- Iterator<IBufferChangedListener> e = new ArrayList<IBufferChangedListener>(
+ Iterator<IBufferChangedListener> e = new ArrayList<>(
fBufferListeners).iterator();
while (e.hasNext())
e.next().bufferChanged(event);
@@ -512,11 +563,12 @@
/**
* Run the given runnable in the UI thread.
*
- * @param runnable the runnable
+ * @param runnable
+ * the runnable
* @since 3.3
*/
private static final void run(Runnable runnable) {
- Display currentDisplay= Display.getCurrent();
+ Display currentDisplay = Display.getCurrent();
if (currentDisplay != null)
runnable.run();
else
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
index ded2607..09e10ea 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/EditorUtility.java
@@ -472,8 +472,8 @@
}
public static IEditorPart[] getDirtyEditors() {
- Set<IEditorInput> inputs = new HashSet<IEditorInput>();
- List<IEditorPart> result = new ArrayList<IEditorPart>(0);
+ Set<IEditorInput> inputs = new HashSet<>();
+ List<IEditorPart> result = new ArrayList<>(0);
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
for (int i = 0; i < windows.length; i++) {
@@ -685,7 +685,7 @@
// r1.rightStart()<r2.rightStart() ->
// r1.rightEnd()<r2.rightStart
- ArrayList<IRegion> regions = new ArrayList<IRegion>();
+ ArrayList<IRegion> regions = new ArrayList<>();
for (int i = 0; i < differences.length; i++) {
RangeDifference curr = differences[i];
if (curr.kind() == RangeDifference.CHANGE
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ModelElementHyperlinkDetector.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ModelElementHyperlinkDetector.java
index 4f5d288..d2d9886 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ModelElementHyperlinkDetector.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ModelElementHyperlinkDetector.java
@@ -39,8 +39,8 @@
/**
* Script element hyperlink detector.
*/
-public class ModelElementHyperlinkDetector implements IHyperlinkDetector,
- IHyperlinkDetectorExtension {
+public class ModelElementHyperlinkDetector
+ implements IHyperlinkDetector, IHyperlinkDetectorExtension {
private ITextEditor fTextEditor;
@@ -56,8 +56,8 @@
}
@Override
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
- IRegion region, boolean canShowMultipleHyperlinks) {
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region,
+ boolean canShowMultipleHyperlinks) {
if (region == null || !(fTextEditor instanceof ScriptEditor))
return null;
@@ -68,14 +68,14 @@
int offset = region.getOffset();
- IModelElement input = EditorUtility.getEditorInputModelElement(
- fTextEditor, false);
+ IModelElement input = EditorUtility
+ .getEditorInputModelElement(fTextEditor, false);
if (input == null)
return null;
try {
- IDocument document = fTextEditor.getDocumentProvider().getDocument(
- fTextEditor.getEditorInput());
+ IDocument document = fTextEditor.getDocumentProvider()
+ .getDocument(fTextEditor.getEditorInput());
IRegion wordRegion = ScriptWordFinder.findWord(document, offset);
if (wordRegion == null || wordRegion.getLength() == 0)
return null;
@@ -86,8 +86,7 @@
if (selection == null) {
return null;
}
- final List<Object> elements = new ArrayList<Object>(
- selection.size());
+ final List<Object> elements = new ArrayList<>(selection.size());
for (Object element : selection) {
if (element instanceof IModelElement) {
elements.add(element);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java
index 70ac3a3..da6b013 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/OccurrencesFinder.java
@@ -49,7 +49,6 @@
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbenchWindow;
@@ -104,7 +103,7 @@
public OccurrencesFinder(ScriptEditor editor) {
this.editor = editor;
- final NatureExtensionManager<IOccurrencesFinder> occurrencesFinderManager = new NatureExtensionManager<IOccurrencesFinder>(
+ final NatureExtensionManager<IOccurrencesFinder> occurrencesFinderManager = new NatureExtensionManager<>(
DLTKUIPlugin.PLUGIN_ID + ".search", IOccurrencesFinder.class);
finders = occurrencesFinderManager
.getInstances(editor.getLanguageToolkit().getNatureId());
@@ -143,10 +142,10 @@
}
private boolean isCanceled(IProgressMonitor progressMonitor) {
- return fCanceled
- || progressMonitor.isCanceled()
+ return fCanceled || progressMonitor.isCanceled()
|| fPostSelectionValidator != null
- && !(fPostSelectionValidator.isValid(fSelection) || fForcedMarkOccurrencesSelection == fSelection)
+ && !(fPostSelectionValidator.isValid(fSelection)
+ || fForcedMarkOccurrencesSelection == fSelection)
|| LinkedModeModel.hasInstalledModel(fDocument);
}
@@ -177,8 +176,7 @@
// Add occurrence annotations
int length = fLocations.length;
- Map<Annotation, Position> annotationMap = new HashMap<Annotation, Position>(
- length);
+ Map<Annotation, Position> annotationMap = new HashMap<>(length);
for (int i = 0; i < length; i++) {
if (isCanceled(progressMonitor))
@@ -191,8 +189,9 @@
String description = location.getDescription();
String annotationType = "org.eclipse.dltk.ui.occurrences"; //$NON-NLS-1$
- annotationMap.put(new Annotation(annotationType, false,
- description), position);
+ annotationMap.put(
+ new Annotation(annotationType, false, description),
+ position);
}
if (isCanceled(progressMonitor))
@@ -211,8 +210,8 @@
mapEntry.getValue());
}
}
- fOccurrenceAnnotations = annotationMap.keySet().toArray(
- new Annotation[annotationMap.keySet().size()]);
+ fOccurrenceAnnotations = annotationMap.keySet()
+ .toArray(new Annotation[annotationMap.keySet().size()]);
}
return Status.OK_STATUS;
@@ -224,8 +223,8 @@
*
* @since 3.0
*/
- class OccurrencesFinderJobCanceler implements IDocumentListener,
- ITextInputListener {
+ class OccurrencesFinderJobCanceler
+ implements IDocumentListener, ITextInputListener {
public void install() {
ISourceViewer sourceViewer = getViewer();
@@ -278,9 +277,9 @@
}
/*
- * @see
- * org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged
- * (org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
+ * @see org.eclipse.jface.text.ITextInputListener#
+ * inputDocumentAboutToBeChanged (org.eclipse.jface.text.IDocument,
+ * org.eclipse.jface.text.IDocument)
*/
@Override
public void inputDocumentAboutToBeChanged(IDocument oldInput,
@@ -297,7 +296,8 @@
* .eclipse .jface.text.IDocument, org.eclipse.jface.text.IDocument)
*/
@Override
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
+ public void inputDocumentChanged(IDocument oldInput,
+ IDocument newInput) {
if (newInput == null)
return;
newInput.addDocumentListener(this);
@@ -403,9 +403,8 @@
* @return
*/
public boolean isMarkingOccurrences() {
- return preferenceStore != null
- && preferenceStore
- .getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
+ return preferenceStore != null && preferenceStore
+ .getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
}
protected boolean handlePreferenceStoreChanged(String property,
@@ -431,14 +430,9 @@
protected void installOccurrencesFinder(boolean forceUpdate) {
fMarkOccurrenceAnnotations = true;
- fPostSelectionListenerWithAST = new ISelectionListenerWithAST() {
- @Override
- public void selectionChanged(IEditorPart part,
- ITextSelection selection, ISourceModule module,
- IModuleDeclaration astRoot) {
- updateOccurrenceAnnotations(selection, module, astRoot);
- }
- };
+ fPostSelectionListenerWithAST = (part, selection, module,
+ astRoot) -> updateOccurrenceAnnotations(selection, module,
+ astRoot);
SelectionListenerWithASTManager.getDefault().addListener(editor,
fPostSelectionListenerWithAST);
if (forceUpdate && getSelectionProvider() != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java
index 2074f59..46723db 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptEditor.java
@@ -477,7 +477,7 @@
public void addTextConverter(ITextConverter textConverter) {
if (fTextConverters == null) {
- fTextConverters = new ArrayList<ITextConverter>(1);
+ fTextConverters = new ArrayList<>(1);
fTextConverters.add(textConverter);
} else if (!fTextConverters.contains(textConverter))
fTextConverters.add(textConverter);
@@ -767,8 +767,7 @@
* @return the preference store for this editor
*/
private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
- final List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(
- 8);
+ final List<IPreferenceStore> stores = new ArrayList<>(8);
final IScriptProject project = EditorUtility.getScriptProject(input);
final IDLTKLanguageToolkit toolkit = getLanguageToolkit();
final String preferenceQualifier = toolkit.getPreferenceQualifier();
@@ -3123,7 +3122,7 @@
@Override
protected String[] collectContextMenuPreferencePages() {
- final List<String> result = new ArrayList<String>();
+ final List<String> result = new ArrayList<>();
final IDLTKUILanguageToolkit uiToolkit = getUILanguageToolkit();
addPages(result, uiToolkit.getEditorPreferencePages());
addPages(result, super.collectContextMenuPreferencePages());
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java
index 4b6265a..fea6465 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptOutlinePage.java
@@ -142,7 +142,7 @@
return children;
}
- List<IModelElement> v = new ArrayList<IModelElement>();
+ List<IModelElement> v = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
if (matches(children[i])) {
continue;
@@ -529,7 +529,7 @@
ListenerList.IDENTITY);
private ListenerList<ISelectionChangedListener> fPostSelectionChangedListeners = new ListenerList<>(
ListenerList.IDENTITY);
- private Hashtable<String, IAction> fActions = new Hashtable<String, IAction>();
+ private Hashtable<String, IAction> fActions = new Hashtable<>();
private TogglePresentationAction fTogglePresentation;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
index 99e19bd..0842cbc 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
@@ -360,7 +360,7 @@
*/
@Override
protected String[] getContextTypeIds(IDocument document, int offset) {
- final Set<String> ids = new HashSet<String>();
+ final Set<String> ids = new HashSet<>();
final Iterator<TemplateContextType> i = getContextTypeRegistry()
.contextTypes();
while (i.hasNext()) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
index 99bdd00..2999380 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
@@ -366,7 +366,7 @@
@Override
public void addOverlaid(IScriptAnnotation annotation) {
if (fOverlaids == null)
- fOverlaids = new ArrayList<IScriptAnnotation>(1);
+ fOverlaids = new ArrayList<>(1);
fOverlaids.add(annotation);
}
@@ -380,7 +380,7 @@
}
@Override
- public Iterator getOverlaidIterator() {
+ public Iterator<IScriptAnnotation> getOverlaidIterator() {
if (fOverlaids != null)
return fOverlaids.iterator();
return null;
@@ -465,7 +465,7 @@
Object fValue;
}
- private List<Entry> fList = new ArrayList<Entry>(2);
+ private List<Entry> fList = new ArrayList<>(2);
private int fAnchor = 0;
public ReverseMap() {
@@ -546,18 +546,18 @@
List<IProblem> fReportedProblems;
}
- private ThreadLocal<ProblemRequestorState> fProblemRequestorState = new ThreadLocal<ProblemRequestorState>();
+ private ThreadLocal<ProblemRequestorState> fProblemRequestorState = new ThreadLocal<>();
private int fStateCount = 0;
private ISourceModule fSourceModule;
- private List<Annotation> fGeneratedAnnotations = new ArrayList<Annotation>();
+ private List<Annotation> fGeneratedAnnotations = new ArrayList<>();
private IProgressMonitor fProgressMonitor;
private boolean fIsActive = false;
private boolean fIsHandlingTemporaryProblems;
private ReverseMap fReverseMap = new ReverseMap();
private List<ScriptMarkerAnnotation> fPreviouslyOverlaid = null;
- private List<ScriptMarkerAnnotation> fCurrentlyOverlaid = new ArrayList<ScriptMarkerAnnotation>();
+ private List<ScriptMarkerAnnotation> fCurrentlyOverlaid = new ArrayList<>();
protected IProblemFactory problemFactory;
public SourceModuleAnnotationModel(IResource resource) {
@@ -642,7 +642,7 @@
if (fSourceModule != null && !fSourceModule.isReadOnly()) {
ProblemRequestorState state = new ProblemRequestorState();
state.fInsideReportingSequence = insideReportingSequence;
- state.fReportedProblems = new ArrayList<IProblem>();
+ state.fReportedProblems = new ArrayList<>();
synchronized (getLockObject()) {
fProblemRequestorState.set(state);
++fStateCount;
@@ -700,7 +700,7 @@
boolean isCanceled = false;
fPreviouslyOverlaid = fCurrentlyOverlaid;
- fCurrentlyOverlaid = new ArrayList<ScriptMarkerAnnotation>();
+ fCurrentlyOverlaid = new ArrayList<>();
if (fGeneratedAnnotations.size() > 0) {
temporaryProblemsChanged = true;
@@ -873,7 +873,7 @@
List<Annotation> list = (List<Annotation>) cached;
list.add(annotation);
} else if (cached instanceof Annotation) {
- List<Annotation> list = new ArrayList<Annotation>(2);
+ List<Annotation> list = new ArrayList<>(2);
list.add((Annotation) cached);
list.add(annotation);
fReverseMap.put(position, list);
@@ -934,7 +934,7 @@
protected IMarker[] retrieveMarkers() throws CoreException {
String moduleLocation = location.toPortableString();
IMarker[] markers = super.retrieveMarkers();
- List<IMarker> locationMarkers = new LinkedList<IMarker>();
+ List<IMarker> locationMarkers = new LinkedList<>();
for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i];
String markerLocation = (String) marker
@@ -1031,7 +1031,7 @@
*
*
*/
- private final Map<Object, SourceModuleInfo> fFakeCUMapForMissingInfo = new HashMap<Object, SourceModuleInfo>();
+ private final Map<Object, SourceModuleInfo> fFakeCUMapForMissingInfo = new HashMap<>();
public SourceModuleDocumentProvider() {
@@ -1070,7 +1070,7 @@
DLTKUIPlugin.getDefault().getPreferenceStore()
.removePropertyChangeListener(fPropertyListener);
- Iterator e = getConnectedElementsIterator();
+ Iterator<?> e = getConnectedElementsIterator();
while (e.hasNext()) {
disconnect(e.next());
}
@@ -1119,8 +1119,9 @@
*/
protected void enableHandlingTemporaryProblems() {
boolean enable = isHandlingTemporaryProblems();
- for (Iterator iter = getFileInfosIterator(); iter.hasNext();) {
- FileInfo info = (FileInfo) iter.next();
+ for (Iterator<FileInfo> iter = getFileInfosIterator(); iter
+ .hasNext();) {
+ FileInfo info = iter.next();
if (info.fModel instanceof IProblemRequestorExtension) {
IProblemRequestorExtension extension = (IProblemRequestorExtension) info.fModel;
extension.setIsHandlingTemporaryProblems(enable);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java
index c37c6f5..703361e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java
@@ -25,32 +25,36 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.IUpdate;
-
public class GoToNextPreviousMemberAction extends Action implements IUpdate {
- public static final String NEXT_MEMBER= "GoToNextMember"; //$NON-NLS-1$
- public static final String PREVIOUS_MEMBER= "GoToPreviousMember"; //$NON-NLS-1$
+ public static final String NEXT_MEMBER = "GoToNextMember"; //$NON-NLS-1$
+ public static final String PREVIOUS_MEMBER = "GoToPreviousMember"; //$NON-NLS-1$
private ScriptEditor fEditor;
private boolean fIsGotoNext;
- public static GoToNextPreviousMemberAction newGoToNextMemberAction(ScriptEditor editor) {
- String text= SelectionActionMessages.GotoNextMember_label;
+ public static GoToNextPreviousMemberAction newGoToNextMemberAction(
+ ScriptEditor editor) {
+ String text = SelectionActionMessages.GotoNextMember_label;
return new GoToNextPreviousMemberAction(editor, text, true);
}
- public static GoToNextPreviousMemberAction newGoToPreviousMemberAction(ScriptEditor editor) {
- String text= SelectionActionMessages.GotoPreviousMember_label;
+ public static GoToNextPreviousMemberAction newGoToPreviousMemberAction(
+ ScriptEditor editor) {
+ String text = SelectionActionMessages.GotoPreviousMember_label;
return new GoToNextPreviousMemberAction(editor, text, false);
}
- private GoToNextPreviousMemberAction(ScriptEditor editor, String text, boolean isGotoNext) {
+ private GoToNextPreviousMemberAction(ScriptEditor editor, String text,
+ boolean isGotoNext) {
super(text);
- fEditor= editor;
- fIsGotoNext= isGotoNext;
-// if (isGotoNext)
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_NEXT_MEMBER_ACTION);
-// else
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_MEMBER_ACTION);
+ fEditor = editor;
+ fIsGotoNext = isGotoNext;
+ // if (isGotoNext)
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ // IJavaHelpContextIds.GOTO_NEXT_MEMBER_ACTION);
+ // else
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ // IJavaHelpContextIds.GOTO_PREVIOUS_MEMBER_ACTION);
}
/*
@@ -58,7 +62,7 @@
*/
public GoToNextPreviousMemberAction(boolean isSelectNext) {
super(""); //$NON-NLS-1$
- fIsGotoNext= isSelectNext;
+ fIsGotoNext = isSelectNext;
}
@Override
@@ -68,47 +72,54 @@
}
@Override
- public final void run() {
- ITextSelection selection= getTextSelection();
- ISourceRange newRange= getNewSelectionRange(createSourceRange(selection), null);
+ public final void run() {
+ ITextSelection selection = getTextSelection();
+ ISourceRange newRange = getNewSelectionRange(
+ createSourceRange(selection), null);
// Check if new selection differs from current selection
- if (selection.getOffset() == newRange.getOffset() && selection.getLength() == newRange.getLength())
+ if (selection.getOffset() == newRange.getOffset()
+ && selection.getLength() == newRange.getLength())
return;
fEditor.selectAndReveal(newRange.getOffset(), newRange.getLength());
}
private IType[] getTypes() throws ModelException {
- IEditorInput input= fEditor.getEditorInput();
- return DLTKUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input).getTypes();
+ IEditorInput input = fEditor.getEditorInput();
+ return DLTKUIPlugin.getDefault().getWorkingCopyManager()
+ .getWorkingCopy(input).getTypes();
}
private ITextSelection getTextSelection() {
- return (ITextSelection)fEditor.getSelectionProvider().getSelection();
+ return (ITextSelection) fEditor.getSelectionProvider().getSelection();
}
- public ISourceRange getNewSelectionRange(ISourceRange oldSourceRange, IType[] types) {
- try{
+ public ISourceRange getNewSelectionRange(ISourceRange oldSourceRange,
+ IType[] types) {
+ try {
if (types == null)
- types= getTypes();
- Integer[] offsetArray= createOffsetArray(types);
+ types = getTypes();
+ Integer[] offsetArray = createOffsetArray(types);
if (offsetArray.length == 0)
return oldSourceRange;
Arrays.sort(offsetArray);
- Integer oldOffset= Integer.valueOf(oldSourceRange.getOffset());
- int index= Arrays.binarySearch(offsetArray, oldOffset);
+ Integer oldOffset = Integer.valueOf(oldSourceRange.getOffset());
+ int index = Arrays.binarySearch(offsetArray, oldOffset);
if (fIsGotoNext)
- return createNewSourceRange(getNextOffset(index, offsetArray, oldOffset));
+ return createNewSourceRange(
+ getNextOffset(index, offsetArray, oldOffset));
else
- return createNewSourceRange(getPreviousOffset(index, offsetArray, oldOffset));
+ return createNewSourceRange(
+ getPreviousOffset(index, offsetArray, oldOffset));
- } catch (ModelException e){
- DLTKUIPlugin.log(e); //dialog would be too heavy here
- return oldSourceRange;
- }
+ } catch (ModelException e) {
+ DLTKUIPlugin.log(e); // dialog would be too heavy here
+ return oldSourceRange;
+ }
}
- private static Integer getPreviousOffset(int index, Integer[] offsetArray, Integer oldOffset) {
+ private static Integer getPreviousOffset(int index, Integer[] offsetArray,
+ Integer oldOffset) {
if (index == -1)
return oldOffset;
if (index == 0)
@@ -116,67 +127,72 @@
if (index > 0)
return offsetArray[index - 1];
Assert.isTrue(index < -1);
- int absIndex= Math.abs(index);
+ int absIndex = Math.abs(index);
return offsetArray[absIndex - 2];
}
- private static Integer getNextOffset(int index, Integer[] offsetArray, Integer oldOffset) {
+ private static Integer getNextOffset(int index, Integer[] offsetArray,
+ Integer oldOffset) {
if (index == -1)
return offsetArray[0];
- if (index == 0){
+ if (index == 0) {
if (offsetArray.length != 1)
return offsetArray[1];
else
return offsetArray[0];
}
- if (index > 0){
+ if (index > 0) {
if (index == offsetArray.length - 1)
return oldOffset;
return offsetArray[index + 1];
}
Assert.isTrue(index < -1);
- int absIndex= Math.abs(index);
+ int absIndex = Math.abs(index);
if (absIndex > offsetArray.length)
return oldOffset;
else
return offsetArray[absIndex - 1];
}
- private static ISourceRange createNewSourceRange(Integer offset){
+ private static ISourceRange createNewSourceRange(Integer offset) {
return new SourceRange(offset.intValue(), 0);
}
- private static Integer[] createOffsetArray(IType[] types) throws ModelException {
- List<Integer> result = new ArrayList<Integer>();
- for (int i= 0; i < types.length; i++) {
- IType iType= types[i];
+ private static Integer[] createOffsetArray(IType[] types)
+ throws ModelException {
+ List<Integer> result = new ArrayList<>();
+ for (int i = 0; i < types.length; i++) {
+ IType iType = types[i];
addOffset(result, iType.getNameRange().getOffset());
- addOffset(result, iType.getSourceRange().getOffset() + iType.getSourceRange().getLength());
+ addOffset(result, iType.getSourceRange().getOffset()
+ + iType.getSourceRange().getLength());
addMemberOffsetList(result, iType.getMethods());
addMemberOffsetList(result, iType.getFields());
- //addMemberOffsetList(result, iType.getInitializers());
+ // addMemberOffsetList(result, iType.getInitializers());
}
return result.toArray(new Integer[result.size()]);
}
- private static void addMemberOffsetList(List result, IMember[] members) throws ModelException {
- for (int i= 0; i < members.length; i++) {
+ private static void addMemberOffsetList(List result, IMember[] members)
+ throws ModelException {
+ for (int i = 0; i < members.length; i++) {
addOffset(result, getOffset(members[i]));
}
}
private static int getOffset(IMember iMember) throws ModelException {
- //special case
-// if (iMember.getElementType() == IModelElement.INITIALIZER)
-// return firstOpeningBraceOffset((IInitializer)iMember);
+ // special case
+ // if (iMember.getElementType() == IModelElement.INITIALIZER)
+ // return firstOpeningBraceOffset((IInitializer)iMember);
- if (iMember.getNameRange() != null && iMember.getNameRange().getOffset() >= 0)
+ if (iMember.getNameRange() != null
+ && iMember.getNameRange().getOffset() >= 0)
return iMember.getNameRange().getOffset();
return iMember.getSourceRange().getOffset();
}
- //-- private helper methods
+ // -- private helper methods
private static ISourceRange createSourceRange(ITextSelection ts) {
return new SourceRange(ts.getOffset(), ts.getLength());
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/ContributedSemanticHighlighter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/ContributedSemanticHighlighter.java
index a0bba44..7c9aaa9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/ContributedSemanticHighlighter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/ContributedSemanticHighlighter.java
@@ -28,7 +28,8 @@
import org.eclipse.dltk.ui.editor.highlighting.SemanticHighlighting;
import org.eclipse.swt.graphics.RGB;
-public class ContributedSemanticHighlighter extends AbstractSemanticHighlighter {
+public class ContributedSemanticHighlighter
+ extends AbstractSemanticHighlighter {
private final String natureId;
private final ISemanticHighlighter[] highlighters;
@@ -52,7 +53,7 @@
}
private boolean initialized = false;
- private final Map<String, SemanticHighlighting> highlightings = new HashMap<String, SemanticHighlighting>();
+ private final Map<String, SemanticHighlighting> highlightings = new HashMap<>();
private static class StdSemanticHighlighting extends SemanticHighlighting {
@@ -83,17 +84,17 @@
}
- private static class SemanticHighlightingCollector extends
- AbstractColoringPreferenceRequestor {
+ private static class SemanticHighlightingCollector
+ extends AbstractColoringPreferenceRequestor {
- final Map<String, SemanticHighlighting> map = new HashMap<String, SemanticHighlighting>();
+ final Map<String, SemanticHighlighting> map = new HashMap<>();
@Override
public void addPreference(IColoringPreferenceKey key, String name,
RGB color, EnablementStyle enablementStyle,
FontStyle... fontStyles) {
- map.put(key.getColorKey(), new StdSemanticHighlighting(key,
- enablementStyle));
+ map.put(key.getColorKey(),
+ new StdSemanticHighlighting(key, enablementStyle));
}
}
@@ -139,8 +140,8 @@
}
}
}
- return highlightings.values().toArray(
- new SemanticHighlighting[highlightings.size()]);
+ return highlightings.values()
+ .toArray(new SemanticHighlighting[highlightings.size()]);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingPresenter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingPresenter.java
index 7252509..10ac8e3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingPresenter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingPresenter.java
@@ -41,9 +41,8 @@
*
* @since 3.0
*/
-public class SemanticHighlightingPresenter implements
- ITextPresentationListener, ITextInputListener, IDocumentListener,
- IHighlightedPositionFactory {
+public class SemanticHighlightingPresenter implements ITextPresentationListener,
+ ITextInputListener, IDocumentListener, IHighlightedPositionFactory {
/**
* Semantic highlighting position updater.
@@ -74,8 +73,8 @@
int eventEnd = eventOffset + eventOldLength;
try {
- Position[] positions = event.getDocument().getPositions(
- fCategory);
+ Position[] positions = event.getDocument()
+ .getPositions(fCategory);
for (int i = 0; i != positions.length; i++) {
@@ -164,9 +163,8 @@
int end = offset + length;
int includedLength = 0;
- while (includedLength < eventNewLength
- && Character.isJavaIdentifierPart(newText
- .charAt(includedLength)))
+ while (includedLength < eventNewLength && Character
+ .isJavaIdentifierPart(newText.charAt(includedLength)))
includedLength++;
if (includedLength == eventNewLength)
position.setLength(length + deltaLength);
@@ -174,9 +172,8 @@
int newLeftLength = eventOffset - offset + includedLength;
int excludedLength = eventNewLength;
- while (excludedLength > 0
- && Character.isJavaIdentifierPart(newText
- .charAt(excludedLength - 1)))
+ while (excludedLength > 0 && Character.isJavaIdentifierPart(
+ newText.charAt(excludedLength - 1)))
excludedLength--;
int newRightOffset = eventOffset + excludedLength;
int newRightLength = end + deltaLength - newRightOffset;
@@ -212,12 +209,11 @@
int eventNewLength = newText.length();
int includedLength = 0;
- while (includedLength < eventNewLength
- && Character.isJavaIdentifierPart(newText
- .charAt(includedLength)))
+ while (includedLength < eventNewLength && Character
+ .isJavaIdentifierPart(newText.charAt(includedLength)))
includedLength++;
- position.setLength(event.getOffset() - position.getOffset()
- + includedLength);
+ position.setLength(
+ event.getOffset() - position.getOffset() + includedLength);
}
/**
@@ -240,14 +236,13 @@
int eventNewLength = newText.length();
int excludedLength = eventNewLength;
- while (excludedLength > 0
- && Character.isJavaIdentifierPart(newText
- .charAt(excludedLength - 1)))
+ 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);
+ position.update(eventOffset + excludedLength,
+ position.getLength() - deleted + inserted);
}
/**
@@ -270,7 +265,9 @@
private IPositionUpdater fPositionUpdater = new HighlightingPositionUpdater(
getPositionCategory());
- /** The source viewer this semantic highlighting reconciler is installed on */
+ /**
+ * The source viewer this semantic highlighting reconciler is installed on
+ */
private ScriptSourceViewer fSourceViewer;
/** The background presentation reconciler */
private ScriptPresentationReconciler fPresentationReconciler;
@@ -279,7 +276,7 @@
* UI's current highlighted positions - can contain <code>null</code>
* elements
*/
- private List<HighlightedPosition> fPositions = new ArrayList<HighlightedPosition>();
+ private List<HighlightedPosition> fPositions = new ArrayList<>();
/** UI position lock */
private Object fPositionLock = new Object();
@@ -302,8 +299,8 @@
* @return The new highlighted position
*/
@Override
- public HighlightedPosition createHighlightedPosition(int offset,
- int length, HighlightingStyle highlighting) {
+ public HighlightedPosition createHighlightedPosition(int offset, int length,
+ HighlightingStyle highlighting) {
// TODO: reuse deleted positions
return new HighlightedPosition(offset, length, highlighting,
fPositionUpdater);
@@ -448,9 +445,11 @@
if (fSourceViewer == null)
return;
- // checkOrdering("added positions: ", Arrays.asList(addedPositions)); //$NON-NLS-1$
- // checkOrdering("removed positions: ", Arrays.asList(removedPositions)); //$NON-NLS-1$
- // checkOrdering("old positions: ", fPositions); //$NON-NLS-1$
+ // checkOrdering("added positions: ", Arrays.asList(addedPositions));
+ // //$NON-NLS-1$
+ // checkOrdering("removed positions: ",
+ // Arrays.asList(removedPositions)); //$NON-NLS-1$
+ // checkOrdering("old positions: ", fPositions); //$NON-NLS-1$
// TODO: double-check consistency with document.getPositions(...)
// TODO: reuse removed positions
@@ -469,8 +468,8 @@
try {
synchronized (fPositionLock) {
List<HighlightedPosition> oldPositions = fPositions;
- int newSize = Math.max(fPositions.size()
- + addedPositions.length - removedPositions.length, 10);
+ int newSize = Math.max(fPositions.size() + addedPositions.length
+ - removedPositions.length, 10);
/*
* The following loop is a kind of merge sort: it merges two
@@ -480,12 +479,14 @@
* on the fly. The second of two is the list of added positions.
* The result is stored in newPositions.
*/
- List<HighlightedPosition> newPositions = new ArrayList<HighlightedPosition>(
+ List<HighlightedPosition> newPositions = new ArrayList<>(
newSize);
HighlightedPosition position = null;
HighlightedPosition addedPosition = null;
- for (int i = 0, j = 0, n = oldPositions.size(), m = addedPositions.length; i < n
- || position != null || j < m || addedPosition != null;) {
+ for (int i = 0, j = 0, n = oldPositions
+ .size(), m = addedPositions.length; i < n
+ || position != null || j < m
+ || addedPosition != null;) {
// loop variant: i + j < old(i + j)
// a) find the next non-deleted Position from the old list
@@ -537,7 +538,7 @@
// Should not happen
DLTKUIPlugin.log(e);
}
- // checkOrdering("new positions: ", fPositions); //$NON-NLS-1$
+ // checkOrdering("new positions: ", fPositions); //$NON-NLS-1$
if (textPresentation != null)
fSourceViewer.changeTextPresentation(textPresentation, false);
@@ -622,10 +623,11 @@
@Override
public void applyTextPresentation(TextPresentation textPresentation) {
IRegion region = textPresentation.getExtent();
- int i = computeIndexAtOffset(fPositions, region.getOffset()), n = computeIndexAtOffset(
- fPositions, region.getOffset() + region.getLength());
+ int i = computeIndexAtOffset(fPositions, region.getOffset()),
+ n = computeIndexAtOffset(fPositions,
+ region.getOffset() + region.getLength());
if (n - i > 2) {
- List<StyleRange> ranges = new ArrayList<StyleRange>(n - i);
+ List<StyleRange> ranges = new ArrayList<>(n - i);
for (; i < n; i++) {
HighlightedPosition position = fPositions.get(i);
if (!position.isDeleted())
@@ -638,14 +640,15 @@
for (; i < n; i++) {
HighlightedPosition position = fPositions.get(i);
if (!position.isDeleted())
- textPresentation.replaceStyleRange(position
- .createStyleRange());
+ textPresentation
+ .replaceStyleRange(position.createStyleRange());
}
}
}
/*
- * @see ITextInputListener#inputDocumentAboutToBeChanged(IDocument,IDocument)
+ * @see
+ * ITextInputListener#inputDocumentAboutToBeChanged(IDocument,IDocument)
*/
@Override
public void inputDocumentAboutToBeChanged(IDocument oldInput,
@@ -685,8 +688,8 @@
* </p>
*/
public boolean isCanceled() {
- IDocument document = fSourceViewer != null ? fSourceViewer
- .getDocument() : null;
+ IDocument document = fSourceViewer != null ? fSourceViewer.getDocument()
+ : null;
if (document == null)
return fIsCanceled;
@@ -702,8 +705,8 @@
* <code>true</code> iff the current reconcile is canceled
*/
public void setCanceled(boolean isCanceled) {
- IDocument document = fSourceViewer != null ? fSourceViewer
- .getDocument() : null;
+ IDocument document = fSourceViewer != null ? fSourceViewer.getDocument()
+ : null;
if (document == null) {
fIsCanceled = isCanceled;
return;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingReconciler.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingReconciler.java
index e853909..c758cd0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingReconciler.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/semantic/highlighting/SemanticHighlightingReconciler.java
@@ -44,12 +44,14 @@
*
* @since 3.0
*/
-public class SemanticHighlightingReconciler implements
- IScriptReconcilingListener, ITextInputListener {
+public class SemanticHighlightingReconciler
+ implements IScriptReconcilingListener, ITextInputListener {
/** The Java editor this semantic highlighting reconciler is installed on */
private ScriptEditor fEditor;
- /** The source viewer this semantic highlighting reconciler is installed on */
+ /**
+ * The source viewer this semantic highlighting reconciler is installed on
+ */
private ISourceViewer fSourceViewer;
/** The semantic highlighting presenter */
private SemanticHighlightingPresenter fPresenter;
@@ -129,10 +131,10 @@
HighlightedPosition[] added = HighlightedPosition.NO_POSITIONS;
HighlightedPosition[] removed = HighlightedPosition.NO_POSITIONS;
if (!fJobPresenter.isCanceled()) {
- final List<HighlightedPosition> currentPositions = new ArrayList<HighlightedPosition>();
+ final List<HighlightedPosition> currentPositions = new ArrayList<>();
fJobPresenter.addAllPositions(currentPositions);
- final UpdateResult result = positionUpdater.reconcile(
- (IModuleSource) ast, currentPositions);
+ final UpdateResult result = positionUpdater
+ .reconcile((IModuleSource) ast, currentPositions);
added = result.addedPositions;
removed = result.removedPositions;
}
@@ -172,8 +174,8 @@
private void updatePresentation(TextPresentation textPresentation,
HighlightedPosition[] addedPositions,
HighlightedPosition[] removedPositions) {
- Runnable runnable = fJobPresenter.createUpdateRunnable(
- textPresentation, addedPositions, removedPositions);
+ Runnable runnable = fJobPresenter.createUpdateRunnable(textPresentation,
+ addedPositions, removedPositions);
if (runnable == null)
return;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
index c50162e..816effb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
@@ -326,7 +326,7 @@
*/
public String[] getEnabledFilterIds() {
Object[] result = getResult();
- Set<String> enabledIds = new HashSet<String>(result.length);
+ Set<String> enabledIds = new HashSet<>(result.length);
for (int i = 0; i < result.length; i++)
enabledIds.add(((FilterDescriptor) result[i]).getId());
return enabledIds.toArray(new String[enabledIds.size()]);
@@ -349,8 +349,7 @@
private FilterDescriptor[] getEnabledFilterDescriptors() {
FilterDescriptor[] filterDescs = fBuiltInFilters;
- List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(
- filterDescs.length);
+ List<FilterDescriptor> result = new ArrayList<>(filterDescs.length);
List<String> enabledFilterIds = Arrays.asList(fEnabledFilterIds);
for (int i = 0; i < filterDescs.length; i++) {
String id = filterDescs[i].getId();
@@ -365,7 +364,7 @@
StringTokenizer tokenizer = new StringTokenizer(patterns, separator,
true);
int tokenCount = tokenizer.countTokens();
- List<String> result = new ArrayList<String>(tokenCount);
+ List<String> result = new ArrayList<>(tokenCount);
boolean escape = false;
boolean append = false;
while (tokenizer.hasMoreTokens()) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java
index f5086af..d64d55d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/FilterDescriptor.java
@@ -28,8 +28,6 @@
import com.ibm.icu.text.Collator;
-
-
/**
* Represents a custom filter which is provided by the
* "org.eclipse.dltk.dltkElementFilters" extension point.
@@ -37,34 +35,32 @@
*/
public class FilterDescriptor implements Comparable, IPluginContribution {
- private static String PATTERN_FILTER_ID_PREFIX= "_patternFilterId_"; //$NON-NLS-1$
+ private static String PATTERN_FILTER_ID_PREFIX = "_patternFilterId_"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_NAME = "dltkElementFilters"; //$NON-NLS-1$
- private static final String EXTENSION_POINT_NAME= "dltkElementFilters"; //$NON-NLS-1$
+ private static final String FILTER_TAG = "filter"; //$NON-NLS-1$
- private static final String FILTER_TAG= "filter"; //$NON-NLS-1$
-
- private static final String PATTERN_ATTRIBUTE= "pattern"; //$NON-NLS-1$
- private static final String ID_ATTRIBUTE= "id"; //$NON-NLS-1$
+ private static final String PATTERN_ATTRIBUTE = "pattern"; //$NON-NLS-1$
+ private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
/**
* @deprecated as of 3.0 use {@link FilterDescriptor#TARGET_ID_ATTRIBUTE}
*/
@Deprecated
- private static final String VIEW_ID_ATTRIBUTE= "viewId"; //$NON-NLS-1$
- private static final String TARGET_ID_ATTRIBUTE= "targetId"; //$NON-NLS-1$
- private static final String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
- private static final String NAME_ATTRIBUTE= "name"; //$NON-NLS-1$
- private static final String ENABLED_ATTRIBUTE= "enabled"; //$NON-NLS-1$
- private static final String DESCRIPTION_ATTRIBUTE= "description"; //$NON-NLS-1$
+ private static final String VIEW_ID_ATTRIBUTE = "viewId"; //$NON-NLS-1$
+ private static final String TARGET_ID_ATTRIBUTE = "targetId"; //$NON-NLS-1$
+ private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+ private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+ private static final String ENABLED_ATTRIBUTE = "enabled"; //$NON-NLS-1$
+ private static final String DESCRIPTION_ATTRIBUTE = "description"; //$NON-NLS-1$
/**
- * @deprecated use "enabled" instead
+ * @deprecated use "enabled" instead
*/
@Deprecated
- private static final String SELECTED_ATTRIBUTE= "selected"; //$NON-NLS-1$
+ private static final String SELECTED_ATTRIBUTE = "selected"; //$NON-NLS-1$
private static FilterDescriptor[] fgFilterDescriptors;
-
private IConfigurationElement fElement;
/**
@@ -72,22 +68,24 @@
*/
public static FilterDescriptor[] getFilterDescriptors() {
if (fgFilterDescriptors == null) {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] elements= registry.getConfigurationElementsFor(DLTKUIPlugin.PLUGIN_ID, EXTENSION_POINT_NAME);
- fgFilterDescriptors= createFilterDescriptors(elements);
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry
+ .getConfigurationElementsFor(DLTKUIPlugin.PLUGIN_ID,
+ EXTENSION_POINT_NAME);
+ fgFilterDescriptors = createFilterDescriptors(elements);
}
return fgFilterDescriptors;
}
+
/**
- * Returns all element filters which
- * are contributed to the given view.
+ * Returns all element filters which are contributed to the given view.
*/
public static FilterDescriptor[] getFilterDescriptors(String targetId) {
- FilterDescriptor[] filterDescs= FilterDescriptor.getFilterDescriptors();
- List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(
- filterDescs.length);
- for (int i= 0; i < filterDescs.length; i++) {
- String tid= filterDescs[i].getTargetId();
+ FilterDescriptor[] filterDescs = FilterDescriptor
+ .getFilterDescriptors();
+ List<FilterDescriptor> result = new ArrayList<>(filterDescs.length);
+ for (int i = 0; i < filterDescs.length; i++) {
+ String tid = filterDescs[i].getTargetId();
if (WorkbenchActivityHelper.filterItem(filterDescs[i]))
continue;
if (tid == null || tid.equals(targetId))
@@ -100,30 +98,36 @@
* Creates a new filter descriptor for the given configuration element.
*/
private FilterDescriptor(IConfigurationElement element) {
- fElement= element;
+ fElement = element;
// it is either a pattern filter or a custom filter
- Assert.isTrue(isPatternFilter() ^ isCustomFilter(), "An extension for extension-point org.eclipse.dltk.ui.dltkElementFilters does not specify a correct filter"); //$NON-NLS-1$
- Assert.isNotNull(getId(), "An extension for extension-point org.eclipse.dltk.ui.dltkElementFilters does not provide a valid ID"); //$NON-NLS-1$
- Assert.isNotNull(getName(), "An extension for extension-point org.eclipse.dltk.ui.dltkElementFilters does not provide a valid name"); //$NON-NLS-1$
+ Assert.isTrue(isPatternFilter() ^ isCustomFilter(),
+ "An extension for extension-point org.eclipse.dltk.ui.dltkElementFilters does not specify a correct filter"); //$NON-NLS-1$
+ Assert.isNotNull(getId(),
+ "An extension for extension-point org.eclipse.dltk.ui.dltkElementFilters does not provide a valid ID"); //$NON-NLS-1$
+ Assert.isNotNull(getName(),
+ "An extension for extension-point org.eclipse.dltk.ui.dltkElementFilters does not provide a valid name"); //$NON-NLS-1$
}
/**
- * Creates a new <code>ViewerFilter</code>.
- * This method is only valid for viewer filters.
+ * Creates a new <code>ViewerFilter</code>. This method is only valid for
+ * viewer filters.
*/
public ViewerFilter createViewerFilter() {
if (!isCustomFilter())
return null;
- final ViewerFilter[] result= new ViewerFilter[1];
- String message= Messages.format(FilterMessages.FilterDescriptor_filterCreationError_message, getId());
- ISafeRunnable code= new SafeRunnable(message) {
+ final ViewerFilter[] result = new ViewerFilter[1];
+ String message = Messages.format(
+ FilterMessages.FilterDescriptor_filterCreationError_message,
+ getId());
+ ISafeRunnable code = new SafeRunnable(message) {
/*
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
@Override
public void run() throws Exception {
- result[0]= (ViewerFilter)fElement.createExecutableExtension(CLASS_ATTRIBUTE);
+ result[0] = (ViewerFilter) fElement
+ .createExecutableExtension(CLASS_ATTRIBUTE);
}
};
@@ -131,19 +135,19 @@
return result[0];
}
- //---- XML Attribute accessors ---------------------------------------------
+ // ---- XML Attribute accessors
+ // ---------------------------------------------
/**
* Returns the filter's id.
* <p>
- * This attribute is mandatory for custom filters.
- * The ID for pattern filters is
- * PATTERN_FILTER_ID_PREFIX plus the pattern itself.
+ * This attribute is mandatory for custom filters. The ID for pattern
+ * filters is PATTERN_FILTER_ID_PREFIX plus the pattern itself.
* </p>
*/
public String getId() {
if (isPatternFilter()) {
- String targetId= getTargetId();
+ String targetId = getTargetId();
if (targetId == null)
return PATTERN_FILTER_ID_PREFIX + getPattern();
else
@@ -155,21 +159,22 @@
/**
* Returns the filter's name.
* <p>
- * If the name of a pattern filter is missing
- * then the pattern is used as its name.
+ * If the name of a pattern filter is missing then the pattern is used as
+ * its name.
* </p>
*/
public String getName() {
- String name= fElement.getAttribute(NAME_ATTRIBUTE);
+ String name = fElement.getAttribute(NAME_ATTRIBUTE);
if (name == null && isPatternFilter())
- name= getPattern();
+ name = getPattern();
return name;
}
/**
* Returns the filter's pattern.
*
- * @return the pattern string or <code>null</code> if it's not a pattern filter
+ * @return the pattern string or <code>null</code> if it's not a pattern
+ * filter
*/
public String getPattern() {
return fElement.getAttribute(PATTERN_ATTRIBUTE);
@@ -182,7 +187,7 @@
*
*/
public String getTargetId() {
- String tid= fElement.getAttribute(TARGET_ID_ATTRIBUTE);
+ String tid = fElement.getAttribute(TARGET_ID_ATTRIBUTE);
if (tid != null)
return tid;
@@ -195,12 +200,13 @@
/**
* Returns the filter's description.
*
- * @return the description or <code>null</code> if no description is provided
+ * @return the description or <code>null</code> if no description is
+ * provided
*/
public String getDescription() {
- String description= fElement.getAttribute(DESCRIPTION_ATTRIBUTE);
+ String description = fElement.getAttribute(DESCRIPTION_ATTRIBUTE);
if (description == null)
- description= ""; //$NON-NLS-1$
+ description = ""; //$NON-NLS-1$
return description;
}
@@ -219,16 +225,15 @@
}
/**
- * Returns <code>true</code> if the filter
- * is initially enabled.
+ * Returns <code>true</code> if the filter is initially enabled.
*
* This attribute is optional and defaults to <code>true</code>.
*/
public boolean isEnabled() {
- String strVal= fElement.getAttribute(ENABLED_ATTRIBUTE);
+ String strVal = fElement.getAttribute(ENABLED_ATTRIBUTE);
if (strVal == null)
// backward compatibility
- strVal= fElement.getAttribute(SELECTED_ATTRIBUTE);
+ strVal = fElement.getAttribute(SELECTED_ATTRIBUTE);
return strVal == null || Boolean.valueOf(strVal).booleanValue();
}
@@ -238,28 +243,31 @@
@Override
public int compareTo(Object o) {
if (o instanceof FilterDescriptor)
- return Collator.getInstance().compare(getName(), ((FilterDescriptor)o).getName());
+ return Collator.getInstance().compare(getName(),
+ ((FilterDescriptor) o).getName());
else
return Integer.MIN_VALUE;
}
- //---- initialization ---------------------------------------------------
+ // ---- initialization ---------------------------------------------------
/**
* Creates the filter descriptors.
*/
- private static FilterDescriptor[] createFilterDescriptors(IConfigurationElement[] elements) {
- List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(5);
- Set<String> descIds = new HashSet<String>(5);
- for (int i= 0; i < elements.length; i++) {
- final IConfigurationElement element= elements[i];
+ private static FilterDescriptor[] createFilterDescriptors(
+ IConfigurationElement[] elements) {
+ List<FilterDescriptor> result = new ArrayList<>(5);
+ Set<String> descIds = new HashSet<>(5);
+ for (int i = 0; i < elements.length; i++) {
+ final IConfigurationElement element = elements[i];
if (FILTER_TAG.equals(element.getName())) {
- final FilterDescriptor[] desc= new FilterDescriptor[1];
- SafeRunner.run(new SafeRunnable(FilterMessages.FilterDescriptor_filterDescriptionCreationError_message) {
+ final FilterDescriptor[] desc = new FilterDescriptor[1];
+ SafeRunner.run(new SafeRunnable(
+ FilterMessages.FilterDescriptor_filterDescriptionCreationError_message) {
@Override
public void run() throws Exception {
- desc[0]= new FilterDescriptor(element);
+ desc[0] = new FilterDescriptor(element);
}
});
@@ -279,6 +287,6 @@
@Override
public String getPluginId() {
- return fElement.getContributor().getName();
- }
+ return fElement.getContributor().getName();
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java
index 7d49d48..ecb544a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java
@@ -37,11 +37,10 @@
import org.eclipse.dltk.internal.ui.browsing.LogicalPackage;
import org.eclipse.dltk.ui.DLTKUIPlugin;
-
/**
- * An abstract super class to describe mappings from a model element to a
- * set of resources. The class also provides factory methods to create
- * resource mappings.
+ * An abstract super class to describe mappings from a model element to a set of
+ * resources. The class also provides factory methods to create resource
+ * mappings.
*
*/
public abstract class DLTKElementResourceMapping extends ResourceMapping {
@@ -50,9 +49,9 @@
}
public IModelElement getModelElement() {
- Object o= getModelObject();
+ Object o = getModelObject();
if (o instanceof IModelElement)
- return (IModelElement)o;
+ return (IModelElement) o;
return null;
}
@@ -60,12 +59,13 @@
public boolean equals(Object obj) {
if (!(obj instanceof DLTKElementResourceMapping))
return false;
- return getModelElement().equals(((DLTKElementResourceMapping)obj).getModelElement());
+ return getModelElement()
+ .equals(((DLTKElementResourceMapping) obj).getModelElement());
}
@Override
public int hashCode() {
- IModelElement modelElement= getModelElement();
+ IModelElement modelElement = getModelElement();
if (modelElement == null)
return super.hashCode();
@@ -89,13 +89,16 @@
return false;
}
- //---- the factory code ---------------------------------------------------------------
+ // ---- the factory code
+ // ---------------------------------------------------------------
- private static final class ScriptModelResourceMapping extends DLTKElementResourceMapping {
+ private static final class ScriptModelResourceMapping
+ extends DLTKElementResourceMapping {
private final IScriptModel fModel;
+
private ScriptModelResourceMapping(IScriptModel model) {
Assert.isNotNull(model);
- fModel= model;
+ fModel = model;
}
@Override
@@ -105,36 +108,41 @@
@Override
public IProject[] getProjects() {
- IScriptProject[] projects= null;
+ IScriptProject[] projects = null;
try {
- projects= fModel.getScriptProjects();
+ projects = fModel.getScriptProjects();
} catch (ModelException e) {
DLTKUIPlugin.log(e);
return new IProject[0];
}
- IProject[] result= new IProject[projects.length];
- for (int i= 0; i < projects.length; i++) {
- result[i]= projects[i].getProject();
+ IProject[] result = new IProject[projects.length];
+ for (int i = 0; i < projects.length; i++) {
+ result[i] = projects[i].getProject();
}
return result;
}
@Override
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- IScriptProject[] projects= fModel.getScriptProjects();
- ResourceTraversal[] result= new ResourceTraversal[projects.length];
- for (int i= 0; i < projects.length; i++) {
- result[i]= new ResourceTraversal(new IResource[] {projects[i].getProject()}, IResource.DEPTH_INFINITE, 0);
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ IScriptProject[] projects = fModel.getScriptProjects();
+ ResourceTraversal[] result = new ResourceTraversal[projects.length];
+ for (int i = 0; i < projects.length; i++) {
+ result[i] = new ResourceTraversal(
+ new IResource[] { projects[i].getProject() },
+ IResource.DEPTH_INFINITE, 0);
}
return result;
}
}
- private static final class ScriptProjectResourceMapping extends DLTKElementResourceMapping {
+ private static final class ScriptProjectResourceMapping
+ extends DLTKElementResourceMapping {
private final IScriptProject fProject;
+
private ScriptProjectResourceMapping(IScriptProject project) {
Assert.isNotNull(project);
- fProject= project;
+ fProject = project;
}
@Override
@@ -144,22 +152,25 @@
@Override
public IProject[] getProjects() {
- return new IProject[] {fProject.getProject() };
+ return new IProject[] { fProject.getProject() };
}
@Override
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- return new ResourceTraversal[] {
- new ResourceTraversal(new IResource[] {fProject.getProject()}, IResource.DEPTH_INFINITE, 0)
- };
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ return new ResourceTraversal[] { new ResourceTraversal(
+ new IResource[] { fProject.getProject() },
+ IResource.DEPTH_INFINITE, 0) };
}
}
- private static final class PackageFragementRootResourceMapping extends DLTKElementResourceMapping {
+ private static final class PackageFragementRootResourceMapping
+ extends DLTKElementResourceMapping {
private final IProjectFragment fRoot;
+
private PackageFragementRootResourceMapping(IProjectFragment root) {
Assert.isNotNull(root);
- fRoot= root;
+ fRoot = root;
}
@Override
@@ -169,41 +180,48 @@
@Override
public IProject[] getProjects() {
- return new IProject[] {fRoot.getScriptProject().getProject() };
+ return new IProject[] { fRoot.getScriptProject().getProject() };
}
@Override
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- return new ResourceTraversal[] {
- new ResourceTraversal(new IResource[] {fRoot.getResource()}, IResource.DEPTH_INFINITE, 0)
- };
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ return new ResourceTraversal[] { new ResourceTraversal(
+ new IResource[] { fRoot.getResource() },
+ IResource.DEPTH_INFINITE, 0) };
}
}
- private static final class LocalPackageFragementTraversal extends ResourceTraversal {
+ private static final class LocalPackageFragementTraversal
+ extends ResourceTraversal {
private final IScriptFolder fPack;
- public LocalPackageFragementTraversal(IScriptFolder pack) throws CoreException {
- super(new IResource[] {pack.getResource()}, IResource.DEPTH_ONE, 0);
- fPack= pack;
+
+ public LocalPackageFragementTraversal(IScriptFolder pack)
+ throws CoreException {
+ super(new IResource[] { pack.getResource() }, IResource.DEPTH_ONE,
+ 0);
+ fPack = pack;
}
@Override
public void accept(IResourceVisitor visitor) throws CoreException {
- IFile[] files= getPackageContent(fPack);
- final IResource resource= fPack.getResource();
+ IFile[] files = getPackageContent(fPack);
+ final IResource resource = fPack.getResource();
if (resource != null)
visitor.visit(resource);
- for (int i= 0; i < files.length; i++) {
+ for (int i = 0; i < files.length; i++) {
visitor.visit(files[i]);
}
}
}
- private static final class ScriptFolderResourceMapping extends DLTKElementResourceMapping {
+ private static final class ScriptFolderResourceMapping
+ extends DLTKElementResourceMapping {
private final IScriptFolder fPack;
+
private ScriptFolderResourceMapping(IScriptFolder pack) {
Assert.isNotNull(pack);
- fPack= pack;
+ fPack = pack;
}
@Override
@@ -217,34 +235,37 @@
}
@Override
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
if (context instanceof RemoteResourceMappingContext) {
- return new ResourceTraversal[] {
- new ResourceTraversal(new IResource[] {fPack.getResource()}, IResource.DEPTH_ONE, 0)
- };
+ return new ResourceTraversal[] { new ResourceTraversal(
+ new IResource[] { fPack.getResource() },
+ IResource.DEPTH_ONE, 0) };
} else if (fPack.getResource() != null) {
- return new ResourceTraversal[] { new LocalPackageFragementTraversal(fPack) };
- }
- else {
- return new ResourceTraversal[0];
+ return new ResourceTraversal[] {
+ new LocalPackageFragementTraversal(fPack) };
+ } else {
+ return new ResourceTraversal[0];
}
}
@Override
- public void accept(ResourceMappingContext context, IResourceVisitor visitor, IProgressMonitor monitor) throws CoreException {
+ public void accept(ResourceMappingContext context,
+ IResourceVisitor visitor, IProgressMonitor monitor)
+ throws CoreException {
if (context instanceof RemoteResourceMappingContext) {
super.accept(context, visitor, monitor);
} else {
// We assume a local context.
- IFile[] files= getPackageContent(fPack);
+ IFile[] files = getPackageContent(fPack);
if (monitor == null)
- monitor= new NullProgressMonitor();
+ monitor = new NullProgressMonitor();
monitor.beginTask("", files.length + 1); //$NON-NLS-1$
- final IResource resource= fPack.getResource();
+ final IResource resource = fPack.getResource();
if (resource != null)
visitor.visit(resource);
monitor.worked(1);
- for (int i= 0; i < files.length; i++) {
+ for (int i = 0; i < files.length; i++) {
visitor.visit(files[i]);
monitor.worked(1);
}
@@ -252,16 +273,18 @@
}
}
- private static IFile[] getPackageContent(IScriptFolder pack) throws CoreException {
- List<IFile> result = new ArrayList<IFile>();
- IContainer container= (IContainer)pack.getResource();
+ private static IFile[] getPackageContent(IScriptFolder pack)
+ throws CoreException {
+ List<IFile> result = new ArrayList<>();
+ IContainer container = (IContainer) pack.getResource();
if (container != null) {
- IResource[] members= container.members();
- for (int m= 0; m < members.length; m++) {
- IResource member= members[m];
+ IResource[] members = container.members();
+ for (int m = 0; m < members.length; m++) {
+ IResource member = members[m];
if (member instanceof IFile) {
- IFile file= (IFile)member;
- if ("class".equals(file.getFileExtension()) && file.isDerived()) //$NON-NLS-1$
+ IFile file = (IFile) member;
+ if ("class".equals(file.getFileExtension()) //$NON-NLS-1$
+ && file.isDerived())
continue;
result.add((IFile) member);
}
@@ -270,12 +293,13 @@
return result.toArray(new IFile[result.size()]);
}
-
- private static final class SourceModuleResourceMapping extends DLTKElementResourceMapping {
+ private static final class SourceModuleResourceMapping
+ extends DLTKElementResourceMapping {
private final ISourceModule fUnit;
+
private SourceModuleResourceMapping(ISourceModule unit) {
Assert.isNotNull(unit);
- fUnit= unit;
+ fUnit = unit;
}
@Override
@@ -285,21 +309,24 @@
@Override
public IProject[] getProjects() {
- return new IProject[] {fUnit.getScriptProject().getProject() };
+ return new IProject[] { fUnit.getScriptProject().getProject() };
}
@Override
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- return new ResourceTraversal[] {
- new ResourceTraversal(new IResource[] {fUnit.getResource()}, IResource.DEPTH_ONE, 0)
- };
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ return new ResourceTraversal[] { new ResourceTraversal(
+ new IResource[] { fUnit.getResource() },
+ IResource.DEPTH_ONE, 0) };
}
}
- private static final class LogicalPackageResourceMapping extends ResourceMapping {
+ private static final class LogicalPackageResourceMapping
+ extends ResourceMapping {
private final IScriptFolder[] fFragments;
+
private LogicalPackageResourceMapping(IScriptFolder[] fragments) {
- fFragments= fragments;
+ fFragments = fragments;
}
@Override
@@ -309,24 +336,27 @@
@Override
public IProject[] getProjects() {
- Set<IProject> result = new HashSet<IProject>();
- for (int i= 0; i < fFragments.length; i++) {
+ Set<IProject> result = new HashSet<>();
+ for (int i = 0; i < fFragments.length; i++) {
result.add(fFragments[i].getScriptProject().getProject());
}
return result.toArray(new IProject[result.size()]);
}
@Override
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- List<ResourceTraversal> result = new ArrayList<ResourceTraversal>();
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ List<ResourceTraversal> result = new ArrayList<>();
if (context instanceof RemoteResourceMappingContext) {
- for (int i= 0; i < fFragments.length; i++) {
+ for (int i = 0; i < fFragments.length; i++) {
result.add(new ResourceTraversal(
- new IResource[] {fFragments[i].getResource()}, IResource.DEPTH_ONE, 0));
+ new IResource[] { fFragments[i].getResource() },
+ IResource.DEPTH_ONE, 0));
}
} else {
- for (int i= 0; i < fFragments.length; i++) {
- result.add(new LocalPackageFragementTraversal(fFragments[i]));
+ for (int i = 0; i < fFragments.length; i++) {
+ result.add(
+ new LocalPackageFragementTraversal(fFragments[i]));
}
}
return result.toArray(new ResourceTraversal[result.size()]);
@@ -340,20 +370,20 @@
public static ResourceMapping create(IModelElement element) {
switch (element.getElementType()) {
- case IModelElement.TYPE:
- return create((IType)element);
- case IModelElement.SOURCE_MODULE:
- return create((ISourceModule)element);
- case IModelElement.SCRIPT_FOLDER:
- return create((IScriptFolder)element);
- case IModelElement.PROJECT_FRAGMENT:
- return create((IProjectFragment)element);
- case IModelElement.SCRIPT_PROJECT:
- return create((IScriptProject)element);
- case IModelElement.SCRIPT_MODEL:
- return create((IScriptModel)element);
- default:
- return null;
+ case IModelElement.TYPE:
+ return create((IType) element);
+ case IModelElement.SOURCE_MODULE:
+ return create((ISourceModule) element);
+ case IModelElement.SCRIPT_FOLDER:
+ return create((IScriptFolder) element);
+ case IModelElement.PROJECT_FRAGMENT:
+ return create((IProjectFragment) element);
+ case IModelElement.SCRIPT_PROJECT:
+ return create((IScriptProject) element);
+ case IModelElement.SCRIPT_MODEL:
+ return create((IScriptModel) element);
+ default:
+ return null;
}
}
@@ -374,7 +404,8 @@
public static ResourceMapping create(final IScriptFolder pack) {
// test if in an archive
- IProjectFragment root= (IProjectFragment)pack.getAncestor(IModelElement.PROJECT_FRAGMENT);
+ IProjectFragment root = (IProjectFragment) pack
+ .getAncestor(IModelElement.PROJECT_FRAGMENT);
if (!root.isArchive()) {
return new ScriptFolderResourceMapping(pack);
}
@@ -389,25 +420,27 @@
public static ResourceMapping create(IType type) {
// top level types behave like the CU
- IModelElement parent= type.getParent();
+ IModelElement parent = type.getParent();
if (parent instanceof ISourceModule) {
- return create((ISourceModule)parent);
+ return create((ISourceModule) parent);
}
return null;
}
public static ResourceMapping create(LogicalPackage logicalPackage) {
- IScriptFolder[] fragments= logicalPackage.getFragments();
- List toProcess= new ArrayList(fragments.length);
- for (int i= 0; i < fragments.length; i++) {
+ IScriptFolder[] fragments = logicalPackage.getFragments();
+ List toProcess = new ArrayList(fragments.length);
+ for (int i = 0; i < fragments.length; i++) {
// only add if not part of an archive
- IProjectFragment root= (IProjectFragment)fragments[i].getAncestor(IModelElement.PROJECT_FRAGMENT );
+ IProjectFragment root = (IProjectFragment) fragments[i]
+ .getAncestor(IModelElement.PROJECT_FRAGMENT);
if (!root.isArchive()) {
toProcess.add(fragments[i]);
}
}
if (toProcess.size() == 0)
return null;
- return new LogicalPackageResourceMapping((IScriptFolder[])toProcess.toArray(new IScriptFolder[toProcess.size()]));
+ return new LogicalPackageResourceMapping((IScriptFolder[]) toProcess
+ .toArray(new IScriptFolder[toProcess.size()]));
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java
index 0a46e0f..8480dce 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/navigator/ScriptExplorerContentProvider.java
@@ -66,9 +66,9 @@
*
* @see org.eclipse.jdt.ui.StandardJavaElementContentProvider
*/
-public class ScriptExplorerContentProvider extends
- StandardModelElementContentProvider implements ITreeContentProvider,
- IElementChangedListener, IPropertyChangeListener {
+public class ScriptExplorerContentProvider
+ extends StandardModelElementContentProvider implements
+ ITreeContentProvider, IElementChangedListener, IPropertyChangeListener {
protected static final int ORIGINAL = 0;
protected static final int PARENT = 1 << 0;
@@ -102,9 +102,8 @@
}
private boolean arePackagesFoldedInHierarchicalLayout() {
- return getPreferenceStore()
- .getBoolean(
- PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER);
+ return getPreferenceStore().getBoolean(
+ PreferenceConstants.APPEARANCE_FOLD_PACKAGES_IN_PACKAGE_EXPLORER);
}
protected IPreferenceStore getPreferenceStore() {
@@ -120,7 +119,7 @@
*/
@Override
public void elementChanged(final ElementChangedEvent event) {
- final ArrayList<Runnable> runnables = new ArrayList<Runnable>();
+ final ArrayList<Runnable> runnables = new ArrayList<>();
try {
// 58952 delete project does not update Package Explorer [package
// explorer]
@@ -138,7 +137,8 @@
}
}
- protected final void executeRunnables(final Collection<Runnable> runnables) {
+ protected final void executeRunnables(
+ final Collection<Runnable> runnables) {
// now post all collected runnables
Control ctrl = fViewer.getControl();
@@ -250,7 +250,7 @@
}
// hierarchical package mode
- ArrayList<Object> result = new ArrayList<Object>();
+ ArrayList<Object> result = new ArrayList<>();
getHierarchicalPackageChildren(root, null, result);
if (!isProjectProjectFragment(root)) {
Object[] nonJavaResources = root.getForeignResources();
@@ -269,7 +269,7 @@
}
// hierarchical package mode
- ArrayList<Object> result = new ArrayList<Object>();
+ ArrayList<Object> result = new ArrayList<>();
getHierarchicalPackageChildren((IProjectFragment) fragment.getParent(),
fragment, result);
@@ -291,7 +291,7 @@
}
// hierarchical package mode
- ArrayList<Object> result = new ArrayList<Object>();
+ ArrayList<Object> result = new ArrayList<>();
getHierarchicalPackagesInFolder(folder, result);
Object[] others = super.getFolderContent(folder);
@@ -308,18 +308,17 @@
public Object[] getChildren(final Object parentElement) {
try {
if (parentElement instanceof IScriptModel) {
- return getExtendedChildren(
- parentElement,
- StandardModelElementContentProvider
- .concatenate(
- getScriptProjects((IScriptModel) parentElement),
- getNonJavaProjects((IScriptModel) parentElement)));
+ return getExtendedChildren(parentElement,
+ StandardModelElementContentProvider.concatenate(
+ getScriptProjects((IScriptModel) parentElement),
+ getNonJavaProjects(
+ (IScriptModel) parentElement)));
}
if (parentElement instanceof ProjectFragmentContainer) {
- return getExtendedChildren(
- parentElement,
- getContainerProjectFragments((ProjectFragmentContainer) parentElement));
+ return getExtendedChildren(parentElement,
+ getContainerProjectFragments(
+ (ProjectFragmentContainer) parentElement));
}
if (parentElement instanceof IProject) {
@@ -344,7 +343,7 @@
return StandardModelElementContentProvider.NO_CHILDREN;
}
- List<Object> result = new ArrayList<Object>();
+ List<Object> result = new ArrayList<>();
boolean addZIPContainer = false;
@@ -365,11 +364,12 @@
// all ClassPathContainers are added later
} else if (fShowLibrariesNode
&& (entryKind == IBuildpathEntry.BPE_LIBRARY /*
- * || entryKind
- * ==
- * IBuildpathEntry
- * .BPE_VARIABLE
- */)) {
+ * ||
+ * entryKind
+ * ==
+ * IBuildpathEntry
+ * .BPE_VARIABLE
+ */)) {
addZIPContainer = true;
} else {
if (isProjectProjectFragment(root)) {
@@ -394,7 +394,8 @@
IBuildpathEntry[] rawBuidspath = project.getRawBuildpath();
for (int i = 0; i < rawBuidspath.length; i++) {
IBuildpathEntry classpathEntry = rawBuidspath[i];
- if (classpathEntry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
+ if (classpathEntry
+ .getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
result.add(new BuildPathContainer(project, classpathEntry));
}
}
@@ -434,13 +435,13 @@
entry);
} else if (fShowLibrariesNode
&& (entryKind == IBuildpathEntry.BPE_LIBRARY /*
- * ||
- * entryKind
- * ==
- * IBuildpathEntry
- * .
- * BPE_VARIABLE
- */)) {
+ * ||
+ * entryKind
+ * ==
+ * IBuildpathEntry
+ * .
+ * BPE_VARIABLE
+ */)) {
return new LibraryContainer(root.getScriptProject());
}
}
@@ -485,7 +486,7 @@
IModelElement[] children = parent.getChildren();
if (fragment == null || fragment.isRootFolder()) {
- List<IModelElement> newElements = new ArrayList<IModelElement>();
+ List<IModelElement> newElements = new ArrayList<>();
for (int i = 0; i < children.length; ++i) {
if (children[i] instanceof IScriptFolder) {
IScriptFolder scriptFolder = (IScriptFolder) children[i];
@@ -503,26 +504,27 @@
.toArray(new IModelElement[newElements.size()]);
}
- String prefix = fragment != null ? fragment.getElementName()
- + IScriptFolder.PACKAGE_DELIMETER_STR : ""; //$NON-NLS-1$
+ String prefix = fragment != null
+ ? fragment.getElementName()
+ + IScriptFolder.PACKAGE_DELIMETER_STR
+ : ""; //$NON-NLS-1$
int prefixLen = prefix.length();
for (int i = 0; i < children.length; i++) {
if (children[i] instanceof IScriptFolder) {
IScriptFolder curr = (IScriptFolder) children[i];
String name = curr.getElementName();
- if (name.startsWith(prefix)
- && name.length() > prefixLen
+ if (name.startsWith(prefix) && name.length() > prefixLen
&& name.indexOf(IScriptFolder.PACKAGE_DELIMITER,
prefixLen) == -1) {
if (fFoldPackages) {
- curr = ScriptExplorerContentProvider.getFolded(
- children, curr);
+ curr = ScriptExplorerContentProvider.getFolded(children,
+ curr);
}
result.add(curr);
} /*
- * else if (fragment == null && curr.isRootFolder()) {
- * result.add(curr); }
- */
+ * else if (fragment == null && curr.isRootFolder()) {
+ * result.add(curr); }
+ */
} else {
result.add(children[i]);
}
@@ -552,8 +554,8 @@
IScriptFolder fragment = (IScriptFolder) element;
IProjectFragment root = (IProjectFragment) fragment
.getParent();
- element = ScriptExplorerContentProvider.getFolded(root
- .getChildren(), fragment);
+ element = ScriptExplorerContentProvider
+ .getFolded(root.getChildren(), fragment);
}
result.add(element);
}
@@ -573,8 +575,8 @@
if (fFoldPackages
&& ScriptExplorerContentProvider.isEmpty(element)
&& ScriptExplorerContentProvider
- .findSinglePackageChild(element, parent
- .getChildren()) != null) {
+ .findSinglePackageChild(element,
+ parent.getChildren()) != null) {
return getHierarchicalPackageParent(element);
}
} catch (ModelException e) {
@@ -622,9 +624,9 @@
for (int i = 0; i < children.length; i++) {
IModelElement element = children[i];
String name = element.getElementName();
- if (name.startsWith(prefix)
- && name.length() > prefixLen
- && name.indexOf(IScriptFolder.PACKAGE_DELIMITER, prefixLen) == -1) {
+ if (name.startsWith(prefix) && name.length() > prefixLen
+ && name.indexOf(IScriptFolder.PACKAGE_DELIMITER,
+ prefixLen) == -1) {
if (found == null) {
found = (IScriptFolder) element;
} else {
@@ -669,9 +671,11 @@
}
if (elementType == IModelElement.SCRIPT_FOLDER) {
- if ((flags & (IModelElementDelta.F_CONTENT | IModelElementDelta.F_CHILDREN)) == IModelElementDelta.F_CONTENT) {
+ if ((flags & (IModelElementDelta.F_CONTENT
+ | IModelElementDelta.F_CHILDREN)) == IModelElementDelta.F_CONTENT) {
if (!fIsFlatLayout) {
- Object parent = getHierarchicalPackageParent((IScriptFolder) element);
+ Object parent = getHierarchicalPackageParent(
+ (IScriptFolder) element);
if (!(parent instanceof IProjectFragment)) {
postRefresh(internalGetParent(parent), GRANT_PARENT,
element, runnables);
@@ -687,7 +691,8 @@
if (!fIsFlatLayout) {
if (kind == IModelElementDelta.REMOVED) {
- final Object parent = getHierarchicalPackageParent((IScriptFolder) element);
+ final Object parent = getHierarchicalPackageParent(
+ (IScriptFolder) element);
if (parent instanceof IProjectFragment) {
postRemove(element, runnables);
return false;
@@ -697,7 +702,8 @@
return true;
}
} else if (kind == IModelElementDelta.ADDED) {
- final Object parent = getHierarchicalPackageParent((IScriptFolder) element);
+ final Object parent = getHierarchicalPackageParent(
+ (IScriptFolder) element);
if (parent instanceof IProjectFragment) {
if (fFoldPackages) {
postRefresh(parent, PARENT, element, runnables);
@@ -742,7 +748,8 @@
if (elementType == IModelElement.SCRIPT_PROJECT) {
// handle open and closing of a project
- if ((flags & (IModelElementDelta.F_CLOSED | IModelElementDelta.F_OPENED)) != 0) {
+ if ((flags & (IModelElementDelta.F_CLOSED
+ | IModelElementDelta.F_OPENED)) != 0) {
postRefresh(element, ORIGINAL, element, runnables);
return false;
}
@@ -772,7 +779,8 @@
return true;
} else if (element instanceof IProjectFragment
- && ((IProjectFragment) element).getKind() != IProjectFragment.K_SOURCE) {
+ && ((IProjectFragment) element)
+ .getKind() != IProjectFragment.K_SOURCE) {
// libs and class folders can show up twice (in library
// container and as resource at original location)
IResource resource = element.getResource();
@@ -836,7 +844,8 @@
postRefresh(element, ORIGINAL, element, runnables);
return false;
}
- if ((flags & (IModelElementDelta.F_CONTENT | IModelElementDelta.F_CHILDREN)) == IModelElementDelta.F_CONTENT) {
+ if ((flags & (IModelElementDelta.F_CONTENT
+ | IModelElementDelta.F_CHILDREN)) == IModelElementDelta.F_CONTENT) {
// content change, without children info (for example resource
// added/removed to class folder package)
postRefresh(internalGetParent(element), PARENT, element,
@@ -864,7 +873,8 @@
private static boolean isStructuralCUChange(final int flags) {
// No refresh on working copy creation (F_PRIMARY_WORKING_COPY)
return (flags & IModelElementDelta.F_CHILDREN) != 0
- || (flags & (IModelElementDelta.F_CONTENT | IModelElementDelta.F_FINE_GRAINED)) == IModelElementDelta.F_CONTENT;
+ || (flags & (IModelElementDelta.F_CONTENT
+ | IModelElementDelta.F_FINE_GRAINED)) == IModelElementDelta.F_CONTENT;
}
/* package */void handleAffectedChildren(final IModelElementDelta delta,
@@ -896,13 +906,13 @@
if (element instanceof IScriptFolder) {
// a package fragment might become non empty refresh from the
// parent
- IModelElement parent = (IModelElement) internalGetParent(element);
+ IModelElement parent = (IModelElement) internalGetParent(
+ element);
// 1GE8SI6: ITPJUI:WIN98 - Rename is not shown in Packages View
// avoid posting a refresh to an invisible parent
if (element.equals(fInput)) {
- postRefresh(element,
- ScriptExplorerContentProvider.ORIGINAL, element,
- runnables);
+ postRefresh(element, ScriptExplorerContentProvider.ORIGINAL,
+ element, runnables);
} else {
postRefresh(parent, ScriptExplorerContentProvider.PARENT,
element, runnables);
@@ -919,7 +929,8 @@
}
if (resourceDeltas != null) {
for (int i = 0; i < resourceDeltas.length; i++) {
- if (processResourceDelta(resourceDeltas[i], element, runnables)) {
+ if (processResourceDelta(resourceDeltas[i], element,
+ runnables)) {
return; // early return, element got refreshed
}
}
@@ -992,7 +1003,8 @@
// refresh one level above to deal with empty package filtering
// properly
postRefresh(internalGetParent(parent),
- ScriptExplorerContentProvider.PARENT, parent, runnables);
+ ScriptExplorerContentProvider.PARENT, parent,
+ runnables);
return true;
} else {
postRemove(resource, runnables);
@@ -1004,7 +1016,8 @@
// refresh one level above to deal with empty package filtering
// properly
postRefresh(internalGetParent(parent),
- ScriptExplorerContentProvider.PARENT, parent, runnables);
+ ScriptExplorerContentProvider.PARENT, parent,
+ runnables);
return true;
} else {
postAdd(parent, resource, runnables);
@@ -1028,7 +1041,8 @@
int count = 0;
for (int i = 0; i < resourceDeltas.length; i++) {
int kind = resourceDeltas[i].getKind();
- if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
+ if (kind == IResourceDelta.ADDED
+ || kind == IResourceDelta.REMOVED) {
count++;
if (count > 1) {
postRefresh(parent, PARENT, resource, runnables);
@@ -1054,13 +1068,14 @@
}
protected void postRefresh(Object root, final int relation,
- final Object affectedElement, final Collection<Runnable> runnables) {
+ final Object affectedElement,
+ final Collection<Runnable> runnables) {
// JFace doesn't refresh when object isn't part of the viewer
// Therefore move the refresh start down to the viewer's input
if (isParent(root, fInput) || root instanceof IScriptModel) {
root = fInput;
}
- List<Object> toRefresh = new ArrayList<Object>(1);
+ List<Object> toRefresh = new ArrayList<>(1);
toRefresh.add(root);
augmentElementToRefresh(toRefresh, relation, affectedElement);
postRefresh(toRefresh, true, runnables);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/DLTKLoggingPreferencePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/DLTKLoggingPreferencePage.java
index ec3aa86..413782a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/DLTKLoggingPreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/DLTKLoggingPreferencePage.java
@@ -34,8 +34,8 @@
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-public class DLTKLoggingPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public class DLTKLoggingPreferencePage extends PreferencePage
+ implements IWorkbenchPreferencePage {
private static class Option {
final String id;
@@ -67,18 +67,18 @@
@Override
protected Control createContents(Composite parent) {
- viewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER
- | SWT.FULL_SELECTION);
+ viewer = CheckboxTableViewer.newCheckList(parent,
+ SWT.BORDER | SWT.FULL_SELECTION);
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setLabelProvider(new OptionLableProvider());
final List<Option> options = collectOptions();
viewer.setInput(options);
- final Set<String> optionIds = new HashSet<String>();
+ final Set<String> optionIds = new HashSet<>();
for (Option option : options) {
optionIds.add(option.id);
}
final Map<String, Boolean> state = DLTKLogging.getState(optionIds);
- final List<Option> checked = new ArrayList<Option>();
+ final List<Option> checked = new ArrayList<>();
for (Option option : options) {
final Boolean value = state.get(option.id);
if (value != null && value.booleanValue()) {
@@ -90,10 +90,10 @@
}
private List<Option> collectOptions() {
- final IConfigurationElement[] elements = Platform
- .getExtensionRegistry().getConfigurationElementsFor(
+ final IConfigurationElement[] elements = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(
DLTKCore.PLUGIN_ID + ".loggingOptions"); //$NON-NLS-1$
- final List<Option> options = new ArrayList<Option>();
+ final List<Option> options = new ArrayList<>();
for (IConfigurationElement element : elements) {
if ("loggingOption".equals(element.getName())) { //$NON-NLS-1$
final String id = element.getAttribute("id"); //$NON-NLS-1$
@@ -110,7 +110,7 @@
private boolean saveValues() {
final Object input = viewer.getInput();
- final Map<String, Boolean> state = new HashMap<String, Boolean>();
+ final Map<String, Boolean> state = new HashMap<>();
if (input instanceof List<?>) {
for (Iterator<?> i = ((List<?>) input).iterator(); i.hasNext();) {
final Object item = i.next();
@@ -119,7 +119,7 @@
}
}
}
- final Set<String> enabled = new HashSet<String>();
+ final Set<String> enabled = new HashSet<>();
for (Object checked : viewer.getCheckedElements()) {
if (checked instanceof Option) {
final Option option = (Option) checked;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/OptionsConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/OptionsConfigurationBlock.java
index 8bfd6b2..a50f6cd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/OptionsConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/OptionsConfigurationBlock.java
@@ -103,7 +103,7 @@
if (fProject == null || hasProjectSpecificOptions(fProject)) {
fDisabledProjectSettings = null;
} else {
- fDisabledProjectSettings = new HashMap<PreferenceKey, String>();
+ fDisabledProjectSettings = new HashMap<>();
for (PreferenceKey curr : getPreferenceKeys()) {
fDisabledProjectSettings.put(curr,
curr.getStoredValue(fLookupOrder, false, fManager));
@@ -113,7 +113,7 @@
protected void addKeys(List<PreferenceKey> keys) {
Assert.isLegal(!fInitialized);
- final Set<PreferenceKey> all = new LinkedHashSet<PreferenceKey>();
+ final Set<PreferenceKey> all = new LinkedHashSet<>();
Collections.addAll(all, fAllKeys);
all.addAll(keys);
if (all.size() != fAllKeys.length) {
@@ -265,7 +265,7 @@
}
fDisabledProjectSettings = null;
} else {
- fDisabledProjectSettings = new HashMap<PreferenceKey, String>();
+ fDisabledProjectSettings = new HashMap<>();
for (int i = 0; i < allKeys.length; i++) {
PreferenceKey curr = allKeys[i];
String oldSetting = curr.getStoredValue(fLookupOrder, false,
@@ -294,7 +294,7 @@
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
IScopeContext currContext = fLookupOrder[0];
- List<PreferenceKey> changedOptions = new ArrayList<PreferenceKey>();
+ List<PreferenceKey> changedOptions = new ArrayList<>();
boolean needsBuild = getChanges(currContext, changedOptions);
if (changedOptions.isEmpty()) {
return true;
@@ -420,7 +420,7 @@
return excomposite;
}
- private List<ExpandableComposite> fExpandedComposites = new ArrayList<ExpandableComposite>();
+ private List<ExpandableComposite> fExpandedComposites = new ArrayList<>();
private static final String SETTINGS_EXPANDED = "expanded"; //$NON-NLS-1$
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java
index 68f8a6e..921048b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -43,28 +43,30 @@
private IBuildpathEntry fClassPathEntry;
private IBuildpathContainer fContainer;
- public static class RequiredProjectWrapper implements IAdaptable, IWorkbenchAdapter {
+ public static class RequiredProjectWrapper
+ implements IAdaptable, IWorkbenchAdapter {
private final BuildPathContainer fParent;
private final IScriptProject fProject;
-
- public RequiredProjectWrapper(BuildPathContainer parent, IScriptProject project) {
- fParent= parent;
- fProject= project;
+
+ public RequiredProjectWrapper(BuildPathContainer parent,
+ IScriptProject project) {
+ fParent = parent;
+ fProject = project;
}
-
+
public IScriptProject getProject() {
- return fProject;
+ return fProject;
}
-
+
public BuildPathContainer getParentClassPathContainer() {
- return fParent;
+ return fParent;
}
-
+
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class)
+ if (adapter == IWorkbenchAdapter.class)
return (T) this;
return null;
}
@@ -76,7 +78,8 @@
@Override
public ImageDescriptor getImageDescriptor(Object object) {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT);
+ return PlatformUI.getWorkbench().getSharedImages()
+ .getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT);
}
@Override
@@ -92,30 +95,31 @@
public BuildPathContainer(IScriptProject parent, IBuildpathEntry entry) {
super(parent);
- fClassPathEntry= entry;
+ fClassPathEntry = entry;
try {
- fContainer= DLTKCore.getBuildpathContainer(entry.getPath(), parent);
+ fContainer = DLTKCore.getBuildpathContainer(entry.getPath(),
+ parent);
} catch (ModelException e) {
- fContainer= null;
+ fContainer = null;
}
}
@Override
public boolean equals(Object obj) {
if (obj instanceof BuildPathContainer) {
- BuildPathContainer other = (BuildPathContainer)obj;
- if (getScriptProject().equals(other.getScriptProject()) &&
- fClassPathEntry.equals(other.fClassPathEntry)) {
- return true;
+ BuildPathContainer other = (BuildPathContainer) obj;
+ if (getScriptProject().equals(other.getScriptProject())
+ && fClassPathEntry.equals(other.fClassPathEntry)) {
+ return true;
}
-
+
}
return false;
}
@Override
public int hashCode() {
- return getScriptProject().hashCode()*17+fClassPathEntry.hashCode();
+ return getScriptProject().hashCode() * 17 + fClassPathEntry.hashCode();
}
@Override
@@ -125,9 +129,9 @@
@Override
public IAdaptable[] getChildren() {
- List<IAdaptable> list = new ArrayList<IAdaptable>();
- IProjectFragment[] roots= getProjectFragments();
- for (int i= 0; i < roots.length; i++) {
+ List<IAdaptable> list = new ArrayList<>();
+ IProjectFragment[] roots = getProjectFragments();
+ for (int i = 0; i < roots.length; i++) {
list.add(roots[i]);
}
if (fContainer != null) {
@@ -135,15 +139,18 @@
.getBuildpathEntries();
if (classpathEntries == null) {
// invalid implementation of a classpath container
- DLTKUIPlugin.log(new IllegalArgumentException("Invalid classpath container implementation: getClasspathEntries() returns null. " + fContainer.getPath())); //$NON-NLS-1$
+ DLTKUIPlugin.log(new IllegalArgumentException(
+ "Invalid classpath container implementation: getClasspathEntries() returns null. " //$NON-NLS-1$
+ + fContainer.getPath()));
} else {
- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- for (int i= 0; i < classpathEntries.length; i++) {
- IBuildpathEntry entry= classpathEntries[i];
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (int i = 0; i < classpathEntries.length; i++) {
+ IBuildpathEntry entry = classpathEntries[i];
if (entry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
- IResource resource= root.findMember(entry.getPath());
+ IResource resource = root.findMember(entry.getPath());
if (resource instanceof IProject)
- list.add(new RequiredProjectWrapper(this, DLTKCore.create((IProject) resource)));
+ list.add(new RequiredProjectWrapper(this,
+ DLTKCore.create((IProject) resource)));
}
}
}
@@ -161,24 +168,30 @@
public String getLabel() {
if (fContainer != null)
return fContainer.getDescription();
-
- IPath path= fClassPathEntry.getPath();
- String containerId= path.segment(0);
- BuildpathContainerInitializer initializer= DLTKCore.getBuildpathContainerInitializer(containerId);
+
+ IPath path = fClassPathEntry.getPath();
+ String containerId = path.segment(0);
+ BuildpathContainerInitializer initializer = DLTKCore
+ .getBuildpathContainerInitializer(containerId);
if (initializer != null) {
- String description= initializer.getDescription(path, getScriptProject());
- return Messages.format(ScriptMessages.BuildPathContainer_unbound_label, description);
+ String description = initializer.getDescription(path,
+ getScriptProject());
+ return Messages.format(
+ ScriptMessages.BuildPathContainer_unbound_label,
+ description);
}
- return Messages.format(ScriptMessages.BuildPathContainer_unknown_label, path.toString());
+ return Messages.format(ScriptMessages.BuildPathContainer_unknown_label,
+ path.toString());
}
-
+
public IBuildpathEntry getBuildpathEntry() {
return fClassPathEntry;
}
-
- static boolean contains(IScriptProject project, IBuildpathEntry entry, IProjectFragment root) {
- IProjectFragment[] roots= project.findProjectFragments(entry);
- for (int i= 0; i < roots.length; i++) {
+
+ static boolean contains(IScriptProject project, IBuildpathEntry entry,
+ IProjectFragment root) {
+ IProjectFragment[] roots = project.findProjectFragments(entry);
+ for (int i = 0; i < roots.length; i++) {
if (roots[i].equals(root))
return true;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java
index b180c98..e7e1ea0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -57,14 +57,9 @@
return ScriptMessages.LibraryContainer_libraries;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jdt.internal.ui.packageview.PackageFragmentRootContainer#getPackageFragmentRoots()
- */
@Override
public IProjectFragment[] getProjectFragments() {
- List<IProjectFragment> list = new ArrayList<IProjectFragment>();
+ List<IProjectFragment> list = new ArrayList<>();
try {
IProjectFragment[] roots = getScriptProject().getProjectFragments();
for (int i = 0; i < roots.length; i++) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
index bc1773f..fb7cf8f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
@@ -32,9 +32,9 @@
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
-public abstract class WorkingSetAwareContentProvider extends
- ScriptExplorerContentProvider implements
- IMultiElementTreeContentProvider {
+public abstract class WorkingSetAwareContentProvider
+ extends ScriptExplorerContentProvider
+ implements IMultiElementTreeContentProvider {
private WorkingSetModel fWorkingSetModel;
private IPropertyChangeListener fListener;
@@ -96,8 +96,7 @@
if (isKnownWorkingSet) {
result.add(element);
} else {
- IProject project = element
- .getAdapter(IProject.class);
+ IProject project = element.getAdapter(IProject.class);
if (project != null && project.exists()) {
IScriptProject jp = DLTKCore.create(project);
if (jp != null && jp.exists()) {
@@ -138,7 +137,7 @@
return new TreePath[] { path };
}
List modelParents = getModelPath(element);
- List<TreePath> result = new ArrayList<TreePath>();
+ List<TreePath> result = new ArrayList<>();
for (int i = 0; i < modelParents.size(); i++) {
result.addAll(getTreePaths(modelParents, i));
}
@@ -160,8 +159,8 @@
return result;
}
- private List/* <TreePath> */getTreePaths(List modelParents, int index) {
- List result = new ArrayList();
+ private List<TreePath> getTreePaths(List modelParents, int index) {
+ List<TreePath> result = new ArrayList<>();
Object input = getViewerInput();
Object element = modelParents.get(index);
Object[] parents = fWorkingSetModel.getAllParents(element);
@@ -194,15 +193,15 @@
protected void augmentElementToRefresh(List toRefresh, int relation,
Object affectedElement) {
// we are refreshing the ScriptModel and are in working set mode.
- if (DLTKCore.create(ResourcesPlugin.getWorkspace().getRoot()).equals(
- affectedElement)) {
+ if (DLTKCore.create(ResourcesPlugin.getWorkspace().getRoot())
+ .equals(affectedElement)) {
toRefresh.remove(affectedElement);
toRefresh.add(fWorkingSetModel);
} else if (relation == GRANT_PARENT) {
Object parent = internalGetParent(affectedElement);
if (parent != null) {
- toRefresh.addAll(Arrays.asList(fWorkingSetModel
- .getAllParents(parent)));
+ toRefresh.addAll(
+ Arrays.asList(fWorkingSetModel.getAllParents(parent)));
}
}
List nonProjetTopLevelElemens = fWorkingSetModel
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java
index cb9fbd0..bd483a3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java
@@ -36,8 +36,8 @@
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.ui.IWorkingSet;
-
-public class WorkingSetDropAdapter extends DLTKViewerDropAdapter implements TransferDropTargetListener {
+public class WorkingSetDropAdapter extends DLTKViewerDropAdapter
+ implements TransferDropTargetListener {
private ScriptExplorerPart fPackageExplorer;
@@ -49,16 +49,17 @@
public WorkingSetDropAdapter(ScriptExplorerPart part) {
super(part.getTreeViewer());
- fPackageExplorer= part;
+ fPackageExplorer = part;
- fLocation= -1;
+ fLocation = -1;
setScrollEnabled(true);
setExpandEnabled(true);
setFeedbackEnabled(false);
}
- //---- TransferDropTargetListener interface ---------------------------------------
+ // ---- TransferDropTargetListener interface
+ // ---------------------------------------
@Override
public Transfer getTransfer() {
@@ -67,7 +68,7 @@
@Override
public boolean isEnabled(DropTargetEvent event) {
- Object target= event.item != null ? event.item.getData() : null;
+ Object target = event.item != null ? event.item.getData() : null;
if (target == null)
return false;
ISelection selection = LocalSelectionTransfer.getTransfer()
@@ -82,22 +83,26 @@
return true;
}
- //---- Actual DND -----------------------------------------------------------------
+ // ---- Actual DND
+ // -----------------------------------------------------------------
@Override
- public boolean validateDrop(Object target, int operation, TransferData transferType) {
- return determineOperation(target, operation, transferType, DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_COPY) != DND.DROP_NONE;
+ public boolean validateDrop(Object target, int operation,
+ TransferData transferType) {
+ return determineOperation(target, operation, transferType,
+ DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_COPY) != DND.DROP_NONE;
}
@Override
- protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {
- switch(operation) {
- case DND.DROP_DEFAULT:
- case DND.DROP_COPY:
- case DND.DROP_MOVE:
- return validateTarget(target, operation);
- default:
- return DND.DROP_NONE;
+ protected int determineOperation(Object target, int operation,
+ TransferData transferType, int operations) {
+ switch (operation) {
+ case DND.DROP_DEFAULT:
+ case DND.DROP_COPY:
+ case DND.DROP_MOVE:
+ return validateTarget(target, operation);
+ default:
+ return DND.DROP_NONE;
}
}
@@ -116,7 +121,8 @@
if (isWorkingSetSelection()) {
setExpandEnabled(false);
- if (getCurrentLocation() == LOCATION_BEFORE || getCurrentLocation() == LOCATION_AFTER) {
+ if (getCurrentLocation() == LOCATION_BEFORE
+ || getCurrentLocation() == LOCATION_AFTER) {
setFeedbackEnabled(true);
return DND.DROP_MOVE;
}
@@ -125,34 +131,39 @@
if (isOthersWorkingSet(fWorkingSet) && operation == DND.DROP_COPY)
return DND.DROP_NONE;
- List realScriptElements= new ArrayList();
- List realResource= new ArrayList();
- ReorgUtils.splitIntoModelElementsAndResources(fElementsToAdds, realScriptElements, realResource);
- if (fElementsToAdds.length != realScriptElements.size() + realResource.size())
+ List realScriptElements = new ArrayList();
+ List realResource = new ArrayList();
+ ReorgUtils.splitIntoModelElementsAndResources(fElementsToAdds,
+ realScriptElements, realResource);
+ if (fElementsToAdds.length != realScriptElements.size()
+ + realResource.size())
return DND.DROP_NONE;
- for (Iterator iter= realScriptElements.iterator(); iter.hasNext();) {
- IModelElement element= (IModelElement)iter.next();
- if (ReorgUtils.containsElementOrParent(fCurrentElements, element))
+ for (Iterator iter = realScriptElements.iterator(); iter
+ .hasNext();) {
+ IModelElement element = (IModelElement) iter.next();
+ if (ReorgUtils.containsElementOrParent(fCurrentElements,
+ element))
return DND.DROP_NONE;
}
- for (Iterator iter= realResource.iterator(); iter.hasNext();) {
- IResource element= (IResource)iter.next();
- if (ReorgUtils.containsElementOrParent(fCurrentElements, element))
+ for (Iterator iter = realResource.iterator(); iter.hasNext();) {
+ IResource element = (IResource) iter.next();
+ if (ReorgUtils.containsElementOrParent(fCurrentElements,
+ element))
return DND.DROP_NONE;
}
if (!(fSelection instanceof ITreeSelection)) {
return DND.DROP_COPY;
}
- ITreeSelection treeSelection= (ITreeSelection)fSelection;
- TreePath[] paths= treeSelection.getPaths();
- for (int i= 0; i < paths.length; i++) {
- TreePath path= paths[i];
+ ITreeSelection treeSelection = (ITreeSelection) fSelection;
+ TreePath[] paths = treeSelection.getPaths();
+ for (int i = 0; i < paths.length; i++) {
+ TreePath path = paths[i];
if (path.getSegmentCount() != 2)
return DND.DROP_COPY;
if (!(path.getSegment(0) instanceof IWorkingSet))
return DND.DROP_COPY;
if (paths.length == 1) {
- IWorkingSet ws= (IWorkingSet)path.getSegment(0);
+ IWorkingSet ws = (IWorkingSet) path.getSegment(0);
if (WorkingSetIDs.OTHERS.equals(ws.getId()))
return DND.DROP_MOVE;
}
@@ -176,14 +187,15 @@
}
private void initializeState(Object target, ISelection s) {
- fWorkingSet= (IWorkingSet)target;
- fSelection= (IStructuredSelection)s;
- fElementsToAdds= fSelection.toArray();
- fCurrentElements= new HashSet(Arrays.asList(fWorkingSet.getElements()));
+ fWorkingSet = (IWorkingSet) target;
+ fSelection = (IStructuredSelection) s;
+ fElementsToAdds = fSelection.toArray();
+ fCurrentElements = new HashSet(
+ Arrays.asList(fWorkingSet.getElements()));
}
private boolean isWorkingSetSelection() {
- for (int i= 0; i < fElementsToAdds.length; i++) {
+ for (int i = 0; i < fElementsToAdds.length; i++) {
if (!(fElementsToAdds[i] instanceof IWorkingSet))
return false;
}
@@ -205,45 +217,50 @@
}
private void performWorkingSetReordering() {
- WorkingSetModel model= fPackageExplorer.getWorkingSetModel();
- List activeWorkingSets= new ArrayList(Arrays.asList(model.getActiveWorkingSets()));
- int index= activeWorkingSets.indexOf(fWorkingSet);
+ WorkingSetModel model = fPackageExplorer.getWorkingSetModel();
+ List activeWorkingSets = new ArrayList(
+ Arrays.asList(model.getActiveWorkingSets()));
+ int index = activeWorkingSets.indexOf(fWorkingSet);
if (index != -1) {
if (getCurrentLocation() == LOCATION_AFTER)
index++;
List result = new ArrayList(activeWorkingSets.size());
- List selected= new ArrayList(Arrays.asList(fElementsToAdds));
- for (int i= 0; i < activeWorkingSets.size(); i++) {
+ List selected = new ArrayList(Arrays.asList(fElementsToAdds));
+ for (int i = 0; i < activeWorkingSets.size(); i++) {
if (i == index) {
result.addAll(selected);
}
- Object element= activeWorkingSets.get(i);
+ Object element = activeWorkingSets.get(i);
if (!selected.contains(element)) {
result.add(element);
}
}
if (index == activeWorkingSets.size())
result.addAll(selected);
- model.setActiveWorkingSets((IWorkingSet[])result.toArray(new IWorkingSet[result.size()]));
+ model.setActiveWorkingSets((IWorkingSet[]) result
+ .toArray(new IWorkingSet[result.size()]));
}
}
private void performElementRearrange(int eventDetail) {
// only move if target isn't the other working set. If this is the case
- // the move will happenn automatically by refreshing the other working set
+ // the move will happenn automatically by refreshing the other working
+ // set
if (!isOthersWorkingSet(fWorkingSet)) {
List elements = new ArrayList(
Arrays.asList(fWorkingSet.getElements()));
elements.addAll(Arrays.asList(fElementsToAdds));
- fWorkingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ fWorkingSet.setElements((IAdaptable[]) elements
+ .toArray(new IAdaptable[elements.size()]));
}
if (eventDetail == DND.DROP_MOVE) {
- ITreeSelection treeSelection= (ITreeSelection)fSelection;
- Map workingSets= groupByWorkingSets(treeSelection.getPaths());
- for (Iterator iter= workingSets.keySet().iterator(); iter.hasNext();) {
- IWorkingSet ws= (IWorkingSet)iter.next();
- List toRemove= (List)workingSets.get(ws);
- List<IAdaptable> currentElements = new ArrayList<IAdaptable>(
+ ITreeSelection treeSelection = (ITreeSelection) fSelection;
+ Map workingSets = groupByWorkingSets(treeSelection.getPaths());
+ for (Iterator iter = workingSets.keySet().iterator(); iter
+ .hasNext();) {
+ IWorkingSet ws = (IWorkingSet) iter.next();
+ List toRemove = (List) workingSets.get(ws);
+ List<IAdaptable> currentElements = new ArrayList<>(
Arrays.asList(ws.getElements()));
currentElements.removeAll(toRemove);
ws.setElements(currentElements
@@ -252,14 +269,14 @@
}
}
- private Map/*<List<IWorkingSet>>*/ groupByWorkingSets(TreePath[] paths) {
- Map result= new HashMap();
- for (int i= 0; i < paths.length; i++) {
- TreePath path= paths[i];
- IWorkingSet ws= (IWorkingSet)path.getSegment(0);
- List l= (List)result.get(ws);
+ private Map/* <List<IWorkingSet>> */ groupByWorkingSets(TreePath[] paths) {
+ Map result = new HashMap();
+ for (int i = 0; i < paths.length; i++) {
+ TreePath path = paths[i];
+ IWorkingSet ws = (IWorkingSet) path.getSegment(0);
+ List l = (List) result.get(ws);
if (l == null) {
- l= new ArrayList();
+ l = new ArrayList();
result.put(ws, l);
}
l.add(path.getSegment(1));
@@ -267,7 +284,7 @@
return result;
}
- //---- test methods for JUnit test since DnD is hard to simulate
+ // ---- test methods for JUnit test since DnD is hard to simulate
public int internalTestValidateTarget(Object target, int operation) {
return validateTarget(target, operation);
@@ -282,7 +299,7 @@
}
public void internalTestSetLocation(int location) {
- fLocation= location;
+ fLocation = location;
}
/**
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java
index 212bce7..2faca17 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResult.java
@@ -31,15 +31,16 @@
import org.eclipse.search.ui.text.Match;
import org.eclipse.ui.IEditorPart;
-public class DLTKSearchResult extends AbstractTextSearchResult implements IEditorMatchAdapter, IFileMatchAdapter {
+public class DLTKSearchResult extends AbstractTextSearchResult
+ implements IEditorMatchAdapter, IFileMatchAdapter {
private DLTKSearchQuery fQuery;
private Map<Object, IMatchPresentation> fElementsToParticipants;
- private static final Match[] NO_MATCHES= new Match[0];
+ private static final Match[] NO_MATCHES = new Match[0];
public DLTKSearchResult(DLTKSearchQuery query) {
- fQuery= query;
- fElementsToParticipants= new HashMap<Object, IMatchPresentation>();
+ fQuery = query;
+ fElementsToParticipants = new HashMap<>();
setActiveMatchFilters(DLTKMatchFilter.getLastUsedFilters());
}
@@ -59,18 +60,20 @@
}
@Override
- public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
+ public Match[] computeContainedMatches(AbstractTextSearchResult result,
+ IEditorPart editor) {
return computeContainedMatches(editor.getEditorInput());
}
@Override
- public Match[] computeContainedMatches(AbstractTextSearchResult result, IFile file) {
+ public Match[] computeContainedMatches(AbstractTextSearchResult result,
+ IFile file) {
return computeContainedMatches(file);
}
private Match[] computeContainedMatches(IAdaptable adaptable) {
IModelElement modelElement = adaptable.getAdapter(IModelElement.class);
- Set<Match> matches= new HashSet<Match>();
+ Set<Match> matches = new HashSet<>();
if (modelElement != null) {
collectMatches(matches, modelElement);
}
@@ -84,28 +87,27 @@
return NO_MATCHES;
}
-
private void collectMatches(Set<Match> matches, IFile element) {
- Match[] m= getMatches(element);
+ Match[] m = getMatches(element);
if (m.length != 0) {
- for (int i= 0; i < m.length; i++) {
+ for (int i = 0; i < m.length; i++) {
matches.add(m[i]);
}
}
}
private void collectMatches(Set<Match> matches, IModelElement element) {
- Match[] m= getMatches(element);
+ Match[] m = getMatches(element);
if (m.length != 0) {
- for (int i= 0; i < m.length; i++) {
+ for (int i = 0; i < m.length; i++) {
matches.add(m[i]);
}
}
if (element instanceof IParent) {
- IParent parent= (IParent) element;
+ IParent parent = (IParent) element;
try {
- IModelElement[] children= parent.getChildren();
- for (int i= 0; i < children.length; i++) {
+ IModelElement[] children = parent.getChildren();
+ for (int i = 0; i < children.length; i++) {
collectMatches(matches, children[i]);
}
} catch (ModelException e) {
@@ -113,14 +115,19 @@
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchResultCategory#getFile(java.lang.Object)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.search.ui.ISearchResultCategory#getFile(java.lang.Object)
*/
@Override
public IFile getFile(Object element) {
if (element instanceof IModelElement) {
- IModelElement modelElement= (IModelElement) element;
- ISourceModule cu= (ISourceModule) modelElement.getAncestor(IModelElement.SOURCE_MODULE);
+ IModelElement modelElement = (IModelElement) element;
+ ISourceModule cu = (ISourceModule) modelElement
+ .getAncestor(IModelElement.SOURCE_MODULE);
if (cu != null) {
return (IFile) cu.getResource();
}
@@ -134,17 +141,21 @@
/*
* (non-Javadoc)
*
- * @see org.eclipse.search2.ui.text.IStructureProvider#isShownInEditor(org.eclipse.search2.ui.text.Match,
- * org.eclipse.ui.IEditorPart)
+ * @see org.eclipse.search2.ui.text.IStructureProvider#isShownInEditor(org.
+ * eclipse.search2.ui.text.Match, org.eclipse.ui.IEditorPart)
*/
@Override
public boolean isShownInEditor(Match match, IEditorPart editor) {
- Object element= match.getElement();
+ Object element = match.getElement();
if (element instanceof IModelElement) {
- element= ((IModelElement) element).getOpenable(); // class file or compilation unit
- return element != null && element.equals(editor.getEditorInput().getAdapter(IModelElement.class));
+ element = ((IModelElement) element).getOpenable(); // class file or
+ // compilation
+ // unit
+ return element != null && element.equals(
+ editor.getEditorInput().getAdapter(IModelElement.class));
} else if (element instanceof IFile) {
- return element.equals(editor.getEditorInput().getAdapter(IFile.class));
+ return element
+ .equals(editor.getEditorInput().getAdapter(IFile.class));
}
return false;
}
@@ -157,7 +168,9 @@
return DLTKMatchFilter.allFilters();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.search.ui.ISearchResult#getQuery()
*/
@Override
@@ -170,10 +183,14 @@
}
boolean addMatch(Match match, IMatchPresentation participant) {
- Object element= match.getElement();
+ Object element = match.getElement();
if (fElementsToParticipants.get(element) != null) {
- // TODO must access the participant id / label to properly report the error.
- DLTKUIPlugin.log(new Status(IStatus.WARNING, DLTKUIPlugin.getPluginId(), 0, "A second search participant was found for an element", null)); //$NON-NLS-1$
+ // TODO must access the participant id / label to properly report
+ // the error.
+ DLTKUIPlugin.log(new Status(IStatus.WARNING,
+ DLTKUIPlugin.getPluginId(), 0,
+ "A second search participant was found for an element", //$NON-NLS-1$
+ null));
return false;
}
fElementsToParticipants.put(element, participant);
@@ -183,7 +200,7 @@
@Override
public void removeAll() {
- synchronized(this) {
+ synchronized (this) {
fElementsToParticipants.clear();
}
super.removeAll();
@@ -191,7 +208,7 @@
@Override
public void removeMatch(Match match) {
- synchronized(this) {
+ synchronized (this) {
if (getMatchCount(match.getElement()) == 1)
fElementsToParticipants.remove(match.getElement());
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResultPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResultPage.java
index 283b32d..0a810a3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResultPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchResultPage.java
@@ -211,8 +211,7 @@
int length) throws PartInitException {
try {
IMarker marker = file.createMarker(NewSearchUI.SEARCH_MARKER);
- HashMap<String, Integer> attributes = new HashMap<String, Integer>(
- 4);
+ HashMap<String, Integer> attributes = new HashMap<>(4);
attributes.put(IMarker.CHAR_START, Integer.valueOf(offset));
attributes.put(IMarker.CHAR_END, Integer.valueOf(offset + length));
marker.setAttributes(attributes);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
index f356ae4..62dd15f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -66,8 +66,8 @@
if (shell == null)
return null;
IWorkingSetSelectionDialog dialog = PlatformUI.getWorkbench()
- .getWorkingSetManager().createWorkingSetSelectionDialog(shell,
- true);
+ .getWorkingSetManager()
+ .createWorkingSetSelectionDialog(shell, true);
if (dialog.open() == Window.OK) {
IWorkingSet[] workingSets = dialog.getSelection();
if (workingSets.length > 0)
@@ -122,8 +122,8 @@
ArrayList res = new ArrayList();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
for (int i = 0; i < projectNames.length; i++) {
- IScriptProject project = DLTKCore.create(root
- .getProject(projectNames[i]));
+ IScriptProject project = DLTKCore
+ .create(root.getProject(projectNames[i]));
if (project.exists()) {
res.add(project);
}
@@ -166,15 +166,16 @@
: SearchMessages.EnclosingProjectScopeNoInterpreterEnvironment;
scopeDescription = Messages.format(label, projectNames[0]);
} else if (projectNames.length == 2) {
- String label = includeInterp ? SearchMessages.EnclosingProjectsScope2
+ String label = includeInterp
+ ? SearchMessages.EnclosingProjectsScope2
: SearchMessages.EnclosingProjectsScope2NoInterpreterEnvironment;
- scopeDescription = Messages.format(label, new String[] {
- projectNames[0], projectNames[1] });
+ scopeDescription = Messages.format(label,
+ new String[] { projectNames[0], projectNames[1] });
} else {
String label = includeInterp ? SearchMessages.EnclosingProjectsScope
: SearchMessages.EnclosingProjectsScopeNoInterpreterEnvironment;
- scopeDescription = Messages.format(label, new String[] {
- projectNames[0], projectNames[1] });
+ scopeDescription = Messages.format(label,
+ new String[] { projectNames[0], projectNames[1] });
}
return scopeDescription;
}
@@ -182,8 +183,8 @@
public String getProjectScopeDescription(IScriptProject project,
boolean includeInterp) {
if (includeInterp) {
- return Messages.format(SearchMessages.ProjectScope, project
- .getElementName());
+ return Messages.format(SearchMessages.ProjectScope,
+ project.getElementName());
} else {
return Messages.format(
SearchMessages.ProjectScopeNoInterpreterEnvironment,
@@ -218,20 +219,20 @@
if (modelElements.length == 1) {
String label = includeInterp ? SearchMessages.SingleSelectionScope
: SearchMessages.SingleSelectionScopeNoInterpreterEnvironment;
- scopeDescription = Messages.format(label, modelElements[0]
- .getElementName());
+ scopeDescription = Messages.format(label,
+ modelElements[0].getElementName());
} else if (modelElements.length == 1) {
String label = includeInterp ? SearchMessages.DoubleSelectionScope
: SearchMessages.DoubleSelectionScopeNoInterpreterEnvironment;
- scopeDescription = Messages.format(label, new String[] {
- modelElements[0].getElementName(),
- modelElements[1].getElementName() });
+ scopeDescription = Messages.format(label,
+ new String[] { modelElements[0].getElementName(),
+ modelElements[1].getElementName() });
} else {
String label = includeInterp ? SearchMessages.SelectionScope
: SearchMessages.SelectionScopeNoInterpreterEnvironment;
- scopeDescription = Messages.format(label, new String[] {
- modelElements[0].getElementName(),
- modelElements[1].getElementName() });
+ scopeDescription = Messages.format(label,
+ new String[] { modelElements[0].getElementName(),
+ modelElements[1].getElementName() });
}
return scopeDescription;
}
@@ -261,7 +262,7 @@
public IProject[] getProjects(IDLTKSearchScope scope) {
IPath[] paths = scope.enclosingProjectsAndZips();
- HashSet<IProject> temp = new HashSet<IProject>();
+ HashSet<IProject> temp = new HashSet<>();
for (int i = 0; i < paths.length; i++) {
IResource resource = ResourcesPlugin.getWorkspace().getRoot()
.findMember(paths[i]);
@@ -273,8 +274,8 @@
public IModelElement[] getModelElements(ISelection selection) {
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- return getModelElements(((IStructuredSelection) selection)
- .toArray());
+ return getModelElements(
+ ((IStructuredSelection) selection).toArray());
} else {
return new IModelElement[0];
}
@@ -284,7 +285,7 @@
if (elements.length == 0)
return new IModelElement[0];
- Set<IModelElement> result = new HashSet<IModelElement>(elements.length);
+ Set<IModelElement> result = new HashSet<>(elements.length);
for (int i = 0; i < elements.length; i++) {
Object selectedElement = elements[i];
if (selectedElement instanceof IModelElement) {
@@ -321,8 +322,8 @@
}
private IDLTKSearchScope createSearchScope(
- Collection<IModelElement> modelElements,
- boolean includeInterp, IDLTKLanguageToolkit toolkit) {
+ Collection<IModelElement> modelElements, boolean includeInterp,
+ IDLTKLanguageToolkit toolkit) {
if (modelElements.isEmpty())
return EMPTY_SCOPE;
IModelElement[] elementArray = modelElements
@@ -345,8 +346,7 @@
}
private void addModelElements(Set modelElements, IResource resource) {
- IModelElement modelElement = resource
- .getAdapter(IModelElement.class);
+ IModelElement modelElement = resource.getAdapter(IModelElement.class);
if (modelElement == null)
// not a Script resource
return;
@@ -363,7 +363,8 @@
modelElements.add(modelElement);
}
- private void addModelElements(Set modelElements, IModelElement modelElement) {
+ private void addModelElements(Set modelElements,
+ IModelElement modelElement) {
modelElements.add(modelElement);
}
@@ -373,8 +374,8 @@
if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) {
try {
- IScriptProject[] projects = DLTKCore.create(
- ResourcesPlugin.getWorkspace().getRoot())
+ IScriptProject[] projects = DLTKCore
+ .create(ResourcesPlugin.getWorkspace().getRoot())
.getScriptProjects();
modelElements.addAll(Arrays.asList(projects));
} catch (ModelException e) {
@@ -391,8 +392,7 @@
addModelElements(modelElements, modelElement);
continue;
}
- IResource resource = elements[i]
- .getAdapter(IResource.class);
+ IResource resource = elements[i].getAdapter(IResource.class);
if (resource != null) {
addModelElements(modelElements, resource);
}
@@ -412,8 +412,8 @@
IDLTKLanguageToolkit toolkit) {
if (!includeInterp) {
try {
- IScriptProject[] projects = DLTKCore.create(
- ResourcesPlugin.getWorkspace().getRoot())
+ IScriptProject[] projects = DLTKCore
+ .create(ResourcesPlugin.getWorkspace().getRoot())
.getScriptProjects();
return SearchEngine.createSearchScope(projects,
getSearchFlags(includeInterp), toolkit);
@@ -430,13 +430,13 @@
if (root != null) {
try {
IBuildpathEntry entry = root.getRawBuildpathEntry();
- if (entry != null
- && entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
+ if (entry != null && entry
+ .getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
IBuildpathContainer container = DLTKCore
- .getBuildpathContainer(entry.getPath(), root
- .getScriptProject());
- return container != null
- && container.getKind() == IBuildpathContainer.K_DEFAULT_SYSTEM;
+ .getBuildpathContainer(entry.getPath(),
+ root.getScriptProject());
+ return container != null && container
+ .getKind() == IBuildpathContainer.K_DEFAULT_SYSTEM;
}
return false;
} catch (ModelException e) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchTableContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchTableContentProvider.java
index 0fcf0d4..e32f5d9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchTableContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchTableContentProvider.java
@@ -24,7 +24,7 @@
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof DLTKSearchResult) {
- Set<Object> filteredElements = new HashSet<Object>();
+ Set<Object> filteredElements = new HashSet<>();
Object[] rawElements = ((DLTKSearchResult) inputElement)
.getElements();
int limit = getPage().getElementLimit().intValue();
@@ -50,9 +50,9 @@
int addLimit = getAddLimit();
TableViewer viewer = (TableViewer) getPage().getViewer();
- Set<Object> updated = new HashSet<Object>();
- Set<Object> added = new HashSet<Object>();
- Set<Object> removed = new HashSet<Object>();
+ Set<Object> updated = new HashSet<>();
+ Set<Object> added = new HashSet<>();
+ Set<Object> removed = new HashSet<>();
for (int i = 0; i < updatedElements.length; i++) {
if (getPage().getDisplayedMatchCount(updatedElements[i]) > 0) {
if (viewer.testFindItem(updatedElements[i]) != null)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchLabelProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchLabelProvider.java
index eb8c72e..b26a092 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchLabelProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchLabelProvider.java
@@ -42,7 +42,8 @@
private static final String EMPHASIZE_POTENTIAL_MATCHES = "org.eclipse.search.potentialMatch.emphasize"; //$NON-NLS-1$
private static final String POTENTIAL_MATCH_FG_COLOR = "org.eclipse.search.potentialMatch.fgColor"; //$NON-NLS-1$
- protected static final long DEFAULT_SEARCH_TEXTFLAGS = (DEFAULT_TEXTFLAGS | ScriptElementLabels.P_COMPRESSED)
+ protected static final long DEFAULT_SEARCH_TEXTFLAGS = (DEFAULT_TEXTFLAGS
+ | ScriptElementLabels.P_COMPRESSED)
& ~ScriptElementLabels.M_APP_RETURNTYPE;
protected static final int DEFAULT_SEARCH_IMAGEFLAGS = DEFAULT_IMAGEFLAGS;
@@ -55,16 +56,16 @@
private IPropertyChangeListener fSearchPropertyListener;
public SearchLabelProvider(DLTKSearchResultPage page) {
- super(DEFAULT_SEARCH_TEXTFLAGS, DEFAULT_SEARCH_IMAGEFLAGS, DLTKUIPlugin
- .getDefault().getPreferenceStore());
+ super(DEFAULT_SEARCH_TEXTFLAGS, DEFAULT_SEARCH_IMAGEFLAGS,
+ DLTKUIPlugin.getDefault().getPreferenceStore());
if (DLTKCore.DEBUG) {
- System.out
- .println("TODO: Add language dependent preference store support here..."); //$NON-NLS-1$
+ System.out.println(
+ "TODO: Add language dependent preference store support here..."); //$NON-NLS-1$
}
addLabelDecorator(new ProblemsLabelDecorator());
fPage = page;
- fLabelProviderMap = new HashMap<IMatchPresentation, ILabelProvider>(5);
+ fLabelProviderMap = new HashMap<>(5);
fSearchPreferences = new ScopedPreferenceStore(InstanceScope.INSTANCE,
NewSearchUI.PLUGIN_ID);
@@ -96,8 +97,8 @@
private Color getForegroundColor() {
if (fPotentialMatchFgColor == null) {
- fPotentialMatchFgColor = new Color(DLTKUIPlugin
- .getActiveWorkbenchShell().getDisplay(),
+ fPotentialMatchFgColor = new Color(
+ DLTKUIPlugin.getActiveWorkbenchShell().getDisplay(),
getPotentialMatchForegroundColor());
}
return fPotentialMatchFgColor;
@@ -110,7 +111,8 @@
Match[] matches = result.getMatches(element);
for (int i = 0; i < matches.length; i++) {
if ((matches[i]) instanceof DLTKElementMatch) {
- if (((DLTKElementMatch) matches[i]).getAccuracy() == SearchMatch.A_INACCURATE)
+ if (((DLTKElementMatch) matches[i])
+ .getAccuracy() == SearchMatch.A_INACCURATE)
res++;
}
}
@@ -118,17 +120,17 @@
return res;
}
- protected final String getLabelWithCounts(Object element, String elementName) {
+ protected final String getLabelWithCounts(Object element,
+ String elementName) {
int matchCount = fPage.getDisplayedMatchCount(element);
int potentialCount = getNumberOfPotentialMatches(element);
if (matchCount < 2) {
if (matchCount == 1 && hasChildren(element)) {
if (potentialCount > 0)
- return Messages
- .format(
- SearchMessages.SearchLabelProvider_potential_singular,
- elementName);
+ return Messages.format(
+ SearchMessages.SearchLabelProvider_potential_singular,
+ elementName);
return Messages.format(
SearchMessages.SearchLabelProvider_exact_singular,
elementName);
@@ -147,10 +149,9 @@
String[] args = new String[] { elementName,
String.valueOf(matchCount), String.valueOf(exactCount),
String.valueOf(potentialCount) };
- return Messages
- .format(
- SearchMessages.SearchLabelProvider_exact_and_potential_plural,
- args);
+ return Messages.format(
+ SearchMessages.SearchLabelProvider_exact_and_potential_plural,
+ args);
} else if (exactCount == 0) {
String[] args = new String[] { elementName,
String.valueOf(matchCount) };
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchParticipantsExtensionPoint.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchParticipantsExtensionPoint.java
index 962e1b5..abc81c9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchParticipantsExtensionPoint.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchParticipantsExtensionPoint.java
@@ -1,15 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
-/*
- * Created on Apr 13, 2004
- */
package org.eclipse.dltk.internal.ui.search;
import java.util.HashSet;
@@ -25,27 +21,29 @@
import org.eclipse.dltk.ui.DLTKUIPlugin;
import org.eclipse.dltk.ui.search.ScriptSearchPage;
-
public class SearchParticipantsExtensionPoint {
private Set<SearchParticipantDescriptor> fActiveParticipants = null;
private static SearchParticipantsExtensionPoint fgInstance;
public boolean hasAnyParticipants() {
- return Platform.getExtensionRegistry().getConfigurationElementsFor(ScriptSearchPage.PARTICIPANT_EXTENSION_POINT).length > 0;
+ return Platform.getExtensionRegistry().getConfigurationElementsFor(
+ ScriptSearchPage.PARTICIPANT_EXTENSION_POINT).length > 0;
}
private synchronized Set<SearchParticipantDescriptor> getAllParticipants() {
if (fActiveParticipants != null)
return fActiveParticipants;
- IConfigurationElement[] allParticipants= Platform.getExtensionRegistry().getConfigurationElementsFor(ScriptSearchPage.PARTICIPANT_EXTENSION_POINT);
- fActiveParticipants = new HashSet<SearchParticipantDescriptor>(
- allParticipants.length);
- for (int i= 0; i < allParticipants.length; i++) {
- SearchParticipantDescriptor descriptor= new SearchParticipantDescriptor(allParticipants[i]);
- IStatus status= descriptor.checkSyntax();
+ IConfigurationElement[] allParticipants = Platform
+ .getExtensionRegistry().getConfigurationElementsFor(
+ ScriptSearchPage.PARTICIPANT_EXTENSION_POINT);
+ fActiveParticipants = new HashSet<>(allParticipants.length);
+ for (int i = 0; i < allParticipants.length; i++) {
+ SearchParticipantDescriptor descriptor = new SearchParticipantDescriptor(
+ allParticipants[i]);
+ IStatus status = descriptor.checkSyntax();
if (status.isOK()) {
- fActiveParticipants.add(descriptor);
+ fActiveParticipants.add(descriptor);
} else {
DLTKUIPlugin.log(status);
}
@@ -54,21 +52,22 @@
}
private void collectParticipants(IDLTKLanguageToolkit language,
- Set<SearchParticipantRecord> participants,
- IProject[] projects) {
+ Set<SearchParticipantRecord> participants, IProject[] projects) {
Iterator<SearchParticipantDescriptor> activeParticipants = getAllParticipants()
.iterator();
- Set<String> seenParticipants = new HashSet<String>();
+ Set<String> seenParticipants = new HashSet<>();
while (activeParticipants.hasNext()) {
SearchParticipantDescriptor participant = activeParticipants.next();
- if (participant.isEnabled() && language.getNatureId().equals(participant.getLanguage())) {
- String id= participant.getID();
- for (int i= 0; i < projects.length; i++) {
+ if (participant.isEnabled() && language.getNatureId()
+ .equals(participant.getLanguage())) {
+ String id = participant.getID();
+ for (int i = 0; i < projects.length; i++) {
if (seenParticipants.contains(id))
continue;
try {
if (projects[i].hasNature(participant.getNature())) {
- participants.add(new SearchParticipantRecord(participant, participant.create()));
+ participants.add(new SearchParticipantRecord(
+ participant, participant.create()));
seenParticipants.add(id);
}
} catch (CoreException e) {
@@ -80,23 +79,23 @@
}
}
-
-
public SearchParticipantRecord[] getSearchParticipants(
IDLTKLanguageToolkit language, IProject[] concernedProjects)
- throws CoreException {
- Set<SearchParticipantRecord> participantSet = new HashSet<SearchParticipantRecord>();
+ throws CoreException {
+ Set<SearchParticipantRecord> participantSet = new HashSet<>();
collectParticipants(language, participantSet, concernedProjects);
- return participantSet.toArray(new SearchParticipantRecord[participantSet.size()]);
+ return participantSet
+ .toArray(new SearchParticipantRecord[participantSet.size()]);
}
public static synchronized SearchParticipantsExtensionPoint getInstance() {
if (fgInstance == null)
- fgInstance= new SearchParticipantsExtensionPoint();
+ fgInstance = new SearchParticipantsExtensionPoint();
return fgInstance;
}
-
- public static void debugSetInstance(SearchParticipantsExtensionPoint instance) {
- fgInstance= instance;
+
+ public static void debugSetInstance(
+ SearchParticipantsExtensionPoint instance) {
+ fgInstance = instance;
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java
index d85b284..5343385 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -27,52 +27,56 @@
import org.eclipse.ui.PlatformUI;
import org.osgi.framework.Bundle;
-
/**
* This class contains some utility methods for J Search.
*/
public class SearchUtil {
// LRU working sets
- public static final int LRU_WORKINGSET_LIST_SIZE= 3;
+ public static final int LRU_WORKINGSET_LIST_SIZE = 3;
private static LRUWorkingSetsList fgLRUWorkingSets;
// Settings store
- private static final String DIALOG_SETTINGS_KEY= "ModelElementSearchActions"; //$NON-NLS-1$
- private static final String STORE_LRU_WORKING_SET_NAMES= "lastUsedWorkingSetNames"; //$NON-NLS-1$
-
- //private static final String BIN_PRIM_CONST_WARN_DIALOG_ID= "BinaryPrimitiveConstantWarningDialog"; //$NON-NLS-1$
+ private static final String DIALOG_SETTINGS_KEY = "ModelElementSearchActions"; //$NON-NLS-1$
+ private static final String STORE_LRU_WORKING_SET_NAMES = "lastUsedWorkingSetNames"; //$NON-NLS-1$
+
+ // private static final String BIN_PRIM_CONST_WARN_DIALOG_ID=
+ // "BinaryPrimitiveConstantWarningDialog"; //$NON-NLS-1$
public static boolean isSearchPlugInActivated() {
- return Platform.getBundle("org.eclipse.search").getState() == Bundle.ACTIVE; //$NON-NLS-1$
+ return Platform.getBundle("org.eclipse.search") //$NON-NLS-1$
+ .getState() == Bundle.ACTIVE;
}
-
/**
- * This helper method with Object as parameter is needed to prevent the loading
- * of the Search plug-in: the Interpreter verifies the method call and hence loads the
- * types used in the method signature, eventually triggering the loading of
- * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
+ * This helper method with Object as parameter is needed to prevent the
+ * loading of the Search plug-in: the Interpreter verifies the method call
+ * and hence loads the types used in the method signature, eventually
+ * triggering the loading of a plug-in (in this case ISearchQuery results in
+ * Search plug-in being loaded).
*/
public static void runQueryInBackground(Object query) {
- NewSearchUI.runQueryInBackground((ISearchQuery)query);
+ NewSearchUI.runQueryInBackground((ISearchQuery) query);
}
-
+
/**
- * This helper method with Object as parameter is needed to prevent the loading
- * of the Search plug-in: the Interpreter verifies the method call and hence loads the
- * types used in the method signature, eventually triggering the loading of
- * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
+ * This helper method with Object as parameter is needed to prevent the
+ * loading of the Search plug-in: the Interpreter verifies the method call
+ * and hence loads the types used in the method signature, eventually
+ * triggering the loading of a plug-in (in this case ISearchQuery results in
+ * Search plug-in being loaded).
*/
- public static IStatus runQueryInForeground(IRunnableContext context, Object query) {
- return NewSearchUI.runQueryInForeground(context, (ISearchQuery)query);
+ public static IStatus runQueryInForeground(IRunnableContext context,
+ Object query) {
+ return NewSearchUI.runQueryInForeground(context, (ISearchQuery) query);
}
-
+
/**
* Returns the compilation unit for the givenscriptelement.
- *
- * @param element thescriptelement whose compilation unit is searched for
- * @return the compilation unit of the givenscriptelement
+ *
+ * @param element
+ * thescriptelement whose compilation unit is searched for
+ * @return the compilation unit of the givenscriptelement
*/
static ISourceModule findSourceModule(IModelElement element) {
if (element == null)
@@ -80,19 +84,20 @@
return (ISourceModule) element.getAncestor(IModelElement.SOURCE_MODULE);
}
-
public static String toString(IWorkingSet[] workingSets) {
Arrays.sort(workingSets, new WorkingSetComparator());
- String result= ""; //$NON-NLS-1$
+ String result = ""; //$NON-NLS-1$
if (workingSets != null && workingSets.length > 0) {
- boolean firstFound= false;
- for (int i= 0; i < workingSets.length; i++) {
- String workingSetLabel= workingSets[i].getLabel();
+ boolean firstFound = false;
+ for (int i = 0; i < workingSets.length; i++) {
+ String workingSetLabel = workingSets[i].getLabel();
if (firstFound)
- result= Messages.format(SearchMessages.SearchUtil_workingSetConcatenation, new String[] {result, workingSetLabel});
+ result = Messages.format(
+ SearchMessages.SearchUtil_workingSetConcatenation,
+ new String[] { result, workingSetLabel });
else {
- result= workingSetLabel;
- firstFound= true;
+ result = workingSetLabel;
+ firstFound = true;
}
}
}
@@ -103,26 +108,27 @@
/**
* Updates the LRU list of working sets.
- *
- * @param workingSets the workings sets to be added to the LRU list
+ *
+ * @param workingSets
+ * the workings sets to be added to the LRU list
*/
public static void updateLRUWorkingSets(IWorkingSet[] workingSets) {
if (workingSets == null || workingSets.length < 1)
return;
-
+
getLRUWorkingSets().add(workingSets);
saveState(getDialogStoreSection());
}
private static void saveState(IDialogSettings settingsStore) {
IWorkingSet[] workingSets;
- Iterator iter= fgLRUWorkingSets.iterator();
- int i= 0;
+ Iterator iter = fgLRUWorkingSets.iterator();
+ int i = 0;
while (iter.hasNext()) {
- workingSets= (IWorkingSet[])iter.next();
- String[] names= new String[workingSets.length];
- for (int j= 0; j < workingSets.length; j++)
- names[j]= workingSets[j].getName();
+ workingSets = (IWorkingSet[]) iter.next();
+ String[] names = new String[workingSets.length];
+ for (int j = 0; j < workingSets.length; j++)
+ names[j] = workingSets[j].getName();
settingsStore.put(STORE_LRU_WORKING_SET_NAMES + i, names);
i++;
}
@@ -136,21 +142,24 @@
}
private static void restoreState() {
- fgLRUWorkingSets= new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
- IDialogSettings settingsStore= getDialogStoreSection();
-
- boolean foundLRU= false;
- for (int i= LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
- String[] lruWorkingSetNames= settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES + i);
+ fgLRUWorkingSets = new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
+ IDialogSettings settingsStore = getDialogStoreSection();
+
+ boolean foundLRU = false;
+ for (int i = LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
+ String[] lruWorkingSetNames = settingsStore
+ .getArray(STORE_LRU_WORKING_SET_NAMES + i);
if (lruWorkingSetNames != null) {
- Set<IWorkingSet> workingSets = new HashSet<IWorkingSet>(2);
- for (int j= 0; j < lruWorkingSetNames.length; j++) {
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[j]);
+ Set<IWorkingSet> workingSets = new HashSet<>(2);
+ for (int j = 0; j < lruWorkingSetNames.length; j++) {
+ IWorkingSet workingSet = PlatformUI.getWorkbench()
+ .getWorkingSetManager()
+ .getWorkingSet(lruWorkingSetNames[j]);
if (workingSet != null) {
workingSets.add(workingSet);
}
}
- foundLRU= true;
+ foundLRU = true;
if (!workingSets.isEmpty())
fgLRUWorkingSets.add(workingSets
.toArray(new IWorkingSet[workingSets.size()]));
@@ -162,29 +171,34 @@
}
private static IDialogSettings getDialogStoreSection() {
- IDialogSettings settingsStore= DLTKUIPlugin.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS_KEY);
+ IDialogSettings settingsStore = DLTKUIPlugin.getDefault()
+ .getDialogSettings().getSection(DIALOG_SETTINGS_KEY);
if (settingsStore == null)
- settingsStore= DLTKUIPlugin.getDefault().getDialogSettings().addNewSection(DIALOG_SETTINGS_KEY);
+ settingsStore = DLTKUIPlugin.getDefault().getDialogSettings()
+ .addNewSection(DIALOG_SETTINGS_KEY);
return settingsStore;
}
private static void restoreFromOldFormat() {
- fgLRUWorkingSets= new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
- IDialogSettings settingsStore= getDialogStoreSection();
+ fgLRUWorkingSets = new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
+ IDialogSettings settingsStore = getDialogStoreSection();
- boolean foundLRU= false;
- String[] lruWorkingSetNames= settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES);
+ boolean foundLRU = false;
+ String[] lruWorkingSetNames = settingsStore
+ .getArray(STORE_LRU_WORKING_SET_NAMES);
if (lruWorkingSetNames != null) {
- for (int i= lruWorkingSetNames.length - 1; i >= 0; i--) {
- IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[i]);
+ for (int i = lruWorkingSetNames.length - 1; i >= 0; i--) {
+ IWorkingSet workingSet = PlatformUI.getWorkbench()
+ .getWorkingSetManager()
+ .getWorkingSet(lruWorkingSetNames[i]);
if (workingSet != null) {
- foundLRU= true;
- fgLRUWorkingSets.add(new IWorkingSet[]{workingSet});
+ foundLRU = true;
+ fgLRUWorkingSets.add(new IWorkingSet[] { workingSet });
}
}
}
if (foundLRU)
// save in new format
saveState(settingsStore);
- }
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/LineComparator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/LineComparator.java
index 95f68e8..6b58e9a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/LineComparator.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/LineComparator.java
@@ -39,7 +39,7 @@
fDocument = document;
// fills the list with nulls
Integer[] nulls = new Integer[fDocument.getNumberOfLines()];
- fHashes = new ArrayList<Integer>(Arrays.asList(nulls));
+ fHashes = new ArrayList<>(Arrays.asList(nulls));
}
@Override
@@ -51,8 +51,8 @@
public boolean rangesEqual(int thisIndex, IRangeComparator other,
int otherIndex) {
try {
- return getHash(thisIndex).equals(
- ((LineComparator) other).getHash(otherIndex));
+ return getHash(thisIndex)
+ .equals(((LineComparator) other).getHash(otherIndex));
} catch (BadLocationException e) {
DLTKUIPlugin.log(e);
return false;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/ScriptCompositeReconcilingStrategy.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/ScriptCompositeReconcilingStrategy.java
index 34eb712..621e83b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/ScriptCompositeReconcilingStrategy.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/ScriptCompositeReconcilingStrategy.java
@@ -25,8 +25,8 @@
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-public class ScriptCompositeReconcilingStrategy extends
- CompositeReconcilingStrategy {
+public class ScriptCompositeReconcilingStrategy
+ extends CompositeReconcilingStrategy {
private ITextEditor fEditor;
private ScriptReconcilingStrategy fScriptStrategy;
@@ -39,18 +39,19 @@
* the document partitioning this strategy uses for configuration
*/
public ScriptCompositeReconcilingStrategy(ITextEditor editor,
- String documentPartitioning, SpellCheckDelegate spellCheckDelegate) {
+ String documentPartitioning,
+ SpellCheckDelegate spellCheckDelegate) {
fEditor = editor;
fScriptStrategy = new ScriptReconcilingStrategy(editor);
- final List<IReconcilingStrategy> strategies = new ArrayList<IReconcilingStrategy>();
+ final List<IReconcilingStrategy> strategies = new ArrayList<>();
strategies.add(fScriptStrategy);
if (spellCheckDelegate != null) {
final IDLTKLanguageToolkit toolkit = ScriptUtils
.getLanguageToolkit(editor);
if (toolkit != null) {
final IContentType contentType = Platform
- .getContentTypeManager().getContentType(
- toolkit.getLanguageContentType());
+ .getContentTypeManager()
+ .getContentType(toolkit.getLanguageContentType());
if (contentType != null) {
strategies.add(new ScriptSpellingReconcileStrategy(editor,
documentPartitioning, contentType,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java
index 2ce866f..d16efd8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AbstractScriptEditorTextHover.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -160,7 +160,7 @@
*
*/
protected String getHoverInfo(String nature, Object[] elements) {
- final List<IModelElement> modelElements = new ArrayList<IModelElement>();
+ final List<IModelElement> modelElements = new ArrayList<>();
for (Object element : elements) {
if (element instanceof IModelElement) {
modelElements.add((IModelElement) element);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java
index 5595ad6..bd408e4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java
@@ -10,7 +10,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -125,7 +124,7 @@
if (model == null)
return null;
- List<Annotation> exact = new ArrayList<Annotation>();
+ List<Annotation> exact = new ArrayList<>();
HashMap messagesAtPosition = new HashMap();
Iterator<Annotation> e = model.getAnnotationIterator();
@@ -163,27 +162,20 @@
return input;
}
- protected void sort(List exact, final IAnnotationModel model) {
- class AnnotationComparator implements Comparator {
+ protected void sort(List<Annotation> exact, final IAnnotationModel model) {
- @Override
- public int compare(Object o1, Object o2) {
- Annotation a1 = (Annotation) o1;
- Annotation a2 = (Annotation) o2;
+ Collections.sort(exact, (o1, o2) -> {
- Position p1 = model.getPosition(a1);
- Position p2 = model.getPosition(a2);
+ Position p1 = model.getPosition(o1);
+ Position p2 = model.getPosition(o2);
- // annotation order:
- // primary order: by position in line
- // secondary: annotation importance
- if (p1.offset == p2.offset)
- return getOrder(a2) - getOrder(a1);
- return p1.offset - p2.offset;
- }
- }
-
- Collections.sort(exact, new AnnotationComparator());
+ // annotation order:
+ // primary order: by position in line
+ // secondary: annotation importance
+ if (p1.offset == p2.offset)
+ return getOrder(o2) - getOrder(o1);
+ return p1.offset - p2.offset;
+ });
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java
index a4a2f30..21d3db3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java
@@ -62,30 +62,30 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
-
/**
- * A control that can display a number of annotations. The control can decide how it layouts the
- * annotations to present them to the user.
+ * A control that can display a number of annotations. The control can decide
+ * how it layouts the annotations to present them to the user.
* <p>
- * This class got moved here form Platform Text since it was not used there
- * and caused discouraged access warnings. It will be moved down again once
+ * This class got moved here form Platform Text since it was not used there and
+ * caused discouraged access warnings. It will be moved down again once
* annotation roll-over support is provided by Platform Text.
* </p>
- * <p>Each annotation can have its custom context menu and hover.</p>
+ * <p>
+ * Each annotation can have its custom context menu and hover.
+ * </p>
*
* @since 3.2
*/
-public class AnnotationExpansionControl implements IInformationControl, IInformationControlExtension, IInformationControlExtension2 {
-
+public class AnnotationExpansionControl implements IInformationControl,
+ IInformationControlExtension, IInformationControlExtension2 {
public interface ICallback {
void run(IInformationControlExtension2 control);
}
/**
- * Input used by the control to display the annotations.
- * TODO move to top-level class
- * TODO encapsulate fields
+ * Input used by the control to display the annotations. TODO move to
+ * top-level class TODO encapsulate fields
*
* @since 3.0
*/
@@ -105,22 +105,22 @@
StyleRange[] oldStyles;
public void selected() {
- Display disp= fShell.getDisplay();
+ Display disp = fShell.getDisplay();
canvas.setCursor(fHandCursor);
// TODO: shade - for now: set grey background
canvas.setBackground(getSelectionColor(disp));
// highlight the viewer background at its position
- oldStyles= setViewerBackground(fAnnotation);
+ oldStyles = setViewerBackground(fAnnotation);
// set the selection
- fSelection= this;
+ fSelection = this;
if (fHoverManager != null)
fHoverManager.showInformation();
if (fInput.fAnnotationListener != null) {
- VerticalRulerEvent event= new VerticalRulerEvent(fAnnotation);
+ VerticalRulerEvent event = new VerticalRulerEvent(fAnnotation);
fInput.fAnnotationListener.annotationSelected(event);
}
@@ -128,7 +128,7 @@
public void defaultSelected() {
if (fInput.fAnnotationListener != null) {
- VerticalRulerEvent event= new VerticalRulerEvent(fAnnotation);
+ VerticalRulerEvent event = new VerticalRulerEvent(fAnnotation);
fInput.fAnnotationListener.annotationDefaultSelected(event);
}
@@ -137,18 +137,19 @@
public void deselect() {
// hide the popup
-// fHoverManager.disposeInformationControl();
+ // fHoverManager.disposeInformationControl();
// deselect
- fSelection= null;
+ fSelection = null;
resetViewerBackground(oldStyles);
- oldStyles= null;
+ oldStyles = null;
- Display disp= fShell.getDisplay();
+ Display disp = fShell.getDisplay();
canvas.setCursor(null);
// TODO: remove shading - for now: set standard background
- canvas.setBackground(disp.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ canvas.setBackground(
+ disp.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
@@ -160,11 +161,11 @@
private final static class MyDisposeListener implements DisposeListener {
@Override
public void widgetDisposed(DisposeEvent e) {
- Item item= (Item) ((Widget) e.getSource()).getData();
+ Item item = (Item) ((Widget) e.getSource()).getData();
item.deselect();
- item.canvas= null;
- item.fAnnotation= null;
- item.oldStyles= null;
+ item.canvas = null;
+ item.fAnnotation = null;
+ item.oldStyles = null;
((Widget) e.getSource()).setData(null);
}
@@ -180,9 +181,9 @@
// TODO: show per-item menu
// for now: show ruler context menu
if (fInput != null) {
- Control ruler= fInput.fRulerInfo.getControl();
+ Control ruler = fInput.fRulerInfo.getControl();
if (ruler != null && !ruler.isDisposed()) {
- Menu menu= ruler.getMenu();
+ Menu menu = ruler.getMenu();
if (menu != null && !menu.isDisposed()) {
menu.setLocation(event.x, event.y);
menu.addMenuListener(new MenuListener() {
@@ -205,45 +206,51 @@
}
}
-
/**
* Listener on mouse events on the items.
*/
private final class MyMouseListener extends MouseAdapter {
@Override
public void mouseDoubleClick(MouseEvent e) {
- Item item= (Item) ((Widget) e.getSource()).getData();
- if (e.button == 1 && item.fAnnotation == fInput.fAnnotations[0] && fInput.fDoubleClickListener != null) {
+ Item item = (Item) ((Widget) e.getSource()).getData();
+ if (e.button == 1 && item.fAnnotation == fInput.fAnnotations[0]
+ && fInput.fDoubleClickListener != null) {
fInput.fDoubleClickListener.doubleClick(null);
// special code for JDT to renew the annotation set.
if (fInput.redoAction != null)
fInput.redoAction.run(AnnotationExpansionControl.this);
}
-// dispose();
- // TODO special action to invoke double-click action on the vertical ruler
+ // dispose();
+ // TODO special action to invoke double-click action on the vertical
+ // ruler
// how about
-// Canvas can= (Canvas) e.getSource();
-// Annotation a= (Annotation) can.getData();
-// if (a != null) {
-// a.getDoubleClickAction().run();
-// }
+ // Canvas can= (Canvas) e.getSource();
+ // Annotation a= (Annotation) can.getData();
+ // if (a != null) {
+ // a.getDoubleClickAction().run();
+ // }
}
@Override
public void mouseDown(MouseEvent e) {
- Item item= (Item) ((Widget) e.getSource()).getData();
- // TODO for now, to make double click work: disable single click on the first item
- // disable later when the annotationlistener selectively handles input
- if (item != null && e.button == 1) // && item.fAnnotation != fInput.fAnnotations[0])
+ Item item = (Item) ((Widget) e.getSource()).getData();
+ // TODO for now, to make double click work: disable single click on
+ // the first item
+ // disable later when the annotationlistener selectively handles
+ // input
+ if (item != null && e.button == 1) // && item.fAnnotation !=
+ // fInput.fAnnotations[0])
item.defaultSelected();
}
/*
- * @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt.events.MouseEvent)
+ * @see
+ * org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt.events.
+ * MouseEvent)
*/
- //public void mouseDown(MouseEvent e) {
- // super.mouseDown(e);
- //}
+ // public void mouseDown(MouseEvent e) {
+ // super.mouseDown(e);
+ // }
}
/**
@@ -252,7 +259,7 @@
private final class MyMouseTrackListener implements MouseTrackListener {
@Override
public void mouseEnter(MouseEvent e) {
- Item item= (Item) ((Widget) e.getSource()).getData();
+ Item item = (Item) ((Widget) e.getSource()).getData();
if (item != null)
item.selected();
}
@@ -260,32 +267,31 @@
@Override
public void mouseExit(MouseEvent e) {
- Item item= (Item) ((Widget) e.getSource()).getData();
+ Item item = (Item) ((Widget) e.getSource()).getData();
if (item != null)
item.deselect();
// if the event lies outside the entire popup, dispose
- org.eclipse.swt.graphics.Region region= fShell.getRegion();
- Canvas can= (Canvas) e.getSource();
- Point p= can.toDisplay(e.x, e.y);
+ org.eclipse.swt.graphics.Region region = fShell.getRegion();
+ Canvas can = (Canvas) e.getSource();
+ Point p = can.toDisplay(e.x, e.y);
if (region == null) {
- Rectangle bounds= fShell.getBounds();
-// p= fShell.toControl(p);
+ Rectangle bounds = fShell.getBounds();
+ // p= fShell.toControl(p);
if (!bounds.contains(p))
dispose();
} else {
- p= fShell.toControl(p);
+ p = fShell.toControl(p);
if (!region.contains(p))
dispose();
}
-
}
@Override
public void mouseHover(MouseEvent e) {
if (fHoverManager == null) {
- fHoverManager= new HoverManager();
+ fHoverManager = new HoverManager();
fHoverManager.takesFocusWhenVisible(false);
fHoverManager.install(fComposite);
fHoverManager.showInformation();
@@ -293,7 +299,6 @@
}
}
-
/**
*
*
@@ -301,23 +306,24 @@
*/
public class LinearLayouter {
- private static final int ANNOTATION_SIZE= 14;
- private static final int BORDER_WIDTH= 2;
+ private static final int ANNOTATION_SIZE = 14;
+ private static final int BORDER_WIDTH = 2;
public Layout getLayout(int itemCount) {
// simple layout: a row of items
- GridLayout layout= new GridLayout(itemCount, true);
- layout.horizontalSpacing= 1;
- layout.verticalSpacing= 0;
- layout.marginHeight= 1;
- layout.marginWidth= 1;
+ GridLayout layout = new GridLayout(itemCount, true);
+ layout.horizontalSpacing = 1;
+ layout.verticalSpacing = 0;
+ layout.marginHeight = 1;
+ layout.marginWidth = 1;
return layout;
}
public Object getLayoutData() {
- GridData gridData= new GridData(ANNOTATION_SIZE + 2 * BORDER_WIDTH, ANNOTATION_SIZE + 2 * BORDER_WIDTH);
- gridData.horizontalAlignment= GridData.CENTER;
- gridData.verticalAlignment= GridData.CENTER;
+ GridData gridData = new GridData(ANNOTATION_SIZE + 2 * BORDER_WIDTH,
+ ANNOTATION_SIZE + 2 * BORDER_WIDTH);
+ gridData.horizontalAlignment = GridData.CENTER;
+ gridData.verticalAlignment = GridData.CENTER;
return gridData;
}
@@ -336,17 +342,20 @@
}
-
/**
- * Listener on paint events on the items. Paints the annotation image on the given <code>GC</code>.
+ * Listener on paint events on the items. Paints the annotation image on the
+ * given <code>GC</code>.
*/
private final class MyPaintListener implements PaintListener {
@Override
public void paintControl(PaintEvent e) {
- Canvas can= (Canvas) e.getSource();
- Annotation a= ((Item) can.getData()).fAnnotation;
+ Canvas can = (Canvas) e.getSource();
+ Annotation a = ((Item) can.getData()).fAnnotation;
if (a != null) {
- Rectangle rect= new Rectangle(fLayouter.getBorderWidth(), fLayouter.getBorderWidth(), fLayouter.getAnnotationSize(), fLayouter.getAnnotationSize());
+ Rectangle rect = new Rectangle(fLayouter.getBorderWidth(),
+ fLayouter.getBorderWidth(),
+ fLayouter.getAnnotationSize(),
+ fLayouter.getAnnotationSize());
if (fAnnotationAccessExtension != null)
fAnnotationAccessExtension.paint(a, e.gc, can, rect);
}
@@ -366,25 +375,25 @@
setMargins(5, 10);
setAnchor(ANCHOR_BOTTOM);
- setFallbackAnchors(new Anchor[] {ANCHOR_BOTTOM, ANCHOR_LEFT, ANCHOR_RIGHT} );
+ setFallbackAnchors(
+ new Anchor[] { ANCHOR_BOTTOM, ANCHOR_LEFT, ANCHOR_RIGHT });
}
@Override
protected void computeInformation() {
if (fSelection != null) {
- Rectangle subjectArea= fSelection.canvas.getBounds();
- Annotation annotation= fSelection.fAnnotation;
+ Rectangle subjectArea = fSelection.canvas.getBounds();
+ Annotation annotation = fSelection.fAnnotation;
String msg;
if (annotation != null)
- msg= annotation.getText();
+ msg = annotation.getText();
else
- msg= null;
+ msg = null;
setInformation(msg, subjectArea);
}
}
-
}
/** Model data. */
@@ -395,14 +404,15 @@
protected Composite fComposite;
/** The hand cursor. */
private Cursor fHandCursor;
- /** The currently selected item, or <code>null</code> if none is selected. */
+ /**
+ * The currently selected item, or <code>null</code> if none is selected.
+ */
private Item fSelection;
/** The hover manager for the per-item hovers. */
private HoverManager fHoverManager;
/** The annotation access extension. */
private IAnnotationAccessExtension fAnnotationAccessExtension;
-
/* listener legion */
private final MyPaintListener fPaintListener;
private final MyMouseTrackListener fMouseTrackListener;
@@ -420,67 +430,74 @@
* @param shellStyle
* @param access
*/
- public AnnotationExpansionControl(Shell parent, int shellStyle, IAnnotationAccess access) {
- fPaintListener= new MyPaintListener();
- fMouseTrackListener= new MyMouseTrackListener();
- fMouseListener= new MyMouseListener();
- fMenuDetectListener= new MyMenuDetectListener();
- fDisposeListener= new MyDisposeListener();
- fViewportListener= verticalOffset -> dispose();
- fLayouter= new LinearLayouter();
+ public AnnotationExpansionControl(Shell parent, int shellStyle,
+ IAnnotationAccess access) {
+ fPaintListener = new MyPaintListener();
+ fMouseTrackListener = new MyMouseTrackListener();
+ fMouseListener = new MyMouseListener();
+ fMenuDetectListener = new MyMenuDetectListener();
+ fDisposeListener = new MyDisposeListener();
+ fViewportListener = verticalOffset -> dispose();
+ fLayouter = new LinearLayouter();
if (access instanceof IAnnotationAccessExtension)
- fAnnotationAccessExtension= (IAnnotationAccessExtension) access;
+ fAnnotationAccessExtension = (IAnnotationAccessExtension) access;
- fShell= new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP);
- Display display= fShell.getDisplay();
+ fShell = new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP);
+ Display display = fShell.getDisplay();
fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
- fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM);
-// fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.V_SCROLL);
+ fComposite = new Composite(fShell,
+ SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM);
+ // fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE
+ // | SWT.NO_TRIM | SWT.V_SCROLL);
- GridLayout layout= new GridLayout(1, true);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
fShell.setLayout(layout);
- GridData data= new GridData(GridData.FILL_BOTH);
- data.heightHint= fLayouter.getAnnotationSize() + 2 * fLayouter.getBorderWidth() + 4;
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = fLayouter.getAnnotationSize()
+ + 2 * fLayouter.getBorderWidth() + 4;
fComposite.setLayoutData(data);
fComposite.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent e) {
if (fComposite == null)
- return;
- Control[] children= fComposite.getChildren();
- Rectangle bounds= null;
- for (int i= 0; i < children.length; i++) {
+ return;
+ Control[] children = fComposite.getChildren();
+ Rectangle bounds = null;
+ for (int i = 0; i < children.length; i++) {
if (bounds == null)
- bounds= children[i].getBounds();
+ bounds = children[i].getBounds();
else
bounds.add(children[i].getBounds());
if (bounds.contains(e.x, e.y))
return;
}
- // if none of the children contains the event, we leave the popup
+ // if none of the children contains the event, we leave the
+ // popup
dispose();
}
});
-// fComposite.getVerticalBar().addListener(SWT.Selection, new Listener() {
-//
-// public void handleEvent(Event event) {
-// Rectangle bounds= fShell.getBounds();
-// int x= bounds.x - fLayouter.getAnnotationSize() - fLayouter.getBorderWidth();
-// int y= bounds.y;
-// fShell.setBounds(x, y, bounds.width, bounds.height);
-// }
-//
-// });
+ // fComposite.getVerticalBar().addListener(SWT.Selection, new Listener()
+ // {
+ //
+ // public void handleEvent(Event event) {
+ // Rectangle bounds= fShell.getBounds();
+ // int x= bounds.x - fLayouter.getAnnotationSize() -
+ // fLayouter.getBorderWidth();
+ // int y= bounds.y;
+ // fShell.setBounds(x, y, bounds.width, bounds.height);
+ // }
+ //
+ // });
- fHandCursor= new Cursor(display, SWT.CURSOR_HAND);
+ fHandCursor = new Cursor(display, SWT.CURSOR_HAND);
fShell.setCursor(fHandCursor);
fComposite.setCursor(fHandCursor);
@@ -488,7 +505,7 @@
}
private void setInfoSystemColor() {
- Display display= fShell.getDisplay();
+ Display display = fShell.getDisplay();
setForegroundColor(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
setBackgroundColor(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
@@ -498,16 +515,15 @@
setInput(null);
}
-
@Override
public void setInput(Object input) {
if (fInput != null && fInput.fViewer != null)
fInput.fViewer.removeViewportListener(fViewportListener);
if (input instanceof AnnotationHoverInput)
- fInput= (AnnotationHoverInput) input;
+ fInput = (AnnotationHoverInput) input;
else
- fInput= null;
+ fInput = null;
inputChanged(fInput, null);
}
@@ -530,15 +546,15 @@
fShell.setRegion(fLayouter.getShellRegion(fInput.fAnnotations.length));
- Layout layout= fLayouter.getLayout(fInput.fAnnotations.length);
+ Layout layout = fLayouter.getLayout(fInput.fAnnotations.length);
fComposite.setLayout(layout);
- Control[] children= fComposite.getChildren();
- for (int i= 0; i < fInput.fAnnotations.length; i++) {
- Canvas canvas= (Canvas) children[i];
- Item item= new Item();
- item.canvas= canvas;
- item.fAnnotation= fInput.fAnnotations[i];
+ Control[] children = fComposite.getChildren();
+ for (int i = 0; i < fInput.fAnnotations.length; i++) {
+ Canvas canvas = (Canvas) children[i];
+ Item item = new Item();
+ item.canvas = canvas;
+ item.fAnnotation = fInput.fAnnotations[i];
canvas.setData(item);
canvas.redraw();
}
@@ -549,18 +565,19 @@
if (fComposite == null)
return;
- Control[] children= fComposite.getChildren();
- int oldSize= children.length;
- int newSize= fInput == null ? 0 : fInput.fAnnotations.length;
+ Control[] children = fComposite.getChildren();
+ int oldSize = children.length;
+ int newSize = fInput == null ? 0 : fInput.fAnnotations.length;
- Display display= fShell.getDisplay();
+ Display display = fShell.getDisplay();
// add missing items
- for (int i= oldSize; i < newSize; i++) {
- Canvas canvas= new Canvas(fComposite, SWT.NONE);
- Object gridData= fLayouter.getLayoutData();
+ for (int i = oldSize; i < newSize; i++) {
+ Canvas canvas = new Canvas(fComposite, SWT.NONE);
+ Object gridData = fLayouter.getLayoutData();
canvas.setLayoutData(gridData);
- canvas.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ canvas.setBackground(
+ display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
canvas.addPaintListener(fPaintListener);
@@ -574,8 +591,8 @@
}
// dispose of exceeding resources
- for (int i= oldSize; i > newSize; i--) {
- Item item= (Item) children[i - 1].getData();
+ for (int i = oldSize; i > newSize; i--) {
+ Item item = (Item) children[i - 1].getData();
item.deselect();
children[i - 1].dispose();
}
@@ -592,15 +609,15 @@
if (fShell != null) {
if (!fShell.isDisposed())
fShell.dispose();
- fShell= null;
- fComposite= null;
+ fShell = null;
+ fComposite = null;
if (fHandCursor != null)
fHandCursor.dispose();
- fHandCursor= null;
+ fHandCursor = null;
if (fHoverManager != null)
fHoverManager.dispose();
- fHoverManager= null;
- fSelection= null;
+ fHoverManager = null;
+ fSelection = null;
}
}
@@ -611,8 +628,8 @@
@Override
public void setSizeConstraints(int maxWidth, int maxHeight) {
- //fMaxWidth= maxWidth;
- //fMaxHeight= maxHeight;
+ // fMaxWidth= maxWidth;
+ // fMaxHeight= maxHeight;
}
@Override
@@ -655,8 +672,8 @@
if (fComposite.isFocusControl())
return true;
- Control[] children= fComposite.getChildren();
- for (int i= 0; i < children.length; i++) {
+ Control[] children = fComposite.getChildren();
+ for (int i = 0; i < children.length; i++) {
if (children[i].isFocusControl())
return true;
}
@@ -679,38 +696,44 @@
}
private StyleRange[] setViewerBackground(Annotation annotation) {
- StyledText text= fInput.fViewer.getTextWidget();
+ StyledText text = fInput.fViewer.getTextWidget();
if (text == null || text.isDisposed())
return null;
- Display disp= text.getDisplay();
+ Display disp = text.getDisplay();
- Position pos= fInput.model.getPosition(annotation);
+ Position pos = fInput.model.getPosition(annotation);
if (pos == null)
return null;
- IRegion region= ((TextViewer)fInput.fViewer).modelRange2WidgetRange(new Region(pos.offset, pos.length));
+ IRegion region = ((TextViewer) fInput.fViewer)
+ .modelRange2WidgetRange(new Region(pos.offset, pos.length));
if (region == null)
return null;
- StyleRange[] ranges= text.getStyleRanges(region.getOffset(), region.getLength());
+ StyleRange[] ranges = text.getStyleRanges(region.getOffset(),
+ region.getLength());
- List<StyleRange> undoRanges = new ArrayList<StyleRange>(ranges.length);
- for (int i= 0; i < ranges.length; i++) {
+ List<StyleRange> undoRanges = new ArrayList<>(ranges.length);
+ for (int i = 0; i < ranges.length; i++) {
undoRanges.add((StyleRange) ranges[i].clone());
}
- int offset= region.getOffset();
- StyleRange current= undoRanges.size() > 0 ? (StyleRange) undoRanges.get(0) : null;
- int curStart= current != null ? current.start : region.getOffset() + region.getLength();
- int curEnd= current != null ? current.start + current.length : -1;
- int index= 0;
+ int offset = region.getOffset();
+ StyleRange current = undoRanges.size() > 0
+ ? (StyleRange) undoRanges.get(0)
+ : null;
+ int curStart = current != null ? current.start
+ : region.getOffset() + region.getLength();
+ int curEnd = current != null ? current.start + current.length : -1;
+ int index = 0;
// fill no-style regions
while (curEnd < region.getOffset() + region.getLength()) {
// add empty range
if (curStart > offset) {
- StyleRange undoRange= new StyleRange(offset, curStart - offset, null, null);
+ StyleRange undoRange = new StyleRange(offset, curStart - offset,
+ null, null);
undoRanges.add(index, undoRange);
index++;
}
@@ -718,30 +741,30 @@
// step
index++;
if (index < undoRanges.size()) {
- offset= curEnd;
+ offset = curEnd;
current = undoRanges.get(index);
- curStart= current.start;
- curEnd= current.start + current.length;
+ curStart = current.start;
+ curEnd = current.start + current.length;
} else if (index == undoRanges.size()) {
// last one
- offset= curEnd;
- current= null;
- curStart= region.getOffset() + region.getLength();
- curEnd= -1;
+ offset = curEnd;
+ current = null;
+ curStart = region.getOffset() + region.getLength();
+ curEnd = -1;
} else
- curEnd= region.getOffset() + region.getLength();
+ curEnd = region.getOffset() + region.getLength();
}
// create modified styles (with background)
- List shadedRanges= new ArrayList(undoRanges.size());
- for (Iterator it= undoRanges.iterator(); it.hasNext(); ) {
- StyleRange range= (StyleRange) ((StyleRange) it.next()).clone();
+ List shadedRanges = new ArrayList(undoRanges.size());
+ for (Iterator it = undoRanges.iterator(); it.hasNext();) {
+ StyleRange range = (StyleRange) ((StyleRange) it.next()).clone();
shadedRanges.add(range);
- range.background= getHighlightColor(disp);
+ range.background = getHighlightColor(disp);
}
// set the ranges one by one
- for (Iterator iter= shadedRanges.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = shadedRanges.iterator(); iter.hasNext();) {
text.setStyleRange((StyleRange) iter.next());
}
@@ -757,12 +780,12 @@
if (fInput == null)
return;
- StyledText text= fInput.fViewer.getTextWidget();
+ StyledText text = fInput.fViewer.getTextWidget();
if (text == null || text.isDisposed())
return;
// set the ranges one by one
- for (int i= 0; i < oldRanges.length; i++) {
+ for (int i = 0; i < oldRanges.length; i++) {
text.setStyleRange(oldRanges[i]);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/BestMatchHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/BestMatchHover.java
index 226cb5c..9612a78 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/BestMatchHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/BestMatchHover.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -27,8 +27,8 @@
/**
* Caution: this implementation is a layer breaker and contains some "shortcuts"
*/
-public class BestMatchHover extends AbstractScriptEditorTextHover implements
- ITextHoverExtension, IInformationProviderExtension2 {
+public class BestMatchHover extends AbstractScriptEditorTextHover
+ implements ITextHoverExtension, IInformationProviderExtension2 {
private List<EditorTextHoverDescriptor> fTextHoverSpecifications = null;
private List<ITextHover> fInstantiatedTextHovers;
@@ -48,8 +48,8 @@
private void installTextHovers() {
// initialize lists - indicates that the initialization happened
- fTextHoverSpecifications = new ArrayList<EditorTextHoverDescriptor>(8);
- fInstantiatedTextHovers = new ArrayList<ITextHover>(8);
+ fTextHoverSpecifications = new ArrayList<>(8);
+ fInstantiatedTextHovers = new ArrayList<>(8);
// populate list
EditorTextHoverDescriptor[] hoverDescs = DLTKUIPlugin.getDefault()
@@ -57,8 +57,8 @@
getNatureId());
for (int i = 0; i < hoverDescs.length; i++) {
// ensure that we don't add ourselves to the list
- if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i]
- .getId()))
+ if (!PreferenceConstants.ID_BESTMATCH_HOVER
+ .equals(hoverDescs[i].getId()))
fTextHoverSpecifications.add(hoverDescs[i]);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/EditorTextHoverDescriptor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/EditorTextHoverDescriptor.java
index cac29c6..943cec7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/EditorTextHoverDescriptor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/EditorTextHoverDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -49,7 +49,7 @@
/**
* Returns all editor text hovers contributed to the workbench.
- *
+ *
* @deprecated
*/
@Deprecated
@@ -75,7 +75,7 @@
/**
* Computes the state mask for the given modifier string.
- *
+ *
* @param modifiers
* the string with the modifiers, separated by '+', '-', ';', ','
* or '.'
@@ -119,12 +119,10 @@
return (IScriptEditorTextHover) fElement
.createExecutableExtension(CLASS_ATTRIBUTE);
} catch (CoreException x) {
- DLTKUIPlugin
- .log(new Status(
- IStatus.ERROR,
- DLTKUIPlugin.getPluginId(),
- 0,
- "DLTKHoverMessages.JavaTextHover_createTextHover", null)); //$NON-NLS-1$
+ DLTKUIPlugin.log(new Status(IStatus.ERROR,
+ DLTKUIPlugin.getPluginId(), 0,
+ "DLTKHoverMessages.JavaTextHover_createTextHover", //$NON-NLS-1$
+ null));
}
}
return null;
@@ -164,7 +162,7 @@
/**
* Returns the hover's description.
- *
+ *
* @return the hover's description or <code>null</code> if not provided
*/
public String getDescription() {
@@ -176,8 +174,8 @@
}
public boolean canActivatePlugIn() {
- return Boolean.valueOf(
- fElement.getAttribute(ACTIVATE_PLUG_IN_ATTRIBUTE))
+ return Boolean
+ .valueOf(fElement.getAttribute(ACTIVATE_PLUG_IN_ATTRIBUTE))
.booleanValue();
}
@@ -196,7 +194,7 @@
private static EditorTextHoverDescriptor[] createDescriptors(
IConfigurationElement[] elements, String natureId) {
- List<EditorTextHoverDescriptor> result = new ArrayList<EditorTextHoverDescriptor>(
+ List<EditorTextHoverDescriptor> result = new ArrayList<>(
elements.length);
for (int i = 0; i < elements.length; i++) {
IConfigurationElement element = elements[i];
@@ -219,18 +217,18 @@
.getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS);
StringTokenizer tokenizer = new StringTokenizer(
compiledTextHoverModifiers, VALUE_SEPARATOR);
- HashMap<String, String> idToModifier = new HashMap<String, String>(
+ HashMap<String, String> idToModifier = new HashMap<>(
tokenizer.countTokens() / 2);
while (tokenizer.hasMoreTokens()) {
String id = tokenizer.nextToken();
if (tokenizer.hasMoreTokens())
idToModifier.put(id, tokenizer.nextToken());
}
- String compiledTextHoverModifierMasks = store
- .getString(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS);
+ String compiledTextHoverModifierMasks = store.getString(
+ PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS);
tokenizer = new StringTokenizer(compiledTextHoverModifierMasks,
VALUE_SEPARATOR);
- HashMap<String, String> idToModifierMask = new HashMap<String, String>(
+ HashMap<String, String> idToModifierMask = new HashMap<>(
tokenizer.countTokens() / 2);
while (tokenizer.hasMoreTokens()) {
String id = tokenizer.nextToken();
@@ -254,8 +252,8 @@
if (hovers[i].fStateMask == -1) {
// Fallback: use stored modifier masks
try {
- hovers[i].fStateMask = Integer.parseInt(idToModifierMask
- .get(hovers[i].getId()));
+ hovers[i].fStateMask = Integer
+ .parseInt(idToModifierMask.get(hovers[i].getId()));
} catch (NumberFormatException ex) {
hovers[i].fStateMask = -1;
}
@@ -272,7 +270,7 @@
/**
* Returns the configured modifier getStateMask for this hover.
- *
+ *
* @return the hover modifier stateMask or -1 if no hover is configured
*/
public int getStateMask() {
@@ -281,7 +279,7 @@
/**
* Returns the modifier String as set in the preference store.
- *
+ *
* @return the modifier string
*/
public String getModifierString() {
@@ -290,7 +288,7 @@
/**
* Returns whether this hover is enabled or not.
- *
+ *
* @return <code>true</code> if enabled
*/
public boolean isEnabled() {
@@ -299,9 +297,9 @@
/**
* Returns this hover descriptors configuration element.
- *
+ *
* @return the configuration element
- *
+ *
*/
public IConfigurationElement getConfigurationElement() {
return fElement;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java
index b44eb69..da8d0f1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java
@@ -89,7 +89,7 @@
if (model == null)
return null;
- List<Annotation> exact = new ArrayList<Annotation>();
+ List<Annotation> exact = new ArrayList<>();
HashMap messagesAtPosition = new HashMap();
Iterator<Annotation> e = model.getAnnotationIterator();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/spelling/ScriptSpellingReconcileStrategy.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/spelling/ScriptSpellingReconcileStrategy.java
index 6434d23..a6dd9bd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/spelling/ScriptSpellingReconcileStrategy.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/spelling/ScriptSpellingReconcileStrategy.java
@@ -43,14 +43,15 @@
*
* @since 4.0
*/
-public class ScriptSpellingReconcileStrategy implements IReconcilingStrategy,
- IReconcilingStrategyExtension {
+public class ScriptSpellingReconcileStrategy
+ implements IReconcilingStrategy, IReconcilingStrategyExtension {
/**
* Spelling problem collector that forwards {@link SpellingProblem}s as
* {@link IProblem}s to the {@link IProblemRequestor}.
*/
- private class SpellingProblemCollector implements ISpellingProblemCollector {
+ private class SpellingProblemCollector
+ implements ISpellingProblemCollector {
SpellingProblemCollector() {
}
@@ -61,7 +62,8 @@
if (requestor != null) {
try {
final IDocument document = getDocument();
- int line = document.getLineOfOffset(problem.getOffset()) + 1;
+ int line = document.getLineOfOffset(problem.getOffset())
+ + 1;
String word = document.get(problem.getOffset(),
problem.getLength());
// boolean dictionaryMatch= false;
@@ -76,8 +78,8 @@
IEditorInput editorInput = fEditor.getEditorInput();
if (editorInput != null) {
ScriptSpellingProblem iProblem = new ScriptSpellingProblem(
- problem.getOffset(), problem.getOffset()
- + problem.getLength(), line,
+ problem.getOffset(),
+ problem.getOffset() + problem.getLength(), line,
problem.getMessage(), word,
false /* dictionaryMatch */,
false /* sentenceStart */, document,
@@ -171,7 +173,7 @@
ITypedRegion[] partitions = TextUtilities.computePartitioning(
fDocument, fPartitioning, region.getOffset(),
region.getLength(), false);
- List<IRegion> lst = new ArrayList<IRegion>(partitions.length);
+ List<IRegion> lst = new ArrayList<>(partitions.length);
for (int index = 0; index < partitions.length; index++) {
if (fProgressMonitor != null
&& fProgressMonitor.isCanceled())
@@ -203,8 +205,8 @@
}
private boolean isSpellingEnabled() {
- return EditorsUI.getPreferenceStore().getBoolean(
- SpellingService.PREFERENCE_SPELLING_ENABLED);
+ return EditorsUI.getPreferenceStore()
+ .getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED);
}
@Override
@@ -219,7 +221,8 @@
*/
private void updateProblemRequester() {
IAnnotationModel model = getAnnotationModel();
- fRequestor = (model instanceof IProblemRequestor) ? (IProblemRequestor) model
+ fRequestor = (model instanceof IProblemRequestor)
+ ? (IProblemRequestor) model
: null;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyContentProvider.java
index c7b9959..fc6ee0f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyContentProvider.java
@@ -38,8 +38,8 @@
* must override 'getTypesInHierarchy'. Java delta processing is also performed
* by the content provider
*/
-public abstract class TypeHierarchyContentProvider implements
- ITreeContentProvider, IWorkingCopyProvider {
+public abstract class TypeHierarchyContentProvider
+ implements ITreeContentProvider, IWorkingCopyProvider {
protected static final Object[] NO_ELEMENTS = new Object[0];
protected TypeHierarchyLifeCycle fTypeHierarchy;
@@ -56,11 +56,12 @@
fMemberFilter = null;
fWorkingSetFilter = null;
fMethodOverrideTester = null;
- fTypeHierarchyLifeCycleListener = (typeHierarchyProvider, changedTypes) -> {
-if (changedTypes == null) {
- fMethodOverrideTester = null;
-}
-};
+ fTypeHierarchyLifeCycleListener = (typeHierarchyProvider,
+ changedTypes) -> {
+ if (changedTypes == null) {
+ fMethodOverrideTester = null;
+ }
+ };
lifecycle.addChangedListener(fTypeHierarchyLifeCycleListener);
}
@@ -105,8 +106,8 @@
}
}
- private boolean hasCompatibleMethod(IMethod filterMethod, IType typeToFindIn)
- throws ModelException {
+ private boolean hasCompatibleMethod(IMethod filterMethod,
+ IType typeToFindIn) throws ModelException {
boolean filterMethodOverrides = initializeMethodOverrideTester(
filterMethod, typeToFindIn);
IMethod[] methods = typeToFindIn.getMethods();
@@ -177,7 +178,7 @@
}
protected void compactTypes(Collection<Object> types) {
- final Map<String, Object> map = new HashMap<String, Object>();
+ final Map<String, Object> map = new HashMap<>();
for (Iterator i = types.iterator(); i.hasNext();) {
final Object item = i.next();
if (item instanceof IType) {
@@ -190,7 +191,7 @@
} else if (value instanceof List) {
((List<IType>) value).add(type);
} else {
- List<Object> list = new ArrayList<Object>(4);
+ List<Object> list = new ArrayList<>(4);
list.add(value);
list.add(type);
map.put(qName, list);
@@ -198,15 +199,15 @@
i.remove();
}
}
- final List<String> qNames = new ArrayList<String>(map.keySet());
+ final List<String> qNames = new ArrayList<>(map.keySet());
Collections.sort(qNames);
for (final String qName : qNames) {
final Object value = map.get(qName);
if (value instanceof List) {
@SuppressWarnings("unchecked")
final List<IType> list = (List<IType>) value;
- types.add(new CumulativeType(qName, list.toArray(new IType[list
- .size()])));
+ types.add(new CumulativeType(qName,
+ list.toArray(new IType[list.size()])));
} else {
types.add(value);
}
@@ -309,8 +310,8 @@
if (element instanceof IType) {
try {
IType type = (IType) element;
- return hasTypeChildren(type)
- || (fMemberFilter != null && hasMemberFilterChildren(type));
+ return hasTypeChildren(type) || (fMemberFilter != null
+ && hasMemberFilterChildren(type));
} catch (ModelException e) {
return false;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyLifeCycle.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyLifeCycle.java
index fd63e70..4138230 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyLifeCycle.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyLifeCycle.java
@@ -36,8 +36,8 @@
/**
* Manages a type hierarchy, to keep it refreshed, and to allow it to be shared.
*/
-public class TypeHierarchyLifeCycle implements ITypeHierarchyChangedListener,
- IElementChangedListener {
+public class TypeHierarchyLifeCycle
+ implements ITypeHierarchyChangedListener, IElementChangedListener {
private boolean fHierarchyRefreshNeeded;
private ITypeHierarchy fHierarchy;
@@ -54,7 +54,7 @@
fHierarchy = null;
fInputElement = null;
fIsSuperTypesOnly = isSuperTypesOnly;
- fChangeListeners = new ArrayList<ITypeHierarchyLifeCycleListener>(2);
+ fChangeListeners = new ArrayList<>(2);
}
public ITypeHierarchy getHierarchy() {
@@ -74,7 +74,8 @@
}
}
- public void removeChangedListener(ITypeHierarchyLifeCycleListener listener) {
+ public void removeChangedListener(
+ ITypeHierarchyLifeCycleListener listener) {
fChangeListeners.remove(listener);
}
@@ -92,14 +93,14 @@
}
public void ensureRefreshedTypeHierarchy(final IModelElement element,
- IRunnableContext context) throws InvocationTargetException,
- InterruptedException {
+ IRunnableContext context)
+ throws InvocationTargetException, InterruptedException {
if (element == null || !element.exists()) {
freeHierarchy();
return;
}
- boolean hierachyCreationNeeded = (fHierarchy == null || !element
- .equals(fInputElement));
+ boolean hierachyCreationNeeded = (fHierarchy == null
+ || !element.equals(fInputElement));
if (hierachyCreationNeeded || fHierarchyRefreshNeeded) {
@@ -138,7 +139,8 @@
region.add(roots[i]);
}
}
- } else if (element.getElementType() == IModelElement.PROJECT_FRAGMENT) {
+ } else if (element
+ .getElementType() == IModelElement.PROJECT_FRAGMENT) {
IProjectFragment[] roots = element.getScriptProject()
.getProjectFragments();
String name = element.getElementName();
@@ -158,8 +160,8 @@
public synchronized void doHierarchyRefresh(IModelElement element,
IProgressMonitor pm) throws ModelException {
- boolean hierachyCreationNeeded = (fHierarchy == null || !element
- .equals(fInputElement));
+ boolean hierachyCreationNeeded = (fHierarchy == null
+ || !element.equals(fInputElement));
// to ensure the order of the two listeners always remove / add
// listeners on operations
// on type hierarchies
@@ -196,10 +198,11 @@
if (fHierarchyRefreshNeeded) {
return;
} else {
- ArrayList<IType> changedTypes = new ArrayList<IType>();
+ ArrayList<IType> changedTypes = new ArrayList<>();
processDelta(event.getDelta(), changedTypes);
if (changedTypes.size() > 0) {
- fireChange(changedTypes.toArray(new IType[changedTypes.size()]));
+ fireChange(
+ changedTypes.toArray(new IType[changedTypes.size()]));
}
}
}
@@ -246,7 +249,8 @@
}
private boolean isPossibleStructuralChange(int flags) {
- return (flags & (IModelElementDelta.F_CONTENT | IModelElementDelta.F_FINE_GRAINED)) == IModelElementDelta.F_CONTENT;
+ return (flags & (IModelElementDelta.F_CONTENT
+ | IModelElementDelta.F_FINE_GRAINED)) == IModelElementDelta.F_CONTENT;
}
private void processTypeDelta(IType type, ArrayList<IType> changedTypes) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java
index 4eb213e..46ea82f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/typehierarchy/TypeHierarchyViewPart.java
@@ -223,7 +223,7 @@
fIsEnableMemberFilter = false;
- fInputHistory = new ArrayList<IModelElement>();
+ fInputHistory = new ArrayList<>();
fAllViewers = null;
fViewActions = new ToggleViewAction[] {
@@ -1240,7 +1240,7 @@
List<?> selected = ((IStructuredSelection) sel).toList();
int nSelected = selected.size();
if (nSelected != 0) {
- List<IType> types = new ArrayList<IType>(nSelected);
+ List<IType> types = new ArrayList<>(nSelected);
for (int i = nSelected - 1; i >= 0; i--) {
Object elem = selected.get(i);
if (elem instanceof IType) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java
index f44bad2..52d1536 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/viewsupport/ContextActivator.java
@@ -44,12 +44,11 @@
* the DLTK outline view is brought to the front, the DLTK context is set.
*/
public class ContextActivator implements IWindowListener, IPartListener2 {
- private static ContextActivator sInstance= new ContextActivator();
+ private static ContextActivator sInstance = new ContextActivator();
- private Map<ContentOutline, IContextActivation> fActivationPerOutline = new HashMap<ContentOutline, IContextActivation>();
- private Map<CommonNavigator, SelectionListener> fActivationPerNavigator= new HashMap<CommonNavigator, SelectionListener>();
- private Collection<IWorkbenchWindow> fWindows= new HashSet<IWorkbenchWindow>();
-
+ private Map<ContentOutline, IContextActivation> fActivationPerOutline = new HashMap<>();
+ private Map<CommonNavigator, SelectionListener> fActivationPerNavigator = new HashMap<>();
+ private Collection<IWorkbenchWindow> fWindows = new HashSet<>();
private ContextActivator() {
}
@@ -63,17 +62,19 @@
if (workbench != null) {
// listen for new windows
workbench.addWindowListener(this);
- IWorkbenchWindow[] wnds= workbench.getWorkbenchWindows();
+ IWorkbenchWindow[] wnds = workbench.getWorkbenchWindows();
for (int i = 0; i < wnds.length; i++) {
IWorkbenchWindow window = wnds[i];
register(window);
}
// register open windows
- IWorkbenchWindow ww= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow ww = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
if (ww != null) {
IWorkbenchPage activePage = ww.getActivePage();
if (activePage != null) {
- IWorkbenchPartReference part= activePage.getActivePartReference();
+ IWorkbenchPartReference part = activePage
+ .getActivePartReference();
if (part != null) {
partActivated(part);
}
@@ -83,12 +84,14 @@
}
public void uninstall() {
- for (Iterator<IWorkbenchWindow> iterator = fWindows.iterator(); iterator.hasNext();) {
+ for (Iterator<IWorkbenchWindow> iterator = fWindows.iterator(); iterator
+ .hasNext();) {
IWorkbenchWindow window = iterator.next();
unregister(window);
}
- for (Iterator<SelectionListener> iterator = fActivationPerNavigator.values().iterator(); iterator.hasNext();) {
- SelectionListener l= iterator.next();
+ for (Iterator<SelectionListener> iterator = fActivationPerNavigator
+ .values().iterator(); iterator.hasNext();) {
+ SelectionListener l = iterator.next();
l.uninstall();
}
}
@@ -128,17 +131,17 @@
private void onContentOutlineActivated(ContentOutline outline) {
IPage page = outline.getCurrentPage();
if (page instanceof ScriptOutlinePage) {
- if (!fActivationPerOutline.containsKey(outline)){
+ if (!fActivationPerOutline.containsKey(outline)) {
// dltk outline activated for the first time
IContextService ctxtService = outline.getViewSite()
.getService(IContextService.class);
IContextActivation activateContext = ctxtService
.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
- fActivationPerOutline.put(outline,activateContext);
+ fActivationPerOutline.put(outline, activateContext);
}
- }
- else {
- IContextActivation activation = fActivationPerOutline.remove(outline);
+ } else {
+ IContextActivation activation = fActivationPerOutline
+ .remove(outline);
if (activation != null) {
// other outline page brought to front
IContextService ctxtService = outline.getViewSite()
@@ -148,15 +151,16 @@
}
}
- private static class SelectionListener implements ISelectionChangedListener {
+ private static class SelectionListener
+ implements ISelectionChangedListener {
private IWorkbenchPartSite fSite;
private IContextService fCtxService;
private IContextActivation fActivation;
public SelectionListener(IWorkbenchPartSite site) {
- fSite= site;
+ fSite = site;
fCtxService = fSite.getService(IContextService.class);
- ISelectionProvider sp= site.getSelectionProvider();
+ ISelectionProvider sp = site.getSelectionProvider();
if (sp != null && fCtxService != null) {
sp.addSelectionChangedListener(this);
@@ -165,7 +169,7 @@
}
public void uninstall() {
- ISelectionProvider sp= fSite.getSelectionProvider();
+ ISelectionProvider sp = fSite.getSelectionProvider();
if (sp != null && fCtxService != null) {
onNewSelection(null);
sp.removeSelectionChangedListener(this);
@@ -178,9 +182,11 @@
}
private void onNewSelection(ISelection selection) {
- boolean isRelevant= false;
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- if (((IStructuredSelection) selection).getFirstElement() instanceof ModelElement) {
+ boolean isRelevant = false;
+ if (selection instanceof IStructuredSelection
+ && !selection.isEmpty()) {
+ if (((IStructuredSelection) selection)
+ .getFirstElement() instanceof ModelElement) {
isRelevant = true;
}
}
@@ -189,20 +195,19 @@
fActivation = fCtxService
.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
}
- }
- else {
+ } else {
if (fActivation != null) {
fCtxService.deactivateContext(fActivation);
- fActivation= null;
+ fActivation = null;
}
}
}
}
private void onCommonNavigatorActivated(CommonNavigator part) {
- SelectionListener l= fActivationPerNavigator.get(part);
+ SelectionListener l = fActivationPerNavigator.get(part);
if (l == null) {
- l= new SelectionListener(part.getSite());
+ l = new SelectionListener(part.getSite());
fActivationPerNavigator.put(part, l);
}
}
@@ -213,22 +218,20 @@
@Override
public void partActivated(IWorkbenchPartReference partRef) {
- IWorkbenchPart part= partRef.getPart(false);
+ IWorkbenchPart part = partRef.getPart(false);
if (part instanceof ContentOutline) {
onContentOutlineActivated((ContentOutline) part);
- }
- else if (part instanceof CommonNavigator) {
+ } else if (part instanceof CommonNavigator) {
onCommonNavigatorActivated((CommonNavigator) part);
}
}
@Override
public void partClosed(IWorkbenchPartReference partRef) {
- IWorkbenchPart part= partRef.getPart(false);
+ IWorkbenchPart part = partRef.getPart(false);
if (part instanceof ContentOutline) {
- onContentOutlineClosed((ContentOutline)part);
- }
- else if (part instanceof CommonNavigator) {
+ onContentOutlineClosed((ContentOutline) part);
+ } else if (part instanceof CommonNavigator) {
onCommonNavigatorClosed((CommonNavigator) part);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDetector.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDetector.java
index fd54b66..53fc6a0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDetector.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/BuildpathDetector.java
@@ -54,14 +54,14 @@
@Override
public int compare(IBuildpathEntry e1, IBuildpathEntry e2) {
- return fCollator.compare(e1.getPath().toString(), e2.getPath()
- .toString());
+ return fCollator.compare(e1.getPath().toString(),
+ e2.getPath().toString());
}
}
public BuildpathDetector(IProject project, IDLTKLanguageToolkit toolkit) {
- fSourceFolders = new HashMap<IPath, List<IPath>>();
- fZIPFiles = new HashSet<IPath>(10);
+ fSourceFolders = new HashMap<>();
+ fZIPFiles = new HashSet<>(10);
// fSourceFiles = new ArrayList(100);
fProject = project;
fResultBuildpath = null;
@@ -94,13 +94,15 @@
monitor.beginTask(Messages.BuildpathDetector_detectingBuildpath,
120);
fMonitor = monitor;
- final List<IFile> correctFiles = new ArrayList<IFile>();
- fProject.accept(proxy -> BuildpathDetector.this.visit(proxy, correctFiles), IResource.NONE);
+ final List<IFile> correctFiles = new ArrayList<>();
+ fProject.accept(
+ proxy -> BuildpathDetector.this.visit(proxy, correctFiles),
+ IResource.NONE);
monitor.worked(10);
SubProgressMonitor sub = new SubProgressMonitor(monitor, 80);
processSources(correctFiles, sub);
sub.done();
- ArrayList<IBuildpathEntry> cpEntries = new ArrayList<IBuildpathEntry>();
+ ArrayList<IBuildpathEntry> cpEntries = new ArrayList<>();
detectSourceFolders(cpEntries);
if (monitor.isCanceled()) {
throw new OperationCanceledException();
@@ -119,8 +121,8 @@
if (cpEntries.size() == 1) {
IBuildpathEntry entry = cpEntries.get(0);
if (entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
- cpEntries.add(0, DLTKCore.newSourceEntry(fProject
- .getFullPath()));
+ cpEntries.add(0,
+ DLTKCore.newSourceEntry(fProject.getFullPath()));
}
}
@@ -130,8 +132,9 @@
IBuildpathEntry[] entries = cpEntries
.toArray(new IBuildpathEntry[cpEntries.size()]);
- if (!BuildpathEntry.validateBuildpath(DLTKCore.create(fProject),
- entries).isOK()) {
+ if (!BuildpathEntry
+ .validateBuildpath(DLTKCore.create(fProject), entries)
+ .isOK()) {
return;
}
fResultBuildpath = entries;
@@ -144,14 +147,15 @@
SubProgressMonitor sub) {
}
- protected void addInterpreterContainer(ArrayList<IBuildpathEntry> cpEntries) {
- cpEntries.add(DLTKCore.newContainerEntry(new Path(
- ScriptRuntime.INTERPRETER_CONTAINER)));
+ protected void addInterpreterContainer(
+ ArrayList<IBuildpathEntry> cpEntries) {
+ cpEntries.add(DLTKCore.newContainerEntry(
+ new Path(ScriptRuntime.INTERPRETER_CONTAINER)));
}
private void detectLibraries(ArrayList<IBuildpathEntry> cpEntries) {
if (this.fToolkit.languageSupportZIPBuildpath()) {
- ArrayList<IBuildpathEntry> res = new ArrayList<IBuildpathEntry>();
+ ArrayList<IBuildpathEntry> res = new ArrayList<>();
Set<IPath> sourceFolderSet = fSourceFolders.keySet();
for (Iterator<IPath> iter = fZIPFiles.iterator(); iter.hasNext();) {
IPath path = iter.next();
@@ -167,9 +171,10 @@
}
private void detectSourceFolders(ArrayList<IBuildpathEntry> resEntries) {
- ArrayList<IBuildpathEntry> res = new ArrayList<IBuildpathEntry>();
+ ArrayList<IBuildpathEntry> res = new ArrayList<>();
Set<IPath> sourceFolderSet = fSourceFolders.keySet();
- for (Iterator<IPath> iter = sourceFolderSet.iterator(); iter.hasNext();) {
+ for (Iterator<IPath> iter = sourceFolderSet.iterator(); iter
+ .hasNext();) {
IPath path = iter.next();
// ArrayList excluded = new ArrayList();
boolean primary = true;
@@ -204,7 +209,7 @@
IPath relPath) {
List<IPath> list = map.get(folderPath);
if (list == null) {
- list = new ArrayList<IPath>(50);
+ list = new ArrayList<>(50);
map.put(folderPath, list);
}
list.add(relPath);
@@ -245,8 +250,8 @@
}
protected boolean visitSourceModule(IFile file) {
- if (DLTKContentTypeManager
- .isValidResourceForContentType(fToolkit, file)) {
+ if (DLTKContentTypeManager.isValidResourceForContentType(fToolkit,
+ file)) {
IPath packPath = file.getParent().getFullPath();
String cuName = file.getName();
addToMap(fSourceFolders, packPath, new Path(cuName));
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/ProjectWizardState.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/ProjectWizardState.java
index 7ec2717..83f1c70 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/ProjectWizardState.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/ProjectWizardState.java
@@ -24,8 +24,8 @@
private String externalLocation;
private String projectName;
private String mode;
- private final Map<String, String> tooltips = new HashMap<String, String>();
- private final Map<String, String> attributes = new HashMap<String, String>();
+ private final Map<String, String> tooltips = new HashMap<>();
+ private final Map<String, String> attributes = new HashMap<>();
public ProjectWizardState(String nature) {
this.nature = nature;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java
index 1b67063..3b8a0fd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java
@@ -90,7 +90,8 @@
this(parent, project, entryKind, path, res, null, external);
}
- public BPListElement(IScriptProject project, int entryKind, boolean external) {
+ public BPListElement(IScriptProject project, int entryKind,
+ boolean external) {
this(null, project, entryKind, null, null, external);
}
@@ -119,8 +120,8 @@
createAttributeElement(INCLUSION, new Path[0], true);
createAttributeElement(EXCLUSION, new Path[0], true);
if (DLTKCore.DEBUG) {
- System.err
- .println("TODO: Add adding containers for languages here"); //$NON-NLS-1$
+ System.err.println(
+ "TODO: Add adding containers for languages here"); //$NON-NLS-1$
// createAttributeElement(NATIVE_LIB_PATH, null, false);
}
break;
@@ -133,27 +134,27 @@
// rendered
if (DLTKCore.DEBUG) {
- System.err
- .println("TODO: Add adding containers for languages here"); //$NON-NLS-1$
+ System.err.println(
+ "TODO: Add adding containers for languages here"); //$NON-NLS-1$
// createAttributeElement(NATIVE_LIB_PATH, null, false);
}
break;
case IBuildpathEntry.BPE_CONTAINER:
createAttributeElement(ACCESSRULES, new IAccessRule[0], true);
try {
- IBuildpathContainer container = DLTKCore.getBuildpathContainer(
- fPath, fProject);
+ IBuildpathContainer container = DLTKCore
+ .getBuildpathContainer(fPath, fProject);
if (container != null) {
IBuildpathEntry[] entries = container.getBuildpathEntries();
for (int i = 0; i < entries.length; i++) {
IBuildpathEntry entry = entries[i];
if (entry != null) {
- BPListElement curr = createFromExisting(this,
- entry, fProject);
+ BPListElement curr = createFromExisting(this, entry,
+ fProject);
fChildren.add(curr);
} else {
- DLTKUIPlugin
- .logErrorMessage("Null entry in container '" + fPath + "'"); //$NON-NLS-1$//$NON-NLS-2$
+ DLTKUIPlugin.logErrorMessage(
+ "Null entry in container '" + fPath + "'"); //$NON-NLS-1$//$NON-NLS-2$
}
}
}
@@ -161,8 +162,8 @@
}
// createAttributeElement( NATIVE_LIB_PATH, null, false );
if (DLTKCore.DEBUG) {
- System.err
- .println("TODO: Add adding containers for languages here"); //$NON-NLS-1$
+ System.err.println(
+ "TODO: Add adding containers for languages here"); //$NON-NLS-1$
// createAttributeElement(NATIVE_LIB_PATH, null, false);
}
break;
@@ -183,7 +184,7 @@
private IBuildpathAttribute[] getBuildpathAttributes() {
- ArrayList<IBuildpathAttribute> res = new ArrayList<IBuildpathAttribute>();
+ ArrayList<IBuildpathAttribute> res = new ArrayList<>();
for (int i = 0; i < fChildren.size(); i++) {
Object curr = fChildren.get(i);
if (curr instanceof BPListElementAttribute) {
@@ -207,9 +208,10 @@
return DLTKCore.newSourceEntry(fPath, inclusionPattern,
exclusionPattern, extraAttributes);
case IBuildpathEntry.BPE_LIBRARY: {
- IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES);
- if (fPath.toString().startsWith(
- IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
+ IAccessRule[] accesRules = (IAccessRule[]) getAttribute(
+ ACCESSRULES);
+ if (fPath.toString()
+ .startsWith(IBuildpathEntry.BUILTIN_EXTERNAL_ENTRY_STR)) {
return DLTKCore.newBuiltinEntry(fPath, accesRules,
extraAttributes, new IPath[0],
BuildpathEntry.INCLUDE_ALL, isExported(), fExternal);
@@ -219,14 +221,16 @@
}
}
case IBuildpathEntry.BPE_PROJECT: {
- IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES);
- boolean combineAccessRules = ((Boolean) getAttribute(COMBINE_ACCESSRULES))
- .booleanValue();
+ IAccessRule[] accesRules = (IAccessRule[]) getAttribute(
+ ACCESSRULES);
+ boolean combineAccessRules = ((Boolean) getAttribute(
+ COMBINE_ACCESSRULES)).booleanValue();
return DLTKCore.newProjectEntry(fPath, accesRules,
combineAccessRules, extraAttributes, isExported());
}
case IBuildpathEntry.BPE_CONTAINER: {
- IAccessRule[] accesRules = (IAccessRule[]) getAttribute(ACCESSRULES);
+ IAccessRule[] accesRules = (IAccessRule[]) getAttribute(
+ ACCESSRULES);
return DLTKCore.newContainerEntry(fPath, accesRules,
extraAttributes, isExported());
}
@@ -291,13 +295,13 @@
return null;
}
if (key.equals(EXCLUSION) || key.equals(INCLUSION)) {
- Assert.isTrue(value != null
- || fEntryKind != IBuildpathEntry.BPE_SOURCE);
+ Assert.isTrue(
+ value != null || fEntryKind != IBuildpathEntry.BPE_SOURCE);
}
if (key.equals(ACCESSRULES)) {
- Assert.isTrue(value != null
- || fEntryKind == IBuildpathEntry.BPE_SOURCE);
+ Assert.isTrue(
+ value != null || fEntryKind == IBuildpathEntry.BPE_SOURCE);
}
if (key.equals(COMBINE_ACCESSRULES)) {
Assert.isTrue(value instanceof Boolean);
@@ -336,9 +340,11 @@
IPath[] exclusionFilters = (IPath[]) getAttribute(key);
if (!ScriptModelUtil.isExcludedPath(path, exclusionFilters)) {
- IPath pathToExclude = path.removeFirstSegments(
- getPath().segmentCount()).addTrailingSeparator();
- IPath[] newExclusionFilters = new IPath[exclusionFilters.length + 1];
+ IPath pathToExclude = path
+ .removeFirstSegments(getPath().segmentCount())
+ .addTrailingSeparator();
+ IPath[] newExclusionFilters = new IPath[exclusionFilters.length
+ + 1];
System.arraycopy(exclusionFilters, 0, newExclusionFilters, 0,
exclusionFilters.length);
newExclusionFilters[exclusionFilters.length] = pathToExclude;
@@ -351,12 +357,11 @@
private boolean removeFilter(IPath path, String key) {
IPath[] exclusionFilters = (IPath[]) getAttribute(key);
- IPath pathToExclude = path
- .removeFirstSegments(getPath().segmentCount())
+ IPath pathToExclude = path.removeFirstSegments(getPath().segmentCount())
.addTrailingSeparator();
if (ScriptModelUtil.isExcludedPath(pathToExclude, exclusionFilters)) {
- List<IPath> l = new ArrayList<IPath>(Arrays.asList(exclusionFilters));
+ List<IPath> l = new ArrayList<>(Arrays.asList(exclusionFilters));
l.remove(pathToExclude);
IPath[] newExclusionFilters = l.toArray(new IPath[l.size()]);
setAttribute(key, newExclusionFilters);
@@ -579,8 +584,8 @@
switch (curr.getEntryKind()) {
case IBuildpathEntry.BPE_CONTAINER:
try {
- isMissing = project != null
- && (DLTKCore.getBuildpathContainer(path, project) == null);
+ isMissing = project != null && (DLTKCore
+ .getBuildpathContainer(path, project) == null);
} catch (ModelException e) {
isMissing = true;
}
@@ -590,8 +595,9 @@
isExternel = curr.isExternal();
if (res == null) {
if (!ArchiveFileFilter.isArchivePath(path)) {
- if (root.getWorkspace().validatePath(path.toString(),
- IResource.FOLDER).isOK()
+ if (root.getWorkspace()
+ .validatePath(path.toString(), IResource.FOLDER)
+ .isOK()
&& root.getProject(path.segment(0)).exists()) {
res = root.getFolder(path);
}
@@ -602,8 +608,8 @@
} else {
IEnvironment environment = EnvironmentManager
.getEnvironment(project);
- IFileHandle handle = EnvironmentPathUtils.getFile(
- environment, path);
+ IFileHandle handle = EnvironmentPathUtils
+ .getFile(environment, path);
if (handle == null || !handle.exists()) {
isMissing = true;
}
@@ -616,8 +622,9 @@
path = path.removeTrailingSeparator();
res = root.findMember(path);
if (res == null) {
- if (root.getWorkspace().validatePath(path.toString(),
- IResource.FOLDER).isOK()) {
+ if (root.getWorkspace()
+ .validatePath(path.toString(), IResource.FOLDER)
+ .isOK()) {
res = root.getFolder(path);
}
isMissing = true;
@@ -630,8 +637,8 @@
isMissing = (res == null);
break;
}
- BPListElement elem = new BPListElement(parent, project, curr
- .getEntryKind(), path, res, linkTarget, isExternel);
+ BPListElement elem = new BPListElement(parent, project,
+ curr.getEntryKind(), path, res, linkTarget, isExternel);
elem.setExported(curr.isExported());
elem.setAttribute(EXCLUSION, curr.getExclusionPatterns());
elem.setAttribute(INCLUSION, curr.getInclusionPatterns());
@@ -643,7 +650,8 @@
IBuildpathAttribute[] extraAttributes = curr.getExtraAttributes();
for (int i = 0; i < extraAttributes.length; i++) {
IBuildpathAttribute attrib = extraAttributes[i];
- if (elem.setAttribute(attrib.getName(), attrib.getValue()) == null) {
+ if (elem.setAttribute(attrib.getName(),
+ attrib.getValue()) == null) {
// Store this in extraAttributesList
elem.fExtraAttributes.add(attrib);
}
@@ -666,7 +674,8 @@
return buf;
}
- public static StringBuffer appendEncodedString(String str, StringBuffer buf) {
+ public static StringBuffer appendEncodedString(String str,
+ StringBuffer buf) {
if (str != null) {
buf.append('[').append(str.length()).append(']').append(str);
@@ -726,8 +735,8 @@
.append(';');
} else if (ACCESSRULES.equals(key)) {
appendEncodedAccessRules(
- (IAccessRule[]) elem.getValue(), buf).append(
- ';');
+ (IAccessRule[]) elem.getValue(), buf)
+ .append(';');
} else if (COMBINE_ACCESSRULES.equals(key)) {
buf.append(((Boolean) elem.getValue()).booleanValue())
.append(';');
@@ -768,8 +777,7 @@
List<BPListElement> cpList) {
int length = cpList.size();
- BPListElement[] elements = cpList
- .toArray(new BPListElement[length]);
+ BPListElement[] elements = cpList.toArray(new BPListElement[length]);
int i = 0;
while (i < length
&& elements[i].getEntryKind() != element.getEntryKind()) {
@@ -798,10 +806,10 @@
}
}
- public static IBuildpathEntry[] convertToBuildpathEntries(List/*
- * <CPListElement
- * >
- */cpList) {
+ public static IBuildpathEntry[] convertToBuildpathEntries(
+ List/*
+ * <CPListElement >
+ */ cpList) {
IBuildpathEntry[] result = new IBuildpathEntry[cpList.size()];
int i = 0;
@@ -851,11 +859,10 @@
}
public boolean isExternalFolder() {
- return this.fExternal
- && this.fEntryKind == IBuildpathEntry.BPE_LIBRARY
+ return this.fExternal && this.fEntryKind == IBuildpathEntry.BPE_LIBRARY
&& !Util.isArchiveFileName(DLTKLanguageManager
- .getLanguageToolkit(getScriptProject()), this.fPath
- .toOSString());
+ .getLanguageToolkit(getScriptProject()),
+ this.fPath.toOSString());
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
index ec3d786..b95cbca 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
@@ -71,7 +71,7 @@
public BPUserLibraryElement(String name, IBuildpathContainer container,
IScriptProject project, Map<String, String> attributes) {
fName = name;
- fChildren = new ArrayList<BPListElement>();
+ fChildren = new ArrayList<>();
if (container != null) {
IBuildpathEntry[] entries = container.getBuildpathEntries();
BPListElement[] res = new BPListElement[entries.length];
@@ -85,12 +85,13 @@
// ScriptUI.getLibraryJavadocLocation(curr.getPath()));
fChildren.add(elem);
}
- fIsSystemLibrary = container.getKind() == IBuildpathContainer.K_SYSTEM;
+ fIsSystemLibrary = container
+ .getKind() == IBuildpathContainer.K_SYSTEM;
} else {
fIsSystemLibrary = false;
}
if (attributes != null)
- fAttributes = new HashMap<String, String>(attributes);
+ fAttributes = new HashMap<>(attributes);
}
public BPUserLibraryElement(String name, boolean isSystemLibrary,
@@ -101,7 +102,7 @@
public BPUserLibraryElement(String name, boolean isSystemLibrary,
BPListElement[] children, Map<String, String> attributes) {
fName = name;
- fChildren = new ArrayList<BPListElement>();
+ fChildren = new ArrayList<>();
if (children != null) {
for (int i = 0; i < children.length; i++) {
BPListElement child = children[i];
@@ -111,12 +112,11 @@
}
fIsSystemLibrary = isSystemLibrary;
if (attributes != null)
- fAttributes = new HashMap<String, String>(attributes);
+ fAttributes = new HashMap<>(attributes);
}
public BPListElement[] getChildren() {
- return fChildren.toArray(new BPListElement[fChildren
- .size()]);
+ return fChildren.toArray(new BPListElement[fChildren.size()]);
}
public String getName() {
@@ -153,7 +153,7 @@
private List<BPListElement> moveUp(List<BPListElement> elements,
List<BPListElement> move) {
int nElements = elements.size();
- List<BPListElement> res = new ArrayList<BPListElement>(nElements);
+ List<BPListElement> res = new ArrayList<>(nElements);
BPListElement floating = null;
for (int i = 0; i < nElements; i++) {
BPListElement curr = elements.get(i);
@@ -218,8 +218,8 @@
public boolean hasChanges(IBuildpathContainer oldContainer,
IScriptProject project) {
- if (oldContainer == null
- || (oldContainer.getKind() == IBuildpathContainer.K_SYSTEM) != fIsSystemLibrary) {
+ if (oldContainer == null || (oldContainer
+ .getKind() == IBuildpathContainer.K_SYSTEM) != fIsSystemLibrary) {
return true;
}
IBuildpathEntry[] oldEntries = oldContainer.getBuildpathEntries();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java
index 6b19e8d..61af686 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java
@@ -26,30 +26,29 @@
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
-
/**
*
*/
public class BuildPathSupport {
- public static final String InterpreterEnvironment_PREF_PAGE_ID= "org.eclipse.dltk.debug.ui.preferences.InterpreterPreferencePage"; //$NON-NLS-1$
-
+ public static final String InterpreterEnvironment_PREF_PAGE_ID = "org.eclipse.dltk.debug.ui.preferences.InterpreterPreferencePage"; //$NON-NLS-1$
private BuildPathSupport() {
super();
}
- private static class UpdatedBuildpathContainer implements IBuildpathContainer {
+ private static class UpdatedBuildpathContainer
+ implements IBuildpathContainer {
private IBuildpathEntry[] fNewEntries;
private IBuildpathContainer fOriginal;
- public UpdatedBuildpathContainer(IBuildpathContainer original, IBuildpathEntry[] newEntries) {
- fNewEntries= newEntries;
- fOriginal= original;
+ public UpdatedBuildpathContainer(IBuildpathContainer original,
+ IBuildpathEntry[] newEntries) {
+ fNewEntries = newEntries;
+ fOriginal = original;
}
-
@Override
public IBuildpathEntry[] getBuildpathEntries() {
return fNewEntries;
@@ -73,64 +72,107 @@
}
/**
- * Apply a modified buildpath entry to the buildpath. The buildpath entry can also be from a buildpath container.
- * @param shell If not null and the entry could not be found on the projects buildpath, a dialog will ask to put the entry on the buildpath
- * @param newEntry The modified entry. The entry's kind or path must be unchanged.
- * @param changedAttributes The attibutes that have changed. See {@link BPListElement} for constants values.
- * @param jproject Project where the entry belongs to
- * @param containerPath The path of the entry's parent container or <code>null</code> if the entry is not in a container
- * @param monitor The progress monitor to use
+ * Apply a modified buildpath entry to the buildpath. The buildpath entry
+ * can also be from a buildpath container.
+ *
+ * @param shell
+ * If not null and the entry could not be found on the projects
+ * buildpath, a dialog will ask to put the entry on the buildpath
+ * @param newEntry
+ * The modified entry. The entry's kind or path must be
+ * unchanged.
+ * @param changedAttributes
+ * The attibutes that have changed. See {@link BPListElement} for
+ * constants values.
+ * @param jproject
+ * Project where the entry belongs to
+ * @param containerPath
+ * The path of the entry's parent container or <code>null</code>
+ * if the entry is not in a container
+ * @param monitor
+ * The progress monitor to use
* @throws CoreException
*/
- public static void modifyBuildpathEntry(Shell shell, IBuildpathEntry newEntry, String[] changedAttributes, IScriptProject jproject, IPath containerPath, IProgressMonitor monitor) throws CoreException {
+ public static void modifyBuildpathEntry(Shell shell,
+ IBuildpathEntry newEntry, String[] changedAttributes,
+ IScriptProject jproject, IPath containerPath,
+ IProgressMonitor monitor) throws CoreException {
if (containerPath != null) {
- updateContainerBuildpath(jproject, containerPath, newEntry, changedAttributes, monitor);
+ updateContainerBuildpath(jproject, containerPath, newEntry,
+ changedAttributes, monitor);
} else {
- updateProjectBuildpath(shell, jproject, newEntry, changedAttributes, monitor);
+ updateProjectBuildpath(shell, jproject, newEntry, changedAttributes,
+ monitor);
}
}
-
/**
- * Apply a modified buildpath entry to the buildpath. The buildpath entry can also be from a buildpath container.
- * @param shell If not null and the entry could not be found on the projects buildpath, a dialog will ask to put the entry on the buildpath
- * @param newEntry The modified entry. The entry's kind or path must be unchanged.
- * @param jproject Project where the entry belongs to
- * @param containerPath The path of the entry's parent container or <code>null</code> if the entry is not in a container
- * @param monitor The progress monitor to use
+ * Apply a modified buildpath entry to the buildpath. The buildpath entry
+ * can also be from a buildpath container.
+ *
+ * @param shell
+ * If not null and the entry could not be found on the projects
+ * buildpath, a dialog will ask to put the entry on the buildpath
+ * @param newEntry
+ * The modified entry. The entry's kind or path must be
+ * unchanged.
+ * @param jproject
+ * Project where the entry belongs to
+ * @param containerPath
+ * The path of the entry's parent container or <code>null</code>
+ * if the entry is not in a container
+ * @param monitor
+ * The progress monitor to use
* @throws CoreException
*/
- public static void modifyBuildpathEntry(Shell shell, IBuildpathEntry newEntry, IScriptProject jproject, IPath containerPath, IProgressMonitor monitor) throws CoreException {
- modifyBuildpathEntry(shell, newEntry, null, jproject, containerPath, monitor);
+ public static void modifyBuildpathEntry(Shell shell,
+ IBuildpathEntry newEntry, IScriptProject jproject,
+ IPath containerPath, IProgressMonitor monitor)
+ throws CoreException {
+ modifyBuildpathEntry(shell, newEntry, null, jproject, containerPath,
+ monitor);
}
- private static void updateContainerBuildpath(IScriptProject project, IPath containerPath, IBuildpathEntry newEntry, String[] changedAttributes, IProgressMonitor monitor) throws CoreException {
- IBuildpathContainer container= DLTKCore.getBuildpathContainer(containerPath, project);
+ private static void updateContainerBuildpath(IScriptProject project,
+ IPath containerPath, IBuildpathEntry newEntry,
+ String[] changedAttributes, IProgressMonitor monitor)
+ throws CoreException {
+ IBuildpathContainer container = DLTKCore
+ .getBuildpathContainer(containerPath, project);
if (container == null) {
- throw new CoreException(new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID, IStatus.ERROR, "Container " + containerPath + " cannot be resolved", null)); //$NON-NLS-1$//$NON-NLS-2$
+ throw new CoreException(new Status(IStatus.ERROR,
+ DLTKUIPlugin.PLUGIN_ID, IStatus.ERROR,
+ "Container " + containerPath + " cannot be resolved", //$NON-NLS-1$//$NON-NLS-2$
+ null));
}
IBuildpathEntry[] entries = container.getBuildpathEntries();
- IBuildpathEntry[] newEntries= new IBuildpathEntry[entries.length];
- for (int i= 0; i < entries.length; i++) {
- IBuildpathEntry curr= entries[i];
- if (curr.getEntryKind() == newEntry.getEntryKind() && curr.getPath().equals(newEntry.getPath())) {
- newEntries[i]= getUpdatedEntry(curr, newEntry, changedAttributes, project);
+ IBuildpathEntry[] newEntries = new IBuildpathEntry[entries.length];
+ for (int i = 0; i < entries.length; i++) {
+ IBuildpathEntry curr = entries[i];
+ if (curr.getEntryKind() == newEntry.getEntryKind()
+ && curr.getPath().equals(newEntry.getPath())) {
+ newEntries[i] = getUpdatedEntry(curr, newEntry,
+ changedAttributes, project);
} else {
- newEntries[i]= curr;
+ newEntries[i] = curr;
}
}
requestContainerUpdate(project, container, newEntries);
monitor.worked(1);
}
- private static IBuildpathEntry getUpdatedEntry(IBuildpathEntry currEntry, IBuildpathEntry updatedEntry, String[] updatedAttributes, IScriptProject jproject) {
+ private static IBuildpathEntry getUpdatedEntry(IBuildpathEntry currEntry,
+ IBuildpathEntry updatedEntry, String[] updatedAttributes,
+ IScriptProject jproject) {
if (updatedAttributes == null) {
return updatedEntry; // used updated entry 'as is'
}
- BPListElement currElem= BPListElement.createFromExisting(currEntry, jproject);
- BPListElement newElem= BPListElement.createFromExisting(updatedEntry, jproject);
- for (int i= 0; i < updatedAttributes.length; i++) {
- String attrib= updatedAttributes[i];
+ BPListElement currElem = BPListElement.createFromExisting(currEntry,
+ jproject);
+ BPListElement newElem = BPListElement.createFromExisting(updatedEntry,
+ jproject);
+ for (int i = 0; i < updatedAttributes.length; i++) {
+ String attrib = updatedAttributes[i];
currElem.setAttribute(attrib, newElem.getAttribute(attrib));
}
return currElem.getBuildpathEntry();
@@ -138,39 +180,59 @@
/**
* Request a container update.
- * @param jproject The project of the container
- * @param container The container to requesta change to
- * @param newEntries The updated entries
+ *
+ * @param jproject
+ * The project of the container
+ * @param container
+ * The container to requesta change to
+ * @param newEntries
+ * The updated entries
* @throws CoreException
*/
- public static void requestContainerUpdate(IScriptProject jproject, IBuildpathContainer container, IBuildpathEntry[] newEntries) throws CoreException {
- IPath containerPath= container.getPath();
- IBuildpathContainer updatedContainer= new UpdatedBuildpathContainer(container, newEntries);
- BuildpathContainerInitializer initializer= DLTKCore.getBuildpathContainerInitializer(containerPath.segment(0));
+ public static void requestContainerUpdate(IScriptProject jproject,
+ IBuildpathContainer container, IBuildpathEntry[] newEntries)
+ throws CoreException {
+ IPath containerPath = container.getPath();
+ IBuildpathContainer updatedContainer = new UpdatedBuildpathContainer(
+ container, newEntries);
+ BuildpathContainerInitializer initializer = DLTKCore
+ .getBuildpathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
- initializer.requestBuildpathContainerUpdate(containerPath, jproject, updatedContainer);
- if(DLTKCore.DEBUG) {
- System.err.println("BuildPathSupport: Add user library preference page container"); //$NON-NLS-1$
- //initializer.requestBuildpathContainerUpdate(containerPath, UserLibraryPreferencePage.getPlaceholderProject(), updatedContainer);
- //DLTKCore.setBuildpathContainer(containerPath, new IScriptProject[] {jproject, UserLibraryPreferencePage.getPlaceholderProject()}, new IBuildpathContainer[] {updatedContainer, updatedContainer}, null); // force updating of containers, bug 62250
+ initializer.requestBuildpathContainerUpdate(containerPath, jproject,
+ updatedContainer);
+ if (DLTKCore.DEBUG) {
+ System.err.println(
+ "BuildPathSupport: Add user library preference page container"); //$NON-NLS-1$
+ // initializer.requestBuildpathContainerUpdate(containerPath,
+ // UserLibraryPreferencePage.getPlaceholderProject(),
+ // updatedContainer);
+ // DLTKCore.setBuildpathContainer(containerPath, new
+ // IScriptProject[] {jproject,
+ // UserLibraryPreferencePage.getPlaceholderProject()}, new
+ // IBuildpathContainer[] {updatedContainer, updatedContainer},
+ // null); // force updating of containers, bug 62250
}
}
}
- private static void updateProjectBuildpath(Shell shell, IScriptProject jproject, IBuildpathEntry newEntry, String[] changedAttributes, IProgressMonitor monitor) throws ModelException {
- IBuildpathEntry[] oldBuildpath= jproject.getRawBuildpath();
- int nEntries= oldBuildpath.length;
- ArrayList<IBuildpathEntry> newEntries = new ArrayList<IBuildpathEntry>(
- nEntries + 1);
- int entryKind= newEntry.getEntryKind();
- IPath archivePath= newEntry.getPath();
- boolean found= false;
- for (int i= 0; i < nEntries; i++) {
- IBuildpathEntry curr= oldBuildpath[i];
- if (curr.getEntryKind() == entryKind && curr.getPath().equals(archivePath)) {
+ private static void updateProjectBuildpath(Shell shell,
+ IScriptProject jproject, IBuildpathEntry newEntry,
+ String[] changedAttributes, IProgressMonitor monitor)
+ throws ModelException {
+ IBuildpathEntry[] oldBuildpath = jproject.getRawBuildpath();
+ int nEntries = oldBuildpath.length;
+ ArrayList<IBuildpathEntry> newEntries = new ArrayList<>(nEntries + 1);
+ int entryKind = newEntry.getEntryKind();
+ IPath archivePath = newEntry.getPath();
+ boolean found = false;
+ for (int i = 0; i < nEntries; i++) {
+ IBuildpathEntry curr = oldBuildpath[i];
+ if (curr.getEntryKind() == entryKind
+ && curr.getPath().equals(archivePath)) {
// add modified entry
- newEntries.add(getUpdatedEntry(curr, newEntry, changedAttributes, jproject));
- found= true;
+ newEntries.add(getUpdatedEntry(curr, newEntry,
+ changedAttributes, jproject));
+ found = true;
} else {
newEntries.add(curr);
}
@@ -192,7 +254,7 @@
return false;
}
- final boolean[] result= new boolean[1];
+ final boolean[] result = new boolean[1];
shell.getDisplay().syncExec(() -> {
String title = NewWizardMessages.BuildPathSupport_putoncpdialog_title;
String message = NewWizardMessages.BuildPathSupport_putoncpdialog_message;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildpathContainerDescriptor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildpathContainerDescriptor.java
index 7d04fd7..96bf360 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildpathContainerDescriptor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildpathContainerDescriptor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -47,9 +46,9 @@
String nature = configElement.getAttribute(ATT_NATURE);
if (name == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID, 0,
- "Invalid extension (missing name): " + id, null)); //$NON-NLS-1$
+ throw new CoreException(
+ new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID, 0,
+ "Invalid extension (missing name): " + id, null)); //$NON-NLS-1$
}
if (nature == null) {
throw new CoreException(new Status(IStatus.ERROR,
@@ -57,9 +56,10 @@
"Invalid extension (missing nature): " + nature, null)); //$NON-NLS-1$
}
if (pageClassName == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID, 0,
- "Invalid extension (missing page class name): " + id, null)); //$NON-NLS-1$
+ throw new CoreException(
+ new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID, 0,
+ "Invalid extension (missing page class name): " //$NON-NLS-1$
+ + id, null));
}
}
@@ -71,12 +71,11 @@
fPage = (IBuildpathContainerPage) elem;
} else {
String id = fConfigElement.getAttribute(ATT_ID);
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
- 0,
- "Invalid extension (page not of type IBuildpathContainerPage): " + id, null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR,
+ DLTKUIPlugin.PLUGIN_ID, 0,
+ "Invalid extension (page not of type IBuildpathContainerPage): " //$NON-NLS-1$
+ + id,
+ null));
}
}
return fPage;
@@ -129,7 +128,7 @@
public static BuildpathContainerDescriptor[] getDescriptors(
IScriptProject proj) {
- ArrayList<BuildpathContainerDescriptor> containers = new ArrayList<BuildpathContainerDescriptor>();
+ ArrayList<BuildpathContainerDescriptor> containers = new ArrayList<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
.getExtensionPoint(DLTKUIPlugin.PLUGIN_ID, ATT_EXTENSION);
@@ -147,9 +146,8 @@
if (defaultPageName.equals(curr.getPageClass())) {
defaultPage = curr;
} else {
- if (proj == null
- || proj.getProject()
- .hasNature(curr.getNature()))
+ if (proj == null || proj.getProject()
+ .hasNature(curr.getNature()))
containers.add(curr);
}
} catch (CoreException e) {
@@ -162,7 +160,7 @@
containers.add(defaultPage);
}
}
- return containers.toArray(new BuildpathContainerDescriptor[containers
- .size()]);
+ return containers
+ .toArray(new BuildpathContainerDescriptor[containers.size()]);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java
index 474b921..13411b0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java
@@ -650,7 +650,7 @@
if (selected != null) {
// IWorkspaceRoot root =
// fCurrJProject.getProject().getWorkspace().getRoot();
- ArrayList<BPListElement> res = new ArrayList<BPListElement>();
+ ArrayList<BPListElement> res = new ArrayList<>();
for (int i = 0; i < selected.length; i++) {
// IPath curr = selected[i];
res.add(new BPListElement(fCurrJProject,
@@ -673,7 +673,7 @@
if (selected != null) {
IWorkspaceRoot root = fCurrJProject.getProject().getWorkspace()
.getRoot();
- ArrayList<BPListElement> res = new ArrayList<BPListElement>();
+ ArrayList<BPListElement> res = new ArrayList<>();
for (int i = 0; i < selected.length; i++) {
IPath curr = selected[i];
IResource resource = root.findMember(curr);
@@ -697,7 +697,7 @@
getShell(), fCurrJProject.getPath(),
getUsedArchiveFiles(existing));
if (selected != null) {
- ArrayList<BPListElement> res = new ArrayList<BPListElement>();
+ ArrayList<BPListElement> res = new ArrayList<>();
for (int i = 0; i < selected.length; i++) {
IPath curr = selected[i];
IResource resource = root.findMember(curr);
@@ -723,7 +723,7 @@
}
private IPath[] getUsedContainers(BPListElement existing) {
- ArrayList<IPath> res = new ArrayList<IPath>();
+ ArrayList<IPath> res = new ArrayList<>();
List cplist = fLibrariesList.getElements();
for (int i = 0; i < cplist.size(); i++) {
BPListElement elem = (BPListElement) cplist.get(i);
@@ -740,7 +740,7 @@
}
private IPath[] getUsedArchiveFiles(BPListElement existing) {
- List<IPath> res = new ArrayList<IPath>();
+ List<IPath> res = new ArrayList<>();
List cplist = fLibrariesList.getElements();
for (int i = 0; i < cplist.size(); i++) {
BPListElement elem = (BPListElement) cplist.get(i);
@@ -766,7 +766,7 @@
IPath[] selected = BuildpathDialogAccess
.chooseExternalArchiveEntries(getShell(), environment);
if (selected != null) {
- ArrayList<BPListElement> res = new ArrayList<BPListElement>();
+ ArrayList<BPListElement> res = new ArrayList<>();
for (int i = 0; i < selected.length; i++) {
res.add(new BPListElement(fCurrJProject,
IBuildpathEntry.BPE_LIBRARY, selected[i], null,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java
index f127100..ebbbdd5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java
@@ -200,7 +200,7 @@
}
protected void updateFoldersList() {
- ArrayList<BPListElement> folders = new ArrayList<BPListElement>();
+ ArrayList<BPListElement> folders = new ArrayList<>();
List<?> cpelements = fBuildpathList.getElements();
for (int i = 0; i < cpelements.size(); i++) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java
index 5588f62..2d543f8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddFolderToBuildpathAction.java
@@ -53,20 +53,20 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ISetSelectionTarget;
-public class AddFolderToBuildpathAction extends Action implements
- ISelectionChangedListener {
+public class AddFolderToBuildpathAction extends Action
+ implements ISelectionChangedListener {
private final IWorkbenchSite fSite;
// IScriptProject || IPackageFrament || IFolder
private final List<Object> fSelectedElements;
public AddFolderToBuildpathAction(IWorkbenchSite site) {
- super(
- NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label,
+ super(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label,
DLTKPluginImages.DESC_OBJS_PACKFRAG_ROOT);
- setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_tooltip);
+ setToolTipText(
+ NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_tooltip);
fSite = site;
- fSelectedElements = new ArrayList<Object>();
+ fSelectedElements = new ArrayList<>();
}
@Override
@@ -108,8 +108,8 @@
throw new InvocationTargetException(e);
}
};
- PlatformUI.getWorkbench().getProgressService()
- .run(true, false, runnable);
+ PlatformUI.getWorkbench().getProgressService().run(true, false,
+ runnable);
} catch (final InvocationTargetException e) {
if (e.getCause() instanceof CoreException) {
showExceptionDialog((CoreException) e.getCause());
@@ -122,12 +122,12 @@
private List<IModelElement> addToBuildpath(List<Object> elements,
IScriptProject project, boolean removeProjectFromBuildpath,
- IProgressMonitor monitor) throws OperationCanceledException,
- CoreException {
+ IProgressMonitor monitor)
+ throws OperationCanceledException, CoreException {
if (!DLTKLanguageManager.hasScriptNature(project.getProject())) {
StatusInfo rootStatus = new StatusInfo();
- rootStatus
- .setError(NewWizardMessages.BuildpathModifier_Error_NoNatures);
+ rootStatus.setError(
+ NewWizardMessages.BuildpathModifier_Error_NoNatures);
throw new CoreException(rootStatus);
}
@@ -147,7 +147,7 @@
monitor.worked(1);
}
- List<BPListElement> newEntries = new ArrayList<BPListElement>();
+ List<BPListElement> newEntries = new ArrayList<>();
for (int i = 0; i < elements.size(); i++) {
Object element = elements.get(i);
BPListElement entry;
@@ -158,16 +158,17 @@
else
entry = BuildpathModifier.addToBuildpath(
(IModelElement) element, existingEntries,
- newEntries, project, new SubProgressMonitor(
- monitor, 1));
+ newEntries, project,
+ new SubProgressMonitor(monitor, 1));
newEntries.add(entry);
}
- Set<BPListElement> modifiedSourceEntries = new HashSet<BPListElement>();
- BuildPathBasePage.fixNestingConflicts(newEntries
- .toArray(new BPListElement[newEntries.size()]),
- existingEntries.toArray(new BPListElement[existingEntries
- .size()]), modifiedSourceEntries);
+ Set<BPListElement> modifiedSourceEntries = new HashSet<>();
+ BuildPathBasePage.fixNestingConflicts(
+ newEntries.toArray(new BPListElement[newEntries.size()]),
+ existingEntries
+ .toArray(new BPListElement[existingEntries.size()]),
+ modifiedSourceEntries);
BuildpathModifier.setNewEntry(existingEntries, newEntries, project,
new SubProgressMonitor(monitor, 1));
@@ -175,7 +176,7 @@
BuildpathModifier.commitBuildPath(existingEntries, project,
new SubProgressMonitor(monitor, 1));
- List<IModelElement> result = new ArrayList<IModelElement>();
+ List<IModelElement> result = new ArrayList<>();
for (int i = 0; i < newEntries.size(); i++) {
IBuildpathEntry entry = newEntries.get(i).getBuildpathEntry();
IModelElement root;
@@ -219,14 +220,13 @@
} else if (element instanceof IProject) {
IScriptProject scriptProject = DLTKCore
.create((IProject) element);
- if (!scriptProject.isValid()
- || BuildpathModifier.isSourceFolder(scriptProject)) {
+ if (!scriptProject.isValid() || BuildpathModifier
+ .isSourceFolder(scriptProject)) {
return false;
}
fSelectedElements.add(scriptProject);
} else if (element instanceof IScriptFolder) {
- int type = DialogPackageExplorerActionGroup.getType(
- element,
+ int type = DialogPackageExplorerActionGroup.getType(element,
((IScriptFolder) element).getScriptProject());
if (type != DialogPackageExplorerActionGroup.PACKAGE_FRAGMENT
&& type != DialogPackageExplorerActionGroup.INCLUDED_FOLDER)
@@ -271,7 +271,7 @@
return;
// get all the view and editor parts
- List<IWorkbenchPart> parts = new ArrayList<IWorkbenchPart>();
+ List<IWorkbenchPart> parts = new ArrayList<>();
IWorkbenchPartReference refs[] = page.getViewReferences();
for (int i = 0; i < refs.length; i++) {
IWorkbenchPart part = refs[i].getPart(false);
@@ -291,8 +291,7 @@
if (part instanceof ISetSelectionTarget)
target = (ISetSelectionTarget) part;
else
- target = part
- .getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java
index e3d3cce..41eff19 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/AddLibraryToBuildpathAction.java
@@ -53,17 +53,17 @@
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.part.ISetSelectionTarget;
-public class AddLibraryToBuildpathAction extends Action implements
- ISelectionChangedListener {
+public class AddLibraryToBuildpathAction extends Action
+ implements ISelectionChangedListener {
private IScriptProject fSelectedProject;
private final IWorkbenchSite fSite;
public AddLibraryToBuildpathAction(IWorkbenchSite site) {
- super(
- NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_label,
+ super(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_label,
DLTKPluginImages.DESC_OBJS_LIBRARY);
- setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip);
+ setToolTipText(
+ NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip);
fSite = site;
}
@@ -127,12 +127,11 @@
IBuildpathEntry[] selected = getNewEntries();
if (selected != null) {
try {
- pm
- .beginTask(
- NewWizardMessages.BuildpathModifier_Monitor_AddToBuildpath,
- 4);
+ pm.beginTask(
+ NewWizardMessages.BuildpathModifier_Monitor_AddToBuildpath,
+ 4);
- List<BPListElement> addedEntries = new ArrayList<BPListElement>();
+ List<BPListElement> addedEntries = new ArrayList<>();
for (int i = 0; i < selected.length; i++) {
BPListElement listElement = BPListElement
.createFromExisting(selected[i], project);
@@ -143,11 +142,11 @@
if (pm.isCanceled())
throw new InterruptedException();
- List existingEntries = BuildpathModifier
+ List<BPListElement> existingEntries = BuildpathModifier
.getExistingEntries(project);
BuildpathModifier.setNewEntry(existingEntries,
- addedEntries, project, new SubProgressMonitor(
- pm, 1));
+ addedEntries, project,
+ new SubProgressMonitor(pm, 1));
if (pm.isCanceled())
throw new InterruptedException();
@@ -156,7 +155,8 @@
if (pm.isCanceled())
throw new InterruptedException();
- List result = new ArrayList(addedEntries.size());
+ List<BuildPathContainer> result = new ArrayList<>(
+ addedEntries.size());
for (int i = 0; i < addedEntries.size(); i++) {
result.add(new BuildPathContainer(project,
selected[i]));
@@ -232,7 +232,7 @@
return;
// get all the view and editor parts
- List parts = new ArrayList();
+ List<IWorkbenchPart> parts = new ArrayList<>();
IWorkbenchPartReference refs[] = page.getViewReferences();
for (int i = 0; i < refs.length; i++) {
IWorkbenchPart part = refs[i].getPart(false);
@@ -245,23 +245,22 @@
parts.add(refs[i].getPart(false));
}
- Iterator itr = parts.iterator();
+ Iterator<IWorkbenchPart> itr = parts.iterator();
while (itr.hasNext()) {
- IWorkbenchPart part = (IWorkbenchPart) itr.next();
+ IWorkbenchPart part = itr.next();
// get the part's ISetSelectionTarget implementation
ISetSelectionTarget target = null;
if (part instanceof ISetSelectionTarget)
target = (ISetSelectionTarget) part;
else
- target = part
- .getAdapter(ISetSelectionTarget.class);
+ target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
final ISetSelectionTarget finalTarget = target;
- page.getWorkbenchWindow().getShell().getDisplay().asyncExec(
- () -> finalTarget.selectReveal(selection));
+ page.getWorkbenchWindow().getShell().getDisplay()
+ .asyncExec(() -> finalTarget.selectReveal(selection));
}
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/BuildpathModifierDropDownAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/BuildpathModifierDropDownAction.java
index 59e62ca..8281d81 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/BuildpathModifierDropDownAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/BuildpathModifierDropDownAction.java
@@ -19,156 +19,171 @@
import org.eclipse.swt.widgets.Menu;
/**
- * Drop down action for toolbars containing <code>BuildpathModifierAction</code>s.
- * The drop down action manages a list of actions that are displayed when invocing
- * the drop down. If there is at least one valid action, then the drop down action
- * itself will also be valid and invocing run will delegate the call to the
- * first valid action in the list.
+ * Drop down action for toolbars containing
+ * <code>BuildpathModifierAction</code>s. The drop down action manages a list of
+ * actions that are displayed when invocing the drop down. If there is at least
+ * one valid action, then the drop down action itself will also be valid and
+ * invocing run will delegate the call to the first valid action in the list.
*/
-public class BuildpathModifierDropDownAction extends BuildpathModifierAction implements IMenuCreator {
+public class BuildpathModifierDropDownAction extends BuildpathModifierAction
+ implements IMenuCreator {
- /** The menu to be populated with items*/
- private Menu fMenu;
- /** A list of actions that will be used as
- * drop down items*/
+ /** The menu to be populated with items */
+ private Menu fMenu;
+ /**
+ * A list of actions that will be used as drop down items
+ */
protected List<BuildpathModifierAction> fActions;
- /** Index of the action that can be executed when clicking directly on the dropdown button.*/
- private int fIndex;
+ /**
+ * Index of the action that can be executed when clicking directly on the
+ * dropdown button.
+ */
+ private int fIndex;
- /**
- * Create a drop down action using the same descriptors as the provided action, but it's on
- * tool tip text. The action will automatically be put in the list of actions that are
- * managed by this drop down menu.
- *
- * @param action an action to be added to the dropdown menu
- * @param text a label text for the action
- * @param toolTipText the tooltip text for the drop down menu
- */
- public BuildpathModifierDropDownAction(BuildpathModifierAction action, String text, String toolTipText) {
- super(action.getOperation(), action.getImageDescriptor(), action.getDisabledImageDescriptor(),
- text, toolTipText, IAction.AS_DROP_DOWN_MENU);
- fActions = new ArrayList<BuildpathModifierAction>();
- fActions.add(action);
- fIndex= 0;
- }
+ /**
+ * Create a drop down action using the same descriptors as the provided
+ * action, but it's on tool tip text. The action will automatically be put
+ * in the list of actions that are managed by this drop down menu.
+ *
+ * @param action
+ * an action to be added to the dropdown menu
+ * @param text
+ * a label text for the action
+ * @param toolTipText
+ * the tooltip text for the drop down menu
+ */
+ public BuildpathModifierDropDownAction(BuildpathModifierAction action,
+ String text, String toolTipText) {
+ super(action.getOperation(), action.getImageDescriptor(),
+ action.getDisabledImageDescriptor(), text, toolTipText,
+ IAction.AS_DROP_DOWN_MENU);
+ fActions = new ArrayList<>();
+ fActions.add(action);
+ fIndex = 0;
+ }
- /**
- * Runs the first action of the list of managed actions that is valid.
- */
- @Override
+ /**
+ * Runs the first action of the list of managed actions that is valid.
+ */
+ @Override
public void run() {
BuildpathModifierAction action = fActions.get(fIndex);
- action.run();
- }
+ action.run();
+ }
- @Override
+ @Override
public IMenuCreator getMenuCreator() {
- return this;
- }
+ return this;
+ }
- @Override
+ @Override
public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
- fMenu = new Menu(parent);
- createEntries(fMenu);
- return fMenu;
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ fMenu = new Menu(parent);
+ createEntries(fMenu);
+ return fMenu;
- }
+ }
- @Override
+ @Override
public Menu getMenu(Menu parent) {
- return fMenu;
- }
+ return fMenu;
+ }
- /**
- * Add dynamically an action to the drop down menu.
- *
- * @param action the action to be added
- */
- public void addAction(BuildpathModifierAction action) {
- fActions.add(action);
- }
+ /**
+ * Add dynamically an action to the drop down menu.
+ *
+ * @param action
+ * the action to be added
+ */
+ public void addAction(BuildpathModifierAction action) {
+ fActions.add(action);
+ }
- /**
- * Add dynamically an array of actions to the
- * drop down menu.
- *
- * @param actions an array of actions to be added
- */
- public void addActions(BuildpathModifierAction[] actions) {
- for(int i= 0; i < actions.length; i++) {
- addAction(actions[i]);
- }
- }
+ /**
+ * Add dynamically an array of actions to the drop down menu.
+ *
+ * @param actions
+ * an array of actions to be added
+ */
+ public void addActions(BuildpathModifierAction[] actions) {
+ for (int i = 0; i < actions.length; i++) {
+ addAction(actions[i]);
+ }
+ }
- /**
- * Remove an action from the drop down menu
- *
- * @param action the action to be removed
- */
- public void removeAction(BuildpathModifierAction action) {
- fActions.remove(action);
- }
+ /**
+ * Remove an action from the drop down menu
+ *
+ * @param action
+ * the action to be removed
+ */
+ public void removeAction(BuildpathModifierAction action) {
+ fActions.remove(action);
+ }
- /**
- * Get all actions within this drop down menu.
- *
- * @return an array of actions
- */
- public BuildpathModifierAction[] getActions() {
+ /**
+ * Get all actions within this drop down menu.
+ *
+ * @return an array of actions
+ */
+ public BuildpathModifierAction[] getActions() {
return fActions.toArray(new BuildpathModifierAction[fActions.size()]);
- }
+ }
- /**
- * Populate the menu with the given action item
- *
- * @param parent the menu to add an action for
- * @param action the action to be added
- */
- private void addActionToMenu(Menu parent, IAction action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
+ /**
+ * Populate the menu with the given action item
+ *
+ * @param parent
+ * the menu to add an action for
+ * @param action
+ * the action to be added
+ */
+ private void addActionToMenu(Menu parent, IAction action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
- /**
- * Fill the menu with all actions
- *
- * @param menu the menu to be populated
- */
- private void createEntries(Menu menu) {
- for(int i= 0; i < fActions.size(); i++) {
+ /**
+ * Fill the menu with all actions
+ *
+ * @param menu
+ * the menu to be populated
+ */
+ private void createEntries(Menu menu) {
+ for (int i = 0; i < fActions.size(); i++) {
IAction action = fActions.get(i);
- addActionToMenu(menu, action);
- }
- }
+ addActionToMenu(menu, action);
+ }
+ }
- @Override
+ @Override
public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- fMenu = null;
- }
- }
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
- /**
- * Check all managed actions to find out if at least one is valid.
- * The first valid action that is found will be used when calling
- * <code>run()</code>.
- *
- * @return <code>true</code> if at least one of the managed actions is valid,
- * <code>false</code> otherwise.
- */
- @Override
- public boolean isValid(List selectedElements, int[] types) throws ModelException {
- for(int i= 0; i < fActions.size(); i++) {
+ /**
+ * Check all managed actions to find out if at least one is valid. The first
+ * valid action that is found will be used when calling <code>run()</code>.
+ *
+ * @return <code>true</code> if at least one of the managed actions is
+ * valid, <code>false</code> otherwise.
+ */
+ @Override
+ public boolean isValid(List selectedElements, int[] types)
+ throws ModelException {
+ for (int i = 0; i < fActions.size(); i++) {
BuildpathModifierAction action = fActions.get(i);
- if(action.isValid(selectedElements, types)) {
- fIndex= i;
- return true;
- }
- }
- return false;
- }
+ if (action.isValid(selectedElements, types)) {
+ fIndex = i;
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java
index a5f0fe6..e050034 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java
@@ -289,7 +289,7 @@
}
public BuildpathModifierAction[] getActions() {
- List<BuildpathModifierAction> result = new ArrayList<BuildpathModifierAction>();
+ List<BuildpathModifierAction> result = new ArrayList<>();
for (int i = 0; i < fActions.length; i++) {
BuildpathModifierAction action = fActions[i];
if (action instanceof BuildpathModifierDropDownAction) {
@@ -349,7 +349,7 @@
/**
* Forces the action group to recompute the available actions and fire an
* event to all listeners
- *
+ *
* @throws ModelException
*
* @see #setContext(DialogExplorerActionContext)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/GenerateBuildPathActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/GenerateBuildPathActionGroup.java
index e248f45..56b9d93 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/GenerateBuildPathActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/GenerateBuildPathActionGroup.java
@@ -115,11 +115,12 @@
}
// Needs to be public for the operation, will be protected later.
- public abstract boolean selectionChanged(IStructuredSelection selection);
+ public abstract boolean selectionChanged(
+ IStructuredSelection selection);
}
- private abstract static class CreateSourceFolderAction extends
- OpenBuildPathWizardAction {
+ private abstract static class CreateSourceFolderAction
+ extends OpenBuildPathWizardAction {
private AddSourceFolderWizard fAddSourceFolderWizard;
private IScriptProject fSelectedProject;
@@ -135,8 +136,8 @@
IBuildpathEntry.BPE_SOURCE, false);
BPListElement[] existing = BPListElement
.createFromExisting(fSelectedProject);
- boolean isProjectSrcFolder = BPListElement.isProjectSourceFolder(
- existing, fSelectedProject);
+ boolean isProjectSrcFolder = BPListElement
+ .isProjectSourceFolder(existing, fSelectedProject);
fAddSourceFolderWizard = new AddSourceFolderWizard(existing,
newEntrie, fIsLinked, false, false, isProjectSrcFolder,
isProjectSrcFolder);
@@ -168,14 +169,16 @@
}
- public static class CreateLocalSourceFolderAction extends
- CreateSourceFolderAction {
+ public static class CreateLocalSourceFolderAction
+ extends CreateSourceFolderAction {
public CreateLocalSourceFolderAction() {
super(false);
setText(ActionMessages.OpenNewSourceFolderWizardAction_text2);
- setDescription(ActionMessages.OpenNewSourceFolderWizardAction_description);
- setToolTipText(ActionMessages.OpenNewSourceFolderWizardAction_tooltip);
+ setDescription(
+ ActionMessages.OpenNewSourceFolderWizardAction_description);
+ setToolTipText(
+ ActionMessages.OpenNewSourceFolderWizardAction_tooltip);
setImageDescriptor(DLTKPluginImages.DESC_TOOL_NEWPACKROOT);
if (DLTKCore.DEBUG) {
System.err.println("Add help support here..."); //$NON-NLS-1$
@@ -185,15 +188,18 @@
}
}
- public static class CreateLinkedSourceFolderAction extends
- CreateSourceFolderAction {
+ public static class CreateLinkedSourceFolderAction
+ extends CreateSourceFolderAction {
public CreateLinkedSourceFolderAction() {
super(true);
setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_label);
- setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_tooltip);
- setImageDescriptor(DLTKPluginImages.DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH);
- setDescription(NewWizardMessages.PackageExplorerActionGroup_FormText_createLinkedFolder);
+ setToolTipText(
+ NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_tooltip);
+ setImageDescriptor(
+ DLTKPluginImages.DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH);
+ setDescription(
+ NewWizardMessages.PackageExplorerActionGroup_FormText_createLinkedFolder);
}
}
@@ -205,10 +211,14 @@
public EditFilterAction() {
setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_label);
- setDescription(NewWizardMessages.PackageExplorerActionGroup_FormText_Edit);
- setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip);
- setImageDescriptor(DLTKPluginImages.DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS);
- setDisabledImageDescriptor(DLTKPluginImages.DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS);
+ setDescription(
+ NewWizardMessages.PackageExplorerActionGroup_FormText_Edit);
+ setToolTipText(
+ NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip);
+ setImageDescriptor(
+ DLTKPluginImages.DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS);
+ setDisabledImageDescriptor(
+ DLTKPluginImages.DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS);
}
@Override
@@ -252,7 +262,8 @@
if (ProjectFragment.getKind() == IProjectFragment.K_SOURCE
&& project != null
&& findElement((IModelElement) element,
- BPListElement.createFromExisting(project)) != null) {
+ BPListElement.createFromExisting(
+ project)) != null) {
fSelectedProject = project;
fSelectedElement = (IModelElement) element;
return true;
@@ -313,7 +324,7 @@
private GenerateBuildPathActionGroup(IWorkbenchSite site) {
fSite = site;
- fActions = new ArrayList<Action>();
+ fActions = new ArrayList<>();
final CreateLinkedSourceFolderAction addLinkedSourceFolderAction = new CreateLinkedSourceFolderAction();
fActions.add(addLinkedSourceFolderAction);
@@ -364,7 +375,8 @@
for (Iterator iter = fActions.iterator(); iter.hasNext();) {
Action action = (Action) iter.next();
if (action instanceof ISelectionChangedListener) {
- provider.addSelectionChangedListener((ISelectionChangedListener) action);
+ provider.addSelectionChangedListener(
+ (ISelectionChangedListener) action);
}
}
@@ -461,7 +473,8 @@
for (Iterator<Action> iter = fActions.iterator(); iter.hasNext();) {
Action action = iter.next();
if (action instanceof ISelectionChangedListener)
- provider.removeSelectionChangedListener((ISelectionChangedListener) action);
+ provider.removeSelectionChangedListener(
+ (ISelectionChangedListener) action);
}
}
fActions = null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java
index b15c8d4..623f0fd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/IncludeToBuildpathAction.java
@@ -45,24 +45,27 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ISetSelectionTarget;
-
-public class IncludeToBuildpathAction extends Action implements ISelectionChangedListener {
+public class IncludeToBuildpathAction extends Action
+ implements ISelectionChangedListener {
private final IWorkbenchSite fSite;
- private final List fSelectedElements; //IResources
+ private final List fSelectedElements; // IResources
public IncludeToBuildpathAction(IWorkbenchSite site) {
- super(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Unexclude_label, DLTKPluginImages.DESC_ELCL_INCLUDE_ON_BUILDPATH);
- setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Unexclude_tooltip);
- setDisabledImageDescriptor(DLTKPluginImages.DESC_DLCL_INCLUDE_ON_BUILDPATH);
- fSite= site;
- fSelectedElements= new ArrayList();
+ super(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Unexclude_label,
+ DLTKPluginImages.DESC_ELCL_INCLUDE_ON_BUILDPATH);
+ setToolTipText(
+ NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Unexclude_tooltip);
+ setDisabledImageDescriptor(
+ DLTKPluginImages.DESC_DLCL_INCLUDE_ON_BUILDPATH);
+ fSite = site;
+ fSelectedElements = new ArrayList();
}
@Override
public void run() {
- IResource resource= (IResource)fSelectedElements.get(0);
- final IScriptProject project= DLTKCore.create(resource.getProject());
+ IResource resource = (IResource) fSelectedElements.get(0);
+ final IScriptProject project = DLTKCore.create(resource.getProject());
try {
final IRunnableWithProgress runnable = monitor -> {
@@ -74,10 +77,11 @@
throw new InvocationTargetException(e);
}
};
- PlatformUI.getWorkbench().getProgressService().run(true, false, runnable);
+ PlatformUI.getWorkbench().getProgressService().run(true, false,
+ runnable);
} catch (final InvocationTargetException e) {
if (e.getCause() instanceof CoreException) {
- showExceptionDialog((CoreException)e.getCause());
+ showExceptionDialog((CoreException) e.getCause());
} else {
DLTKUIPlugin.log(e);
}
@@ -85,24 +89,32 @@
}
}
- protected List unExclude(List elements, IScriptProject project, IProgressMonitor monitor) throws ModelException {
+ protected List unExclude(List elements, IScriptProject project,
+ IProgressMonitor monitor) throws ModelException {
if (monitor == null)
- monitor= new NullProgressMonitor();
+ monitor = new NullProgressMonitor();
try {
- monitor.beginTask(NewWizardMessages.BuildpathModifier_Monitor_Including, 2 * elements.size());
+ monitor.beginTask(
+ NewWizardMessages.BuildpathModifier_Monitor_Including,
+ 2 * elements.size());
- List entries= BuildpathModifier.getExistingEntries(project);
- for (int i= 0; i < elements.size(); i++) {
- IResource resource= (IResource) elements.get(i);
- IProjectFragment root= BuildpathModifier.getFragmentRoot(resource, project, new SubProgressMonitor(monitor, 1));
+ List entries = BuildpathModifier.getExistingEntries(project);
+ for (int i = 0; i < elements.size(); i++) {
+ IResource resource = (IResource) elements.get(i);
+ IProjectFragment root = BuildpathModifier.getFragmentRoot(
+ resource, project, new SubProgressMonitor(monitor, 1));
if (root != null) {
- BPListElement entry= BuildpathModifier.getBuildpathEntry(entries, root);
- BuildpathModifier.unExclude(resource, entry, project, new SubProgressMonitor(monitor, 1));
+ BPListElement entry = BuildpathModifier
+ .getBuildpathEntry(entries, root);
+ BuildpathModifier.unExclude(resource, entry, project,
+ new SubProgressMonitor(monitor, 1));
}
}
- BuildpathModifier.commitBuildPath(entries, project, new SubProgressMonitor(monitor, 4));
- List resultElements= BuildpathModifier.getCorrespondingElements(elements, project);
+ BuildpathModifier.commitBuildPath(entries, project,
+ new SubProgressMonitor(monitor, 4));
+ List resultElements = BuildpathModifier
+ .getCorrespondingElements(elements, project);
return resultElements;
} finally {
monitor.done();
@@ -125,12 +137,13 @@
try {
fSelectedElements.clear();
- for (Iterator iter= elements.iterator(); iter.hasNext();) {
- Object element= iter.next();
+ for (Iterator iter = elements.iterator(); iter.hasNext();) {
+ Object element = iter.next();
fSelectedElements.add(element);
if (element instanceof IResource) {
- IResource resource= (IResource)element;
- IScriptProject project= DLTKCore.create(resource.getProject());
+ IResource resource = (IResource) element;
+ IScriptProject project = DLTKCore
+ .create(resource.getProject());
if (project == null || !project.exists())
return false;
@@ -147,11 +160,14 @@
}
private void showExceptionDialog(CoreException exception) {
- showError(exception, fSite.getShell(), NewWizardMessages.IncludeToBuildpathAction_ErrorTitle, exception.getMessage());
+ showError(exception, fSite.getShell(),
+ NewWizardMessages.IncludeToBuildpathAction_ErrorTitle,
+ exception.getMessage());
}
- private void showError(CoreException e, Shell shell, String title, String message) {
- IStatus status= e.getStatus();
+ private void showError(CoreException e, Shell shell, String title,
+ String message) {
+ IStatus status = e.getStatus();
if (status != null) {
ErrorDialog.openError(shell, message, title, status);
} else {
@@ -161,20 +177,20 @@
private void selectAndReveal(final ISelection selection) {
// validate the input
- IWorkbenchPage page= fSite.getPage();
+ IWorkbenchPage page = fSite.getPage();
if (page == null)
return;
// get all the view and editor parts
- List<IWorkbenchPart> parts = new ArrayList<IWorkbenchPart>();
- IWorkbenchPartReference refs[]= page.getViewReferences();
- for (int i= 0; i < refs.length; i++) {
- IWorkbenchPart part= refs[i].getPart(false);
+ List<IWorkbenchPart> parts = new ArrayList<>();
+ IWorkbenchPartReference refs[] = page.getViewReferences();
+ for (int i = 0; i < refs.length; i++) {
+ IWorkbenchPart part = refs[i].getPart(false);
if (part != null)
parts.add(part);
}
- refs= page.getEditorReferences();
- for (int i= 0; i < refs.length; i++) {
+ refs = page.getEditorReferences();
+ for (int i = 0; i < refs.length; i++) {
if (refs[i].getPart(false) != null)
parts.add(refs[i].getPart(false));
}
@@ -182,15 +198,15 @@
for (IWorkbenchPart part : parts) {
// get the part's ISetSelectionTarget implementation
- ISetSelectionTarget target= null;
+ ISetSelectionTarget target = null;
if (part instanceof ISetSelectionTarget)
- target= (ISetSelectionTarget) part;
+ target = (ISetSelectionTarget) part;
else
target = part.getAdapter(ISetSelectionTarget.class);
if (target != null) {
// select and reveal resource
- final ISetSelectionTarget finalTarget= target;
+ final ISetSelectionTarget finalTarget = target;
page.getWorkbenchWindow().getShell().getDisplay()
.asyncExec(() -> finalTarget.selectReveal(selection));
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java
index c7368f1..8068caf 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/RemoveFromBuildpathAction.java
@@ -48,15 +48,17 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ISetSelectionTarget;
-
-public class RemoveFromBuildpathAction extends Action implements ISelectionChangedListener {
+public class RemoveFromBuildpathAction extends Action
+ implements ISelectionChangedListener {
private final IWorkbenchSite fSite;
private List fSelectedElements; // IPackageFramgentRoot || IScriptProject ||
// BuildpathContainer iff isEnabled()
public RemoveFromBuildpathAction(IWorkbenchSite site) {
- super(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_label, DLTKPluginImages.DESC_ELCL_REMOVE_FROM_BP);
- setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_tooltip);
+ super(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_label,
+ DLTKPluginImages.DESC_ELCL_REMOVE_FROM_BP);
+ setToolTipText(
+ NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_tooltip);
fSite = site;
fSelectedElements = new ArrayList();
}
@@ -98,7 +100,8 @@
monitor.done();
}
};
- PlatformUI.getWorkbench().getProgressService().run(true, false, runnable);
+ PlatformUI.getWorkbench().getProgressService().run(true, false,
+ runnable);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof CoreException) {
showExceptionDialog((CoreException) e.getCause());
@@ -112,9 +115,12 @@
}
}
- private void deleteFolders(List folders, IProgressMonitor monitor) throws CoreException {
+ private void deleteFolders(List folders, IProgressMonitor monitor)
+ throws CoreException {
try {
- monitor.beginTask(NewWizardMessages.BuildpathModifier_Monitor_RemoveFromBuildpath, folders.size());
+ monitor.beginTask(
+ NewWizardMessages.BuildpathModifier_Monitor_RemoveFromBuildpath,
+ folders.size());
for (Iterator iter = folders.iterator(); iter.hasNext();) {
IFolder folder = (IFolder) iter.next();
folder.delete(true, true, new SubProgressMonitor(monitor, 1));
@@ -124,42 +130,57 @@
}
}
- private List removeFromBuildpath(List elements, IScriptProject project, IProgressMonitor monitor) throws CoreException {
+ private List removeFromBuildpath(List elements, IScriptProject project,
+ IProgressMonitor monitor) throws CoreException {
try {
- monitor.beginTask(NewWizardMessages.BuildpathModifier_Monitor_RemoveFromBuildpath, elements.size() + 1);
- List existingEntries = BuildpathModifier.getExistingEntries(project);
+ monitor.beginTask(
+ NewWizardMessages.BuildpathModifier_Monitor_RemoveFromBuildpath,
+ elements.size() + 1);
+ List existingEntries = BuildpathModifier
+ .getExistingEntries(project);
List result = new ArrayList();
for (int i = 0; i < elements.size(); i++) {
Object element = elements.get(i);
if (element instanceof IScriptProject) {
- Object res = BuildpathModifier.removeFromBuildpath((IScriptProject) element, existingEntries, new SubProgressMonitor(
- monitor, 1));
+ Object res = BuildpathModifier.removeFromBuildpath(
+ (IScriptProject) element, existingEntries,
+ new SubProgressMonitor(monitor, 1));
result.add(res);
} else if (element instanceof IProjectFragment) {
- Object res = BuildpathModifier.removeFromBuildpath((IProjectFragment) element, existingEntries, project,
- new SubProgressMonitor(monitor, 1));
+ Object res = BuildpathModifier.removeFromBuildpath(
+ (IProjectFragment) element, existingEntries,
+ project, new SubProgressMonitor(monitor, 1));
if (res != null)
result.add(res);
} else {
- existingEntries.remove(BPListElement.createFromExisting(((BuildPathContainer) element).getBuildpathEntry(), project));
+ existingEntries.remove(BPListElement.createFromExisting(
+ ((BuildPathContainer) element).getBuildpathEntry(),
+ project));
}
}
- BuildpathModifier.commitBuildPath(existingEntries, project, new SubProgressMonitor(monitor, 1));
+ BuildpathModifier.commitBuildPath(existingEntries, project,
+ new SubProgressMonitor(monitor, 1));
return result;
} finally {
monitor.done();
}
}
- private void queryToRemoveLinkedFolders(final List elementsToRemove, final List foldersToDelete) throws ModelException {
- final Shell shell = fSite.getShell() != null ? fSite.getShell() : DLTKUIPlugin.getActiveWorkbenchShell();
+ private void queryToRemoveLinkedFolders(final List elementsToRemove,
+ final List foldersToDelete) throws ModelException {
+ final Shell shell = fSite.getShell() != null ? fSite.getShell()
+ : DLTKUIPlugin.getActiveWorkbenchShell();
for (Iterator iter = fSelectedElements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IProjectFragment) {
- IFolder folder = getLinkedSourceFolder((IProjectFragment) element);
+ IFolder folder = getLinkedSourceFolder(
+ (IProjectFragment) element);
if (folder != null) {
- RemoveLinkedFolderDialog dialog = new RemoveLinkedFolderDialog(shell, folder);
- final int result = dialog.open() == Window.OK ? dialog.getRemoveStatus() : IRemoveLinkedFolderQuery.REMOVE_CANCEL;
+ RemoveLinkedFolderDialog dialog = new RemoveLinkedFolderDialog(
+ shell, folder);
+ final int result = dialog.open() == Window.OK
+ ? dialog.getRemoveStatus()
+ : IRemoveLinkedFolderQuery.REMOVE_CANCEL;
if (result != IRemoveLinkedFolderQuery.REMOVE_CANCEL) {
if (result == IRemoveLinkedFolderQuery.REMOVE_BUILD_PATH) {
elementsToRemove.add(element);
@@ -177,7 +198,8 @@
}
}
- private IFolder getLinkedSourceFolder(IProjectFragment root) throws ModelException {
+ private IFolder getLinkedSourceFolder(IProjectFragment root)
+ throws ModelException {
if (root.getKind() != IProjectFragment.K_SOURCE)
return null;
final IResource resource = root.getCorrespondingResource();
@@ -207,15 +229,19 @@
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
fSelectedElements.add(element);
- if (!(element instanceof IProjectFragment || element instanceof IScriptProject || element instanceof BuildPathContainer))
+ if (!(element instanceof IProjectFragment
+ || element instanceof IScriptProject
+ || element instanceof BuildPathContainer))
return false;
if (element instanceof IScriptProject) {
IScriptProject project = (IScriptProject) element;
if (!BuildpathModifier.isSourceFolder(project))
return false;
} else if (element instanceof IProjectFragment) {
- IBuildpathEntry entry = ((IProjectFragment) element).getRawBuildpathEntry();
- if (entry != null && entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
+ IBuildpathEntry entry = ((IProjectFragment) element)
+ .getRawBuildpathEntry();
+ if (entry != null && entry
+ .getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
return false;
}
}
@@ -227,10 +253,13 @@
}
private void showExceptionDialog(CoreException exception) {
- showError(exception, fSite.getShell(), NewWizardMessages.RemoveFromBuildpathAction_ErrorTitle, exception.getMessage());
+ showError(exception, fSite.getShell(),
+ NewWizardMessages.RemoveFromBuildpathAction_ErrorTitle,
+ exception.getMessage());
}
- private void showError(CoreException e, Shell shell, String title, String message) {
+ private void showError(CoreException e, Shell shell, String title,
+ String message) {
IStatus status = e.getStatus();
if (status != null) {
ErrorDialog.openError(shell, message, title, status);
@@ -245,7 +274,7 @@
if (page == null)
return;
// get all the view and editor parts
- List<IWorkbenchPart> parts = new ArrayList<IWorkbenchPart>();
+ List<IWorkbenchPart> parts = new ArrayList<>();
IWorkbenchPartReference refs[] = page.getViewReferences();
for (int i = 0; i < refs.length; i++) {
IWorkbenchPart part = refs[i].getPart(false);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/CheckedListDialogField.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/CheckedListDialogField.java
index affeee0..9851396 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/CheckedListDialogField.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/CheckedListDialogField.java
@@ -40,8 +40,8 @@
public CheckedListDialogField(IListAdapter adapter,
String[] customButtonLabels, ILabelProvider lprovider) {
super(adapter, customButtonLabels, lprovider);
- fCheckedElements = new ArrayList<E>();
- fGrayedElements = new ArrayList<E>();
+ fCheckedElements = new ArrayList<>();
+ fGrayedElements = new ArrayList<>();
fCheckAllButtonIndex = -1;
fUncheckAllButtonIndex = -1;
@@ -114,7 +114,7 @@
// workaround for bug 53853
Object[] checked = ((CheckboxTableViewer) fTable)
.getCheckedElements();
- ArrayList<E> res = new ArrayList<E>(checked.length);
+ ArrayList<E> res = new ArrayList<>(checked.length);
for (int i = 0; i < checked.length; i++) {
@SuppressWarnings("unchecked")
final E element = (E) checked[i];
@@ -123,7 +123,7 @@
return res;
}
- return new ArrayList<E>(fCheckedElements);
+ return new ArrayList<>(fCheckedElements);
}
/**
@@ -156,7 +156,7 @@
* Sets the checked elements.
*/
public void setCheckedElements(Collection<E> list) {
- fCheckedElements = new ArrayList<E>(list);
+ fCheckedElements = new ArrayList<>(list);
if (isOkToUse(fTableControl)) {
((CheckboxTableViewer) fTable).setCheckedElements(list.toArray());
}
@@ -164,7 +164,7 @@
}
public void setGrayedElements(Collection<E> list) {
- fGrayedElements = new ArrayList<E>(list);
+ fGrayedElements = new ArrayList<>(list);
if (isOkToUse(fTableControl)) {
((CheckboxTableViewer) fTable).setGrayedElements(list.toArray());
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/ListDialogField.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/ListDialogField.java
index 5da8d0b..f9e78f1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/ListDialogField.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/ListDialogField.java
@@ -132,7 +132,7 @@
fListViewerAdapter = new ListViewerAdapter();
fParentElement = this;
- fElements = new ArrayList<E>(10);
+ fElements = new ArrayList<>(10);
fButtonLabels = buttonLabels;
if (fButtonLabels != null) {
@@ -593,7 +593,7 @@
* Sets the elements shown in the list.
*/
public void setElements(Collection<E> elements) {
- fElements = new ArrayList<E>(elements);
+ fElements = new ArrayList<>(elements);
if (isOkToUse(fTableControl)) {
fTable.refresh();
}
@@ -605,7 +605,7 @@
* can be modified by the user.
*/
public List<E> getElements() {
- return new ArrayList<E>(fElements);
+ return new ArrayList<>(fElements);
}
/**
@@ -690,7 +690,7 @@
if (nElements > 0) {
// filter duplicated
- ArrayList<E> elementsToAdd = new ArrayList<E>(nElements);
+ ArrayList<E> elementsToAdd = new ArrayList<>(nElements);
for (int i = 0; i < nElements; i++) {
E elem = elements.get(i);
@@ -816,7 +816,7 @@
private List<E> moveUp(List<E> elements, List<E> move) {
int nElements = elements.size();
- List<E> res = new ArrayList<E>(nElements);
+ List<E> res = new ArrayList<>(nElements);
E floating = null;
for (int i = 0; i < nElements; i++) {
E curr = elements.get(i);
@@ -850,7 +850,7 @@
}
private List<E> reverse(List<E> p) {
- List<E> reverse = new ArrayList<E>(p.size());
+ List<E> reverse = new ArrayList<>(p.size());
for (int i = p.size() - 1; i >= 0; i--) {
reverse.add(p.get(i));
}
@@ -902,7 +902,7 @@
* Returns the selected elements.
*/
public List<E> getSelectedElements() {
- List<E> result = new ArrayList<E>();
+ List<E> result = new ArrayList<>();
if (isOkToUse(fTableControl)) {
ISelection selection = fTable.getSelection();
if (selection instanceof IStructuredSelection) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/TreeListDialogField.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/TreeListDialogField.java
index 479aa60..ac74bed 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/TreeListDialogField.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/dialogfields/TreeListDialogField.java
@@ -896,12 +896,6 @@
doListSelected(event);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.
- * eclipse.jface.viewers.DoubleClickEvent)
- */
@Override
public void doubleClick(DoubleClickEvent event) {
doDoubleClick(event);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java
index c0c9bcf..dd383fc 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java
@@ -24,25 +24,26 @@
public ConfigureWorkingSetAction(IWorkbenchPartSite site) {
super(WorkingSetMessages.ConfigureWorkingSetAction_label);
- fSite= site;
+ fSite = site;
}
public void setWorkingSetModel(WorkingSetModel model) {
- fWorkingSetModel= model;
+ fWorkingSetModel = model;
}
@Override
public void run() {
- List<IWorkingSet> workingSets = new ArrayList<IWorkingSet>(
+ List<IWorkingSet> workingSets = new ArrayList<>(
Arrays.asList(fWorkingSetModel.getAllWorkingSets()));
- IWorkingSet[] activeWorkingSets= fWorkingSetModel.getActiveWorkingSets();
- WorkingSetConfigurationDialog dialog= new WorkingSetConfigurationDialog(
- fSite.getShell(),
+ IWorkingSet[] activeWorkingSets = fWorkingSetModel
+ .getActiveWorkingSets();
+ WorkingSetConfigurationDialog dialog = new WorkingSetConfigurationDialog(
+ fSite.getShell(),
workingSets.toArray(new IWorkingSet[workingSets.size()]),
- activeWorkingSets);
+ activeWorkingSets);
dialog.setSelection(activeWorkingSets);
if (dialog.open() == IDialogConstants.OK_ID) {
- IWorkingSet[] selection= dialog.getSelection();
+ IWorkingSet[] selection = dialog.getSelection();
fWorkingSetModel.setActiveWorkingSets(selection);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java
index 07dbe17..756bf13 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java
@@ -30,29 +30,30 @@
@Override
public void selectionChanged(IStructuredSelection selection) {
- IWorkingSet workingSet= getWorkingSet(selection);
- setEnabled(workingSet != null && !WorkingSetIDs.OTHERS.equals(workingSet.getId()));
+ IWorkingSet workingSet = getWorkingSet(selection);
+ setEnabled(workingSet != null
+ && !WorkingSetIDs.OTHERS.equals(workingSet.getId()));
}
private IWorkingSet getWorkingSet(IStructuredSelection selection) {
if (!(selection instanceof ITreeSelection))
return null;
- ITreeSelection treeSelection= (ITreeSelection)selection;
- List elements= treeSelection.toList();
- IWorkingSet result= null;
- for (Iterator iter= elements.iterator(); iter.hasNext();) {
- Object element= iter.next();
- TreePath[] paths= treeSelection.getPathsFor(element);
+ ITreeSelection treeSelection = (ITreeSelection) selection;
+ List elements = treeSelection.toList();
+ IWorkingSet result = null;
+ for (Iterator iter = elements.iterator(); iter.hasNext();) {
+ Object element = iter.next();
+ TreePath[] paths = treeSelection.getPathsFor(element);
if (paths.length != 1)
return null;
- TreePath path= paths[0];
+ TreePath path = paths[0];
if (path.getSegmentCount() != 2)
return null;
- Object candidate= path.getSegment(0);
+ Object candidate = path.getSegment(0);
if (!(candidate instanceof IWorkingSet))
return null;
if (result == null) {
- result= (IWorkingSet)candidate;
+ result = (IWorkingSet) candidate;
} else {
if (result != candidate)
return null;
@@ -63,13 +64,13 @@
@Override
public void run(IStructuredSelection selection) {
- IWorkingSet ws= getWorkingSet(selection);
+ IWorkingSet ws = getWorkingSet(selection);
if (ws == null)
return;
- List<IAdaptable> elements = new ArrayList<IAdaptable>(
+ List<IAdaptable> elements = new ArrayList<>(
Arrays.asList(ws.getElements()));
- List selectedElements= selection.toList();
- for (Iterator iter= selectedElements.iterator(); iter.hasNext();) {
+ List selectedElements = selection.toList();
+ for (Iterator iter = selectedElements.iterator(); iter.hasNext();) {
elements.remove(iter.next());
}
ws.setElements(elements.toArray(new IAdaptable[elements.size()]));
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
index d00f9d7..2ff4991 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
@@ -255,7 +255,7 @@
@Override
public void finish() {
String workingSetName = fWorkingSetName.getText();
- ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(10);
+ ArrayList<IAdaptable> elements = new ArrayList<>(10);
findCheckedElements(elements, fTree.getInput());
if (fWorkingSet == null) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java
index 6764053..7659ff3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java
@@ -27,7 +27,8 @@
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetUpdater;
-public class ScriptWorkingSetUpdater implements IWorkingSetUpdater, IElementChangedListener {
+public class ScriptWorkingSetUpdater
+ implements IWorkingSetUpdater, IElementChangedListener {
private List<IWorkingSet> fWorkingSets;
@@ -35,24 +36,28 @@
private IWorkingSet fWorkingSet;
private List<IAdaptable> fElements;
private boolean fChanged;
+
public WorkingSetDelta(IWorkingSet workingSet) {
- fWorkingSet= workingSet;
- fElements = new ArrayList<IAdaptable>(
+ fWorkingSet = workingSet;
+ fElements = new ArrayList<>(
Arrays.asList(workingSet.getElements()));
}
+
public int indexOf(Object element) {
return fElements.indexOf(element);
}
public void set(int index, IAdaptable element) {
fElements.set(index, element);
- fChanged= true;
+ fChanged = true;
}
+
public void remove(int index) {
if (fElements.remove(index) != null) {
- fChanged= true;
+ fChanged = true;
}
}
+
public void process() {
if (fChanged) {
fWorkingSet.setElements(
@@ -62,7 +67,7 @@
}
public ScriptWorkingSetUpdater() {
- fWorkingSets = new ArrayList<IWorkingSet>();
+ fWorkingSets = new ArrayList<>();
DLTKCore.addElementChangedListener(this);
}
@@ -77,22 +82,22 @@
@Override
public boolean remove(IWorkingSet workingSet) {
boolean result;
- synchronized(fWorkingSets) {
- result= fWorkingSets.remove(workingSet);
+ synchronized (fWorkingSets) {
+ result = fWorkingSets.remove(workingSet);
}
return result;
}
@Override
public boolean contains(IWorkingSet workingSet) {
- synchronized(fWorkingSets) {
+ synchronized (fWorkingSets) {
return fWorkingSets.contains(workingSet);
}
}
@Override
public void dispose() {
- synchronized(fWorkingSets) {
+ synchronized (fWorkingSets) {
fWorkingSets.clear();
}
DLTKCore.removeElementChangedListener(this);
@@ -101,16 +106,18 @@
@Override
public void elementChanged(ElementChangedEvent event) {
IWorkingSet[] workingSets;
- synchronized(fWorkingSets) {
+ synchronized (fWorkingSets) {
workingSets = fWorkingSets
.toArray(new IWorkingSet[fWorkingSets.size()]);
}
- for (int w= 0; w < workingSets.length; w++) {
- WorkingSetDelta workingSetDelta= new WorkingSetDelta(workingSets[w]);
+ for (int w = 0; w < workingSets.length; w++) {
+ WorkingSetDelta workingSetDelta = new WorkingSetDelta(
+ workingSets[w]);
processScriptDelta(workingSetDelta, event.getDelta());
- IResourceDelta[] resourceDeltas= event.getDelta().getResourceDeltas();
+ IResourceDelta[] resourceDeltas = event.getDelta()
+ .getResourceDeltas();
if (resourceDeltas != null) {
- for (int r= 0; r < resourceDeltas.length; r++) {
+ for (int r = 0; r < resourceDeltas.length; r++) {
processResourceDelta(workingSetDelta, resourceDeltas[r]);
}
}
@@ -118,17 +125,20 @@
}
}
- private void processScriptDelta(WorkingSetDelta result, IModelElementDelta delta) {
- IModelElement jElement= delta.getElement();
- int index= result.indexOf(jElement);
- int type= jElement.getElementType();
- int kind= delta.getKind();
- int flags= delta.getFlags();
- if (type == IModelElement.SCRIPT_PROJECT && kind == IModelElementDelta.CHANGED) {
+ private void processScriptDelta(WorkingSetDelta result,
+ IModelElementDelta delta) {
+ IModelElement jElement = delta.getElement();
+ int index = result.indexOf(jElement);
+ int type = jElement.getElementType();
+ int kind = delta.getKind();
+ int flags = delta.getFlags();
+ if (type == IModelElement.SCRIPT_PROJECT
+ && kind == IModelElementDelta.CHANGED) {
if (index != -1 && (flags & IModelElementDelta.F_CLOSED) != 0) {
- result.set(index, ((IScriptProject)jElement).getProject());
+ result.set(index, ((IScriptProject) jElement).getProject());
} else if ((flags & IModelElementDelta.F_OPENED) != 0) {
- index= result.indexOf(((IScriptProject)jElement).getProject());
+ index = result
+ .indexOf(((IScriptProject) jElement).getProject());
if (index != -1)
result.set(index, jElement);
}
@@ -142,33 +152,35 @@
}
}
}
- IResourceDelta[] resourceDeltas= delta.getResourceDeltas();
+ IResourceDelta[] resourceDeltas = delta.getResourceDeltas();
if (resourceDeltas != null) {
- for (int i= 0; i < resourceDeltas.length; i++) {
+ for (int i = 0; i < resourceDeltas.length; i++) {
processResourceDelta(result, resourceDeltas[i]);
}
}
- IModelElementDelta[] children= delta.getAffectedChildren();
- for (int i= 0; i < children.length; i++) {
+ IModelElementDelta[] children = delta.getAffectedChildren();
+ for (int i = 0; i < children.length; i++) {
processScriptDelta(result, children[i]);
}
}
- private void processResourceDelta(WorkingSetDelta result, IResourceDelta delta) {
- IResource resource= delta.getResource();
- int type= resource.getType();
- int index= result.indexOf(resource);
- int kind= delta.getKind();
- int flags= delta.getFlags();
- if (kind == IResourceDelta.CHANGED && type == IResource.PROJECT && index != -1) {
+ private void processResourceDelta(WorkingSetDelta result,
+ IResourceDelta delta) {
+ IResource resource = delta.getResource();
+ int type = resource.getType();
+ int index = result.indexOf(resource);
+ int kind = delta.getKind();
+ int flags = delta.getFlags();
+ if (kind == IResourceDelta.CHANGED && type == IResource.PROJECT
+ && index != -1) {
if ((flags & IResourceDelta.OPEN) != 0) {
result.set(index, resource);
}
}
if (index != -1 && kind == IResourceDelta.REMOVED) {
if ((flags & IResourceDelta.MOVED_TO) != 0) {
- result.set(index,
- ResourcesPlugin.getWorkspace().getRoot().findMember(delta.getMovedToPath()));
+ result.set(index, ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(delta.getMovedToPath()));
} else {
result.remove(index);
}
@@ -178,51 +190,53 @@
if (projectGotClosedOrOpened(resource, kind, flags))
return;
- IResourceDelta[] children= delta.getAffectedChildren();
- for (int i= 0; i < children.length; i++) {
+ IResourceDelta[] children = delta.getAffectedChildren();
+ for (int i = 0; i < children.length; i++) {
processResourceDelta(result, children[i]);
}
}
- private boolean projectGotClosedOrOpened(IResource resource, int kind, int flags) {
+ private boolean projectGotClosedOrOpened(IResource resource, int kind,
+ int flags) {
return resource.getType() == IResource.PROJECT
- && kind == IResourceDelta.CHANGED
- && (flags & IResourceDelta.OPEN) != 0;
+ && kind == IResourceDelta.CHANGED
+ && (flags & IResourceDelta.OPEN) != 0;
}
private void checkElementExistence(IWorkingSet workingSet) {
- List<IAdaptable> elements = new ArrayList<IAdaptable>(
+ List<IAdaptable> elements = new ArrayList<>(
Arrays.asList(workingSet.getElements()));
- boolean changed= false;
+ boolean changed = false;
for (Iterator<IAdaptable> iter = elements.iterator(); iter.hasNext();) {
IAdaptable element = iter.next();
- boolean remove= false;
+ boolean remove = false;
if (element instanceof IModelElement) {
- IModelElement jElement= (IModelElement)element;
+ IModelElement jElement = (IModelElement) element;
// If we have directly a project then remove it when it
// doesn't exist anymore. However if we have a sub element
// under a project only remove the element if the parent
// project is open. Otherwise we would remove all elements
// in closed projects.
if (jElement instanceof IScriptProject) {
- remove= !jElement.exists();
+ remove = !jElement.exists();
} else {
- IProject project= jElement.getScriptProject().getProject();
- remove= project.isOpen() && !jElement.exists();
+ IProject project = jElement.getScriptProject().getProject();
+ remove = project.isOpen() && !jElement.exists();
}
} else if (element instanceof IResource) {
- IResource resource= (IResource)element;
+ IResource resource = (IResource) element;
// See comments above
if (resource instanceof IProject) {
- remove= !resource.exists();
+ remove = !resource.exists();
} else {
- IProject project= resource.getProject();
- remove= (project != null ? project.isOpen() : true) && !resource.exists();
+ IProject project = resource.getProject();
+ remove = (project != null ? project.isOpen() : true)
+ && !resource.exists();
}
}
if (remove) {
iter.remove();
- changed= true;
+ changed = true;
}
}
if (changed) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java
index 993f616..73dcaae 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/WorkingSetModel.java
@@ -230,7 +230,7 @@
fLocalWorkingSetManager = PlatformUI.getWorkbench()
.createLocalWorkingSetManager();
addListenersToWorkingSetManagers();
- fActiveWorkingSets = new ArrayList<IWorkingSet>(2);
+ fActiveWorkingSets = new ArrayList<>(2);
if (memento == null || !restoreState(memento)) {
IWorkingSet others = fLocalWorkingSetManager.createWorkingSet(
@@ -346,7 +346,7 @@
}
public IWorkingSet[] getAllWorkingSets() {
- List<IWorkingSet> result = new ArrayList<IWorkingSet>();
+ List<IWorkingSet> result = new ArrayList<>();
result.addAll(fActiveWorkingSets);
IWorkingSet[] locals = fLocalWorkingSetManager.getWorkingSets();
for (int i = 0; i < locals.length; i++) {
@@ -363,8 +363,7 @@
}
public void setActiveWorkingSets(IWorkingSet[] workingSets) {
- fActiveWorkingSets = new ArrayList<IWorkingSet>(
- Arrays.asList(workingSets));
+ fActiveWorkingSets = new ArrayList<>(Arrays.asList(workingSets));
fElementMapper.rebuild(getActiveWorkingSets());
fOthersWorkingSetUpdater.updateElements();
fireEvent(new PropertyChangeEvent(this,
@@ -443,8 +442,7 @@
} else if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE
.equals(property)) {
IWorkingSet workingSet = (IWorkingSet) event.getOldValue();
- List<IWorkingSet> elements = new ArrayList<IWorkingSet>(
- fActiveWorkingSets);
+ List<IWorkingSet> elements = new ArrayList<>(fActiveWorkingSets);
elements.remove(workingSet);
setActiveWorkingSets(
elements.toArray(new IWorkingSet[elements.size()]));
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/AbstractDLTKUILanguageToolkit.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/AbstractDLTKUILanguageToolkit.java
index 9e3d83d..0028d1e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/AbstractDLTKUILanguageToolkit.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/AbstractDLTKUILanguageToolkit.java
@@ -24,8 +24,8 @@
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.ITextEditor;
-public abstract class AbstractDLTKUILanguageToolkit implements
- IDLTKUILanguageToolkit {
+public abstract class AbstractDLTKUILanguageToolkit
+ implements IDLTKUILanguageToolkit {
@Override
public ScriptUILabelProvider createScriptUILabelProvider() {
@@ -56,12 +56,12 @@
@Override
public IPreferenceStore getCombinedPreferenceStore() {
if (fCombinedPreferenceStore == null) {
- final List<IPreferenceStore> scopes = new ArrayList<IPreferenceStore>();
+ final List<IPreferenceStore> scopes = new ArrayList<>();
scopes.add(getPreferenceStore());
final String qualifier = getCoreToolkit().getPreferenceQualifier();
if (qualifier != null) {
- scopes.add(new EclipsePreferencesAdapter(
- InstanceScope.INSTANCE, qualifier));
+ scopes.add(new EclipsePreferencesAdapter(InstanceScope.INSTANCE,
+ qualifier));
}
scopes.add(DLTKUIPlugin.getDefault().getPreferenceStore());
scopes.add(new EclipsePreferencesAdapter(InstanceScope.INSTANCE,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKPluginImages.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKPluginImages.java
index 106a789..fcd6ef7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKPluginImages.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKPluginImages.java
@@ -24,7 +24,7 @@
import org.osgi.framework.Bundle;
public class DLTKPluginImages {
- //TODO: Please sort me...
+ // TODO: Please sort me...
public static final IPath ICONS_PATH = new Path("/icons/full"); //$NON-NLS-1$
private static final String NAME_PREFIX = "org.eclipse.dltk.ui."; //$NON-NLS-1$
@@ -40,12 +40,14 @@
private static final String T_ELCL = "elcl16"; //$NON-NLS-1$
private static final String T_DLCL = "dlcl16"; //$NON-NLS-1$
private static final String T_ETOOL = "etool16"; //$NON-NLS-1$
-// private static final String T_EVIEW = "eview16"; //$NON-NLS-1$
+ // private static final String T_EVIEW = "eview16"; //$NON-NLS-1$
- public static final String TERMINATE_CONSOLE = NAME_PREFIX + "term_sbook.gif"; //$NON-NLS-1$
+ public static final String TERMINATE_CONSOLE = NAME_PREFIX
+ + "term_sbook.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_GHOST = NAME_PREFIX + "unknown_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_CLASSALT = NAME_PREFIX + "classfo_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CLASSALT = NAME_PREFIX
+ + "classfo_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_CLASS = NAME_PREFIX + "class_obj.png"; //$NON-NLS-1$
/**
* @since 3.0
@@ -53,22 +55,26 @@
public static final String IMG_OBJS_ENUM = NAME_PREFIX + "enum_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_NAMESPACE = NAME_PREFIX
+ "namespace_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ERROROBJ = NAME_PREFIX + "error_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ERROROBJ = NAME_PREFIX
+ + "error_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_TEST = NAME_PREFIX + "test_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_TESTCASE = NAME_PREFIX
+ "testcase_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_MODULE = NAME_PREFIX + "module_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_LIBRARY = NAME_PREFIX + "library_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_LIBRARY = NAME_PREFIX
+ + "library_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_LIBRARY_SRC = NAME_PREFIX
+ "library_src_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ACCESSRULES_ATTRIB = NAME_PREFIX + "access_restriction_attrib.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ACCESSRULES_ATTRIB = NAME_PREFIX
+ + "access_restriction_attrib.png"; //$NON-NLS-1$
/**
* @since 2.0
*/
public static final String IMG_OBJS_JAVADOCTAG = NAME_PREFIX
+ "jdoc_tag_obj.png"; //$NON-NLS-1$
- public static final String IMG_CORRECTION_CHANGE= NAME_PREFIX + "correction_change.png"; //$NON-NLS-1$
+ public static final String IMG_CORRECTION_CHANGE = NAME_PREFIX
+ + "correction_change.png"; //$NON-NLS-1$
public static final String IMG_CORRECTION_ADD = NAME_PREFIX
+ "add_correction.png"; //$NON-NLS-1$
public static final String IMG_CORRECTION_CAST = NAME_PREFIX
@@ -80,58 +86,91 @@
public static final String IMG_CORRECTION_RENAME = NAME_PREFIX
+ "correction_rename.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ANNOTATION= NAME_PREFIX + "annotation_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ANNOTATION_DEFAULT= NAME_PREFIX + "annotation_default_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ANNOTATION_PROTECTED= NAME_PREFIX + "annotation_protected_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ANNOTATION_PRIVATE= NAME_PREFIX + "annotation_private_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ANNOTATION_ALT= NAME_PREFIX + "annotation_alt_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ANNOTATION = NAME_PREFIX
+ + "annotation_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ANNOTATION_DEFAULT = NAME_PREFIX
+ + "annotation_default_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ANNOTATION_PROTECTED = NAME_PREFIX
+ + "annotation_protected_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ANNOTATION_PRIVATE = NAME_PREFIX
+ + "annotation_private_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ANNOTATION_ALT = NAME_PREFIX
+ + "annotation_alt_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_CLASS_PUBLIC= NAME_PREFIX + "innerclass_public_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_CLASS_DEFAULT= NAME_PREFIX + "innerclass_default_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_CLASS_PROTECTED= NAME_PREFIX + "innerclass_protected_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_CLASS_PRIVATE= NAME_PREFIX + "innerclass_private_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_CLASS_PUBLIC = NAME_PREFIX
+ + "innerclass_public_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_CLASS_DEFAULT = NAME_PREFIX
+ + "innerclass_default_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_CLASS_PROTECTED = NAME_PREFIX
+ + "innerclass_protected_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_CLASS_PRIVATE = NAME_PREFIX
+ + "innerclass_private_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INTERFACE= NAME_PREFIX + "int_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INTERFACEALT= NAME_PREFIX + "intf_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INTERFACE_DEFAULT= NAME_PREFIX + "int_default_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INTERFACE = NAME_PREFIX + "int_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INTERFACEALT = NAME_PREFIX
+ + "intf_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INTERFACE_DEFAULT = NAME_PREFIX
+ + "int_default_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_INTERFACE_PUBLIC= NAME_PREFIX + "innerinterface_public_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_INTERFACE_DEFAULT= NAME_PREFIX + "innerinterface_default_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_INTERFACE_PROTECTED= NAME_PREFIX + "innerinterface_protected_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_INNER_INTERFACE_PRIVATE= NAME_PREFIX + "innerinterface_private_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_INTERFACE_PUBLIC = NAME_PREFIX
+ + "innerinterface_public_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_INTERFACE_DEFAULT = NAME_PREFIX
+ + "innerinterface_default_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_INTERFACE_PROTECTED = NAME_PREFIX
+ + "innerinterface_protected_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_INNER_INTERFACE_PRIVATE = NAME_PREFIX
+ + "innerinterface_private_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_FIELD = NAME_PREFIX + "field_default_obj.png"; //$NON-NLS-1$
- public static final String IMG_FIELD_DEFAULT = NAME_PREFIX + "field_default_obj.png"; //$NON-NLS-1$
- public static final String IMG_FIELD_PRIVATE = NAME_PREFIX + "field_private_obj.png"; //$NON-NLS-1$
- public static final String IMG_FIELD_PROTECTED = NAME_PREFIX + "field_protected_obj.png"; //$NON-NLS-1$
- public static final String IMG_FIELD_PUBLIC = NAME_PREFIX + "field_public_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_FIELD = NAME_PREFIX
+ + "field_default_obj.png"; //$NON-NLS-1$
+ public static final String IMG_FIELD_DEFAULT = NAME_PREFIX
+ + "field_default_obj.png"; //$NON-NLS-1$
+ public static final String IMG_FIELD_PRIVATE = NAME_PREFIX
+ + "field_private_obj.png"; //$NON-NLS-1$
+ public static final String IMG_FIELD_PROTECTED = NAME_PREFIX
+ + "field_protected_obj.png"; //$NON-NLS-1$
+ public static final String IMG_FIELD_PUBLIC = NAME_PREFIX
+ + "field_public_obj.png"; //$NON-NLS-1$
- public static final String IMG_METHOD_PUBLIC = NAME_PREFIX + "methpub_obj.png"; //$NON-NLS-1$
- public static final String IMG_METHOD_PROTECTED = NAME_PREFIX + "methpro_obj.png"; //$NON-NLS-1$
- public static final String IMG_METHOD_PRIVATE= NAME_PREFIX + "methpri_obj.png"; //$NON-NLS-1$
- public static final String IMG_METHOD_DEFAULT = NAME_PREFIX + "methdef_obj.png"; //$NON-NLS-1$
+ public static final String IMG_METHOD_PUBLIC = NAME_PREFIX
+ + "methpub_obj.png"; //$NON-NLS-1$
+ public static final String IMG_METHOD_PROTECTED = NAME_PREFIX
+ + "methpro_obj.png"; //$NON-NLS-1$
+ public static final String IMG_METHOD_PRIVATE = NAME_PREFIX
+ + "methpri_obj.png"; //$NON-NLS-1$
+ public static final String IMG_METHOD_DEFAULT = NAME_PREFIX
+ + "methdef_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_NLS_TRANSLATE = NAME_PREFIX + "translate.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_NLS_NEVER_TRANSLATE = NAME_PREFIX + "never_translate.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_NLS_TRANSLATE = NAME_PREFIX
+ + "translate.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_NLS_NEVER_TRANSLATE = NAME_PREFIX
+ + "never_translate.png"; //$NON-NLS-1$
public static final String IMG_OBJS_NLS_SKIP = NAME_PREFIX + "skip.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_REFACTORING_FATAL = NAME_PREFIX + "fatalerror_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_REFACTORING_ERROR = NAME_PREFIX + "error_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_REFACTORING_WARNING = NAME_PREFIX + "warning_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_REFACTORING_INFO = NAME_PREFIX + "info_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_REFACTORING_FATAL = NAME_PREFIX
+ + "fatalerror_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_REFACTORING_ERROR = NAME_PREFIX
+ + "error_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_REFACTORING_WARNING = NAME_PREFIX
+ + "warning_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_REFACTORING_INFO = NAME_PREFIX
+ + "info_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_CUNIT = NAME_PREFIX + "jcu_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_CUNIT_RESOURCE = NAME_PREFIX
+ "jcu_resource_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_CFILE = NAME_PREFIX + "classf_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_CFILECLASS = NAME_PREFIX + "class_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CFILECLASS = NAME_PREFIX
+ + "class_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_CFILEINT = NAME_PREFIX + "int_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_LOGICAL_PACKAGE = NAME_PREFIX
+ "logical_package_obj.png";//$NON-NLS-1$
- public static final String IMG_OBJS_EMPTY_LOGICAL_PACKAGE = NAME_PREFIX + "empty_logical_package_obj.png";//$NON-NLS-1$
+ public static final String IMG_OBJS_EMPTY_LOGICAL_PACKAGE = NAME_PREFIX
+ + "empty_logical_package_obj.png";//$NON-NLS-1$
public static final String IMG_OBJS_PACKAGE = NAME_PREFIX
+ "package_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_EMPTY_PACK_RESOURCE = NAME_PREFIX
+ "empty_pack_fldr_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_EMPTY_PACKAGE = NAME_PREFIX + "empty_pack_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EMPTY_PACKAGE = NAME_PREFIX
+ + "empty_pack_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_PACKFRAG_ROOT = NAME_PREFIX
+ "packagefolder_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_ZIP = NAME_PREFIX + "jar_obj.png"; //$NON-NLS-1$
@@ -142,22 +181,28 @@
+ "jar_lsrc_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_ENV_VAR = NAME_PREFIX
+ "envvar_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_MODEL = NAME_PREFIX + "java_model_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_UNKNOWN = NAME_PREFIX + "unknown_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_MODEL = NAME_PREFIX
+ + "java_model_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_UNKNOWN = NAME_PREFIX
+ + "unknown_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_LOCAL_VARIABLE = NAME_PREFIX
+ "localvariable_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_KEYWORD = NAME_PREFIX
+ "keyword_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_PROJECT_SETTINGS = NAME_PREFIX + "settings_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_TEMPLATE= NAME_PREFIX + "template_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_PROJECT_SETTINGS = NAME_PREFIX
+ + "settings_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_TEMPLATE = NAME_PREFIX
+ + "template_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_PACKDECL = NAME_PREFIX
+ "packd_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_IMPDECL = NAME_PREFIX + "imp_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_IMPCONT = NAME_PREFIX + "impc_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_JSEARCH = NAME_PREFIX
+ "jsearch_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_SEARCH_DECL= NAME_PREFIX + "search_decl_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_SEARCH_REF= NAME_PREFIX + "search_ref_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_SEARCH_DECL = NAME_PREFIX
+ + "search_decl_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_SEARCH_REF = NAME_PREFIX
+ + "search_ref_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_JAR = NAME_PREFIX + "jar_obj.png"; //$NON-NLS-1$
public static final String IMG_OBJS_EXTJAR = NAME_PREFIX + "jar_l_obj.png"; //$NON-NLS-1$
@@ -166,37 +211,54 @@
public static final String IMG_OBJS_EXTJAR_WSRC = NAME_PREFIX
+ "jar_lsrc_obj.png"; //$NON-NLS-1$
- public static final String IMG_ELCL_VIEW_MENU= NAME_PREFIX + T_ELCL + "view_menu.png"; //$NON-NLS-1$
- public static final String IMG_DLCL_VIEW_MENU= NAME_PREFIX + T_DLCL + "view_menu.png"; //$NON-NLS-1$
+ public static final String IMG_ELCL_VIEW_MENU = NAME_PREFIX + T_ELCL
+ + "view_menu.png"; //$NON-NLS-1$
+ public static final String IMG_DLCL_VIEW_MENU = NAME_PREFIX + T_DLCL
+ + "view_menu.png"; //$NON-NLS-1$
public static final String IMG_OBJS_SEARCH_OCCURRENCE = NAME_PREFIX
+ "occ_match.png"; //$NON-NLS-1$
- //TERMINATE_CONSOLE
+ // TERMINATE_CONSOLE
- public static final ImageDescriptor DESC_TERMINATE_CONSOLE = createUnManaged(T_ELCL, "ch_cancel.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_SAVE_SESSION = createUnManaged(T_ELCL, "save.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TERMINATE_CONSOLE = createUnManaged(
+ T_ELCL, "ch_cancel.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_SAVE_SESSION = createUnManaged(
+ T_ELCL, "save.gif"); //$NON-NLS-1$
- public static final String IMG_OBJS_EXCEPTION= NAME_PREFIX + "jexception_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_ERROR= NAME_PREFIX + "error_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXCEPTION = NAME_PREFIX
+ + "jexception_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ERROR = NAME_PREFIX + "error_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_BREAKPOINT_INSTALLED= NAME_PREFIX + "brkpi_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_QUICK_ASSIST= NAME_PREFIX + "quickassist_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_FIXABLE_PROBLEM= NAME_PREFIX + "quickfix_warning_obj.png"; //$NON-NLS-1$
- public static final String IMG_OBJS_FIXABLE_ERROR= NAME_PREFIX + "quickfix_error_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_BREAKPOINT_INSTALLED = NAME_PREFIX
+ + "brkpi_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_QUICK_ASSIST = NAME_PREFIX
+ + "quickassist_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_FIXABLE_PROBLEM = NAME_PREFIX
+ + "quickfix_warning_obj.png"; //$NON-NLS-1$
+ public static final String IMG_OBJS_FIXABLE_ERROR = NAME_PREFIX
+ + "quickfix_error_obj.png"; //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB = createUnManaged(
+ T_OBJ, "exclusion_filter_attrib.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_INCLUSION_FILTER_ATTRIB = createUnManaged(
+ T_OBJ, "inclusion_filter_attrib.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_OUTPUT_FOLDER_ATTRIB = createUnManaged(
+ T_OBJ, "output_folder_attrib.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB = createUnManaged(
+ T_OBJ, "source_attach_attrib.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_JAVADOC_LOCATION_ATTRIB = createUnManaged(
+ T_OBJ, "javadoc_location_attrib.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_INFO_OBJ = createUnManaged(
+ T_OBJ, "info_obj.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB = createUnManaged(T_OBJ, "exclusion_filter_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_INCLUSION_FILTER_ATTRIB = createUnManaged(T_OBJ, "inclusion_filter_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_OUTPUT_FOLDER_ATTRIB = createUnManaged(T_OBJ, "output_folder_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB = createUnManaged(T_OBJ, "source_attach_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_JAVADOC_LOCATION_ATTRIB = createUnManaged(T_OBJ, "javadoc_location_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_INFO_OBJ = createUnManaged(T_OBJ, "info_obj.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_ACCESSRULES_ATTRIB = createManagedFromKey(
+ T_OBJ, IMG_OBJS_ACCESSRULES_ATTRIB);
+ public static final ImageDescriptor DESC_OBJS_NATIVE_LIB_PATH_ATTRIB = createUnManaged(
+ T_OBJ, "native_lib_path_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_ACCESSRULES_ATTRIB = createManagedFromKey(T_OBJ, IMG_OBJS_ACCESSRULES_ATTRIB);
- public static final ImageDescriptor DESC_OBJS_NATIVE_LIB_PATH_ATTRIB = createUnManaged(T_OBJ, "native_lib_path_attrib.png"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_OBJS_CLASS= createManagedFromKey(T_OBJ, IMG_OBJS_CLASS);
+ public static final ImageDescriptor DESC_OBJS_CLASS = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CLASS);
/**
* @since 4.1
@@ -209,179 +271,310 @@
*/
public static final ImageDescriptor DESC_OBJS_ENUM = createManagedFromKey(
T_OBJ, IMG_OBJS_ENUM);
- public static final ImageDescriptor DESC_OBJS_INTERFACE= createManagedFromKey(T_OBJ, IMG_OBJS_INTERFACE);
- public static final ImageDescriptor DESC_OBJS_NAMESPACE= createManagedFromKey(T_OBJ, IMG_OBJS_NAMESPACE);
- public static final ImageDescriptor DESC_OBJS_ERROR= createManagedFromKey(T_OBJ, IMG_OBJS_ERROROBJ);
- public static final ImageDescriptor DESC_OBJS_TEST= createManagedFromKey(T_OBJ, IMG_OBJS_TEST);
- public static final ImageDescriptor DESC_OBJS_TESTCASE= createManagedFromKey(T_OBJ, IMG_OBJS_TESTCASE);
- public static final ImageDescriptor DESC_OBJS_MODULE= createManagedFromKey(T_OBJ, IMG_OBJS_MODULE);
- public static final ImageDescriptor DESC_OBJS_TEMPLATE= createManagedFromKey(T_OBJ, IMG_OBJS_TEMPLATE);
- public static final ImageDescriptor DESC_OVR_CONSTRUCTOR = createUnManaged(T_OVR, "constr_ovr.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_ABSTRACT = createUnManaged(T_OVR, "abstract_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_FINAL = createUnManaged(T_OVR, "final_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_OVERRIDES = createUnManaged(T_OVR, "over_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_IMPLEMENTS = createUnManaged(T_OVR, "implm_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_STATIC = createUnManaged(T_OVR, "static_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_RECURSIVE = createUnManaged(T_OVR, "recursive_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_CALLER = createUnManaged(T_OVR, "read.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_MAX_LEVEL = createUnManaged(T_OVR, "maxlevel_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWCLASS = createUnManaged(T_WIZBAN, "newclass_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWINT = createUnManaged(T_WIZBAN, "newint_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWENUM = createUnManaged(T_WIZBAN, "newenum_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWANNOT = createUnManaged(T_WIZBAN, "newannotation_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_INTERFACE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_INTERFACE);
+ public static final ImageDescriptor DESC_OBJS_NAMESPACE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_NAMESPACE);
+ public static final ImageDescriptor DESC_OBJS_ERROR = createManagedFromKey(
+ T_OBJ, IMG_OBJS_ERROROBJ);
+ public static final ImageDescriptor DESC_OBJS_TEST = createManagedFromKey(
+ T_OBJ, IMG_OBJS_TEST);
+ public static final ImageDescriptor DESC_OBJS_TESTCASE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_TESTCASE);
+ public static final ImageDescriptor DESC_OBJS_MODULE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_MODULE);
+ public static final ImageDescriptor DESC_OBJS_TEMPLATE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_TEMPLATE);
+ public static final ImageDescriptor DESC_OVR_CONSTRUCTOR = createUnManaged(
+ T_OVR, "constr_ovr.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_ABSTRACT = createUnManaged(
+ T_OVR, "abstract_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_FINAL = createUnManaged(T_OVR,
+ "final_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_OVERRIDES = createUnManaged(
+ T_OVR, "over_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_IMPLEMENTS = createUnManaged(
+ T_OVR, "implm_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_STATIC = createUnManaged(T_OVR,
+ "static_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_RECURSIVE = createUnManaged(
+ T_OVR, "recursive_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_CALLER = createUnManaged(T_OVR,
+ "read.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_MAX_LEVEL = createUnManaged(
+ T_OVR, "maxlevel_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWCLASS = createUnManaged(
+ T_WIZBAN, "newclass_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWINT = createUnManaged(
+ T_WIZBAN, "newint_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWENUM = createUnManaged(
+ T_WIZBAN, "newenum_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWANNOT = createUnManaged(
+ T_WIZBAN, "newannotation_wiz.png"); //$NON-NLS-1$
/**
* @deprecated
*/
@Deprecated
- public static final ImageDescriptor DESC_WIZBAN_NEWPRJ = createUnManaged(T_WIZBAN, "newprj_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR = createUnManaged(T_WIZBAN, "newsrcfldr_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWMETH = createUnManaged(T_WIZBAN, "newmeth_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWPACK = createUnManaged(T_WIZBAN, "newpack_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_NEWSCRAPPAGE = createUnManaged(T_WIZBAN, "newsbook_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_JAVA_LAUNCH = createUnManaged(T_WIZBAN, "java_app_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_JAVA_ATTACH = createUnManaged(T_WIZBAN, "java_attach_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR = createUnManaged(T_WIZBAN, "refactor_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD = createUnManaged(T_WIZBAN, "fieldrefact_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD = createUnManaged(T_WIZBAN, "methrefact_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE = createUnManaged(T_WIZBAN, "typerefact_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PACKAGE = createUnManaged(T_WIZBAN, "packrefact_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CODE = createUnManaged(T_WIZBAN, "coderefact_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CU = createUnManaged(T_WIZBAN, "compunitrefact_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PULL_UP = createUnManaged(T_WIZBAN, "pullup_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIX_DEPRECATION = createUnManaged(T_WIZBAN, "fixdepr_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_JAR_PACKAGER = createUnManaged(T_WIZBAN, "jar_pack_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REFACTOR_EXTRACT_SUPERTYPE = createUnManaged(T_WIZBAN, "extractsupertype_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_REPLACE_JAR = createUnManaged(T_WIZBAN, "replacejar_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_SCRIPT_WORKINGSET = createUnManaged(T_WIZBAN, "java_workingset_wiz.png");//$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_EXPORT_JAVADOC = createUnManaged(T_WIZBAN, "export_javadoc_wiz.png");//$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_EXTERNALIZE_STRINGS = createUnManaged(T_WIZBAN, "extstr_wiz.png");//$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY = createUnManaged(T_WIZBAN, "addlibrary_wiz.png");//$NON-NLS-1$
- public static final ImageDescriptor DESC_WIZBAN_CLEAN_UP = createUnManaged(T_WIZBAN, "cleanup_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWPRJ = createUnManaged(
+ T_WIZBAN, "newprj_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR = createUnManaged(
+ T_WIZBAN, "newsrcfldr_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWMETH = createUnManaged(
+ T_WIZBAN, "newmeth_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWPACK = createUnManaged(
+ T_WIZBAN, "newpack_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_NEWSCRAPPAGE = createUnManaged(
+ T_WIZBAN, "newsbook_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_JAVA_LAUNCH = createUnManaged(
+ T_WIZBAN, "java_app_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_JAVA_ATTACH = createUnManaged(
+ T_WIZBAN, "java_attach_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR = createUnManaged(
+ T_WIZBAN, "refactor_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIELD = createUnManaged(
+ T_WIZBAN, "fieldrefact_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_METHOD = createUnManaged(
+ T_WIZBAN, "methrefact_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_TYPE = createUnManaged(
+ T_WIZBAN, "typerefact_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PACKAGE = createUnManaged(
+ T_WIZBAN, "packrefact_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CODE = createUnManaged(
+ T_WIZBAN, "coderefact_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_CU = createUnManaged(
+ T_WIZBAN, "compunitrefact_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_PULL_UP = createUnManaged(
+ T_WIZBAN, "pullup_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_FIX_DEPRECATION = createUnManaged(
+ T_WIZBAN, "fixdepr_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_JAR_PACKAGER = createUnManaged(
+ T_WIZBAN, "jar_pack_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REFACTOR_EXTRACT_SUPERTYPE = createUnManaged(
+ T_WIZBAN, "extractsupertype_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_REPLACE_JAR = createUnManaged(
+ T_WIZBAN, "replacejar_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_SCRIPT_WORKINGSET = createUnManaged(
+ T_WIZBAN, "java_workingset_wiz.png");//$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_EXPORT_JAVADOC = createUnManaged(
+ T_WIZBAN, "export_javadoc_wiz.png");//$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_EXTERNALIZE_STRINGS = createUnManaged(
+ T_WIZBAN, "extstr_wiz.png");//$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_ADD_LIBRARY = createUnManaged(
+ T_WIZBAN, "addlibrary_wiz.png");//$NON-NLS-1$
+ public static final ImageDescriptor DESC_WIZBAN_CLEAN_UP = createUnManaged(
+ T_WIZBAN, "cleanup_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_BUILDPATH_ORDER= createUnManaged(T_OBJ, "cp_order_obj.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_BUILDPATH_ORDER = createUnManaged(
+ T_OBJ, "cp_order_obj.png"); //$NON-NLS-1$
/*
* Set of predefined Image Descriptors.
*/
- public static final ImageDescriptor DESC_ELCL_FILTER = createUnManaged(T_ELCL, "filter_ps.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_FILTER = createUnManaged(T_DLCL, "filter_ps.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_FILTER = createUnManaged(
+ T_ELCL, "filter_ps.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_FILTER = createUnManaged(
+ T_DLCL, "filter_ps.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_VIEW_MENU = createUnManaged(T_ELCL, "view_menu.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_VIEW_MENU = createUnManaged(T_DLCL, "view_menu.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_VIEW_MENU = createUnManaged(
+ T_ELCL, "view_menu.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_VIEW_MENU = createUnManaged(
+ T_DLCL, "view_menu.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_JAR = createManagedFromKey(
+ T_OBJ, IMG_OBJS_JAR);
+ public static final ImageDescriptor DESC_OBJS_EXTJAR = createManagedFromKey(
+ T_OBJ, IMG_OBJS_EXTJAR);
+ public static final ImageDescriptor DESC_OBJS_JAR_WSRC = createManagedFromKey(
+ T_OBJ, IMG_OBJS_JAR_WSRC);
+ public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC = createManagedFromKey(
+ T_OBJ, IMG_OBJS_EXTJAR_WSRC);
+ public static final ImageDescriptor DESC_OBJS_ENV_VAR = createManagedFromKey(
+ T_OBJ, IMG_OBJS_ENV_VAR);
- public static final ImageDescriptor DESC_OBJS_JAR= createManagedFromKey(T_OBJ, IMG_OBJS_JAR);
- public static final ImageDescriptor DESC_OBJS_EXTJAR= createManagedFromKey(T_OBJ, IMG_OBJS_EXTJAR);
- public static final ImageDescriptor DESC_OBJS_JAR_WSRC= createManagedFromKey(T_OBJ, IMG_OBJS_JAR_WSRC);
- public static final ImageDescriptor DESC_OBJS_EXTJAR_WSRC= createManagedFromKey(T_OBJ, IMG_OBJS_EXTJAR_WSRC);
- public static final ImageDescriptor DESC_OBJS_ENV_VAR= createManagedFromKey(T_OBJ, IMG_OBJS_ENV_VAR);
+ public static final ImageDescriptor DESC_OBJS_PACKDECL = createManagedFromKey(
+ T_OBJ, IMG_OBJS_PACKDECL);
+ public static final ImageDescriptor DESC_OBJS_IMPDECL = createManagedFromKey(
+ T_OBJ, IMG_OBJS_IMPDECL);
+ public static final ImageDescriptor DESC_OBJS_IMPCONT = createManagedFromKey(
+ T_OBJ, IMG_OBJS_IMPCONT);
+ public static final ImageDescriptor DESC_OBJS_JSEARCH = createManagedFromKey(
+ T_OBJ, IMG_OBJS_JSEARCH);
+ public static final ImageDescriptor DESC_OBJS_SEARCH_DECL = createManagedFromKey(
+ T_OBJ, IMG_OBJS_SEARCH_DECL);
+ public static final ImageDescriptor DESC_OBJS_SEARCH_REF = createManagedFromKey(
+ T_OBJ, IMG_OBJS_SEARCH_REF);
+ public static final ImageDescriptor DESC_OBJS_CUNIT = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CUNIT);
+ public static final ImageDescriptor DESC_OBJS_CUNIT_RESOURCE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CUNIT_RESOURCE);
+ public static final ImageDescriptor DESC_OBJS_CFILE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CFILE);
+ public static final ImageDescriptor DESC_OBJS_CFILECLASS = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CFILECLASS);
+ public static final ImageDescriptor DESC_ELCL_CLEAR = createUnManaged(
+ T_ELCL, "clear_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CLEAR = createUnManaged(
+ T_DLCL, "clear_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_CFILEINT = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CFILEINT);
+ public static final ImageDescriptor DESC_OBJS_PACKAGE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_PACKAGE);
+ public static final ImageDescriptor DESC_OBJS_EMPTY_LOGICAL_PACKAGE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_EMPTY_LOGICAL_PACKAGE);
+ public static final ImageDescriptor DESC_OBJS_LOGICAL_PACKAGE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_LOGICAL_PACKAGE);
+ public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE_RESOURCES = createManagedFromKey(
+ T_OBJ, IMG_OBJS_EMPTY_PACK_RESOURCE);
+ public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_EMPTY_PACKAGE);
+ public static final ImageDescriptor DESC_OBJS_PACKFRAG_ROOT = createManagedFromKey(
+ T_OBJ, IMG_OBJS_PACKFRAG_ROOT);
+ public static final ImageDescriptor DESC_OBJS_PROJECT_SETTINGS = createManagedFromKey(
+ T_OBJ, IMG_OBJS_PROJECT_SETTINGS);
- public static final ImageDescriptor DESC_OBJS_PACKDECL= createManagedFromKey(T_OBJ, IMG_OBJS_PACKDECL);
- public static final ImageDescriptor DESC_OBJS_IMPDECL= createManagedFromKey(T_OBJ, IMG_OBJS_IMPDECL);
- public static final ImageDescriptor DESC_OBJS_IMPCONT= createManagedFromKey(T_OBJ, IMG_OBJS_IMPCONT);
- public static final ImageDescriptor DESC_OBJS_JSEARCH= createManagedFromKey(T_OBJ, IMG_OBJS_JSEARCH);
- public static final ImageDescriptor DESC_OBJS_SEARCH_DECL= createManagedFromKey(T_OBJ, IMG_OBJS_SEARCH_DECL);
- public static final ImageDescriptor DESC_OBJS_SEARCH_REF= createManagedFromKey(T_OBJ, IMG_OBJS_SEARCH_REF);
- public static final ImageDescriptor DESC_OBJS_CUNIT= createManagedFromKey(T_OBJ, IMG_OBJS_CUNIT);
- public static final ImageDescriptor DESC_OBJS_CUNIT_RESOURCE= createManagedFromKey(T_OBJ, IMG_OBJS_CUNIT_RESOURCE);
- public static final ImageDescriptor DESC_OBJS_CFILE= createManagedFromKey(T_OBJ, IMG_OBJS_CFILE);
- public static final ImageDescriptor DESC_OBJS_CFILECLASS= createManagedFromKey(T_OBJ, IMG_OBJS_CFILECLASS);
- public static final ImageDescriptor DESC_ELCL_CLEAR= createUnManaged(T_ELCL, "clear_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_CLEAR= createUnManaged(T_DLCL, "clear_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_CFILEINT= createManagedFromKey(T_OBJ, IMG_OBJS_CFILEINT);
- public static final ImageDescriptor DESC_OBJS_PACKAGE= createManagedFromKey(T_OBJ, IMG_OBJS_PACKAGE);
- public static final ImageDescriptor DESC_OBJS_EMPTY_LOGICAL_PACKAGE= createManagedFromKey(T_OBJ, IMG_OBJS_EMPTY_LOGICAL_PACKAGE);
- public static final ImageDescriptor DESC_OBJS_LOGICAL_PACKAGE= createManagedFromKey(T_OBJ, IMG_OBJS_LOGICAL_PACKAGE);
- public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE_RESOURCES= createManagedFromKey(T_OBJ, IMG_OBJS_EMPTY_PACK_RESOURCE);
- public static final ImageDescriptor DESC_OBJS_EMPTY_PACKAGE= createManagedFromKey(T_OBJ, IMG_OBJS_EMPTY_PACKAGE);
- public static final ImageDescriptor DESC_OBJS_PACKFRAG_ROOT= createManagedFromKey(T_OBJ, IMG_OBJS_PACKFRAG_ROOT);
- public static final ImageDescriptor DESC_OBJS_PROJECT_SETTINGS= createManagedFromKey(T_OBJ, IMG_OBJS_PROJECT_SETTINGS);
+ public static final ImageDescriptor DESC_DLCL_ADD_LINKED_SOURCE_TO_BUILDPATH = createUnManaged(
+ T_DLCL, "add_linked_source_to_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH = createUnManaged(
+ T_ELCL, "add_linked_source_to_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_ADD_LINKED_SOURCE_TO_BUILDPATH= createUnManaged(T_DLCL, "add_linked_source_to_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH= createUnManaged(T_ELCL, "add_linked_source_to_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH = createUnManaged(
+ T_DLCL, "configure_build_path.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH = createUnManaged(
+ T_ELCL, "configure_build_path.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH= createUnManaged(T_DLCL, "configure_build_path.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH= createUnManaged(T_ELCL, "configure_build_path.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS = createUnManaged(
+ T_DLCL, "configure_buildpath_filters.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS = createUnManaged(
+ T_ELCL, "configure_buildpath_filters.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS= createUnManaged(T_DLCL, "configure_buildpath_filters.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS= createUnManaged(T_ELCL, "configure_buildpath_filters.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CONFIGURE_OUTPUT_FOLDER = createUnManaged(
+ T_DLCL, "configure_output_folder.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CONFIGURE_OUTPUT_FOLDER = createUnManaged(
+ T_ELCL, "configure_output_folder.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_CONFIGURE_OUTPUT_FOLDER= createUnManaged(T_DLCL, "configure_output_folder.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_CONFIGURE_OUTPUT_FOLDER= createUnManaged(T_ELCL, "configure_output_folder.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_EXCLUDE_FROM_BUILDPATH = createUnManaged(
+ T_DLCL, "exclude_from_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_EXCLUDE_FROM_BUILDPATH = createUnManaged(
+ T_ELCL, "exclude_from_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_EXCLUDE_FROM_BUILDPATH= createUnManaged(T_DLCL, "exclude_from_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_EXCLUDE_FROM_BUILDPATH= createUnManaged(T_ELCL, "exclude_from_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_INCLUDE_ON_BUILDPATH = createUnManaged(
+ T_DLCL, "include_on_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_INCLUDE_ON_BUILDPATH = createUnManaged(
+ T_ELCL, "include_on_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_INCLUDE_ON_BUILDPATH= createUnManaged(T_DLCL, "include_on_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_INCLUDE_ON_BUILDPATH= createUnManaged(T_ELCL, "include_on_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_ADD_AS_SOURCE_FOLDER = createUnManaged(
+ T_DLCL, "add_as_source_folder.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_ADD_AS_SOURCE_FOLDER = createUnManaged(
+ T_ELCL, "add_as_source_folder.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_ADD_AS_SOURCE_FOLDER= createUnManaged(T_DLCL, "add_as_source_folder.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_ADD_AS_SOURCE_FOLDER= createUnManaged(T_ELCL, "add_as_source_folder.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_REMOVE_AS_SOURCE_FOLDER = createUnManaged(
+ T_DLCL, "remove_as_source_folder.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_REMOVE_AS_SOURCE_FOLDER = createUnManaged(
+ T_ELCL, "remove_as_source_folder.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_REMOVE_AS_SOURCE_FOLDER= createUnManaged(T_DLCL, "remove_as_source_folder.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_REMOVE_AS_SOURCE_FOLDER= createUnManaged(T_ELCL, "remove_as_source_folder.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_COPY_QUALIFIED_NAME = createUnManaged(
+ T_DLCL, "cpyqual_menu.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_COPY_QUALIFIED_NAME = createUnManaged(
+ T_ELCL, "cpyqual_menu.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_COPY_QUALIFIED_NAME= createUnManaged(T_DLCL, "cpyqual_menu.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_COPY_QUALIFIED_NAME= createUnManaged(T_ELCL, "cpyqual_menu.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM = createManagedFromKey(
+ T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
+ public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR = createManagedFromKey(
+ T_OBJ, IMG_OBJS_FIXABLE_ERROR);
- public static final ImageDescriptor DESC_OBJS_FIXABLE_PROBLEM= createManagedFromKey(T_OBJ, IMG_OBJS_FIXABLE_PROBLEM);
- public static final ImageDescriptor DESC_OBJS_FIXABLE_ERROR= createManagedFromKey(T_OBJ, IMG_OBJS_FIXABLE_ERROR);
+ public static final ImageDescriptor DESC_ELCL_ADD_TO_BP = createUnManaged(
+ T_ELCL, "add_to_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_REMOVE_FROM_BP = createUnManaged(
+ T_ELCL, "remove_from_buildpath.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_INCLUSION = createUnManaged(
+ T_ELCL, "inclusion_filter_attrib.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_EXCLUSION = createUnManaged(
+ T_ELCL, "exclusion_filter_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_ADD_TO_BP= createUnManaged(T_ELCL, "add_to_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_REMOVE_FROM_BP= createUnManaged(T_ELCL, "remove_from_buildpath.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_INCLUSION= createUnManaged(T_ELCL, "inclusion_filter_attrib.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_EXCLUSION= createUnManaged(T_ELCL, "exclusion_filter_attrib.png"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_OBJS_LIBRARY= createManagedFromKey(T_OBJ, IMG_OBJS_LIBRARY);
- public static final ImageDescriptor DESC_OBJS_LIBRARY_SRC= createManagedFromKey(T_OBJ, IMG_OBJS_LIBRARY_SRC);
+ public static final ImageDescriptor DESC_OBJS_LIBRARY = createManagedFromKey(
+ T_OBJ, IMG_OBJS_LIBRARY);
+ public static final ImageDescriptor DESC_OBJS_LIBRARY_SRC = createManagedFromKey(
+ T_OBJ, IMG_OBJS_LIBRARY_SRC);
/**
* @since 2.0
*/
public static final ImageDescriptor DESC_OBJS_JAVADOCTAG = createManagedFromKey(
T_OBJ, IMG_OBJS_JAVADOCTAG);
- public static final ImageDescriptor DESC_TOOL_OPENMETHOD= createUnManaged(T_ETOOL, "opentype.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_OPENTYPE= createUnManaged(T_ETOOL, "opentype.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_NEWPROJECT= createUnManaged(T_ETOOL, "newjprj_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_NEWPACKAGE= createUnManaged(T_ETOOL, "newpack_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_NEWCLASS= createUnManaged(T_ETOOL, "newclass_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_NEWINTERFACE= createUnManaged(T_ETOOL, "newint_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_NEWSNIPPET= createUnManaged(T_ETOOL, "newsbook_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_TOOL_NEWPACKROOT= createUnManaged(T_ETOOL, "newpackfolder_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_NEWPACKROOT= createUnManaged(T_DLCL, "newpackfolder_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_OPENMETHOD = createUnManaged(
+ T_ETOOL, "opentype.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_OPENTYPE = createUnManaged(
+ T_ETOOL, "opentype.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_NEWPROJECT = createUnManaged(
+ T_ETOOL, "newjprj_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_NEWPACKAGE = createUnManaged(
+ T_ETOOL, "newpack_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_NEWCLASS = createUnManaged(
+ T_ETOOL, "newclass_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_NEWINTERFACE = createUnManaged(
+ T_ETOOL, "newint_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_NEWSNIPPET = createUnManaged(
+ T_ETOOL, "newsbook_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_TOOL_NEWPACKROOT = createUnManaged(
+ T_ETOOL, "newpackfolder_wiz.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_NEWPACKROOT = createUnManaged(
+ T_DLCL, "newpackfolder_wiz.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_GHOST= createManagedFromKey(T_OBJ, IMG_OBJS_GHOST);
- public static final ImageDescriptor DESC_OBJS_CLASSALT= createManagedFromKey(T_OBJ, IMG_OBJS_CLASSALT);
- public static final ImageDescriptor DESC_OBJS_INTERFACEALT= createManagedFromKey(T_OBJ, IMG_OBJS_INTERFACEALT);
+ public static final ImageDescriptor DESC_OBJS_GHOST = createManagedFromKey(
+ T_OBJ, IMG_OBJS_GHOST);
+ public static final ImageDescriptor DESC_OBJS_CLASSALT = createManagedFromKey(
+ T_OBJ, IMG_OBJS_CLASSALT);
+ public static final ImageDescriptor DESC_OBJS_INTERFACEALT = createManagedFromKey(
+ T_OBJ, IMG_OBJS_INTERFACEALT);
- public static final ImageDescriptor DESC_OBJS_UNKNOWN= createManagedFromKey(T_OBJ, IMG_OBJS_UNKNOWN);
+ public static final ImageDescriptor DESC_OBJS_UNKNOWN = createManagedFromKey(
+ T_OBJ, IMG_OBJS_UNKNOWN);
- public static final ImageDescriptor DESC_OBJS_TYPE_SEPARATOR= createUnManaged(T_OBJ, "type_separator.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OBJS_TYPE_SEPARATOR = createUnManaged(
+ T_OBJ, "type_separator.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_WARNING= createUnManagedCached(T_OVR, "warning_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_ERROR= createUnManagedCached(T_OVR, "error_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_WARNING = createUnManagedCached(
+ T_OVR, "warning_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_ERROR = createUnManagedCached(
+ T_OVR, "error_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_FIELD_NAMESPACE = createUnManagedCached(T_OVR, "native_co.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_FIELD_UPVAR = createUnManagedCached(T_OVR, "over_co1.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_FIELD_GLOBAL = createUnManagedCached(T_OVR, "global_co.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OVR_FIELD_INDEX = createUnManagedCached(T_OVR, "index_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_FIELD_NAMESPACE = createUnManagedCached(
+ T_OVR, "native_co.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_FIELD_UPVAR = createUnManagedCached(
+ T_OVR, "over_co1.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_FIELD_GLOBAL = createUnManagedCached(
+ T_OVR, "global_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OVR_FIELD_INDEX = createUnManagedCached(
+ T_OVR, "index_co.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ELCL_CODE_ASSIST= createUnManaged(T_ELCL, "metharg_obj.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_DLCL_CODE_ASSIST= createUnManaged(T_DLCL, "metharg_obj.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ELCL_CODE_ASSIST = createUnManaged(
+ T_ELCL, "metharg_obj.png"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DLCL_CODE_ASSIST = createUnManaged(
+ T_DLCL, "metharg_obj.png"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_FIELD_DEFAULT= createManagedFromKey(T_OBJ, IMG_FIELD_DEFAULT);
- public static final ImageDescriptor DESC_FIELD_PRIVATE= createManagedFromKey(T_OBJ, IMG_FIELD_PRIVATE);
- public static final ImageDescriptor DESC_FIELD_PROTECTED= createManagedFromKey(T_OBJ, IMG_FIELD_PROTECTED);
- public static final ImageDescriptor DESC_FIELD_PUBLIC= createManagedFromKey(T_OBJ, IMG_FIELD_PUBLIC);
+ public static final ImageDescriptor DESC_FIELD_DEFAULT = createManagedFromKey(
+ T_OBJ, IMG_FIELD_DEFAULT);
+ public static final ImageDescriptor DESC_FIELD_PRIVATE = createManagedFromKey(
+ T_OBJ, IMG_FIELD_PRIVATE);
+ public static final ImageDescriptor DESC_FIELD_PROTECTED = createManagedFromKey(
+ T_OBJ, IMG_FIELD_PROTECTED);
+ public static final ImageDescriptor DESC_FIELD_PUBLIC = createManagedFromKey(
+ T_OBJ, IMG_FIELD_PUBLIC);
public static final ImageDescriptor DESC_OBJS_FIELD = DESC_FIELD_DEFAULT;
- public static final ImageDescriptor DESC_OBJS_LOCAL_VARIABLE= createManagedFromKey(T_OBJ, IMG_OBJS_LOCAL_VARIABLE);
- public static final ImageDescriptor DESC_OBJS_KEYWORD= createManagedFromKey(T_OBJ, IMG_OBJS_KEYWORD);
+ public static final ImageDescriptor DESC_OBJS_LOCAL_VARIABLE = createManagedFromKey(
+ T_OBJ, IMG_OBJS_LOCAL_VARIABLE);
+ public static final ImageDescriptor DESC_OBJS_KEYWORD = createManagedFromKey(
+ T_OBJ, IMG_OBJS_KEYWORD);
- public static final ImageDescriptor DESC_METHOD_PUBLIC= createManagedFromKey(T_OBJ, IMG_METHOD_PUBLIC);
- public static final ImageDescriptor DESC_METHOD_PROTECTED= createManagedFromKey(T_OBJ, IMG_METHOD_PROTECTED);
- public static final ImageDescriptor DESC_METHOD_PRIVATE= createManagedFromKey(T_OBJ, IMG_METHOD_PRIVATE);
- public static final ImageDescriptor DESC_METHOD_DEFAULT = createManagedFromKey(T_OBJ, IMG_METHOD_DEFAULT);
+ public static final ImageDescriptor DESC_METHOD_PUBLIC = createManagedFromKey(
+ T_OBJ, IMG_METHOD_PUBLIC);
+ public static final ImageDescriptor DESC_METHOD_PROTECTED = createManagedFromKey(
+ T_OBJ, IMG_METHOD_PROTECTED);
+ public static final ImageDescriptor DESC_METHOD_PRIVATE = createManagedFromKey(
+ T_OBJ, IMG_METHOD_PRIVATE);
+ public static final ImageDescriptor DESC_METHOD_DEFAULT = createManagedFromKey(
+ T_OBJ, IMG_METHOD_DEFAULT);
/**
* @since 3.0
@@ -409,15 +602,17 @@
@Override
public ImageData getImageData() {
if (fData == null) {
- fData= fDescriptor.getImageData();
+ fData = fDescriptor.getImageData();
}
return fData;
}
}
- private static ImageDescriptor createUnManagedCached(String prefix, String name) {
+ private static ImageDescriptor createUnManagedCached(String prefix,
+ String name) {
return new CachedImageDescriptor(create(prefix, name, true));
}
+
/**
* Returns the image managed under the given key in this registry.
*
@@ -453,7 +648,8 @@
* @param iconName
* the icon name
*/
- public static void setToolImageDescriptors(IAction action, String iconName) {
+ public static void setToolImageDescriptors(IAction action,
+ String iconName) {
setImageDescriptors(action, "tool16", iconName); //$NON-NLS-1$
}
@@ -466,7 +662,8 @@
* @param iconName
* the icon name
*/
- public static void setLocalImageDescriptors(IAction action, String iconName) {
+ public static void setLocalImageDescriptors(IAction action,
+ String iconName) {
setImageDescriptors(action, "lcl16", iconName); //$NON-NLS-1$
}
@@ -487,7 +684,8 @@
// ---- Helper methods to access icons on the file system
// --------------------------------------
- private static void setImageDescriptors(IAction action, String type, String relPath) {
+ private static void setImageDescriptors(IAction action, String type,
+ String relPath) {
ImageDescriptor id = create("d" + type, relPath, false); //$NON-NLS-1$
if (id != null)
action.setDisabledImageDescriptor(id);
@@ -500,7 +698,8 @@
action.setImageDescriptor(descriptor);
}
- private static ImageDescriptor createManagedFromKey(String prefix, String key) {
+ private static ImageDescriptor createManagedFromKey(String prefix,
+ String key) {
return createManaged(prefix, key.substring(NAME_PREFIX_LENGTH), key);
}
@@ -509,7 +708,7 @@
try {
ImageDescriptor result = create(prefix, name, true);
if (fgAvoidSWTErrorMap == null) {
- fgAvoidSWTErrorMap = new HashMap<String, ImageDescriptor>();
+ fgAvoidSWTErrorMap = new HashMap<>();
}
fgAvoidSWTErrorMap.put(key, result);
if (fgImageRegistry != null) {
@@ -528,11 +727,14 @@
* Creates an image descriptor for the given prefix and name in the DLTK UI
* bundle. The path can contain variables like $NL$. If no image could be
* found, <code>useMissingImageDescriptor</code> decides if either the
- * 'missing image descriptor' is returned or <code>null</code>. or <code>null</code>.
+ * 'missing image descriptor' is returned or <code>null</code>. or
+ * <code>null</code>.
*/
- private static ImageDescriptor create(String prefix, String name, boolean useMissingImageDescriptor) {
+ private static ImageDescriptor create(String prefix, String name,
+ boolean useMissingImageDescriptor) {
IPath path = ICONS_PATH.append(prefix).append(name);
- return createImageDescriptor(DLTKUIPlugin.getDefault().getBundle(), path, useMissingImageDescriptor);
+ return createImageDescriptor(DLTKUIPlugin.getDefault().getBundle(),
+ path, useMissingImageDescriptor);
}
/*
@@ -546,11 +748,12 @@
/*
* Creates an image descriptor for the given path in a bundle. The path can
- * contain variables like $NL$. If no image could be found, <code>useMissingImageDescriptor</code>
- * decides if either the 'missing image descriptor' is returned or <code>null</code>.
- * Added for 3.1.1.
+ * contain variables like $NL$. If no image could be found,
+ * <code>useMissingImageDescriptor</code> decides if either the 'missing
+ * image descriptor' is returned or <code>null</code>. Added for 3.1.1.
*/
- public static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path, boolean useMissingImageDescriptor) {
+ public static ImageDescriptor createImageDescriptor(Bundle bundle,
+ IPath path, boolean useMissingImageDescriptor) {
URL url = FileLocator.find(bundle, path, null);
if (url != null) {
return ImageDescriptor.createFromURL(url);
@@ -583,8 +786,8 @@
Image image = plugin.getImageRegistry().get(imagePath);
if (image == null) {
final ImageDescriptor descriptor = AbstractUIPlugin
- .imageDescriptorFromPlugin(plugin.getBundle()
- .getSymbolicName(), imagePath);
+ .imageDescriptorFromPlugin(
+ plugin.getBundle().getSymbolicName(), imagePath);
if (descriptor != null) {
image = descriptor.createImage();
plugin.getImageRegistry().put(imagePath, image);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java
index cd56e19..2038abf 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/DLTKUIPlugin.java
@@ -554,7 +554,7 @@
return fContentAssistHistory;
}
- private final Map<String, EditorTextHoverDescriptor[]> editorTextHoverDescriptorsByNature = new HashMap<String, EditorTextHoverDescriptor[]>();
+ private final Map<String, EditorTextHoverDescriptor[]> editorTextHoverDescriptorsByNature = new HashMap<>();
/**
* Resets editor text hovers contributed to the workbench.
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java
index 7b0dd96..8b604dd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ScriptElementImageProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* 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
@@ -86,7 +86,7 @@
* Returns the icon for a given element. The icon depends on the element
* type and element properties. If configured, overlay icons are constructed
* for <code>ISourceReference</code>s.
- *
+ *
* @param flags
* Flags as defined by the ScriptImageLabelProvider
*/
@@ -144,7 +144,7 @@
* Creates {@link ILabelProvider} objects from configuration elements.
*/
private static void createProviders(IConfigurationElement[] elements) {
- labelProviders = new HashMap<String, ILabelProvider>();
+ labelProviders = new HashMap<>();
for (int i = 0; i < elements.length; i++) {
IConfigurationElement element = elements[i];
try {
@@ -162,7 +162,8 @@
if (labelProviders == null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry
- .getConfigurationElementsFor(LABELPROVIDERS_EXTENSION_POINT);
+ .getConfigurationElementsFor(
+ LABELPROVIDERS_EXTENSION_POINT);
createProviders(elements);
}
IDLTKLanguageToolkit languageToolkit = DLTKLanguageManager
@@ -194,7 +195,8 @@
Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
ImageDescriptor descr = getBaseImageDescriptor(element, flags);
if (descr != null) {
- return new ScriptElementImageDescriptor(descr, adornmentFlags, size);
+ return new ScriptElementImageDescriptor(descr, adornmentFlags,
+ size);
} else {
return null;
}
@@ -286,14 +288,13 @@
return DESC_OBJ_PROJECT;
}
return DESC_OBJ_PROJECT_CLOSED;
- // return DESC_OBJ_PROJECT;
+ // return DESC_OBJ_PROJECT;
case IModelElement.SCRIPT_MODEL:
// return DLTKPluginImages.DESC_OBJS_JAVA_MODEL;
return null;
}
- Assert.isTrue(
- false,
+ Assert.isTrue(false,
DLTKUIMessages.ScriptImageLabelprovider_assert_wrongImage
+ "(" + element.getElementType() + ","
+ element.getElementName() + ")");
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java
index e92f835..a5c0d3c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java
@@ -87,8 +87,8 @@
* out.
* </p>
*/
-public class StandardModelElementContentProvider2 implements
- ITreeContentProvider, IWorkingCopyProvider {
+public class StandardModelElementContentProvider2
+ implements ITreeContentProvider, IWorkingCopyProvider {
protected static final Object[] NO_CHILDREN = new Object[0];
protected boolean fProvideMembers;
@@ -261,7 +261,7 @@
throws ModelException {
IModelElement[] fragments = root.getChildren();
- List<IModelElement> newFragments = new ArrayList<IModelElement>();
+ List<IModelElement> newFragments = new ArrayList<>();
for (int i = 0; i < fragments.length; ++i) {
if (fragments[i] instanceof IScriptFolder) {
IScriptFolder scriptFolder = ((IScriptFolder) fragments[i]);
@@ -344,7 +344,8 @@
* Note: This method is for internal use only. Clients should not call this
* method.
*/
- protected Object[] getScriptProjects(IScriptModel jm) throws ModelException {
+ protected Object[] getScriptProjects(IScriptModel jm)
+ throws ModelException {
return jm.getScriptProjects();
}
@@ -403,7 +404,8 @@
// We therefore exclude Java elements from the list
// of non-Java resources.
if (isFolderOnClasspath) {
- if (javaProject.findProjectFragment(member.getFullPath()) == null) {
+ if (javaProject
+ .findProjectFragment(member.getFullPath()) == null) {
nonJavaResources.add(member);
}
} else if (!javaProject.isOnBuildpath(member)) {
@@ -420,13 +422,15 @@
protected boolean isBuildPathChange(IModelElementDelta delta) {
// need to test the flags only for package fragment roots
- if (delta.getElement().getElementType() != IModelElement.PROJECT_FRAGMENT)
+ if (delta.getElement()
+ .getElementType() != IModelElement.PROJECT_FRAGMENT)
return false;
int flags = delta.getFlags();
return (delta.getKind() == IModelElementDelta.CHANGED
&& ((flags & IModelElementDelta.F_ADDED_TO_BUILDPATH) != 0)
- || ((flags & IModelElementDelta.F_REMOVED_FROM_BUILDPATH) != 0) || ((flags & IModelElementDelta.F_REORDER) != 0));
+ || ((flags & IModelElementDelta.F_REMOVED_FROM_BUILDPATH) != 0)
+ || ((flags & IModelElementDelta.F_REORDER) != 0));
}
/**
@@ -448,8 +452,8 @@
if (element instanceof IScriptFolder) {
IScriptFolder fragment = (IScriptFolder) element;
if (fragment.exists()
- && !(fragment.hasChildren() || (fForeignResources && fragment
- .getForeignResources().length > 0))
+ && !(fragment.hasChildren() || (fForeignResources
+ && fragment.getForeignResources().length > 0))
&& fragment.hasSubfolders())
return true;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
index 12fa0c2..55eea88 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
@@ -63,7 +63,7 @@
*/
public class CustomFiltersActionGroup extends ActionGroup {
- private static final String TAG_DUMMY_TO_TEST_EXISTENCE= "TAG_DUMMY_TO_TEST_EXISTENCE"; //$NON-NLS-1$
+ private static final String TAG_DUMMY_TO_TEST_EXISTENCE = "TAG_DUMMY_TO_TEST_EXISTENCE"; //$NON-NLS-1$
class ShowFilterDialogAction extends Action {
ShowFilterDialogAction() {
@@ -94,19 +94,26 @@
/**
* Constructor for FilterActionMenuContributionItem.
*
- * @param actionGroup the action group
- * @param filterId the id of the filter
- * @param filterName the name of the filter
- * @param state the initial state of the filter
- * @param itemNumber the menu item index
+ * @param actionGroup
+ * the action group
+ * @param filterId
+ * the id of the filter
+ * @param filterName
+ * the name of the filter
+ * @param state
+ * the initial state of the filter
+ * @param itemNumber
+ * the menu item index
*/
- public FilterActionMenuContributionItem(CustomFiltersActionGroup actionGroup, String filterId, String filterName, boolean state, int itemNumber) {
+ public FilterActionMenuContributionItem(
+ CustomFiltersActionGroup actionGroup, String filterId,
+ String filterName, boolean state, int itemNumber) {
super(filterId);
- fActionGroup= actionGroup;
- fFilterId= filterId;
- fFilterName= filterName;
- fState= state;
- fItemNumber= itemNumber;
+ fActionGroup = actionGroup;
+ fFilterId = filterId;
+ fFilterName = filterName;
+ fState = state;
+ fItemNumber = itemNumber;
}
/*
@@ -114,18 +121,19 @@
*/
@Override
public void fill(Menu menu, int index) {
- MenuItem mi= new MenuItem(menu, SWT.CHECK, index);
- mi.setText("&" + fItemNumber + " " + fFilterName); //$NON-NLS-1$ //$NON-NLS-2$
+ MenuItem mi = new MenuItem(menu, SWT.CHECK, index);
+ mi.setText("&" + fItemNumber + " " + fFilterName); //$NON-NLS-1$ //$NON-NLS-2$
/*
- * XXX: Don't set the image - would look bad because other menu items don't provide image
- * XXX: Get working set specific image name from XML - would need to cache icons
+ * XXX: Don't set the image - would look bad because other menu
+ * items don't provide image XXX: Get working set specific image
+ * name from XML - would need to cache icons
*/
-// mi.setImage(DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_JAVA_WORKING_SET));
+ // mi.setImage(DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_JAVA_WORKING_SET));
mi.setSelection(fState);
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- fState= !fState;
+ fState = !fState;
fActionGroup.setFilter(fFilterId, fState);
}
});
@@ -141,27 +149,27 @@
}
private static final String TAG_CUSTOM_FILTERS = "customFilters"; //$NON-NLS-1$
- private static final String TAG_USER_DEFINED_PATTERNS_ENABLED= "userDefinedPatternsEnabled"; //$NON-NLS-1$
- private static final String TAG_USER_DEFINED_PATTERNS= "userDefinedPatterns"; //$NON-NLS-1$
- private static final String TAG_XML_DEFINED_FILTERS= "xmlDefinedFilters"; //$NON-NLS-1$
+ private static final String TAG_USER_DEFINED_PATTERNS_ENABLED = "userDefinedPatternsEnabled"; //$NON-NLS-1$
+ private static final String TAG_USER_DEFINED_PATTERNS = "userDefinedPatterns"; //$NON-NLS-1$
+ private static final String TAG_XML_DEFINED_FILTERS = "xmlDefinedFilters"; //$NON-NLS-1$
private static final String TAG_LRU_FILTERS = "lastRecentlyUsedFilters"; //$NON-NLS-1$
- private static final String TAG_CHILD= "child"; //$NON-NLS-1$
- private static final String TAG_PATTERN= "pattern"; //$NON-NLS-1$
- private static final String TAG_FILTER_ID= "filterId"; //$NON-NLS-1$
- private static final String TAG_IS_ENABLED= "isEnabled"; //$NON-NLS-1$
+ private static final String TAG_CHILD = "child"; //$NON-NLS-1$
+ private static final String TAG_PATTERN = "pattern"; //$NON-NLS-1$
+ private static final String TAG_FILTER_ID = "filterId"; //$NON-NLS-1$
+ private static final String TAG_IS_ENABLED = "isEnabled"; //$NON-NLS-1$
- private static final String SEPARATOR= ","; //$NON-NLS-1$
+ private static final String SEPARATOR = ","; //$NON-NLS-1$
- private static final int MAX_FILTER_MENU_ENTRIES= 3;
- private static final String RECENT_FILTERS_GROUP_NAME= "recentFiltersGroup"; //$NON-NLS-1$
+ private static final int MAX_FILTER_MENU_ENTRIES = 3;
+ private static final String RECENT_FILTERS_GROUP_NAME = "recentFiltersGroup"; //$NON-NLS-1$
private StructuredViewer fViewer;
private NamePatternFilter fPatternFilter;
private Map fInstalledBuiltInFilters;
- private Map/*<String, Boolean>*/ fEnabledFilterIds;
+ private Map/* <String, Boolean> */ fEnabledFilterIds;
private boolean fUserDefinedPatternsEnabled;
private String[] fUserDefinedPatterns;
private FilterDescriptor[] fCachedFilterDescriptors;
@@ -173,15 +181,15 @@
*/
private Stack fLRUFilterIdsStack;
/**
- * Handle to menu manager to dynamically update
- * the last recently used filters.
+ * Handle to menu manager to dynamically update the last recently used
+ * filters.
*
*
*/
private IMenuManager fMenuManager;
/**
- * The menu listener which dynamically updates
- * the last recently used filters.
+ * The menu listener which dynamically updates the last recently used
+ * filters.
*
*
*/
@@ -198,8 +206,10 @@
/**
* Creates a new <code>CustomFiltersActionGroup</code>.
*
- * @param part the view part that owns this action group
- * @param viewer the viewer to be filtered
+ * @param part
+ * the view part that owns this action group
+ * @param viewer
+ * the viewer to be filtered
*/
public CustomFiltersActionGroup(IViewPart part, StructuredViewer viewer) {
this(part.getViewSite().getId(), viewer);
@@ -208,14 +218,16 @@
/**
* Creates a new <code>CustomFiltersActionGroup</code>.
*
- * @param ownerId the id of this action group's owner
- * @param viewer the viewer to be filtered
+ * @param ownerId
+ * the id of this action group's owner
+ * @param viewer
+ * the viewer to be filtered
*/
public CustomFiltersActionGroup(String ownerId, StructuredViewer viewer) {
- fTargetId= ownerId;
- fViewer= viewer;
+ fTargetId = ownerId;
+ fViewer = viewer;
- fLRUFilterIdsStack= new Stack();
+ fLRUFilterIdsStack = new Stack();
initializeWithPluginContributions();
initializeWithViewDefaults();
@@ -233,11 +245,11 @@
}
/**
- * Returns a list of currently enabled filters. The filter
- * is identified by its id.
+ * Returns a list of currently enabled filters. The filter is identified by
+ * its id.
* <p>
- * This method is for internal use only and should not
- * be called by clients outside of DLTK/UI.
+ * This method is for internal use only and should not be called by clients
+ * outside of DLTK/UI.
* </p>
*
* @return a list of currently enabled filters
@@ -245,13 +257,12 @@
*
*/
public String[] internalGetEnabledFilterIds() {
- Set<String> enabledFilterIds = new HashSet<String>(
- fEnabledFilterIds.size());
- Iterator iter= fEnabledFilterIds.entrySet().iterator();
+ Set<String> enabledFilterIds = new HashSet<>(fEnabledFilterIds.size());
+ Iterator iter = fEnabledFilterIds.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry= (Map.Entry)iter.next();
- String id= (String)entry.getKey();
- boolean isEnabled= ((Boolean)entry.getValue()).booleanValue();
+ Map.Entry entry = (Map.Entry) iter.next();
+ String id = (String) entry.getKey();
+ boolean isEnabled = ((Boolean) entry.getValue()).booleanValue();
if (isEnabled)
enabledFilterIds.add(id);
}
@@ -261,58 +272,67 @@
/**
* Removes filters for the given parent and element
*
- * @param parent the parent of the element
- * @param element the element
- * @param contentProvider the content provider of the viewer from which
- * the filters will be removed
+ * @param parent
+ * the parent of the element
+ * @param element
+ * the element
+ * @param contentProvider
+ * the content provider of the viewer from which the filters will
+ * be removed
*
* @return the array of new filter ids
*/
- public String[] removeFiltersFor(Object parent, Object element, IContentProvider contentProvider) {
- String[] enabledFilters= internalGetEnabledFilterIds();
- Set<String> newFilters = new HashSet<String>();
- for (int i= 0; i < enabledFilters.length; i++) {
- String filterName= enabledFilters[i];
- ViewerFilter filter= (ViewerFilter) fInstalledBuiltInFilters.get(filterName);
- if (filter == null)
- newFilters.add(filterName);
- else if (isSelected(parent, element, contentProvider, filter))
- newFilters.add(filterName);
- }
- if (newFilters.size() == enabledFilters.length)
- return new String[0];
+ public String[] removeFiltersFor(Object parent, Object element,
+ IContentProvider contentProvider) {
+ String[] enabledFilters = internalGetEnabledFilterIds();
+ Set<String> newFilters = new HashSet<>();
+ for (int i = 0; i < enabledFilters.length; i++) {
+ String filterName = enabledFilters[i];
+ ViewerFilter filter = (ViewerFilter) fInstalledBuiltInFilters
+ .get(filterName);
+ if (filter == null)
+ newFilters.add(filterName);
+ else if (isSelected(parent, element, contentProvider, filter))
+ newFilters.add(filterName);
+ }
+ if (newFilters.size() == enabledFilters.length)
+ return new String[0];
return newFilters.toArray(new String[newFilters.size()]);
}
/**
* Sets the filters to the given array of new filters
*
- * @param newFilters the new filters
+ * @param newFilters
+ * the new filters
*/
public void setFilters(String[] newFilters) {
- setEnabledFilterIds(newFilters);
- updateViewerFilters(true);
+ setEnabledFilterIds(newFilters);
+ updateViewerFilters(true);
}
- private boolean isSelected(Object parent, Object element, IContentProvider contentProvider, ViewerFilter filter) {
- if (contentProvider instanceof ITreeContentProvider) {
- // the element and all its parents have to be selected
- ITreeContentProvider provider = (ITreeContentProvider) contentProvider;
- while (element != null && !(element instanceof IScriptModel)) {
- if (!filter.select(fViewer, parent, element))
- return false;
- element= provider.getParent( element);
- }
- return true;
- }
- return filter.select(fViewer, parent, element);
+ private boolean isSelected(Object parent, Object element,
+ IContentProvider contentProvider, ViewerFilter filter) {
+ if (contentProvider instanceof ITreeContentProvider) {
+ // the element and all its parents have to be selected
+ ITreeContentProvider provider = (ITreeContentProvider) contentProvider;
+ while (element != null && !(element instanceof IScriptModel)) {
+ if (!filter.select(fViewer, parent, element))
+ return false;
+ element = provider.getParent(element);
+ }
+ return true;
+ }
+ return filter.select(fViewer, parent, element);
}
- /**
+ /**
* Sets the enable state of the given filter.
*
- * @param filterId the id of the filter
- * @param state the filter state
+ * @param filterId
+ * the id of the filter
+ * @param state
+ * the filter state
*/
private void setFilter(String filterId, boolean state) {
// Renew filter id in LRU stack
@@ -326,41 +346,44 @@
}
private void setEnabledFilterIds(String[] enabledIds) {
- Iterator iter= fEnabledFilterIds.keySet().iterator();
+ Iterator iter = fEnabledFilterIds.keySet().iterator();
while (iter.hasNext()) {
- String id= (String)iter.next();
+ String id = (String) iter.next();
fEnabledFilterIds.put(id, Boolean.FALSE);
}
- for (int i= 0; i < enabledIds.length; i++)
+ for (int i = 0; i < enabledIds.length; i++)
fEnabledFilterIds.put(enabledIds[i], Boolean.TRUE);
}
private void setUserDefinedPatterns(String[] patterns) {
- fUserDefinedPatterns= patterns;
+ fUserDefinedPatterns = patterns;
cleanUpPatternDuplicates();
}
/**
* Sets the recently changed filters.
*
- * @param changeHistory the change history
+ * @param changeHistory
+ * the change history
*
*/
private void setRecentlyChangedFilters(Stack changeHistory) {
- Stack oldestFirstStack= new Stack();
+ Stack oldestFirstStack = new Stack();
- int length= Math.min(changeHistory.size(), MAX_FILTER_MENU_ENTRIES);
- for (int i= 0; i < length; i++)
- oldestFirstStack.push(((FilterDescriptor)changeHistory.pop()).getId());
+ int length = Math.min(changeHistory.size(), MAX_FILTER_MENU_ENTRIES);
+ for (int i = 0; i < length; i++)
+ oldestFirstStack
+ .push(((FilterDescriptor) changeHistory.pop()).getId());
- length= Math.min(fLRUFilterIdsStack.size(), MAX_FILTER_MENU_ENTRIES - oldestFirstStack.size());
- int NEWEST= 0;
- for (int i= 0; i < length; i++) {
- Object filter= fLRUFilterIdsStack.remove(NEWEST);
+ length = Math.min(fLRUFilterIdsStack.size(),
+ MAX_FILTER_MENU_ENTRIES - oldestFirstStack.size());
+ int NEWEST = 0;
+ for (int i = 0; i < length; i++) {
+ Object filter = fLRUFilterIdsStack.remove(NEWEST);
if (!oldestFirstStack.contains(filter))
oldestFirstStack.push(filter);
}
- fLRUFilterIdsStack= oldestFirstStack;
+ fLRUFilterIdsStack = oldestFirstStack;
}
private boolean areUserDefinedPatternsEnabled() {
@@ -368,30 +391,29 @@
}
private void setUserDefinedPatternsEnabled(boolean state) {
- fUserDefinedPatternsEnabled= state;
+ fUserDefinedPatternsEnabled = state;
}
private void fillToolBar(IToolBarManager tooBar) {
}
/**
- * Fills the given view menu with the entries managed by the
- * group.
+ * Fills the given view menu with the entries managed by the group.
*
- * @param viewMenu the menu to fill
+ * @param viewMenu
+ * the menu to fill
*/
public void fillViewMenu(IMenuManager viewMenu) {
/*
- * Don't change the separator group name.
- * Using this name ensures that other filters
- * get contributed to the same group.
+ * Don't change the separator group name. Using this name ensures that
+ * other filters get contributed to the same group.
*/
viewMenu.add(new Separator("filters")); //$NON-NLS-1$
viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME));
viewMenu.add(new ShowFilterDialogAction());
- fMenuManager= viewMenu;
- fMenuListener= manager -> {
+ fMenuManager = viewMenu;
+ fMenuListener = manager -> {
removePreviousLRUFilterActions(manager);
addLRUFilterActions(manager);
};
@@ -402,13 +424,13 @@
if (fFilterIdsUsedInLastViewMenu == null)
return;
- for (int i= 0; i < fFilterIdsUsedInLastViewMenu.length; i++)
+ for (int i = 0; i < fFilterIdsUsedInLastViewMenu.length; i++)
mm.remove(fFilterIdsUsedInLastViewMenu[i]);
}
private void addLRUFilterActions(IMenuManager mm) {
if (fLRUFilterIdsStack.isEmpty()) {
- fFilterIdsUsedInLastViewMenu= null;
+ fFilterIdsUsedInLastViewMenu = null;
return;
}
@@ -417,14 +439,17 @@
String[] recentlyChangedFilterIds = sortedFilters
.toArray(new String[sortedFilters.size()]);
- fFilterIdsUsedInLastViewMenu= new String[recentlyChangedFilterIds.length];
- for (int i= 0; i < recentlyChangedFilterIds.length; i++) {
- String id= recentlyChangedFilterIds[i];
- fFilterIdsUsedInLastViewMenu[i]= id;
- boolean state= fEnabledFilterIds.containsKey(id) && ((Boolean)fEnabledFilterIds.get(id)).booleanValue();
- FilterDescriptor filterDesc= (FilterDescriptor)fFilterDescriptorMap.get(id);
+ fFilterIdsUsedInLastViewMenu = new String[recentlyChangedFilterIds.length];
+ for (int i = 0; i < recentlyChangedFilterIds.length; i++) {
+ String id = recentlyChangedFilterIds[i];
+ fFilterIdsUsedInLastViewMenu[i] = id;
+ boolean state = fEnabledFilterIds.containsKey(id)
+ && ((Boolean) fEnabledFilterIds.get(id)).booleanValue();
+ FilterDescriptor filterDesc = (FilterDescriptor) fFilterDescriptorMap
+ .get(id);
if (filterDesc != null) {
- IContributionItem item= new FilterActionMenuContributionItem(this, id, filterDesc.getName(), state, i+1);
+ IContributionItem item = new FilterActionMenuContributionItem(
+ this, id, filterDesc.getName(), state, i + 1);
mm.insertBefore(RECENT_FILTERS_GROUP_NAME, item);
}
}
@@ -434,23 +459,25 @@
public void dispose() {
if (fMenuManager != null)
fMenuManager.removeMenuListener(fMenuListener);
- fCachedFilterDescriptors= null;
+ fCachedFilterDescriptors = null;
super.dispose();
}
private void initializeWithPluginContributions() {
- fUserDefinedPatterns= new String[0];
- fUserDefinedPatternsEnabled= false;
+ fUserDefinedPatterns = new String[0];
+ fUserDefinedPatternsEnabled = false;
- FilterDescriptor[] filterDescs= getCachedFilterDescriptors();
- fFilterDescriptorMap= new HashMap(filterDescs.length);
- fEnabledFilterIds= new HashMap(filterDescs.length);
- for (int i= 0; i < filterDescs.length; i++) {
- String id= filterDescs[i].getId();
- Boolean isEnabled= Boolean.valueOf(filterDescs[i].isEnabled());
+ FilterDescriptor[] filterDescs = getCachedFilterDescriptors();
+ fFilterDescriptorMap = new HashMap(filterDescs.length);
+ fEnabledFilterIds = new HashMap(filterDescs.length);
+ for (int i = 0; i < filterDescs.length; i++) {
+ String id = filterDescs[i].getId();
+ Boolean isEnabled = Boolean.valueOf(filterDescs[i].isEnabled());
if (fEnabledFilterIds.containsKey(id)) {
- //XXX: dltk logging?
- //DLTKUIPlugin.logErrorMessage("WARNING: Duplicate id for extension-point \"org.eclipse.dltk.ui.modelElementFilters\""); //$NON-NLS-1$
+ // XXX: dltk logging?
+ // DLTKUIPlugin.logErrorMessage("WARNING: Duplicate id for
+ // extension-point
+ // \"org.eclipse.dltk.ui.modelElementFilters\""); //$NON-NLS-1$
}
fEnabledFilterIds.put(id, isEnabled);
fFilterDescriptorMap.put(id, filterDescs[i]);
@@ -460,15 +487,15 @@
// ---------- viewer filter handling ----------
private void installFilters() {
- fInstalledBuiltInFilters= new HashMap(fEnabledFilterIds.size());
- fPatternFilter= new NamePatternFilter();
+ fInstalledBuiltInFilters = new HashMap(fEnabledFilterIds.size());
+ fPatternFilter = new NamePatternFilter();
fPatternFilter.setPatterns(getUserAndBuiltInPatterns());
fViewer.addFilter(fPatternFilter);
updateBuiltInFilters();
}
private void updateViewerFilters(boolean refresh) {
- String[] patterns= getUserAndBuiltInPatterns();
+ String[] patterns = getUserAndBuiltInPatterns();
fPatternFilter.setPatterns(patterns);
fViewer.getControl().setRedraw(false);
updateBuiltInFilters();
@@ -478,14 +505,14 @@
}
private void updateBuiltInFilters() {
- Set installedFilters= fInstalledBuiltInFilters.keySet();
- Set filtersToAdd= new HashSet(fEnabledFilterIds.size());
- Set filtersToRemove= new HashSet(fEnabledFilterIds.size());
- Iterator iter= fEnabledFilterIds.entrySet().iterator();
+ Set installedFilters = fInstalledBuiltInFilters.keySet();
+ Set filtersToAdd = new HashSet(fEnabledFilterIds.size());
+ Set filtersToRemove = new HashSet(fEnabledFilterIds.size());
+ Iterator iter = fEnabledFilterIds.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry= (Map.Entry)iter.next();
- String id= (String)entry.getKey();
- boolean isEnabled= ((Boolean)entry.getValue()).booleanValue();
+ Map.Entry entry = (Map.Entry) iter.next();
+ String id = (String) entry.getKey();
+ boolean isEnabled = ((Boolean) entry.getValue()).booleanValue();
if (isEnabled && !installedFilters.contains(id))
filtersToAdd.add(id);
else if (!isEnabled && installedFilters.contains(id))
@@ -493,21 +520,22 @@
}
// Install the filters
- FilterDescriptor[] filterDescs= getCachedFilterDescriptors();
- for (int i= 0; i < filterDescs.length; i++) {
- String id= filterDescs[i].getId();
+ FilterDescriptor[] filterDescs = getCachedFilterDescriptors();
+ for (int i = 0; i < filterDescs.length; i++) {
+ String id = filterDescs[i].getId();
// just to double check - id should denote a custom filter anyway
- boolean isCustomFilter= filterDescs[i].isCustomFilter();
+ boolean isCustomFilter = filterDescs[i].isCustomFilter();
if (isCustomFilter) {
if (filtersToAdd.contains(id)) {
- ViewerFilter filter= filterDescs[i].createViewerFilter();
+ ViewerFilter filter = filterDescs[i].createViewerFilter();
if (filter != null) {
fViewer.addFilter(filter);
fInstalledBuiltInFilters.put(id, filter);
}
}
if (filtersToRemove.contains(id)) {
- fViewer.removeFilter((ViewerFilter)fInstalledBuiltInFilters.get(id));
+ fViewer.removeFilter(
+ (ViewerFilter) fInstalledBuiltInFilters.get(id));
fInstalledBuiltInFilters.remove(id);
}
}
@@ -515,16 +543,16 @@
}
private String[] getUserAndBuiltInPatterns() {
- List<String> patterns = new ArrayList<String>(
- fUserDefinedPatterns.length);
+ List<String> patterns = new ArrayList<>(fUserDefinedPatterns.length);
if (areUserDefinedPatternsEnabled())
patterns.addAll(Arrays.asList(fUserDefinedPatterns));
- FilterDescriptor[] filterDescs= getCachedFilterDescriptors();
- for (int i= 0; i < filterDescs.length; i++) {
- String id= filterDescs[i].getId();
- boolean isPatternFilter= filterDescs[i].isPatternFilter();
- Object isEnabled= fEnabledFilterIds.get(id);
- if (isEnabled != null && isPatternFilter && ((Boolean)isEnabled).booleanValue())
+ FilterDescriptor[] filterDescs = getCachedFilterDescriptors();
+ for (int i = 0; i < filterDescs.length; i++) {
+ String id = filterDescs[i].getId();
+ boolean isPatternFilter = filterDescs[i].isPatternFilter();
+ Object isEnabled = fEnabledFilterIds.get(id);
+ if (isEnabled != null && isPatternFilter
+ && ((Boolean) isEnabled).booleanValue())
patterns.add(filterDescs[i].getPattern());
}
return patterns.toArray(new String[patterns.size()]);
@@ -534,57 +562,67 @@
private void initializeWithViewDefaults() {
// get default values for view
- IPreferenceStore store= DLTKUIPlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore();
// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=22533
if (!store.contains(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE)))
return;
- fUserDefinedPatternsEnabled= store.getBoolean(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED));
- setUserDefinedPatterns(CustomFiltersDialog.convertFromString(store.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)), SEPARATOR));
+ fUserDefinedPatternsEnabled = store.getBoolean(
+ getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED));
+ setUserDefinedPatterns(CustomFiltersDialog.convertFromString(
+ store.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)),
+ SEPARATOR));
- Iterator iter= fEnabledFilterIds.entrySet().iterator();
+ Iterator iter = fEnabledFilterIds.entrySet().iterator();
while (iter.hasNext()) {
- Entry entry= (Entry) iter.next();
- String id= (String) entry.getKey();
- // set default to value from plugin contributions (fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=73991 ):
+ Entry entry = (Entry) iter.next();
+ String id = (String) entry.getKey();
+ // set default to value from plugin contributions (fixes
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73991 ):
store.setDefault(id, ((Boolean) entry.getValue()).booleanValue());
- Boolean isEnabled= Boolean.valueOf(store.getBoolean(id));
+ Boolean isEnabled = Boolean.valueOf(store.getBoolean(id));
fEnabledFilterIds.put(id, isEnabled);
}
fLRUFilterIdsStack.clear();
- String lruFilterIds= store.getString(TAG_LRU_FILTERS);
- StringTokenizer tokenizer= new StringTokenizer(lruFilterIds, SEPARATOR);
+ String lruFilterIds = store.getString(TAG_LRU_FILTERS);
+ StringTokenizer tokenizer = new StringTokenizer(lruFilterIds,
+ SEPARATOR);
while (tokenizer.hasMoreTokens()) {
- String id= tokenizer.nextToken();
- if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id))
+ String id = tokenizer.nextToken();
+ if (fFilterDescriptorMap.containsKey(id)
+ && !fLRUFilterIdsStack.contains(id))
fLRUFilterIdsStack.push(id);
}
}
private void storeViewDefaults() {
// get default values for view
- IPreferenceStore store= DLTKUIPlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore();
// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=22533
- store.setValue(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE), "storedViewPreferences");//$NON-NLS-1$
+ store.setValue(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE),
+ "storedViewPreferences");//$NON-NLS-1$
- store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED), fUserDefinedPatternsEnabled);
- store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS), CustomFiltersDialog.convertToString(fUserDefinedPatterns ,SEPARATOR));
+ store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED),
+ fUserDefinedPatternsEnabled);
+ store.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS),
+ CustomFiltersDialog.convertToString(fUserDefinedPatterns,
+ SEPARATOR));
- Iterator iter= fEnabledFilterIds.entrySet().iterator();
+ Iterator iter = fEnabledFilterIds.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry= (Map.Entry)iter.next();
- String id= (String)entry.getKey();
- boolean isEnabled= ((Boolean)entry.getValue()).booleanValue();
+ Map.Entry entry = (Map.Entry) iter.next();
+ String id = (String) entry.getKey();
+ boolean isEnabled = ((Boolean) entry.getValue()).booleanValue();
store.setValue(id, isEnabled);
}
- StringBuffer buf= new StringBuffer(fLRUFilterIdsStack.size() * 20);
- iter= fLRUFilterIdsStack.iterator();
+ StringBuffer buf = new StringBuffer(fLRUFilterIdsStack.size() * 20);
+ iter = fLRUFilterIdsStack.iterator();
while (iter.hasNext()) {
- buf.append((String)iter.next());
+ buf.append((String) iter.next());
buf.append(SEPARATOR);
}
store.setValue(TAG_LRU_FILTERS, buf.toString());
@@ -599,54 +637,59 @@
/**
* Saves the state of the custom filters in a memento.
*
- * @param memento the memento into which the state is saved
+ * @param memento
+ * the memento into which the state is saved
*/
public void saveState(IMemento memento) {
- IMemento customFilters= memento.createChild(TAG_CUSTOM_FILTERS);
- customFilters.putString(TAG_USER_DEFINED_PATTERNS_ENABLED, Boolean.toString(fUserDefinedPatternsEnabled));
+ IMemento customFilters = memento.createChild(TAG_CUSTOM_FILTERS);
+ customFilters.putString(TAG_USER_DEFINED_PATTERNS_ENABLED,
+ Boolean.toString(fUserDefinedPatternsEnabled));
saveUserDefinedPatterns(customFilters);
saveXmlDefinedFilters(customFilters);
saveLRUFilters(customFilters);
}
private void saveXmlDefinedFilters(IMemento memento) {
- if(fEnabledFilterIds != null && !fEnabledFilterIds.isEmpty()) {
- IMemento xmlDefinedFilters= memento.createChild(TAG_XML_DEFINED_FILTERS);
- Iterator iter= fEnabledFilterIds.entrySet().iterator();
+ if (fEnabledFilterIds != null && !fEnabledFilterIds.isEmpty()) {
+ IMemento xmlDefinedFilters = memento
+ .createChild(TAG_XML_DEFINED_FILTERS);
+ Iterator iter = fEnabledFilterIds.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry= (Map.Entry)iter.next();
- String id= (String)entry.getKey();
- Boolean isEnabled= (Boolean)entry.getValue();
- IMemento child= xmlDefinedFilters.createChild(TAG_CHILD);
+ Map.Entry entry = (Map.Entry) iter.next();
+ String id = (String) entry.getKey();
+ Boolean isEnabled = (Boolean) entry.getValue();
+ IMemento child = xmlDefinedFilters.createChild(TAG_CHILD);
child.putString(TAG_FILTER_ID, id);
child.putString(TAG_IS_ENABLED, isEnabled.toString());
}
}
}
+
/**
- * Stores the last recently used filter Ids into
- * the given memento
+ * Stores the last recently used filter Ids into the given memento
*
- * @param memento the memento into which to store the LRU filter Ids
+ * @param memento
+ * the memento into which to store the LRU filter Ids
*
*/
private void saveLRUFilters(IMemento memento) {
- if(fLRUFilterIdsStack != null && !fLRUFilterIdsStack.isEmpty()) {
- IMemento lruFilters= memento.createChild(TAG_LRU_FILTERS);
- Iterator iter= fLRUFilterIdsStack.iterator();
+ if (fLRUFilterIdsStack != null && !fLRUFilterIdsStack.isEmpty()) {
+ IMemento lruFilters = memento.createChild(TAG_LRU_FILTERS);
+ Iterator iter = fLRUFilterIdsStack.iterator();
while (iter.hasNext()) {
- String id= (String)iter.next();
- IMemento child= lruFilters.createChild(TAG_CHILD);
+ String id = (String) iter.next();
+ IMemento child = lruFilters.createChild(TAG_CHILD);
child.putString(TAG_FILTER_ID, id);
}
}
}
private void saveUserDefinedPatterns(IMemento memento) {
- if(fUserDefinedPatterns != null && fUserDefinedPatterns.length > 0) {
- IMemento userDefinedPatterns= memento.createChild(TAG_USER_DEFINED_PATTERNS);
- for (int i= 0; i < fUserDefinedPatterns.length; i++) {
- IMemento child= userDefinedPatterns.createChild(TAG_CHILD);
+ if (fUserDefinedPatterns != null && fUserDefinedPatterns.length > 0) {
+ IMemento userDefinedPatterns = memento
+ .createChild(TAG_USER_DEFINED_PATTERNS);
+ for (int i = 0; i < fUserDefinedPatterns.length; i++) {
+ IMemento child = userDefinedPatterns.createChild(TAG_CHILD);
child.putString(TAG_PATTERN, fUserDefinedPatterns[i]);
}
}
@@ -658,19 +701,22 @@
* Note: This method does not refresh the viewer.
* </p>
*
- * @param memento the memento from which the state is restored
+ * @param memento
+ * the memento from which the state is restored
*/
public void restoreState(IMemento memento) {
if (memento == null)
return;
- IMemento customFilters= memento.getChild(TAG_CUSTOM_FILTERS);
+ IMemento customFilters = memento.getChild(TAG_CUSTOM_FILTERS);
if (customFilters == null)
return;
- String userDefinedPatternsEnabled= customFilters.getString(TAG_USER_DEFINED_PATTERNS_ENABLED);
+ String userDefinedPatternsEnabled = customFilters
+ .getString(TAG_USER_DEFINED_PATTERNS_ENABLED);
if (userDefinedPatternsEnabled == null)
return;
- fUserDefinedPatternsEnabled= Boolean.valueOf(userDefinedPatternsEnabled).booleanValue();
+ fUserDefinedPatternsEnabled = Boolean
+ .valueOf(userDefinedPatternsEnabled).booleanValue();
restoreUserDefinedPatterns(customFilters);
restoreXmlDefinedFilters(customFilters);
restoreLRUFilters(customFilters);
@@ -679,12 +725,13 @@
}
private void restoreUserDefinedPatterns(IMemento memento) {
- IMemento userDefinedPatterns= memento.getChild(TAG_USER_DEFINED_PATTERNS);
- if(userDefinedPatterns != null) {
- IMemento children[]= userDefinedPatterns.getChildren(TAG_CHILD);
- String[] patterns= new String[children.length];
+ IMemento userDefinedPatterns = memento
+ .getChild(TAG_USER_DEFINED_PATTERNS);
+ if (userDefinedPatterns != null) {
+ IMemento children[] = userDefinedPatterns.getChildren(TAG_CHILD);
+ String[] patterns = new String[children.length];
for (int i = 0; i < children.length; i++)
- patterns[i]= children[i].getString(TAG_PATTERN);
+ patterns[i] = children[i].getString(TAG_PATTERN);
setUserDefinedPatterns(patterns);
} else
@@ -692,25 +739,27 @@
}
private void restoreXmlDefinedFilters(IMemento memento) {
- IMemento xmlDefinedFilters= memento.getChild(TAG_XML_DEFINED_FILTERS);
- if(xmlDefinedFilters != null) {
- IMemento[] children= xmlDefinedFilters.getChildren(TAG_CHILD);
- for (int i= 0; i < children.length; i++) {
- String id= children[i].getString(TAG_FILTER_ID);
- Boolean isEnabled= Boolean.valueOf(children[i].getString(TAG_IS_ENABLED));
+ IMemento xmlDefinedFilters = memento.getChild(TAG_XML_DEFINED_FILTERS);
+ if (xmlDefinedFilters != null) {
+ IMemento[] children = xmlDefinedFilters.getChildren(TAG_CHILD);
+ for (int i = 0; i < children.length; i++) {
+ String id = children[i].getString(TAG_FILTER_ID);
+ Boolean isEnabled = Boolean
+ .valueOf(children[i].getString(TAG_IS_ENABLED));
fEnabledFilterIds.put(id, isEnabled);
}
}
}
private void restoreLRUFilters(IMemento memento) {
- IMemento lruFilters= memento.getChild(TAG_LRU_FILTERS);
+ IMemento lruFilters = memento.getChild(TAG_LRU_FILTERS);
fLRUFilterIdsStack.clear();
- if(lruFilters != null) {
- IMemento[] children= lruFilters.getChildren(TAG_CHILD);
- for (int i= 0; i < children.length; i++) {
- String id= children[i].getString(TAG_FILTER_ID);
- if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id))
+ if (lruFilters != null) {
+ IMemento[] children = lruFilters.getChildren(TAG_CHILD);
+ for (int i = 0; i < children.length; i++) {
+ String id = children[i].getString(TAG_FILTER_ID);
+ if (fFilterDescriptorMap.containsKey(id)
+ && !fLRUFilterIdsStack.contains(id))
fLRUFilterIdsStack.push(id);
}
}
@@ -719,47 +768,49 @@
private void cleanUpPatternDuplicates() {
if (!areUserDefinedPatternsEnabled())
return;
- List<String> userDefinedPatterns = new ArrayList<String>(
+ List<String> userDefinedPatterns = new ArrayList<>(
Arrays.asList(fUserDefinedPatterns));
- FilterDescriptor[] filters= getCachedFilterDescriptors();
+ FilterDescriptor[] filters = getCachedFilterDescriptors();
- for (int i= 0; i < filters.length; i++) {
+ for (int i = 0; i < filters.length; i++) {
if (filters[i].isPatternFilter()) {
- String pattern= filters[i].getPattern();
+ String pattern = filters[i].getPattern();
if (userDefinedPatterns.contains(pattern)) {
fEnabledFilterIds.put(filters[i].getId(), Boolean.TRUE);
- boolean hasMore= true;
+ boolean hasMore = true;
while (hasMore)
- hasMore= userDefinedPatterns.remove(pattern);
+ hasMore = userDefinedPatterns.remove(pattern);
}
}
}
fUserDefinedPatterns = userDefinedPatterns
.toArray(new String[userDefinedPatterns.size()]);
- setUserDefinedPatternsEnabled(fUserDefinedPatternsEnabled && fUserDefinedPatterns.length > 0);
+ setUserDefinedPatternsEnabled(
+ fUserDefinedPatternsEnabled && fUserDefinedPatterns.length > 0);
}
private FilterDescriptor[] getCachedFilterDescriptors() {
if (fCachedFilterDescriptors == null)
- fCachedFilterDescriptors= FilterDescriptor.getFilterDescriptors(fTargetId);
+ fCachedFilterDescriptors = FilterDescriptor
+ .getFilterDescriptors(fTargetId);
return fCachedFilterDescriptors;
}
// ---------- dialog related code ----------
private void openDialog() {
- CustomFiltersDialog dialog= new CustomFiltersDialog(
- fViewer.getControl().getShell(),
- fTargetId,
- areUserDefinedPatternsEnabled(),
- fUserDefinedPatterns,
- internalGetEnabledFilterIds());
+ CustomFiltersDialog dialog = new CustomFiltersDialog(
+ fViewer.getControl().getShell(), fTargetId,
+ areUserDefinedPatternsEnabled(), fUserDefinedPatterns,
+ internalGetEnabledFilterIds());
if (dialog.open() == Window.OK) {
setEnabledFilterIds(dialog.getEnabledFilterIds());
- setUserDefinedPatternsEnabled(dialog.areUserDefinedPatternsEnabled());
+ setUserDefinedPatternsEnabled(
+ dialog.areUserDefinedPatternsEnabled());
setUserDefinedPatterns(dialog.getUserDefinedPatterns());
- setRecentlyChangedFilters(dialog.getFilterDescriptorChangeHistory());
+ setRecentlyChangedFilters(
+ dialog.getFilterDescriptorChangeHistory());
storeViewDefaults();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FormatAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FormatAction.java
index 0540fa7..f9bfc28 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FormatAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/FormatAction.java
@@ -46,7 +46,7 @@
static class ModuleCollector implements IModelElementVisitor {
- final List<ISourceModule> modules = new ArrayList<ISourceModule>();
+ final List<ISourceModule> modules = new ArrayList<>();
@Override
public boolean visit(IModelElement element) {
@@ -90,10 +90,12 @@
final String lineDelimiter = TextUtilities
.getDefaultLineDelimiter(document);
final Map<String, String> preferences = formatterFactory
- .retrievePreferences(new PreferencesLookupDelegate(
- project));
+ .retrievePreferences(
+ new PreferencesLookupDelegate(
+ project));
final IScriptFormatter formatter = formatterFactory
- .createFormatter(lineDelimiter, preferences);
+ .createFormatter(lineDelimiter,
+ preferences);
final TextEdit edit = formatter.format(source, 0,
source.length(), 0);
if (edit != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java
index 62c5b2e..d02ed4f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -49,7 +49,7 @@
* <p>
* The action is applicable to selections containing elements of type
* <code>ISourceModule</code>, <code>IMember</code> or <code>IFile</code>.
- *
+ *
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
@@ -62,7 +62,7 @@
* Creates a new <code>OpenAction</code>. The action requires that the
* selection provided by the site's selection provider is of type <code>
* org.eclipse.jface.viewers.IStructuredSelection</code> .
- *
+ *
* @param site
* the site providing context information for this action
*/
@@ -82,7 +82,7 @@
/**
* Note: This constructor is for internal use only. Clients should not call
* this constructor.
- *
+ *
* @param editor
* the Script editor
*/
@@ -90,7 +90,8 @@
this(editor.getEditorSite());
fEditor = editor;
setText(ActionMessages.OpenAction_declaration_label);
- setEnabled(EditorUtility.getEditorInputModelElement(fEditor, false) != null);
+ setEnabled(EditorUtility.getEditorInputModelElement(fEditor,
+ false) != null);
}
/*
@@ -125,13 +126,11 @@
|| ((element instanceof IAdaptable) && (((IAdaptable) element)
.getAdapter(ISourceReference.class) != null)))
return true;
- if ((element instanceof IFile)
- || ((element instanceof IAdaptable) && (((IAdaptable) element)
- .getAdapter(IFile.class) != null)))
+ if ((element instanceof IFile) || ((element instanceof IAdaptable)
+ && (((IAdaptable) element).getAdapter(IFile.class) != null)))
return true;
- if ((element instanceof IStorage)
- || ((element instanceof IAdaptable) && (((IAdaptable) element)
- .getAdapter(IStorage.class) != null)))
+ if ((element instanceof IStorage) || ((element instanceof IAdaptable)
+ && (((IAdaptable) element).getAdapter(IStorage.class) != null)))
return true;
return false;
}
@@ -139,14 +138,14 @@
/**
* This method allows alternative editor implementations to override the
* resolution logic.
- *
+ *
* @return
* @throws InvocationTargetException
* @throws InterruptedException
* @since 3.0
*/
- protected Object[] resolveElements() throws InvocationTargetException,
- InterruptedException {
+ protected Object[] resolveElements()
+ throws InvocationTargetException, InterruptedException {
return SelectionConverter.resolveForked(fEditor, false);
}
@@ -177,8 +176,7 @@
if (elements == null || elements.length == 0) {
IEditorStatusLine statusLine = null;
if (fEditor != null)
- statusLine = fEditor
- .getAdapter(IEditorStatusLine.class);
+ statusLine = fEditor.getAdapter(IEditorStatusLine.class);
if (statusLine != null)
statusLine.setMessage(true,
ActionMessages.OpenAction_error_messageBadSelection,
@@ -208,7 +206,7 @@
if (elements == null)
return null;
- Map<Object, Object> uniqueElements = new HashMap<Object, Object>();
+ Map<Object, Object> uniqueElements = new HashMap<>();
for (int i = 0; i < elements.length; i++) {
Object element = elements[i];
if (element instanceof IModelElement) {
@@ -228,8 +226,8 @@
private boolean isProcessable() {
if (fEditor != null) {
- IModelElement je = EditorUtility.getEditorInputModelElement(
- fEditor, false);
+ IModelElement je = EditorUtility.getEditorInputModelElement(fEditor,
+ false);
if (je instanceof ISourceModule
&& !ScriptModelUtil.isPrimary((ISourceModule) je))
return true; // can process non-primary working copies
@@ -250,7 +248,7 @@
/**
* Note: this method is for internal use only. Clients should not call this
* method.
- *
+ *
* @param elements
* the elements to process
*/
@@ -261,14 +259,14 @@
Object element = elements[i];
try {
element = getElementToOpen(element);
- boolean activateOnOpen = fEditor != null ? true : OpenStrategy
- .activateOnOpen();
+ boolean activateOnOpen = fEditor != null ? true
+ : OpenStrategy.activateOnOpen();
OpenActionUtil.open(element, activateOnOpen);
} catch (ModelException e) {
- DLTKUIPlugin.log(new Status(IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
- IModelStatusConstants.INTERNAL_ERROR,
- ActionMessages.OpenAction_error_message, e));
+ DLTKUIPlugin
+ .log(new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID,
+ IModelStatusConstants.INTERNAL_ERROR,
+ ActionMessages.OpenAction_error_message, e));
ErrorDialog.openError(getShell(), getDialogTitle(),
ActionMessages.OpenAction_error_messageProblems,
@@ -287,13 +285,11 @@
}
if (name != null) {
- MessageDialog
- .openError(
- getShell(),
- ActionMessages.OpenAction_error_messageProblems,
- NLS.bind(
- ActionMessages.OpenAction_error_messageArgs,
- name, x.getMessage()));
+ MessageDialog.openError(getShell(),
+ ActionMessages.OpenAction_error_messageProblems,
+ NLS.bind(
+ ActionMessages.OpenAction_error_messageArgs,
+ name, x.getMessage()));
}
}
}
@@ -302,7 +298,7 @@
/**
* Note: this method is for internal use only. Clients should not call this
* method.
- *
+ *
* @param object
* the element to open
* @return the real element to open
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenTypeHierarchyAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenTypeHierarchyAction.java
index 2dbe3a0..431090d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenTypeHierarchyAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/OpenTypeHierarchyAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -43,11 +43,11 @@
* <p>
* The action is applicable to selections containing elements of type
* <code>IType</code>.
- *
+ *
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
- *
+ *
* @since 2.0
*/
public class OpenTypeHierarchyAction extends SelectionDispatchAction {
@@ -59,9 +59,9 @@
* that the selection provided by the site's selection provider is of type
* <code>
* org.eclipse.jface.viewers.IStructuredSelection</code>.
- *
+ *
* @param site
- * the site providing context information for this action
+ * the site providing context information for this action
*/
public OpenTypeHierarchyAction(IWorkbenchSite site) {
super(site);
@@ -77,17 +77,17 @@
* that the selection provided by the given selection provider is of type
* <code>
* org.eclipse.jface.viewers.IStructuredSelection</code>.
- *
+ *
* @param site
- * the site providing context information for this action
+ * the site providing context information for this action
* @param provider
- * a special selection provider which is used instead of the site's
- * selection provider or <code>null</code> to use the site's selection
- * provider
- *
+ * a special selection provider which is used instead of the
+ * site's selection provider or <code>null</code> to use the
+ * site's selection provider
+ *
* @since 3.2
* @deprecated Use {@link #setSpecialSelectionProvider(ISelectionProvider)}
- * instead. This API will be removed after 3.2 M5.
+ * instead. This API will be removed after 3.2 M5.
*/
@Deprecated
public OpenTypeHierarchyAction(IWorkbenchSite site,
@@ -99,9 +99,9 @@
/**
* Note: This constructor is for internal use only. Clients should not call
* this constructor.
- *
+ *
* @param editor
- * the Script editor
+ * the Script editor
*/
public OpenTypeHierarchyAction(IEditorPart editor) {
this(editor.getEditorSite());
@@ -148,7 +148,7 @@
// case IModelElement.CLASS_FILE:
case IModelElement.SOURCE_MODULE:
return true;
- // case IModelElement.LOCAL_VARIABLE:
+ // case IModelElement.LOCAL_VARIABLE:
default:
return false;
}
@@ -168,8 +168,7 @@
.codeResolveOrInputForked(fEditor);
if (elements == null)
return;
- List<IModelElement> candidates = new ArrayList<IModelElement>(
- elements.length);
+ List<IModelElement> candidates = new ArrayList<>(elements.length);
for (int i = 0; i < elements.length; i++) {
IModelElement[] resolvedElements = OpenTypeHierarchyUtil
.getCandidates(elements[i]);
@@ -202,7 +201,8 @@
}
if (!(input instanceof IModelElement)) {
- IStatus status = createStatus(ActionMessages.OpenTypeHierarchyAction_messages_no_script_element);
+ IStatus status = createStatus(
+ ActionMessages.OpenTypeHierarchyAction_messages_no_script_element);
ErrorDialog.openError(getShell(), getDialogTitle(),
ActionMessages.OpenTypeHierarchyAction_messages_title,
status);
@@ -212,7 +212,7 @@
if (!ActionUtil.isProcessable(getShell(), element))
return;
- List<IModelElement> result = new ArrayList<IModelElement>(1);
+ List<IModelElement> result = new ArrayList<>(1);
IStatus status = compileCandidates(result, element);
if (status.isOK()) {
run(result.toArray(new IModelElement[result.size()]));
@@ -241,8 +241,8 @@
private static IStatus compileCandidates(List<IModelElement> result,
IModelElement elem) {
- IStatus ok = new Status(IStatus.OK, DLTKUIPlugin.getPluginId(), 0,
- "", null); //$NON-NLS-1$
+ IStatus ok = new Status(IStatus.OK, DLTKUIPlugin.getPluginId(), 0, "", //$NON-NLS-1$
+ null);
try {
switch (elem.getElementType()) {
// case IModelElement.INITIALIZER:
@@ -258,27 +258,28 @@
result.add(elem);
return ok;
}
- return createStatus(ActionMessages.OpenTypeHierarchyAction_messages_no_script_resources);
+ return createStatus(
+ ActionMessages.OpenTypeHierarchyAction_messages_no_script_resources);
case IModelElement.PACKAGE_DECLARATION:
result.add(elem.getAncestor(IModelElement.SCRIPT_FOLDER));
return ok;
- // case IModelElement.IMPORT_DECLARATION:
- // IImportDeclaration decl= (IImportDeclaration) elem;
- // if (decl.isOnDemand()) {
- // elem= JavaModelUtil.findTypeContainer(elem.getJavaProject(),
- // Signature.getQualifier(elem.getElementName()));
- // } else {
- // elem= elem.getJavaProject().findType(elem.getElementName());
- // }
- // if (elem != null) {
- // result.add(elem);
- // return ok;
- // }
- // return createStatus(ActionMessages.
- // OpenTypeHierarchyAction_messages_unknown_import_decl);
- // case IJavaElement.CLASS_FILE:
- // result.add(((IClassFile)elem).getType());
- // return ok;
+ // case IModelElement.IMPORT_DECLARATION:
+ // IImportDeclaration decl= (IImportDeclaration) elem;
+ // if (decl.isOnDemand()) {
+ // elem= JavaModelUtil.findTypeContainer(elem.getJavaProject(),
+ // Signature.getQualifier(elem.getElementName()));
+ // } else {
+ // elem= elem.getJavaProject().findType(elem.getElementName());
+ // }
+ // if (elem != null) {
+ // result.add(elem);
+ // return ok;
+ // }
+ // return createStatus(ActionMessages.
+ // OpenTypeHierarchyAction_messages_unknown_import_decl);
+ // case IJavaElement.CLASS_FILE:
+ // result.add(((IClassFile)elem).getType());
+ // return ok;
case IModelElement.SOURCE_MODULE:
AbstractSourceModule cu = (AbstractSourceModule) elem;
IType[] types = cu.getTypes();
@@ -286,12 +287,14 @@
result.addAll(Arrays.asList(types));
return ok;
}
- return createStatus(ActionMessages.OpenTypeHierarchyAction_messages_no_types);
+ return createStatus(
+ ActionMessages.OpenTypeHierarchyAction_messages_no_types);
}
} catch (ModelException e) {
return e.getStatus();
}
- return createStatus(ActionMessages.OpenTypeHierarchyAction_messages_no_valid_script_element);
+ return createStatus(
+ ActionMessages.OpenTypeHierarchyAction_messages_no_valid_script_element);
}
private static IStatus createStatus(String message) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java
index 3d4da58..aed21f3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java
@@ -21,8 +21,8 @@
import org.eclipse.dltk.core.ModelException;
/**
- * Contains a list of package fragments with the same name
- * but residing in different source folders of a unique Java project.
+ * Contains a list of package fragments with the same name but residing in
+ * different source folders of a unique Java project.
*/
public class LogicalPackage extends PlatformObject {
@@ -30,58 +30,58 @@
private String fName;
private IScriptProject fScriptProject;
- public LogicalPackage(IScriptFolder fragment){
+ public LogicalPackage(IScriptFolder fragment) {
Assert.isNotNull(fragment);
- fPackages = new HashSet<IScriptFolder>();
- fScriptProject= fragment.getScriptProject();
+ fPackages = new HashSet<>();
+ fScriptProject = fragment.getScriptProject();
Assert.isNotNull(fScriptProject);
add(fragment);
- fName= fragment.getElementName();
+ fName = fragment.getElementName();
}
- public IScriptProject getScriptProject(){
+ public IScriptProject getScriptProject() {
return fScriptProject;
}
- public IScriptFolder[] getScriptFolders(){
+ public IScriptFolder[] getScriptFolders() {
return fPackages.toArray(new IScriptFolder[fPackages.size()]);
}
- public void add(IScriptFolder fragment){
- Assert.isTrue(fragment != null && fScriptProject.equals(fragment.getScriptProject()));
+ public void add(IScriptFolder fragment) {
+ Assert.isTrue(fragment != null
+ && fScriptProject.equals(fragment.getScriptProject()));
fPackages.add(fragment);
}
- public void remove(IScriptFolder fragment){
+ public void remove(IScriptFolder fragment) {
fPackages.remove(fragment);
}
- public boolean contains(IScriptFolder fragment){
+ public boolean contains(IScriptFolder fragment) {
return fPackages.contains(fragment);
}
- public String getElementName(){
+ public String getElementName() {
return fName;
}
- public int size(){
+ public int size() {
return fPackages.size();
}
/**
- * Returns true if the given fragment has the same name and
- * resides inside the same project as the other fragments in
- * the LogicalPackage.
+ * Returns true if the given fragment has the same name and resides inside
+ * the same project as the other fragments in the LogicalPackage.
*
* @param fragment
* @return boolean
*/
public boolean belongs(IScriptFolder fragment) {
- if(fragment==null)
+ if (fragment == null)
return false;
- if(fScriptProject.equals(fragment.getScriptProject())){
+ if (fScriptProject.equals(fragment.getScriptProject())) {
return fName.equals(fragment.getElementName());
}
@@ -104,23 +104,24 @@
}
@Override
- public boolean equals(Object o){
+ public boolean equals(Object o) {
if (!(o instanceof LogicalPackage))
return false;
- LogicalPackage lp= (LogicalPackage)o;
+ LogicalPackage lp = (LogicalPackage) o;
if (!fScriptProject.equals(lp.getScriptProject()))
return false;
- IScriptFolder[] fragments= lp.getScriptFolders();
+ IScriptFolder[] fragments = lp.getScriptFolders();
if (fragments.length != getScriptFolders().length)
return false;
- //this works because a LogicalPackage cannot contain the same IPackageFragment twice
- for (int i= 0; i < fragments.length; i++) {
- IScriptFolder fragment= fragments[i];
- if(!fPackages.contains(fragment))
+ // this works because a LogicalPackage cannot contain the same
+ // IPackageFragment twice
+ for (int i = 0; i < fragments.length; i++) {
+ IScriptFolder fragment = fragments[i];
+ if (!fPackages.contains(fragment))
return false;
}
@@ -129,13 +130,16 @@
@Override
public int hashCode() {
- IScriptFolder[] fragments= getScriptFolders();
- return fScriptProject.hashCode() + getHash(fragments, fragments.length-1);
+ IScriptFolder[] fragments = getScriptFolders();
+ return fScriptProject.hashCode()
+ + getHash(fragments, fragments.length - 1);
}
private int getHash(IScriptFolder[] fragments, int index) {
if (index <= 0)
return fragments[0].hashCode() * 17;
- else return fragments[index].hashCode() * 17 + getHash(fragments, index-1);
+ else
+ return fragments[index].hashCode() * 17
+ + getHash(fragments, index - 1);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java
index a07deb0..a9419aa 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java
@@ -28,50 +28,54 @@
/**
* Table content provider for the hierarchical layout in the packages view.
* <p>
- * XXX: The standard Java browsing part content provider needs and calls
- * the browsing part/view. This class currently doesn't need to do so
- * but might be required to later.
+ * XXX: The standard Java browsing part content provider needs and calls the
+ * browsing part/view. This class currently doesn't need to do so but might be
+ * required to later.
* </p>
*/
-class PackagesViewFlatContentProvider extends LogicalPackagesProvider implements IStructuredContentProvider {
+class PackagesViewFlatContentProvider extends LogicalPackagesProvider
+ implements IStructuredContentProvider {
PackagesViewFlatContentProvider(StructuredViewer viewer) {
super(viewer);
}
/*
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
+ * Object)
*/
public Object[] getChildren(Object parentElement) {
- if(parentElement instanceof IModelElement){
- IModelElement element= (IModelElement) parentElement;
+ if (parentElement instanceof IModelElement) {
+ IModelElement element = (IModelElement) parentElement;
- int type= element.getElementType();
+ int type = element.getElementType();
try {
switch (type) {
- case IModelElement.SCRIPT_PROJECT :
- IScriptProject project= (IScriptProject) element;
- IScriptFolder[] children= getPackageFragments(project.getScriptFolders());
- if(isInCompoundState()) {
- fMapToLogicalPackage.clear();
- fMapToPackageFragments.clear();
- return combineSamePackagesIntoLogialPackages(children);
- } else
- return children;
-
- case IModelElement.PROJECT_FRAGMENT :
+ case IModelElement.SCRIPT_PROJECT:
+ IScriptProject project = (IScriptProject) element;
+ IScriptFolder[] children = getPackageFragments(
+ project.getScriptFolders());
+ if (isInCompoundState()) {
fMapToLogicalPackage.clear();
fMapToPackageFragments.clear();
- IProjectFragment root= (IProjectFragment) element;
- return root.getChildren();
+ return combineSamePackagesIntoLogialPackages(children);
+ } else
+ return children;
- case IModelElement.SCRIPT_FOLDER :
- //no children in flat view
- break;
+ case IModelElement.PROJECT_FRAGMENT:
+ fMapToLogicalPackage.clear();
+ fMapToPackageFragments.clear();
+ IProjectFragment root = (IProjectFragment) element;
+ return root.getChildren();
- default :
- //do nothing, empty array returned
+ case IModelElement.SCRIPT_FOLDER:
+ // no children in flat view
+ break;
+
+ default:
+ // do nothing, empty array returned
}
} catch (ModelException e) {
return NO_CHILDREN;
@@ -84,14 +88,15 @@
/*
* Weeds out packageFragments from external jars
*/
- private IScriptFolder[] getPackageFragments(IScriptFolder[] iPackageFragments) {
- List<IScriptFolder> list = new ArrayList<IScriptFolder>();
- for (int i= 0; i < iPackageFragments.length; i++) {
- IScriptFolder fragment= iPackageFragments[i];
- IModelElement el= fragment.getParent();
+ private IScriptFolder[] getPackageFragments(
+ IScriptFolder[] iPackageFragments) {
+ List<IScriptFolder> list = new ArrayList<>();
+ for (int i = 0; i < iPackageFragments.length; i++) {
+ IScriptFolder fragment = iPackageFragments[i];
+ IModelElement el = fragment.getParent();
if (el instanceof IProjectFragment) {
- IProjectFragment root= (IProjectFragment) el;
- if(root.isArchive() && root.isExternal())
+ IProjectFragment root = (IProjectFragment) el;
+ if (root.isArchive() && root.isExternal())
continue;
}
list.add(fragment);
@@ -99,24 +104,23 @@
return list.toArray(new IScriptFolder[list.size()]);
}
- /*
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
@Override
public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}
@Override
- protected void processDelta(IModelElementDelta delta) throws ModelException {
+ protected void processDelta(IModelElementDelta delta)
+ throws ModelException {
- int kind= delta.getKind();
- final IModelElement element= delta.getElement();
+ int kind = delta.getKind();
+ final IModelElement element = delta.getElement();
if (isClassPathChange(delta)) {
- Object input= fViewer.getInput();
+ Object input = fViewer.getInput();
if (input != null) {
- if (fInputIsProject && input.equals(element.getScriptProject())) {
+ if (fInputIsProject
+ && input.equals(element.getScriptProject())) {
postRefresh(input);
return;
} else if (!fInputIsProject && input.equals(element)) {
@@ -130,15 +134,15 @@
}
if (kind == IModelElementDelta.REMOVED) {
- Object input= fViewer.getInput();
+ Object input = fViewer.getInput();
if (input != null && input.equals(element)) {
- postRemove(input);
- return;
+ postRemove(input);
+ return;
}
}
if (element instanceof IScriptFolder) {
- final IScriptFolder frag= (IScriptFolder) element;
+ final IScriptFolder frag = (IScriptFolder) element;
if (kind == IModelElementDelta.REMOVED) {
removeElement(frag);
@@ -147,51 +151,56 @@
addElement(frag);
} else if (kind == IModelElementDelta.CHANGED) {
- //just refresh
- Object toBeRefreshed= element;
+ // just refresh
+ Object toBeRefreshed = element;
- IScriptFolder pkgFragment= (IScriptFolder) element;
- LogicalPackage logicalPkg= findLogicalPackage(pkgFragment);
- //deal with packages that have been filtered and are now visible
+ IScriptFolder pkgFragment = (IScriptFolder) element;
+ LogicalPackage logicalPkg = findLogicalPackage(pkgFragment);
+ // deal with packages that have been filtered and are now
+ // visible
if (logicalPkg != null)
- toBeRefreshed= findElementToRefresh(logicalPkg);
+ toBeRefreshed = findElementToRefresh(logicalPkg);
else
- toBeRefreshed= findElementToRefresh(pkgFragment);
+ toBeRefreshed = findElementToRefresh(pkgFragment);
postRefresh(toBeRefreshed);
}
- //in this view there will be no children of PackageFragment to refresh
+ // in this view there will be no children of PackageFragment to
+ // refresh
return;
}
processAffectedChildren(delta);
}
- //test to see if element to be refreshed is being filtered out
- //and if so refresh the viewers input element (JavaProject or PackageFragmentRoot)
+ // test to see if element to be refreshed is being filtered out
+ // and if so refresh the viewers input element (JavaProject or
+ // PackageFragmentRoot)
private Object findElementToRefresh(IScriptFolder fragment) {
if (fViewer.testFindItem(fragment) == null) {
- if(fInputIsProject)
+ if (fInputIsProject)
return fragment.getScriptProject();
- else return fragment.getParent();
+ else
+ return fragment.getParent();
}
return fragment;
}
- //test to see if element to be refreshed is being filtered out
- //and if so refresh the viewers input element (JavaProject or PackageFragmentRoot)
+ // test to see if element to be refreshed is being filtered out
+ // and if so refresh the viewers input element (JavaProject or
+ // PackageFragmentRoot)
private Object findElementToRefresh(LogicalPackage logicalPackage) {
if (fViewer.testFindItem(logicalPackage) == null) {
- IScriptFolder fragment= logicalPackage.getScriptFolders()[0];
+ IScriptFolder fragment = logicalPackage.getScriptFolders()[0];
return fragment.getScriptProject();
}
return logicalPackage;
}
-
- private void processAffectedChildren(IModelElementDelta delta) throws ModelException {
- IModelElementDelta[] children= delta.getAffectedChildren();
- for (int i= 0; i < children.length; i++) {
- IModelElementDelta elementDelta= children[i];
+ private void processAffectedChildren(IModelElementDelta delta)
+ throws ModelException {
+ IModelElementDelta[] children = delta.getAffectedChildren();
+ for (int i = 0; i < children.length; i++) {
+ IModelElementDelta elementDelta = children[i];
processDelta(elementDelta);
}
}
@@ -205,7 +214,6 @@
});
}
-
private void postRemove(final Object object) {
postRunnable(() -> {
Control ctrl = fViewer.getControl();
@@ -216,44 +224,45 @@
}
private void postRunnable(final Runnable r) {
- Control ctrl= fViewer.getControl();
+ Control ctrl = fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
- // fBrowsingPart.setProcessSelectionEvents(false);
+ // fBrowsingPart.setProcessSelectionEvents(false);
try {
- Display currentDisplay= Display.getCurrent();
- if (currentDisplay != null && currentDisplay.equals(ctrl.getDisplay()))
+ Display currentDisplay = Display.getCurrent();
+ if (currentDisplay != null
+ && currentDisplay.equals(ctrl.getDisplay()))
ctrl.getDisplay().syncExec(r);
else
ctrl.getDisplay().asyncExec(r);
} finally {
- // fBrowsingPart.setProcessSelectionEvents(true);
+ // fBrowsingPart.setProcessSelectionEvents(true);
}
}
}
private void removeElement(IScriptFolder frag) {
- String key= getKey(frag);
- LogicalPackage lp= (LogicalPackage)fMapToLogicalPackage.get(key);
+ String key = getKey(frag);
+ LogicalPackage lp = (LogicalPackage) fMapToLogicalPackage.get(key);
- if(lp != null){
+ if (lp != null) {
lp.remove(frag);
- //if you need to change the LogicalPackage to a PackageFragment
- if(lp.getScriptFolders().length == 1){
- IScriptFolder fragment= lp.getScriptFolders()[0];
+ // if you need to change the LogicalPackage to a PackageFragment
+ if (lp.getScriptFolders().length == 1) {
+ IScriptFolder fragment = lp.getScriptFolders()[0];
fMapToLogicalPackage.remove(key);
- fMapToPackageFragments.put(key,fragment);
+ fMapToPackageFragments.put(key, fragment);
- //@Improve: Should I replace this with a refresh of the parent?
+ // @Improve: Should I replace this with a refresh of the parent?
postRemove(lp);
postAdd(fragment);
- } return;
+ }
+ return;
} else {
fMapToPackageFragments.remove(key);
postRemove(frag);
}
}
-
private void postRefresh(final Object element) {
postRunnable(() -> {
Control ctrl = fViewer.getControl();
@@ -264,23 +273,24 @@
}
private void addElement(IScriptFolder frag) {
- String key= getKey(frag);
- LogicalPackage lp= (LogicalPackage)fMapToLogicalPackage.get(key);
+ String key = getKey(frag);
+ LogicalPackage lp = (LogicalPackage) fMapToLogicalPackage.get(key);
- if(lp != null && lp.belongs(frag)){
+ if (lp != null && lp.belongs(frag)) {
lp.add(frag);
return;
}
- IScriptFolder fragment= (IScriptFolder)fMapToPackageFragments.get(key);
- if(fragment != null){
- //must create a new LogicalPackage
- if(!fragment.equals(frag)){
- lp= new LogicalPackage(fragment);
+ IScriptFolder fragment = (IScriptFolder) fMapToPackageFragments
+ .get(key);
+ if (fragment != null) {
+ // must create a new LogicalPackage
+ if (!fragment.equals(frag)) {
+ lp = new LogicalPackage(fragment);
lp.add(frag);
fMapToLogicalPackage.put(key, lp);
- //@Improve: should I replace this with a refresh?
+ // @Improve: should I replace this with a refresh?
postRemove(fragment);
postAdd(lp);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java
index a498149..27bb6b5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java
@@ -63,9 +63,9 @@
fMapToPackageFragments.clear();
IScriptProject project = (IScriptProject) parentElement;
- IScriptFolder[] topLevelChildren = getTopLevelChildrenByElementName(project
- .getScriptFolders());
- List<IScriptFolder> list = new ArrayList<IScriptFolder>();
+ IScriptFolder[] topLevelChildren = getTopLevelChildrenByElementName(
+ project.getScriptFolders());
+ List<IScriptFolder> list = new ArrayList<>();
for (int i = 0; i < topLevelChildren.length; i++) {
IScriptFolder fragment = topLevelChildren[i];
@@ -84,14 +84,13 @@
IProjectFragment root = packageFragmentRoots[i];
IResource resource = root.getUnderlyingResource();
if (resource != null && resource instanceof IFolder) {
- folders.addAll(getFolders(((IFolder) resource)
- .members()));
+ folders.addAll(
+ getFolders(((IFolder) resource).members()));
}
}
Object[] logicalPackages = combineSamePackagesIntoLogialPackages(
- list
- .toArray(new IScriptFolder[list.size()]));
+ list.toArray(new IScriptFolder[list.size()]));
if (folders.size() > 0) {
if (logicalPackages.length > 0)
folders.addAll(Arrays.asList(logicalPackages));
@@ -115,9 +114,10 @@
addFragmentsToMap(fragments);
return fragments;
- } else if (resource != null && resource instanceof IFolder) {
- List children = getFoldersAndElements(((IFolder) resource)
- .members());
+ } else if (resource != null
+ && resource instanceof IFolder) {
+ List children = getFoldersAndElements(
+ ((IFolder) resource).members());
IScriptFolder defaultPackage = root.getScriptFolder(""); //$NON-NLS-1$
if (defaultPackage.exists())
@@ -162,7 +162,7 @@
// @Improve: rewrite using concatenate
} else if (parentElement instanceof LogicalPackage) {
- List<IScriptFolder> children = new ArrayList<IScriptFolder>();
+ List<IScriptFolder> children = new ArrayList<>();
LogicalPackage logicalPackage = (LogicalPackage) parentElement;
IScriptFolder[] elements = logicalPackage.getScriptFolders();
for (int i = 0; i < elements.length; i++) {
@@ -172,8 +172,7 @@
children.addAll(Arrays.asList(objects));
}
return combineSamePackagesIntoLogialPackages(
- children
- .toArray(new IScriptFolder[children.size()]));
+ children.toArray(new IScriptFolder[children.size()]));
} else if (parentElement instanceof IFolder) {
IFolder folder = (IFolder) parentElement;
IResource[] resources = folder.members();
@@ -189,7 +188,7 @@
}
private void addFragmentsToMap(List elements) {
- List<IScriptFolder> packageFragments = new ArrayList<IScriptFolder>();
+ List<IScriptFolder> packageFragments = new ArrayList<>();
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object elem = iter.next();
if (elem instanceof IScriptFolder)
@@ -238,7 +237,7 @@
private IScriptFolder[] findNextLevelChildrenByElementName(
IProjectFragment parent, IScriptFolder fragment) {
- List<IScriptFolder> list = new ArrayList<IScriptFolder>();
+ List<IScriptFolder> list = new ArrayList<>();
try {
IModelElement[] children = parent.getChildren();
@@ -273,7 +272,7 @@
private IScriptFolder[] getTopLevelChildrenByElementName(
IModelElement[] elements) {
- List<IScriptFolder> topLevelElements = new ArrayList<IScriptFolder>();
+ List<IScriptFolder> topLevelElements = new ArrayList<>();
for (int i = 0; i < elements.length; i++) {
IModelElement iJavaElement = elements[i];
// if the name of the PackageFragment is the top level package it
@@ -366,8 +365,8 @@
.getProjectFragments();
for (int i = 0; i < roots.length; i++) {
IProjectFragment root = roots[i];
- IScriptFolder fragment = root.getScriptFolder(pkgFragment
- .getElementName());
+ IScriptFolder fragment = root
+ .getScriptFolder(pkgFragment.getElementName());
if (fragment.exists() && !fragment.equals(pkgFragment))
fragments.add(fragment);
}
@@ -449,7 +448,8 @@
}
/*
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
+ * @see
+ * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
*/
@Override
public Object[] getElements(Object inputElement) {
@@ -465,7 +465,8 @@
if (isClassPathChange(delta)) {
Object input = fViewer.getInput();
if (input != null) {
- if (fInputIsProject && input.equals(element.getScriptProject())) {
+ if (fInputIsProject
+ && input.equals(element.getScriptProject())) {
postRefresh(input);
return;
} else if (!fInputIsProject && input.equals(element)) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java
index 416eb82..6a636fa 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/ext/MultiSelectionListViewer.java
@@ -23,7 +23,7 @@
public class MultiSelectionListViewer extends ScrolledComposite {
// Contain ListViewers
- private List<TreeViewer> viewers = new ArrayList<TreeViewer>();
+ private List<TreeViewer> viewers = new ArrayList<>();
private int elements = 0;
private ColumnForm columnForm;
private ITreeContentProvider contentProvider;
@@ -85,12 +85,13 @@
Tree tree = viewer.getTree();
if (!tree.isDisposed()) {
Rectangle bounds = tree.getBounds();
-// Point origin = MultiSelectionListViewer.this.getOrigin();
-// double step = ( origin.x - ( bounds.x + bounds.width ) ) / 10;
-// for (int i = 0; i < 50; i++) {
-// MultiSelectionListViewer.this.setOrigin(origin.x - (int)step*i, bounds.y);
-// redraw();
-// }
+ // Point origin = MultiSelectionListViewer.this.getOrigin();
+ // double step = ( origin.x - ( bounds.x + bounds.width ) ) / 10;
+ // for (int i = 0; i < 50; i++) {
+ // MultiSelectionListViewer.this.setOrigin(origin.x - (int)step*i,
+ // bounds.y);
+ // redraw();
+ // }
}
elementSelectionChanged(viewer.getSelection());
}
@@ -117,7 +118,8 @@
}
@Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
}
@Override
@@ -222,7 +224,8 @@
if (controlIndex < this.viewers.size()) {
TreeViewer prevViewer = viewers.get(controlIndex);
ISelection selection = prevViewer.getSelection();
- if (selection != null && selection instanceof IStructuredSelection) {
+ if (selection != null
+ && selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) selection;
Object firstElement = sel.getFirstElement();
if (firstElement != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/compare/ScriptMergeViewer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/compare/ScriptMergeViewer.java
index bcfa0e1..d17d3ac 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/compare/ScriptMergeViewer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/compare/ScriptMergeViewer.java
@@ -36,7 +36,7 @@
*/
public class ScriptMergeViewer extends TextMergeViewer {
- private static final Stack<IDLTKUILanguageToolkit> toolkitStorage = new Stack<IDLTKUILanguageToolkit>();
+ private static final Stack<IDLTKUILanguageToolkit> toolkitStorage = new Stack<>();
/*
* Unfortunately, super constructor creates controls and calls getTitle().
@@ -61,7 +61,8 @@
* @param title
*/
public ScriptMergeViewer(Composite parent,
- CompareConfiguration configuration, IDLTKUILanguageToolkit toolkit) {
+ CompareConfiguration configuration,
+ IDLTKUILanguageToolkit toolkit) {
super(parent, pushToolkit(toolkit), configuration);
popToolkit();
this.fToolkit = toolkit;
@@ -69,8 +70,8 @@
public ScriptMergeViewer(Composite parent,
CompareConfiguration configuration, String natureId) {
- this(parent, configuration, DLTKUILanguageManager
- .getLanguageToolkit(natureId));
+ this(parent, configuration,
+ DLTKUILanguageManager.getLanguageToolkit(natureId));
}
protected IDLTKUILanguageToolkit getToolkit() {
@@ -87,8 +88,8 @@
@Override
public String getTitle() {
- return NLS.bind("{0} Compare", getToolkit().getCoreToolkit()
- .getLanguageName());
+ return NLS.bind("{0} Compare",
+ getToolkit().getCoreToolkit().getLanguageName());
}
@Override
@@ -101,8 +102,8 @@
return;
}
final SourceViewer sourceViewer = (SourceViewer) textViewer;
- sourceViewer.configure(tools.createSourceViewerConfiguraton(
- getPreferenceStore(), null));
+ sourceViewer.configure(tools
+ .createSourceViewerConfiguraton(getPreferenceStore(), null));
}
@Override
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java
index 8a0d8a1..6f866b3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java
@@ -209,22 +209,23 @@
fElementKinds = elementKinds;
fExtension = extension;
- fFilterExtension = (extension == null) ? null : extension
- .getFilterExtension();
+ fFilterExtension = (extension == null) ? null
+ : extension.getFilterExtension();
fSearchScope = scope;
if (extension != null) {
fValidator = extension.getSelectionValidator();
}
- fTypeInfoUtil = new TypeInfoUtil(extension != null ? extension
- .getImageProvider() : null);
+ fTypeInfoUtil = new TypeInfoUtil(
+ extension != null ? extension.getImageProvider() : null);
fTypeInfoLabelProvider = new TypeItemLabelProvider();
setListLabelProvider(fTypeInfoLabelProvider);
setListSelectionLabelDecorator(fTypeInfoLabelProvider);
- setDetailsLabelProvider(new TypeItemDetailsLabelProvider(fTypeInfoUtil));
+ setDetailsLabelProvider(
+ new TypeItemDetailsLabelProvider(fTypeInfoUtil));
fTypeItemsComparator = new TypeItemsComparator();
}
@@ -245,19 +246,16 @@
if (text == null || text.length() == 0) {
getShell().setText(fTitle);
} else {
- getShell()
- .setText(
- Messages
- .format(
- DLTKUIMessages.FilteredTypeSelectionDialog_titleFormat,
- new String[] { fTitle, text }));
+ getShell().setText(Messages.format(
+ DLTKUIMessages.FilteredTypeSelectionDialog_titleFormat,
+ new String[] { fTitle, text }));
}
}
@Override
protected IDialogSettings getDialogSettings() {
- IDialogSettings settings = DLTKUIPlugin.getDefault()
- .getDialogSettings().getSection(DIALOG_SETTINGS);
+ IDialogSettings settings = DLTKUIPlugin.getDefault().getDialogSettings()
+ .getSection(DIALOG_SETTINGS);
if (settings == null) {
settings = DLTKUIPlugin.getDefault().getDialogSettings()
@@ -278,8 +276,8 @@
StringWriter writer = new StringWriter();
try {
memento.save(writer);
- settings.put(WORKINGS_SET_SETTINGS, writer.getBuffer()
- .toString());
+ settings.put(WORKINGS_SET_SETTINGS,
+ writer.getBuffer().toString());
} catch (IOException e) {
// don't do anything. Simply don't store the settings
DLTKUIPlugin.log(e);
@@ -330,19 +328,16 @@
if (fAllowScopeSwitching) {
fFilterActionGroup = new WorkingSetFilterActionGroup(getShell(),
- DLTKUIPlugin.getActivePage(),
- event -> {
+ DLTKUIPlugin.getActivePage(), event -> {
IWorkingSet ws = (IWorkingSet) event.getNewValue();
- if (ws == null
- || (ws.isAggregateWorkingSet() && ws
- .isEmpty())) {
+ if (ws == null || (ws.isAggregateWorkingSet()
+ && ws.isEmpty())) {
setSearchScope(SearchEngine
.createWorkspaceScope(fToolkit));
setSubtitle(null);
} else {
- setSearchScope(DLTKSearchScopeFactory
- .getInstance().createSearchScope(ws,
- true, fToolkit));
+ setSearchScope(DLTKSearchScopeFactory.getInstance()
+ .createSearchScope(ws, true, fToolkit));
setSubtitle(ws.getLabel());
}
@@ -397,12 +392,10 @@
.getScriptElementLabels();
String containerName = labels.getElementLabel(root,
ScriptElementLabels.ALL_FULLY_QUALIFIED);
- String message = Messages
- .format(
- DLTKUIMessages.FilteredTypesSelectionDialog_dialogMessage,
- new String[] {
- typeInfo.getFullyQualifiedName(),
- containerName });
+ String message = Messages.format(
+ DLTKUIMessages.FilteredTypesSelectionDialog_dialogMessage,
+ new String[] { typeInfo.getFullyQualifiedName(),
+ containerName });
MessageDialog.openError(getShell(), fTitle, message);
getSelectionHistory().remove(typeInfo);
}
@@ -519,17 +512,17 @@
typeSearchFilter);
String typePattern = itemsFilter.getPattern();
- progressMonitor
- .setTaskName(DLTKUIMessages.FilteredTypesSelectionDialog_searchJob_taskName);
+ progressMonitor.setTaskName(
+ DLTKUIMessages.FilteredTypesSelectionDialog_searchJob_taskName);
- IType[] types = new ModelAccess().findTypes(typePattern, ModelAccess
- .convertSearchRule(itemsFilter.getMatchRule()), 0,
+ IType[] types = new ModelAccess().findTypes(typePattern,
+ ModelAccess.convertSearchRule(itemsFilter.getMatchRule()), 0,
Modifiers.AccNameSpace, typeSearchFilter.getSearchScope(),
progressMonitor);
if (types != null) {
for (IType type : types) {
- requestor.acceptTypeNameMatch(new DLTKSearchTypeNameMatch(type,
- type.getFlags()));
+ requestor.acceptTypeNameMatch(
+ new DLTKSearchTypeNameMatch(type, type.getFlags()));
}
} else {
@@ -566,11 +559,10 @@
packPattern == null ? null : packPattern.toCharArray(),
typeSearchFilter.getPackageFlags(), // TODO:
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=176017
- typePattern.toCharArray(),
- matchRule, // TODO:
+ typePattern.toCharArray(), matchRule, // TODO:
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=176017
- typeSearchFilter.getElementKind(), typeSearchFilter
- .getSearchScope(), requestor,
+ typeSearchFilter.getElementKind(),
+ typeSearchFilter.getSearchScope(), requestor,
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
progressMonitor);
} finally {
@@ -600,15 +592,12 @@
if (fValidator != null) {
IType type = ((TypeNameMatch) item).getType();
if (!type.exists())
- return new Status(
+ return new Status(IStatus.ERROR, DLTKUIPlugin.getPluginId(),
IStatus.ERROR,
- DLTKUIPlugin.getPluginId(),
- IStatus.ERROR,
- Messages
- .format(
- DLTKUIMessages.FilteredTypesSelectionDialog_error_type_doesnot_exist,
- ((TypeNameMatch) item)
- .getFullyQualifiedName()), null);
+ Messages.format(
+ DLTKUIMessages.FilteredTypesSelectionDialog_error_type_doesnot_exist,
+ ((TypeNameMatch) item).getFullyQualifiedName()),
+ null);
Object[] elements = { type };
return fValidator.validate(elements);
} else
@@ -634,8 +623,8 @@
private IDLTKUILanguageToolkit tookit;
ConsistencyRunnable(IDLTKLanguageToolkit toolkit) {
- this.tookit = DLTKUILanguageManager.getLanguageToolkit(toolkit
- .getNatureId());
+ this.tookit = DLTKUILanguageManager
+ .getLanguageToolkit(toolkit.getNatureId());
}
@Override
@@ -649,14 +638,12 @@
OpenTypeHistory history = OpenTypeHistory.getInstance(tookit);
if (fgFirstTime || history.isEmpty()) {
if (history.needConsistencyCheck()) {
- monitor
- .beginTask(
- DLTKUIMessages.TypeSelectionDialog_progress_consistency,
- 100);
+ monitor.beginTask(
+ DLTKUIMessages.TypeSelectionDialog_progress_consistency,
+ 100);
refreshSearchIndices(new SubProgressMonitor(monitor, 90));
- history
- .checkConsistency(new SubProgressMonitor(monitor,
- 10));
+ history.checkConsistency(
+ new SubProgressMonitor(monitor, 10));
} else {
refreshSearchIndices(monitor);
}
@@ -678,15 +665,14 @@
private void refreshSearchIndices(IProgressMonitor monitor)
throws InvocationTargetException {
try {
- new SearchEngine().searchAllTypeNames(
- null,
- 0,
+ new SearchEngine().searchAllTypeNames(null, 0,
// make sure we search a concrete name. This is faster
// according to Kent
"_______________".toCharArray(), //$NON-NLS-1$
SearchPattern.RULE_EXACT_MATCH
| SearchPattern.RULE_CASE_SENSITIVE,
- IDLTKSearchConstants.TYPE, SearchEngine
+ IDLTKSearchConstants.TYPE,
+ SearchEngine
.createWorkspaceScope(tookit.getCoreToolkit()),
new NopTypeNameRequestor(),
IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
@@ -701,12 +687,12 @@
public void reloadCache(boolean checkDuplicates, IProgressMonitor monitor) {
IProgressMonitor remainingMonitor;
if (ConsistencyRunnable.needsExecution(fToolkit)) {
- monitor
- .beginTask(
- DLTKUIMessages.TypeSelectionDialog_progress_consistency,
- 10);
+ monitor.beginTask(
+ DLTKUIMessages.TypeSelectionDialog_progress_consistency,
+ 10);
try {
- ConsistencyRunnable runnable = new ConsistencyRunnable(fToolkit);
+ ConsistencyRunnable runnable = new ConsistencyRunnable(
+ fToolkit);
runnable.run(new SubProgressMonitor(monitor, 1));
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e,
@@ -736,8 +722,8 @@
/**
* A <code>LabelProvider</code> for (the table of) types.
*/
- private class TypeItemLabelProvider extends LabelProvider implements
- ILabelDecorator {
+ private class TypeItemLabelProvider extends LabelProvider
+ implements ILabelDecorator {
private boolean fContainerInfo;
@@ -821,8 +807,8 @@
fLabelProvider = new TypeNameMatchLabelProvider(
TypeNameMatchLabelProvider.SHOW_TYPE_ONLY
+ TypeNameMatchLabelProvider.SHOW_FULLYQUALIFIED,
- DLTKUILanguageManager.getLanguageToolkit(fToolkit
- .getNatureId()));
+ DLTKUILanguageManager
+ .getLanguageToolkit(fToolkit.getNatureId()));
}
@Override
@@ -861,15 +847,14 @@
public TypeInfoUtil(ITypeInfoImageProvider extension) {
fProviderExtension = extension;
- List<String> locations = new ArrayList<String>();
- List<String> labels = new ArrayList<String>();
+ List<String> locations = new ArrayList<>();
+ List<String> labels = new ArrayList<>();
IInterpreterInstallType[] installs = ScriptRuntime
.getInterpreterInstallTypes(fToolkit.getNatureId());
for (int i = 0; i < installs.length; i++) {
processInterpreterInstallType(installs[i], locations, labels);
}
- fInstallLocations = locations
- .toArray(new String[locations.size()]);
+ fInstallLocations = locations.toArray(new String[locations.size()]);
fVMNames = labels.toArray(new String[labels.size()]);
}
@@ -895,9 +880,9 @@
// on MacOS X install locations end in an additional
// "/Home" segment; remove it
if (isMac && filePath.endsWith(HOME_SUFFIX))
- filePath = filePath.substring(0, filePath
- .length()
- - HOME_SUFFIX.length() + 1);
+ filePath = filePath.substring(0,
+ filePath.length() - HOME_SUFFIX.length()
+ + 1);
locations.add(filePath);
labels.add(label);
}
@@ -915,10 +900,9 @@
}
private String getFormattedLabel(String name) {
- return Messages
- .format(
- DLTKUIMessages.FilteredTypesSelectionDialog_library_name_format,
- name);
+ return Messages.format(
+ DLTKUIMessages.FilteredTypesSelectionDialog_library_name_format,
+ name);
}
public String getText(Object element) {
@@ -984,7 +968,8 @@
.getScriptElementLabels();
labels.getProjectFragmentLabel(root,
ScriptElementLabels.ROOT_QUALIFIED
- | ScriptElementLabels.ROOT_VARIABLE, buf);
+ | ScriptElementLabels.ROOT_VARIABLE,
+ buf);
return buf.toString();
}
}
@@ -1024,8 +1009,8 @@
ITypeInfoFilterExtension extension) {
super(new TypeSearchPattern());
fScope = scope;
- fIsWorkspaceScope = scope == null ? false : scope
- .equals(SearchEngine.createWorkspaceScope(fToolkit));
+ fIsWorkspaceScope = scope == null ? false
+ : scope.equals(SearchEngine.createWorkspaceScope(fToolkit));
fElemKind = elementKind;
fFilterExt = extension;
String stringPackage = ((TypeSearchPattern) patternMatcher)
@@ -1048,7 +1033,8 @@
if (fMyTypeFilterVersion != typeItemsFilter
.getMyTypeFilterVersion())
return false;
- return getPattern().indexOf('.', filter.getPattern().length()) == -1;
+ return getPattern().indexOf('.',
+ filter.getPattern().length()) == -1;
}
@Override
@@ -1185,8 +1171,8 @@
String packPattern = null;
int index = stringPattern.lastIndexOf("."); //$NON-NLS-1$
if (index != -1) {
- packPattern = evaluatePackagePattern(stringPattern.substring(0,
- index));
+ packPattern = evaluatePackagePattern(
+ stringPattern.substring(0, index));
pattern = stringPattern.substring(index + 1);
if (pattern.length() == 0)
pattern = "**"; //$NON-NLS-1$
@@ -1270,7 +1256,7 @@
return;
if (new TypeFilter(DLTKUILanguageManager
.getLanguageToolkit(fToolkit.getNatureId()))
- .isFiltered(match))
+ .isFiltered(match))
return;
if (!addedNames.contains(match.getTypeQualifiedName())) {
addedNames.add(match.getTypeQualifiedName());
@@ -1295,15 +1281,14 @@
* Creates new instance of TypeItemsComparator
*/
public TypeItemsComparator() {
- List<String> locations = new ArrayList<String>();
- List<String> labels = new ArrayList<String>();
+ List<String> locations = new ArrayList<>();
+ List<String> labels = new ArrayList<>();
IInterpreterInstallType[] installs = ScriptRuntime
.getInterpreterInstallTypes();
for (int i = 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
- fInstallLocations = locations
- .toArray(new String[locations.size()]);
+ fInstallLocations = locations.toArray(new String[locations.size()]);
fVMNames = labels.toArray(new String[labels.size()]);
}
@@ -1344,10 +1329,9 @@
}
private String getFormattedLabel(String name) {
- return NLS
- .bind(
- DLTKUIMessages.FilteredTypesSelectionDialog_library_name_format,
- name);
+ return NLS.bind(
+ DLTKUIMessages.FilteredTypesSelectionDialog_library_name_format,
+ name);
}
@Override
@@ -1356,8 +1340,8 @@
TypeNameMatch leftInfo = (TypeNameMatch) left;
TypeNameMatch rightInfo = (TypeNameMatch) right;
- int result = compareName(leftInfo.getSimpleTypeName(), rightInfo
- .getSimpleTypeName());
+ int result = compareName(leftInfo.getSimpleTypeName(),
+ rightInfo.getSimpleTypeName());
if (result != 0)
return result;
result = compareTypeContainerName(leftInfo.getTypeContainerName(),
@@ -1404,8 +1388,8 @@
private int compareContainerName(TypeNameMatch leftType,
TypeNameMatch rightType) {
- return getContainerName(leftType).compareTo(
- getContainerName(rightType));
+ return getContainerName(leftType)
+ .compareTo(getContainerName(rightType));
}
private String getContainerName(TypeNameMatch type) {
@@ -1426,13 +1410,15 @@
.getScriptElementLabels();
labels.getProjectFragmentLabel(root,
ScriptElementLabels.ROOT_QUALIFIED
- | ScriptElementLabels.ROOT_VARIABLE, buf);
+ | ScriptElementLabels.ROOT_VARIABLE,
+ buf);
return buf.toString();
}
private int getElementTypeCategory(TypeNameMatch type) {
try {
- if (type.getProjectFragment().getKind() == IProjectFragment.K_SOURCE)
+ if (type.getProjectFragment()
+ .getKind() == IProjectFragment.K_SOURCE)
return 0;
} catch (ModelException e) {
DLTKUIPlugin.log(e);
@@ -1466,8 +1452,8 @@
@Override
public synchronized boolean remove(Object element) {
- OpenTypeHistory.getInstance(getUIToolkit()).remove(
- (TypeNameMatch) element);
+ OpenTypeHistory.getInstance(getUIToolkit())
+ .remove((TypeNameMatch) element);
return super.remove(element);
}
@@ -1495,8 +1481,8 @@
if (getReturnCode() == OK) {
Object[] items = getHistoryItems();
for (int i = 0; i < items.length; i++) {
- OpenTypeHistory.getInstance(getUIToolkit()).accessed(
- (TypeNameMatch) items[i]);
+ OpenTypeHistory.getInstance(getUIToolkit())
+ .accessed((TypeNameMatch) items[i]);
}
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/MultipleInputDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/MultipleInputDialog.java
index 6b5e8b4..63a2226 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/MultipleInputDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/MultipleInputDialog.java
@@ -44,10 +44,10 @@
protected Composite panel;
- protected List<FieldSummary> fieldList = new ArrayList<FieldSummary>();
- protected List<Text> controlList = new ArrayList<Text>();
- protected List<Validator> validators = new ArrayList<Validator>();
- protected Map<String, Object> valueMap = new HashMap<String, Object>();
+ protected List<FieldSummary> fieldList = new ArrayList<>();
+ protected List<Text> controlList = new ArrayList<>();
+ protected List<Validator> validators = new ArrayList<>();
+ protected Map<String, Object> valueMap = new HashMap<>();
private String title;
@@ -111,14 +111,14 @@
public void addBrowseField(String labelText, String initialValue,
boolean allowsEmpty) {
- fieldList.add(new FieldSummary(BROWSE, labelText, initialValue,
- allowsEmpty));
+ fieldList.add(
+ new FieldSummary(BROWSE, labelText, initialValue, allowsEmpty));
}
public void addTextField(String labelText, String initialValue,
boolean allowsEmpty) {
- fieldList.add(new FieldSummary(TEXT, labelText, initialValue,
- allowsEmpty));
+ fieldList.add(
+ new FieldSummary(TEXT, labelText, initialValue, allowsEmpty));
}
public void addVariablesField(String labelText, String initialValue,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/highlighting/AbstractSemanticHighlighter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/highlighting/AbstractSemanticHighlighter.java
index a865d9b..16df7cd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/highlighting/AbstractSemanticHighlighter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/highlighting/AbstractSemanticHighlighter.java
@@ -39,7 +39,7 @@
ISemanticHighlightingUpdater, ISemanticHighlightingRequestor {
private IHighlightedPositionFactory positionFactory;
- private Map<String, HighlightingStyle> highlightingStyles = new HashMap<String, HighlightingStyle>();
+ private Map<String, HighlightingStyle> highlightingStyles = new HashMap<>();
@Override
public void initialize(IHighlightedPositionFactory factory,
@@ -48,15 +48,15 @@
this.highlightingStyles.clear();
if (styles != null) {
for (HighlightingStyle style : styles) {
- this.highlightingStyles.put(style.getSemaHighlighting()
- .getPreferenceKey(), style);
+ this.highlightingStyles.put(
+ style.getSemaHighlighting().getPreferenceKey(), style);
}
}
}
- private final List<HighlightedPosition> newPositions = new ArrayList<HighlightedPosition>();
+ private final List<HighlightedPosition> newPositions = new ArrayList<>();
private int oldPositionCount = 0;
- private final List<HighlightedPosition> oldPositions = new ArrayList<HighlightedPosition>();
+ private final List<HighlightedPosition> oldPositions = new ArrayList<>();
@Override
public UpdateResult reconcile(IModuleSource code,
@@ -70,10 +70,10 @@
checkNewPositionOrdering();
final HighlightedPosition[] removed = getRemovedPositions();
if (DEBUG) {
- System.out
- .println("Add:" + newPositions.size() + " " + newPositions); //$NON-NLS-1$ //$NON-NLS-2$
- System.out
- .println("Remove:" + removed.length + " " + Arrays.asList(removed)); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println(
+ "Add:" + newPositions.size() + " " + newPositions); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("Remove:" + removed.length + " " //$NON-NLS-1$ //$NON-NLS-2$
+ + Arrays.asList(removed));
}
return new UpdateResult(getAddedPositions(), removed);
}
@@ -119,8 +119,8 @@
final HighlightedPosition p = newPositions.get(i);
if (p.isEqual(start, len, hl)) {
if (DEBUG) {
- System.err
- .println("WARN: duplicate in new positions [" + start + "+" + len + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ System.err.println("WARN: duplicate in new positions [" //$NON-NLS-1$
+ + start + "+" + len + "]"); //$NON-NLS-1$ //$NON-NLS-2$
}
return;
}
@@ -159,14 +159,14 @@
protected void checkNewPositionOrdering() {
if (newPositions.isEmpty())
return;
- Collections.sort(newPositions, (p1, p2) -> p1.getOffset() - p2.getOffset());
+ Collections.sort(newPositions,
+ (p1, p2) -> p1.getOffset() - p2.getOffset());
Position previous = null;
for (Iterator<HighlightedPosition> i = newPositions.iterator(); i
.hasNext();) {
final Position current = i.next();
- if (previous != null
- && previous.getOffset() + previous.getLength() > current
- .getOffset()) {
+ if (previous != null && previous.getOffset()
+ + previous.getLength() > current.getOffset()) {
if (DEBUG) {
System.err.println("ERROR: unordered position " + current); //$NON-NLS-1$
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/saveparticipant/SaveParticipantRegistry.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/saveparticipant/SaveParticipantRegistry.java
index dce8597..ffa4f7c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/saveparticipant/SaveParticipantRegistry.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/editor/saveparticipant/SaveParticipantRegistry.java
@@ -47,8 +47,8 @@
*
* @since 3.0
*/
-public final class SaveParticipantRegistry extends
- PriorityNatureExtensionManager<IPostSaveListener> {
+public final class SaveParticipantRegistry
+ extends PriorityNatureExtensionManager<IPostSaveListener> {
private static final IPostSaveListener[] EMPTY_ARRAY = new IPostSaveListener[0];
@@ -74,16 +74,17 @@
* @return the current enabled post save listeners according to the
* preferences
*/
- public IPostSaveListener[] getEnabledPostSaveListeners(ISourceModule module) {
+ public IPostSaveListener[] getEnabledPostSaveListeners(
+ ISourceModule module) {
ArrayList<IPostSaveListener> result = null;
final IDLTKLanguageToolkit toolkit = DLTKLanguageManager
.getLanguageToolkit(module);
if (toolkit != null) {
- for (IPostSaveListener descriptor : getInstances(toolkit
- .getNatureId())) {
+ for (IPostSaveListener descriptor : getInstances(
+ toolkit.getNatureId())) {
if (descriptor.isEnabled(module)) {
if (result == null) {
- result = new ArrayList<IPostSaveListener>();
+ result = new ArrayList<>();
}
result.add(descriptor);
}
@@ -115,8 +116,8 @@
IPostSaveListener[] listeners) throws CoreException {
String message = SaveParticipantMessages.SaveParticipantRegistry_needsChangedRegionFailed;
final MultiStatus errorStatus = new MultiStatus(DLTKUIPlugin.PLUGIN_ID,
- IDLTKStatusConstants.EDITOR_CHANGED_REGION_CALCULATION,
- message, null);
+ IDLTKStatusConstants.EDITOR_CHANGED_REGION_CALCULATION, message,
+ null);
try {
final boolean result[] = new boolean[] { false };
@@ -132,25 +133,22 @@
@Override
public void handleException(Throwable ex) {
- String msg = NLS
- .bind("The save participant ''{0}'' caused an exception.", listener.getId()); //$NON-NLS-1$
- DLTKUIPlugin
- .log(new Status(
- IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
- IDLTKStatusConstants.EDITOR_POST_SAVE_NOTIFICATION,
- msg, ex));
+ String msg = NLS.bind(
+ "The save participant ''{0}'' caused an exception.", //$NON-NLS-1$
+ listener.getId());
+ DLTKUIPlugin.log(new Status(IStatus.ERROR,
+ DLTKUIPlugin.PLUGIN_ID,
+ IDLTKStatusConstants.EDITOR_POST_SAVE_NOTIFICATION,
+ msg, ex));
final String participantName = listener.getName();
- msg = NLS
- .bind(SaveParticipantMessages.SaveParticipantRegistry_needsChangedRegionCausedException,
- participantName, ex.toString());
- errorStatus
- .add(new Status(
- IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
- IDLTKStatusConstants.EDITOR_CHANGED_REGION_CALCULATION,
- msg, null));
+ msg = NLS.bind(
+ SaveParticipantMessages.SaveParticipantRegistry_needsChangedRegionCausedException,
+ participantName, ex.toString());
+ errorStatus.add(new Status(IStatus.ERROR,
+ DLTKUIPlugin.PLUGIN_ID,
+ IDLTKStatusConstants.EDITOR_CHANGED_REGION_CALCULATION,
+ msg, null));
}
});
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentContainer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentContainer.java
index 03607d5..044e3ee 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentContainer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentContainer.java
@@ -38,7 +38,7 @@
public class EnvironmentContainer {
private boolean initialized = false;
- private final Map<String, IEnvironment> environments = new HashMap<String, IEnvironment>();
+ private final Map<String, IEnvironment> environments = new HashMap<>();
private List<IEnvironment> environmentList = Collections.emptyList();
private IEnvironmentChangedListener listener = null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java
index 0981ffe..b8113cb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/environment/EnvironmentPathBlock.java
@@ -45,7 +45,7 @@
/**
* Environment to path association.
*/
- private Map<IEnvironment, String> paths = new HashMap<IEnvironment, String>();
+ private Map<IEnvironment, String> paths = new HashMap<>();
private boolean useFolders = false;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/CreateProfileDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/CreateProfileDialog.java
index 3dc927f..df680cf 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/CreateProfileDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/CreateProfileDialog.java
@@ -79,10 +79,14 @@
GridData gd;
final GridLayout layout = new GridLayout(numColumns, false);
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.marginHeight = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_SPACING);
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(layout);
@@ -168,7 +172,7 @@
if (!getStatus().isOK())
return;
- final Map<String, String> baseSettings = new HashMap<String, String>(
+ final Map<String, String> baseSettings = new HashMap<>(
(fSortedProfiles.get(fProfileCombo.getSelectionIndex()))
.getSettings());
final String profileName = fNameText.getText();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/FormatterModifyDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/FormatterModifyDialog.java
index 9abc675..6feb064 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/FormatterModifyDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/FormatterModifyDialog.java
@@ -45,8 +45,8 @@
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
-public abstract class FormatterModifyDialog extends StatusDialog implements
- IFormatterModifyDialog, IStatusChangeListener {
+public abstract class FormatterModifyDialog extends StatusDialog
+ implements IFormatterModifyDialog, IStatusChangeListener {
private final FormatterDialogPreferences preferences = new FormatterDialogPreferences();
@@ -74,8 +74,8 @@
super(dialogOwner.getShell());
this.dialogOwner = dialogOwner;
this.formatterFactory = formatterFactory;
- this.fDialogSettings = getDialogSettingsSection(dialogOwner
- .getDialogSettings(), formatterFactory.getId());
+ this.fDialogSettings = getDialogSettingsSection(
+ dialogOwner.getDialogSettings(), formatterFactory.getId());
setStatusLineAboveButtons(false);
setShellStyle(getShellStyle() | SWT.RESIZE);
}
@@ -121,8 +121,8 @@
@Override
protected Point getInitialLocation(Point initialSize) {
try {
- return new Point(fDialogSettings.getInt(KEY_X), fDialogSettings
- .getInt(KEY_Y));
+ return new Point(fDialogSettings.getInt(KEY_X),
+ fDialogSettings.getInt(KEY_Y));
} catch (NumberFormatException ex) {
return super.getInitialLocation(initialSize);
}
@@ -139,27 +139,27 @@
}
private TabFolder fTabFolder;
- private final List<IFormatterModifiyTabPage> fTabPages = new ArrayList<IFormatterModifiyTabPage>();
+ private final List<IFormatterModifiyTabPage> fTabPages = new ArrayList<>();
@Override
protected Control createDialogArea(Composite parent) {
final Composite composite = (Composite) super.createDialogArea(parent);
Composite nameComposite = new Composite(composite, SWT.NONE);
- nameComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- false));
+ nameComposite
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
nameComposite.setLayout(new GridLayout(3, false));
fProfileNameField = new StringDialogField();
- fProfileNameField
- .setLabelText(FormatterMessages.FormatterModifyDialog_profileName);
+ fProfileNameField.setLabelText(
+ FormatterMessages.FormatterModifyDialog_profileName);
if (profile != null) {
fProfileNameField.setText(profile.getName());
}
fProfileNameField.getLabelControl(nameComposite).setLayoutData(
new GridData(SWT.LEFT, SWT.CENTER, false, false));
- fProfileNameField.getTextControl(nameComposite).setLayoutData(
- new GridData(SWT.FILL, SWT.CENTER, true, false));
+ fProfileNameField.getTextControl(nameComposite)
+ .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
fProfileNameField.setDialogFieldListener(field -> validate());
fSaveButton = createButton(nameComposite, SAVE_BUTTON_ID,
@@ -216,8 +216,8 @@
protected void updateButtonsEnableState(IStatus status) {
super.updateButtonsEnableState(status);
if (fSaveButton != null && !fSaveButton.isDisposed()) {
- fSaveButton.setEnabled(!validateProfileName()
- .matches(IStatus.ERROR));
+ fSaveButton
+ .setEnabled(!validateProfileName().matches(IStatus.ERROR));
}
}
@@ -271,9 +271,7 @@
if (profile.isBuiltInProfile()) {
if (profile.getName().equals(name)) {
- return new Status(
- IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
+ return new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID,
FormatterMessages.FormatterModifyDialog_changeBuiltInProfileName);
}
}
@@ -301,8 +299,8 @@
private void saveButtonPressed() {
IProfileStore store = formatterFactory.getProfileStore();
IProfile selected = manager.create(ProfileKind.TEMPORARY,
- fProfileNameField.getText(), getPreferences(), profile
- .getFormatterId(), profile.getVersion());
+ fProfileNameField.getText(), getPreferences(),
+ profile.getFormatterId(), profile.getVersion());
final FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
dialog.setText(FormatterMessages.FormatterModifyDialog_exportProfile);
@@ -316,14 +314,13 @@
String message = NLS.bind(
FormatterMessages.FormatterModifyDialog_replaceFileQuestion,
file.getAbsolutePath());
- if (file.exists()
- && !MessageDialog.openQuestion(getShell(),
- FormatterMessages.FormatterModifyDialog_exportProfile,
- message)) {
+ if (file.exists() && !MessageDialog.openQuestion(getShell(),
+ FormatterMessages.FormatterModifyDialog_exportProfile,
+ message)) {
return;
}
- final Collection<IProfile> profiles = new ArrayList<IProfile>();
+ final Collection<IProfile> profiles = new ArrayList<>();
profiles.add(selected);
try {
store.writeProfilesToFile(profiles, file);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java
index 2dc51a5..443ed2e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java
@@ -64,7 +64,7 @@
}
/** Jobs to be formatted by this strategy */
- private final LinkedList<FormatJob> fJobs = new LinkedList<FormatJob>();
+ private final LinkedList<FormatJob> fJobs = new LinkedList<>();
/**
* Creates a new java formatting strategy.
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java
index 2438a43..83fec9f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java
@@ -66,8 +66,8 @@
import org.eclipse.ui.dialogs.PreferenceLinkArea;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-public abstract class AbstractFormatterSelectionBlock extends
- AbstractOptionsBlock {
+public abstract class AbstractFormatterSelectionBlock
+ extends AbstractOptionsBlock {
protected abstract IFormatterModifyDialogOwner createDialogOwner();
@@ -95,8 +95,9 @@
public AbstractFormatterSelectionBlock(IStatusChangeListener context,
IProject project, PreferenceKey formatterKey, String natureId,
IWorkbenchPreferenceContainer container) {
- super(context, project, collectPreferenceKeys(TEMP_LIST, natureId,
- formatterKey), container);
+ super(context, project,
+ collectPreferenceKeys(TEMP_LIST, natureId, formatterKey),
+ container);
factories = TEMP_LIST
.toArray(new IScriptFormatterFactory[TEMP_LIST.size()]);
TEMP_LIST = new ArrayList();
@@ -106,18 +107,18 @@
return getProfileManager(getSelectedExtension());
}
- protected IProfileManager getProfileManager(IScriptFormatterFactory factory) {
+ protected IProfileManager getProfileManager(
+ IScriptFormatterFactory factory) {
IProfileManager manager = profileByFactory.get(factory);
if (manager == null) {
- List<IProfile> allProfiles = new ArrayList<IProfile>();
+ List<IProfile> allProfiles = new ArrayList<>();
List<IProfile> buitinProfiles = factory.getBuiltInProfiles();
if (buitinProfiles != null && buitinProfiles.size() > 0) {
allProfiles.addAll(buitinProfiles);
} else {
- DLTKUIPlugin
- .logErrorMessage(NLS
- .bind(FormatterMessages.AbstractFormatterSelectionBlock_noBuiltInProfiles,
- factory.getId()));
+ DLTKUIPlugin.logErrorMessage(NLS.bind(
+ FormatterMessages.AbstractFormatterSelectionBlock_noBuiltInProfiles,
+ factory.getId()));
}
allProfiles.addAll(factory.getCustomProfiles());
manager = factory.createProfileManager(allProfiles);
@@ -150,17 +151,16 @@
}
}
}
- String name = getProfileName(
- manager.getSortedProfiles(),
+ String name = getProfileName(manager.getSortedProfiles(),
FormatterMessages.AbstractFormatterSelectionBlock_activeProfileName);
- IProfile profile = manager.create(ProfileKind.CUSTOM, name,
- preferences, factory.getId(), factory.getProfileVersioner()
- .getCurrentVersion());
+ IProfile profile = manager.create(ProfileKind.CUSTOM, name, preferences,
+ factory.getId(),
+ factory.getProfileVersioner().getCurrentVersion());
manager.setSelected(profile);
}
protected String getProfileName(List<IProfile> profiles, String prefix) {
- HashSet<String> names = new HashSet<String>(profiles.size());
+ HashSet<String> names = new HashSet<>(profiles.size());
for (IProfile profile : profiles) {
names.add(profile.getName());
}
@@ -199,7 +199,7 @@
IScriptFormatterFactory factory = getSelectedExtension();
IProfileManager manager = getProfileManager(factory);
IProfile profile = manager.getSelected();
- Map<String, String> settings = new HashMap<String, String>();
+ Map<String, String> settings = new HashMap<>();
if (profile != null) {
settings.putAll(profile.getSettings());
}
@@ -227,7 +227,7 @@
protected static PreferenceKey[] collectPreferenceKeys(List factories,
String natureId, PreferenceKey formatterKey) {
- List<PreferenceKey> result = new ArrayList<PreferenceKey>();
+ List<PreferenceKey> result = new ArrayList<>();
result.add(formatterKey);
IDLTKContributedExtension[] extensions = ScriptFormatterManager
.getInstance().getContributions(natureId);
@@ -291,15 +291,13 @@
createFormatterSection(fComposite, numColumns, fPixConv);
- final Group group = SWTFactory
- .createGroup(
- fComposite,
- FormatterMessages.AbstractFormatterSelectionBlock_profilesGroup,
- numColumns, numColumns, GridData.FILL_BOTH);
+ final Group group = SWTFactory.createGroup(fComposite,
+ FormatterMessages.AbstractFormatterSelectionBlock_profilesGroup,
+ numColumns, numColumns, GridData.FILL_BOTH);
Label profileLabel = new Label(group, SWT.NONE);
- profileLabel
- .setText(FormatterMessages.AbstractFormatterSelectionBlock_activeProfile);
+ profileLabel.setText(
+ FormatterMessages.AbstractFormatterSelectionBlock_activeProfile);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.horizontalSpan = numColumns;
profileLabel.setLayoutData(data);
@@ -335,8 +333,7 @@
editButtonPressed();
}
});
- fDeleteButton = createButton(
- group,
+ fDeleteButton = createButton(group,
FormatterMessages.AbstractFormatterSelectionBlock_removeProfile,
GridData.HORIZONTAL_ALIGN_BEGINNING);
fDeleteButton.addSelectionListener(new SelectionListener() {
@@ -354,8 +351,7 @@
protected void doDelete() {
IProfileManager profileManager = getProfileManager();
IProfile selected = profileManager.getSelected();
- if (MessageDialog.openQuestion(
- group.getShell(),
+ if (MessageDialog.openQuestion(group.getShell(),
FormatterMessages.AbstractFormatterSelectionBlock_confirmRemoveLabel,
NLS.bind(
FormatterMessages.AbstractFormatterSelectionBlock_confirmRemoveMessage,
@@ -384,9 +380,9 @@
protected void createNewProfile() {
IScriptFormatterFactory formatterFactory = getSelectedExtension();
- final CreateProfileDialog p = new CreateProfileDialog(group
- .getShell(), getProfileManager(), formatterFactory
- .getProfileVersioner());
+ final CreateProfileDialog p = new CreateProfileDialog(
+ group.getShell(), getProfileManager(),
+ formatterFactory.getProfileVersioner());
if (p.open() != Window.OK)
return;
@@ -399,8 +395,7 @@
}
});
- fLoadButton = createButton(
- group,
+ fLoadButton = createButton(group,
FormatterMessages.AbstractFormatterSelectionBlock_importProfile,
GridData.HORIZONTAL_ALIGN_END);
fLoadButton.addSelectionListener(new SelectionListener() {
@@ -418,7 +413,8 @@
protected void doImport() {
final FileDialog dialog = new FileDialog(group.getShell(),
SWT.OPEN);
- dialog.setText(FormatterMessages.AbstractFormatterSelectionBlock_importProfileLabel);
+ dialog.setText(
+ FormatterMessages.AbstractFormatterSelectionBlock_importProfileLabel);
dialog.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$
final String path = dialog.open();
if (path == null)
@@ -431,10 +427,9 @@
try {
profiles = store.readProfilesFromFile(file);
} catch (CoreException e) {
- DLTKUIPlugin
- .logErrorMessage(
- FormatterMessages.AbstractFormatterSelectionBlock_notValidProfile,
- e);
+ DLTKUIPlugin.logErrorMessage(
+ FormatterMessages.AbstractFormatterSelectionBlock_notValidProfile,
+ e);
}
if (profiles == null || profiles.isEmpty())
return;
@@ -446,10 +441,10 @@
if (!versioner.getFormatterId()
.equals(profile.getFormatterId())) {
final String title = FormatterMessages.AbstractFormatterSelectionBlock_importProfileLabel;
- final String message = NLS
- .bind(FormatterMessages.AbstractFormatterSelectionBlock_notValidFormatter,
- versioner.getFormatterId(),
- profile.getFormatterId());
+ final String message = NLS.bind(
+ FormatterMessages.AbstractFormatterSelectionBlock_notValidFormatter,
+ versioner.getFormatterId(),
+ profile.getFormatterId());
MessageDialog.openError(group.getShell(), title, message);
return;
}
@@ -467,8 +462,8 @@
if (aeDialog.open() != Window.OK)
return;
}
- ((IProfile.ICustomProfile) profile).setVersion(versioner
- .getCurrentVersion());
+ ((IProfile.ICustomProfile) profile)
+ .setVersion(versioner.getCurrentVersion());
profileManager.addProfile(profile);
updateComboFromProfiles();
applyPreferences();
@@ -497,7 +492,8 @@
if (index == -1 && factories.length != 0) {
index = 0;
for (int i = 1; i < factories.length; i++) {
- if (factories[i].getPriority() > factories[index].getPriority()) {
+ if (factories[i].getPriority() > factories[index]
+ .getPriority()) {
index = i;
}
}
@@ -505,8 +501,7 @@
}
if (factories.length > 1) {
- createLabel(
- composite,
+ createLabel(composite,
FormatterMessages.AbstractFormatterSelectionBlock_formatterLabel,
numColumns);
fFactoryCombo = createProfileCombo(composite, numColumns,
@@ -556,8 +551,8 @@
numColumns);
fPreviewViewer = createPreview(composite);
- final GridData gd = new GridData(GridData.FILL_VERTICAL
- | GridData.HORIZONTAL_ALIGN_FILL);
+ final GridData gd = new GridData(
+ GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = numColumns;
gd.verticalSpan = 7;
gd.heightHint = 100;
@@ -569,8 +564,8 @@
}
protected final void updateSelection() {
- IProfile selected = getProfileManager().getSortedProfiles().get(
- fProfileCombo.getSelectionIndex());
+ IProfile selected = getProfileManager().getSortedProfiles()
+ .get(fProfileCombo.getSelectionIndex());
getProfileManager().setSelected(selected);
updateButtons();
applyPreferences();
@@ -737,9 +732,9 @@
private int selectedFactory;
private IScriptFormatterFactory[] factories;
- private Map<IScriptFormatterFactory, IProfileManager> profileByFactory = new HashMap<IScriptFormatterFactory, IProfileManager>();
+ private Map<IScriptFormatterFactory, IProfileManager> profileByFactory = new HashMap<>();
protected SourceViewer fPreviewViewer;
- private static List<IScriptFormatterFactory> TEMP_LIST = new ArrayList<IScriptFormatterFactory>();
+ private static List<IScriptFormatterFactory> TEMP_LIST = new ArrayList<>();
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterControlManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterControlManager.java
index 845c24c..86294bf 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterControlManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterControlManager.java
@@ -41,7 +41,7 @@
public FormatterControlManager(IPreferenceDelegate<String> delegate,
IStatusChangeListener listener) {
this.delegate = delegate;
- this.bindingManager = new ControlBindingManager<String>(delegate, this);
+ this.bindingManager = new ControlBindingManager<>(delegate, this);
this.listener = listener;
}
@@ -92,7 +92,7 @@
return text;
}
- private final Map<Control, Label> labelAssociations = new HashMap<Control, Label>();
+ private final Map<Control, Label> labelAssociations = new HashMap<>();
/**
* @param control
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterDialogPreferences.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterDialogPreferences.java
index 7b8397a..613d463 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterDialogPreferences.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/FormatterDialogPreferences.java
@@ -20,7 +20,7 @@
public class FormatterDialogPreferences implements IPreferenceDelegate<String> {
- private final Map<String, String> preferences = new HashMap<String, String>();
+ private final Map<String, String> preferences = new HashMap<>();
@Override
public String getString(String key) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java
index 9a9d08e..a80473d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/AbstractDocumentationView.java
@@ -464,7 +464,7 @@
*/
private String getScriptdocHtmlDetailed(Object[] result) {
final StringBuffer buffer = new StringBuffer();
- final List<String> nodocs = new ArrayList<String>();
+ final List<String> nodocs = new ArrayList<>();
for (int i = 0; i < result.length; i++) {
final Object member = result[i];
Reader reader = ScriptDocumentationAccess
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/ModelElementArray.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/ModelElementArray.java
index a8bbf79..bb9b063 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/ModelElementArray.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/infoviews/ModelElementArray.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -67,7 +67,7 @@
/**
* Checks that all elements are {@link IModelElement#METHOD} and have the
* same name.
- *
+ *
* @return
*/
private boolean isSingleMethodName() {
@@ -98,12 +98,12 @@
*/
public String getContentDescription() {
if (isSingleMethodName()) {
- return NLS
- .bind(InfoViewMessages.ContentDescription_multipleMethodsWithSameName,
- ((IModelElement) elements[0]).getElementName());
+ return NLS.bind(
+ InfoViewMessages.ContentDescription_multipleMethodsWithSameName,
+ ((IModelElement) elements[0]).getElementName());
}
final ScriptElementLabels labels = ScriptElementLabels.getDefault();
- final Set<String> names = new HashSet<String>();
+ final Set<String> names = new HashSet<>();
for (int i = 0; i < elements.length; ++i) {
if (elements[i] instanceof IModelElement) {
names.add(labels.getElementLabel((IModelElement) elements[i],
@@ -115,8 +115,9 @@
return sortAndJoin(names, ", ");//$NON-NLS-1$
}
- private String sortAndJoin(final Set<String> names, final String separator) {
- final List<String> nameList = new ArrayList<String>(names);
+ private String sortAndJoin(final Set<String> names,
+ final String separator) {
+ final List<String> nameList = new ArrayList<>(names);
Collections.sort(nameList);
return join(nameList, separator);
}
@@ -138,7 +139,7 @@
*/
public String getTitleTooltip() {
final ScriptElementLabels labels = ScriptElementLabels.getDefault();
- final Set<String> names = new HashSet<String>();
+ final Set<String> names = new HashSet<>();
for (int i = 0; i < elements.length; ++i) {
if (elements[i] instanceof IModelElement) {
names.add(labels.getElementLabel((IModelElement) elements[i],
@@ -155,12 +156,12 @@
* Joins the elements of the provided <code>Collection</code> into a single
* String containing the provided elements.
* </p>
- *
+ *
* <p>
* No delimiter is added before or after the list. A <code>null</code>
* separator is the same as an empty String ("").
* </p>
- *
+ *
* @param collection
* the <code>Collection</code> of values to join together, may be
* null
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java
index 1324bb2..d95b386 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractConfigurationBlock.java
@@ -56,8 +56,8 @@
* Configures preferences.
*
*/
-public abstract class AbstractConfigurationBlock implements
- IPreferenceConfigurationBlock {
+public abstract class AbstractConfigurationBlock
+ implements IPreferenceConfigurationBlock {
protected static class FilePathValidator implements IInputValidator {
@Override
@@ -97,7 +97,7 @@
/** The preference setting for keeping no section open. */
private static final String __NONE = "__none"; //$NON-NLS-1$
- private Set<ExpandableComposite> fSections = new HashSet<ExpandableComposite>();
+ private Set<ExpandableComposite> fSections = new HashSet<>();
private boolean fIsBeingManaged = false;
@@ -129,10 +129,12 @@
&& fDialogSettingsStore != null)
fDialogSettingsStore.setValue(fLastOpenKey, __NONE);
}
- ExpandableComposite exComp = getParentExpandableComposite(source);
+ ExpandableComposite exComp = getParentExpandableComposite(
+ source);
if (exComp != null)
exComp.layout(true, true);
- ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(source);
+ ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(
+ source);
if (parentScrolledComposite != null) {
parentScrolledComposite.reflow(true);
}
@@ -217,7 +219,8 @@
public Composite createSection(String label) {
Assert.isNotNull(fBody);
final ExpandableComposite excomposite = new ExpandableComposite(
- fBody, SWT.NONE, ExpandableComposite.TWISTIE
+ fBody, SWT.NONE,
+ ExpandableComposite.TWISTIE
| ExpandableComposite.CLIENT_INDENT
| ExpandableComposite.COMPACT);
if (fFirstChild == null)
@@ -252,7 +255,7 @@
private OverlayPreferenceStore fStore;
- private Map<Button, String> fCheckBoxes = new HashMap<Button, String>();
+ private Map<Button, String> fCheckBoxes = new HashMap<>();
private ArrayList fRadioButtons = new ArrayList();
@@ -303,7 +306,7 @@
}
};
- private Map<Text, String> fTextFields = new HashMap<Text, String>();
+ private Map<Text, String> fTextFields = new HashMap<>();
private ModifyListener fTextFieldListener = e -> {
Text text = (Text) e.widget;
@@ -312,7 +315,8 @@
private ArrayList fNumberFields = new ArrayList();
- private ModifyListener fNumberFieldListener = e -> numberFieldChanged((Text) e.widget);
+ private ModifyListener fNumberFieldListener = e -> numberFieldChanged(
+ (Text) e.widget);
/**
* List of master/slave listeners when there's a dependency.
@@ -369,12 +373,13 @@
}
protected void updateSectionStyle(ExpandableComposite excomposite) {
- excomposite.setFont(JFaceResources.getFontRegistry().getBold(
- JFaceResources.DIALOG_FONT));
+ excomposite.setFont(JFaceResources.getFontRegistry()
+ .getBold(JFaceResources.DIALOG_FONT));
}
private void makeScrollableCompositeAware(Control control) {
- ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(control);
+ ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(
+ control);
if (parentScrolledComposite != null) {
parentScrolledComposite.adaptChild(control);
}
@@ -385,7 +390,8 @@
}
protected Composite createComposite(Composite parent, Font font,
- int columns, int hspan, int fill, int marginwidth, int marginheight) {
+ int columns, int hspan, int fill, int marginwidth,
+ int marginheight) {
return SWTFactory.createComposite(parent, font, columns, hspan, fill,
marginwidth, marginheight);
}
@@ -526,7 +532,8 @@
createDependency(master, new Control[] { slave });
}
- protected void createDependency(final Button master, final Control[] slaves) {
+ protected void createDependency(final Button master,
+ final Control[] slaves) {
Assert.isTrue(slaves.length > 0);
indent(slaves[0]);
SelectionListener listener = new SelectionListener() {
@@ -645,18 +652,19 @@
private IStatus validatePositiveNumber(String number) {
StatusInfo status = new StatusInfo();
if (number.length() == 0) {
- status.setError(PreferencesMessages.DLTKEditorPreferencePage_empty_input);
+ status.setError(
+ PreferencesMessages.DLTKEditorPreferencePage_empty_input);
} else {
try {
int value = Integer.parseInt(number);
if (value < 0)
- status.setError(Messages
- .format(PreferencesMessages.DLTKEditorPreferencePage_invalid_input,
- number));
+ status.setError(Messages.format(
+ PreferencesMessages.DLTKEditorPreferencePage_invalid_input,
+ number));
} catch (NumberFormatException e) {
- status.setError(Messages
- .format(PreferencesMessages.DLTKEditorPreferencePage_invalid_input,
- number));
+ status.setError(Messages.format(
+ PreferencesMessages.DLTKEditorPreferencePage_invalid_input,
+ number));
}
}
return status;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractOptionsBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractOptionsBlock.java
index fe476da..334fd64 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractOptionsBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractOptionsBlock.java
@@ -23,17 +23,15 @@
public abstract class AbstractOptionsBlock extends OptionsConfigurationBlock
implements IPreferenceDelegate<PreferenceKey> {
- private final List<PreferenceKey> keys = new ArrayList<PreferenceKey>();
+ private final List<PreferenceKey> keys = new ArrayList<>();
private ControlBindingManager<PreferenceKey> bindManager;
- public AbstractOptionsBlock(IStatusChangeListener context,
- IProject project, PreferenceKey[] allKeys,
- IWorkbenchPreferenceContainer container) {
+ public AbstractOptionsBlock(IStatusChangeListener context, IProject project,
+ PreferenceKey[] allKeys, IWorkbenchPreferenceContainer container) {
super(context, project, allKeys, container);
- this.bindManager = new ControlBindingManager<PreferenceKey>(this,
- context);
+ this.bindManager = new ControlBindingManager<>(this, context);
}
@Override
@@ -97,7 +95,7 @@
/**
* Returns the string that should be used as the title in the popup box that
* indicates a build needs to occur.
- *
+ *
* <p>
* Default implementation returns null. Clients should override to return
* context appropriate title. Clients must also override
@@ -105,7 +103,7 @@
* <code>getProjectBuildDialogMessage()</code> in order to trigger the popup
* box.
* </p>
- *
+ *
* @deprecated
* @see #getPreferenceChangeRebuildPrompt(boolean, Collection)
*/
@@ -117,7 +115,7 @@
/**
* Returns the string that should be used in the popup box that indicates a
* full build needs to occur.
- *
+ *
* <p>
* Default implementation returns null. Clients should override to return
* context appropriate message. Clients must also override
@@ -125,7 +123,7 @@
* <code>getProjectBuildDialogMessage()</code> in order to trigger the popup
* box.
* </p>
- *
+ *
* @deprecated
* @see #getPreferenceChangeRebuildPrompt(boolean, Collection)
*/
@@ -137,7 +135,7 @@
/**
* Returns the string that should be used in the popup box that indicates a
* project build needs to occur.
- *
+ *
* <p>
* Default implementation returns null. Clients should override to return
* context appropriate message. Clients must also override
@@ -145,7 +143,7 @@
* <code>getFullBuildDialogMessage()</code> in order to trigger the popup
* box.
* </p>
- *
+ *
* @deprecated
* @see #getPreferenceChangeRebuildPrompt(boolean, Collection)
*/
@@ -170,7 +168,7 @@
/*
* Override performOk() as public API.
- *
+ *
* @see OptionsConfigurationBlock#performOk()
*/
@Override
@@ -180,7 +178,7 @@
/*
* Override performApply() as public API.
- *
+ *
* @see OptionsConfigurationBlock#performApply()
*/
@Override
@@ -221,8 +219,8 @@
PreferenceLinkArea area = new PreferenceLinkArea(composite, SWT.NONE,
prefPageId, message, getPreferenceContainer(), data);
- area.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, false, false));
+ area.getControl()
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
}
protected void createPropToPrefLink(Composite composite, String message,
@@ -230,13 +228,13 @@
PropToPrefLinkArea area = new PropToPrefLinkArea(composite, SWT.NONE,
prefPageId, message, getShell(), data);
- area.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, false, false));
+ area.getControl()
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
}
/*
* Override getShell() method as public API.
- *
+ *
* @see OptionsConfigurationBlock#getShell()
*/
@Override
@@ -246,7 +244,7 @@
/*
* Override dispose() method as public API.
- *
+ *
* @see OptionsConfigurationBlock#dispose()
*/
@Override
@@ -256,7 +254,7 @@
/*
* Override statusChanged() as public API.
- *
+ *
* @see OptionsConfigurationBlock#statusChanged(IStatus)
*/
@Override
@@ -266,13 +264,14 @@
/*
* Override getPreferenceChangeRebuildPrompt() as public API
- *
+ *
* @see OptionsConfigurationBlock#getPreferenceChangeRebuildPrompt(boolean,
* java.util.Collection)
*/
@Override
protected IPreferenceChangeRebuildPrompt getPreferenceChangeRebuildPrompt(
- boolean workspaceSettings, Collection<PreferenceKey> changedOptions) {
+ boolean workspaceSettings,
+ Collection<PreferenceKey> changedOptions) {
return super.getPreferenceChangeRebuildPrompt(workspaceSettings,
changedOptions);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java
index 243f592..df8eb1e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractScriptEditorColoringConfigurationBlock.java
@@ -276,7 +276,7 @@
@Override
public Object[] getElements(Object inputElement) {
- List<String> categorys = new ArrayList<String>();
+ List<String> categorys = new ArrayList<>();
for (String cat : getCategories()) {
if (getElementsForCategory(cat).length > 0) {
categorys.add(cat);
@@ -366,7 +366,7 @@
/**
* Highlighting color list
*/
- protected final java.util.List<HighlightingColorListItem> fListModel = new ArrayList<HighlightingColorListItem>();
+ protected final java.util.List<HighlightingColorListItem> fListModel = new ArrayList<>();
/**
* Highlighting color list viewer
@@ -419,7 +419,7 @@
protected abstract void setDocumentPartitioning(IDocument document);
protected Object[] getElementsForCategory(String entry) {
- List<HighlightingColorListItem> elements = new ArrayList<HighlightingColorListItem>();
+ List<HighlightingColorListItem> elements = new ArrayList<>();
for (HighlightingColorListItem item : this.fListModel) {
if (entry.equals(item.getCategory())) {
elements.add(item);
@@ -434,7 +434,7 @@
fColorManager = new DLTKColorManager(false);
- final Set<String> colorKeys = new HashSet<String>();
+ final Set<String> colorKeys = new HashSet<>();
final String[][] model = getSyntaxColorListModel();
for (int i = 0, n = model.length; i < n; i++) {
@@ -477,7 +477,7 @@
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
for (int i = 0, n = fListModel.size(); i < n; i++) {
HighlightingColorListItem item = fListModel.get(i);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeAssistConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeAssistConfigurationBlock.java
index adac1ad..b67b512 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeAssistConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeAssistConfigurationBlock.java
@@ -35,13 +35,13 @@
public CodeAssistConfigurationBlock(PreferencePage mainPreferencePage,
OverlayPreferenceStore store, String... optionalPreferences) {
super(store, mainPreferencePage);
- this.optionalPreferences = new HashSet<String>();
+ this.optionalPreferences = new HashSet<>();
Collections.addAll(this.optionalPreferences, optionalPreferences);
getPreferenceStore().addKeys(createOverlayStoreKeys());
}
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
getOverlayKeys(overlayKeys);
@@ -69,8 +69,8 @@
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
PreferenceConstants.CODEASSIST_SORTER));
- if (optionalPreferences
- .contains(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS)) {
+ if (optionalPreferences.contains(
+ PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS)) {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
@@ -93,28 +93,22 @@
Composite composite;
- composite = createSubsection(
- control,
- null,
+ composite = createSubsection(control, null,
PreferencesMessages.CodeAssistConfigurationBlock_insertionSection_title);
final GridLayout layout = GridLayoutFactory.swtDefaults().numColumns(2)
.create();
composite.setLayout(layout);
addInsertionSection(composite);
- if (optionalPreferences
- .contains(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS)) {
- composite = createSubsection(
- control,
- null,
+ if (optionalPreferences.contains(
+ PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS)) {
+ composite = createSubsection(control, null,
PreferencesMessages.CodeAssistConfigurationBlock_filteringSection_title);
composite.setLayout(layout);
addFilteringSection(composite);
}
- composite = createSubsection(
- control,
- null,
+ composite = createSubsection(control, null,
PreferencesMessages.CodeAssistConfigurationBlock_autoactivationSection_title);
composite.setLayout(layout);
addAutoActivationSection(composite);
@@ -146,8 +140,7 @@
private Control autoActivation;
protected void addAutoActivationSection(Composite composite) {
- final Button autoactivation = addCheckBox(
- composite,
+ final Button autoactivation = addCheckBox(composite,
PreferencesMessages.DLTKEditorPreferencePage_enableAutoActivation,
PreferenceConstants.CODEASSIST_AUTOACTIVATION, 2);
autoactivation.addSelectionListener(new SelectionAdapter() {
@@ -157,16 +150,16 @@
}
});
- Control[] ctrl = addLabelledTextField(
- composite,
+ Control[] ctrl = addLabelledTextField(composite,
PreferencesMessages.DLTKEditorPreferencePage_autoActivationDelay,
- PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 2, true);
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 2,
+ true);
autoActivation = ctrl[1];
}
private void updateAutoactivationControls() {
- boolean autoactivation = getPreferenceStore().getBoolean(
- PreferenceConstants.CODEASSIST_AUTOACTIVATION);
+ boolean autoactivation = getPreferenceStore()
+ .getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
if (autoActivation != null) {
autoActivation.setEnabled(autoactivation);
}
@@ -175,8 +168,7 @@
protected void addInsertionSection(Composite composite) {
addCompletionRadioButtons(composite);
- addCheckBox(
- composite,
+ addCheckBox(composite,
PreferencesMessages.DLTKEditorPreferencePage_insertSingleProposalsAutomatically,
PreferenceConstants.CODEASSIST_AUTOINSERT, 2);
}
@@ -204,22 +196,23 @@
fCompletionInsertsRadioButton = new Button(completionComposite,
SWT.RADIO | SWT.LEFT);
- fCompletionInsertsRadioButton
- .setText(PreferencesMessages.DLTKEditorPreferencePage_completionInserts);
+ fCompletionInsertsRadioButton.setText(
+ PreferencesMessages.DLTKEditorPreferencePage_completionInserts);
fCompletionInsertsRadioButton.setLayoutData(new GridData());
fCompletionInsertsRadioButton
.addSelectionListener(completionSelectionListener);
fCompletionOverwritesRadioButton = new Button(completionComposite,
SWT.RADIO | SWT.LEFT);
- fCompletionOverwritesRadioButton
- .setText(PreferencesMessages.DLTKEditorPreferencePage_completionOverwrites);
+ fCompletionOverwritesRadioButton.setText(
+ PreferencesMessages.DLTKEditorPreferencePage_completionOverwrites);
fCompletionOverwritesRadioButton.setLayoutData(new GridData());
fCompletionOverwritesRadioButton
.addSelectionListener(completionSelectionListener);
Label label = new Label(completionComposite, SWT.NONE);
- label.setText(PreferencesMessages.DLTKEditorPreferencePage_completionToggleHint);
+ label.setText(
+ PreferencesMessages.DLTKEditorPreferencePage_completionToggleHint);
GridData gd = new GridData();
gd.horizontalIndent = 20;
gd.horizontalSpan = 2;
@@ -227,8 +220,7 @@
}
protected void addFilteringSection(Composite composite) {
- addCheckBox(
- composite,
+ addCheckBox(composite,
PreferencesMessages.DLTKEditorPreferencePage_showOnlyProposalsVisibleInTheInvocationContext,
PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 2);
}
@@ -236,8 +228,8 @@
@Override
protected void initializeFields() {
super.initializeFields();
- boolean completionInserts = getPreferenceStore().getBoolean(
- PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
+ boolean completionInserts = getPreferenceStore()
+ .getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
fCompletionInsertsRadioButton.setSelection(completionInserts);
fCompletionOverwritesRadioButton.setSelection(!completionInserts);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java
index 089e88e..5c3a380 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java
@@ -76,8 +76,8 @@
public class CodeTemplateBlock extends OptionsConfigurationBlock {
- private class CodeTemplateAdapter extends ViewerComparator implements
- ITreeListAdapter, IDialogFieldListener {
+ private class CodeTemplateAdapter extends ViewerComparator
+ implements ITreeListAdapter, IDialogFieldListener {
private final Object[] NO_CHILDREN = new Object[0];
@@ -115,8 +115,8 @@
return getTemplatesOfCategory(category);
}
} else if (element instanceof TemplateContextType) {
- return getTemplatesOfContextType(((TemplateContextType) element)
- .getId());
+ return getTemplatesOfContextType(
+ ((TemplateContextType) element).getId());
}
return NO_CHILDREN;
}
@@ -139,9 +139,8 @@
return category;
}
} else if (element instanceof TemplateContextType) {
- return codeTemplateAccess
- .getCategoryOfContextType(((TemplateContextType) element)
- .getId());
+ return codeTemplateAccess.getCategoryOfContextType(
+ ((TemplateContextType) element).getId());
}
return null;
}
@@ -193,7 +192,7 @@
// getJDTUIKey(PreferenceConstants.CODEGEN_ADD_COMMENTS);
private static PreferenceKey[] getAllKeys() {
- return new PreferenceKey[] { /* PREF_GENERATE_COMMENTS */};
+ return new PreferenceKey[] { /* PREF_GENERATE_COMMENTS */ };
}
private final static int IDX_ADD = 0;
@@ -249,8 +248,8 @@
fCodeTemplateTree = new TreeListDialogField(adapter, buttonLabels,
new CodeTemplateLabelProvider());
fCodeTemplateTree.setDialogFieldListener(adapter);
- fCodeTemplateTree
- .setLabelText(PreferencesMessages.CodeTemplateBlock_templates_label);
+ fCodeTemplateTree.setLabelText(
+ PreferencesMessages.CodeTemplateBlock_templates_label);
fCodeTemplateTree.setViewerComparator(adapter);
fCodeTemplateTree.enableButton(IDX_EXPORT, false);
@@ -258,8 +257,8 @@
fCodeTemplateTree.enableButton(IDX_EDIT, false);
fCodeTemplateTree.enableButton(IDX_REMOVE, false);
- fCodeTemplateTree.addElements(Arrays.asList(codeTemplateAccess
- .getCategories()));
+ fCodeTemplateTree
+ .addElements(Arrays.asList(codeTemplateAccess.getCategories()));
fCodeTemplateTree.selectFirstElement();
@@ -310,8 +309,8 @@
composite.setLayout(layout);
fCodeTemplateTree.doFillIntoGrid(composite, 3);
- LayoutUtil
- .setHorizontalSpan(fCodeTemplateTree.getLabelControl(null), 2);
+ LayoutUtil.setHorizontalSpan(fCodeTemplateTree.getLabelControl(null),
+ 2);
LayoutUtil
.setHorizontalGrabbing(fCodeTemplateTree.getTreeControl(null));
@@ -340,7 +339,8 @@
SourceViewer viewer = new ScriptSourceViewer(parent, null, null, false,
SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
ScriptSourceViewerConfiguration configuration = tools
- .createSourceViewerConfiguraton(store, null, fTemplateProcessor);
+ .createSourceViewerConfiguraton(store, null,
+ fTemplateProcessor);
viewer.configure(configuration);
viewer.setEditable(false);
@@ -351,14 +351,14 @@
viewer.setDocument(document);
- Font font = JFaceResources.getFont(configuration
- .getFontPropertyPreferenceKey());
+ Font font = JFaceResources
+ .getFont(configuration.getFontPropertyPreferenceKey());
viewer.getTextWidget().setFont(font);
new ScriptSourcePreviewerUpdater(viewer, configuration, store);
Control control = viewer.getControl();
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.FILL_VERTICAL);
+ data = new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
data.horizontalSpan = nColumns;
data.heightHint = fPixelConverter.convertHeightInCharsToPixels(5);
control.setLayoutData(data);
@@ -368,7 +368,7 @@
protected TemplatePersistenceData[] getTemplatesOfCategory(
ICodeTemplateCategory category) {
- ArrayList<TemplatePersistenceData> res = new ArrayList<TemplatePersistenceData>();
+ ArrayList<TemplatePersistenceData> res = new ArrayList<>();
TemplatePersistenceData[] templates = fTemplateStore.getTemplateData();
for (int i = 0; i < templates.length; i++) {
TemplatePersistenceData curr = templates[i];
@@ -387,7 +387,7 @@
protected TemplatePersistenceData[] getTemplatesOfContextType(
String contextTypeId) {
- List<TemplatePersistenceData> res = new ArrayList<TemplatePersistenceData>();
+ List<TemplatePersistenceData> res = new ArrayList<>();
TemplatePersistenceData[] templates = fTemplateStore.getTemplateData();
for (int i = 0; i < templates.length; ++i) {
TemplatePersistenceData curr = templates[i];
@@ -395,13 +395,12 @@
res.add(curr);
}
}
- return res
- .toArray(new TemplatePersistenceData[res.size()]);
+ return res.toArray(new TemplatePersistenceData[res.size()]);
}
protected TemplateContextType[] getTemplateContextTypes(
ICodeTemplateCategory category) {
- ArrayList<TemplateContextType> result = new ArrayList<TemplateContextType>();
+ ArrayList<TemplateContextType> result = new ArrayList<>();
TemplateContextType[] contextTypes = category.getTemplateContextTypes();
for (int i = 0; i < contextTypes.length; ++i) {
TemplateContextType contextType = contextTypes[i];
@@ -417,14 +416,14 @@
Object element = selected.get(0);
if (element instanceof TemplateContextType
|| element instanceof ICodeTemplateCategory
- && ((ICodeTemplateCategory) element).isGroup()) {
+ && ((ICodeTemplateCategory) element).isGroup()) {
return true;
}
if (element instanceof TemplatePersistenceData) {
final TemplatePersistenceData data = (TemplatePersistenceData) element;
final ICodeTemplateCategory category = codeTemplateAccess
- .getCategoryOfContextType(data.getTemplate()
- .getContextTypeId());
+ .getCategoryOfContextType(
+ data.getTemplate().getContextTypeId());
if (category != null && category.isGroup()) {
return true;
}
@@ -459,8 +458,8 @@
.get(0);
Template template = data.getTemplate();
TemplateContextType type = codeTemplateAccess
- .getContextTypeRegistry().getContextType(
- template.getContextTypeId());
+ .getContextTypeRegistry()
+ .getContextType(template.getContextTypeId());
fTemplateProcessor.setContextType(type);
fPatternViewer.getDocument().set(template.getPattern());
} else {
@@ -493,8 +492,8 @@
}
Template newTemplate;
if (orig != null) {
- newTemplate = new Template(
- "", "", contextTypeId, orig.getPattern(), false); //$NON-NLS-1$//$NON-NLS-2$
+ newTemplate = new Template("", "", contextTypeId, //$NON-NLS-1$//$NON-NLS-2$
+ orig.getPattern(), false);
} else {
newTemplate = new Template("", "", contextTypeId, "", false); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
@@ -565,8 +564,8 @@
private void import_() {
FileDialog dialog = new FileDialog(getShell());
dialog.setText(PreferencesMessages.CodeTemplateBlock_import_title);
- dialog
- .setFilterExtensions(new String[] { PreferencesMessages.CodeTemplateBlock_import_extension });
+ dialog.setFilterExtensions(new String[] {
+ PreferencesMessages.CodeTemplateBlock_import_extension });
String path = dialog.open();
if (path == null)
@@ -624,10 +623,8 @@
String name = data2.getTemplate().getName();
String contextTypeId = data2.getTemplate()
.getContextTypeId();
- if (name != null
- && name.equals(dataName)
- && contextTypeId.equals(data.getTemplate()
- .getContextTypeId())) {
+ if (name != null && name.equals(dataName) && contextTypeId
+ .equals(data.getTemplate().getContextTypeId())) {
data2.setTemplate(data.getTemplate());
return;
}
@@ -643,42 +640,45 @@
}
private void export(List selected) {
- Set<TemplatePersistenceData> datas = new HashSet<TemplatePersistenceData>();
+ Set<TemplatePersistenceData> datas = new HashSet<>();
for (int i = 0; i < selected.size(); i++) {
Object curr = selected.get(i);
if (curr instanceof TemplatePersistenceData) {
datas.add((TemplatePersistenceData) curr);
} else if (curr instanceof TemplateContextType) {
- TemplatePersistenceData[] cat = getTemplatesOfContextType((TemplateContextType) curr);
+ TemplatePersistenceData[] cat = getTemplatesOfContextType(
+ (TemplateContextType) curr);
datas.addAll(Arrays.asList(cat));
} else if (curr instanceof ICodeTemplateCategory) {
ICodeTemplateCategory category = (ICodeTemplateCategory) curr;
if (category.isGroup()) {
- TemplateContextType[] types = getTemplateContextTypes(category);
+ TemplateContextType[] types = getTemplateContextTypes(
+ category);
for (int j = 0; j < types.length; ++j) {
TemplateContextType contextType = types[j];
- TemplatePersistenceData[] cat = getTemplatesOfContextType(contextType);
+ TemplatePersistenceData[] cat = getTemplatesOfContextType(
+ contextType);
datas.addAll(Arrays.asList(cat));
}
} else {
- TemplatePersistenceData[] cat = getTemplatesOfCategory(category);
+ TemplatePersistenceData[] cat = getTemplatesOfCategory(
+ category);
datas.addAll(Arrays.asList(cat));
}
}
}
- export(datas
- .toArray(new TemplatePersistenceData[datas.size()]));
+ export(datas.toArray(new TemplatePersistenceData[datas.size()]));
}
private void export(TemplatePersistenceData[] templates) {
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
- dialog.setText(NLS.bind(
- PreferencesMessages.CodeTemplateBlock_export_title, String
- .valueOf(templates.length)));
- dialog
- .setFilterExtensions(new String[] { PreferencesMessages.CodeTemplateBlock_export_extension });
- dialog
- .setFileName(PreferencesMessages.CodeTemplateBlock_export_filename);
+ dialog.setText(
+ NLS.bind(PreferencesMessages.CodeTemplateBlock_export_title,
+ String.valueOf(templates.length)));
+ dialog.setFilterExtensions(new String[] {
+ PreferencesMessages.CodeTemplateBlock_export_extension });
+ dialog.setFileName(
+ PreferencesMessages.CodeTemplateBlock_export_filename);
String path = dialog.open();
if (path == null)
@@ -697,10 +697,9 @@
if (file.exists() && !file.canWrite()) {
String title = PreferencesMessages.CodeTemplateBlock_export_error_title;
- String message = NLS
- .bind(
- PreferencesMessages.CodeTemplateBlock_export_error_canNotWrite,
- BasicElementLabels.getPathLabel(file));
+ String message = NLS.bind(
+ PreferencesMessages.CodeTemplateBlock_export_error_canNotWrite,
+ BasicElementLabels.getPathLabel(file));
MessageDialog.openError(getShell(), title, message);
return;
}
@@ -727,14 +726,11 @@
}
private boolean confirmOverwrite(File file) {
- return MessageDialog
- .openQuestion(
- getShell(),
- PreferencesMessages.CodeTemplateBlock_export_exists_title,
- NLS
- .bind(
- PreferencesMessages.CodeTemplateBlock_export_exists_message,
- BasicElementLabels.getPathLabel(file)));
+ return MessageDialog.openQuestion(getShell(),
+ PreferencesMessages.CodeTemplateBlock_export_exists_title,
+ NLS.bind(
+ PreferencesMessages.CodeTemplateBlock_export_exists_message,
+ BasicElementLabels.getPathLabel(file)));
}
@Override
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ControlBindingManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ControlBindingManager.java
index 2513927..4635362 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ControlBindingManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ControlBindingManager.java
@@ -25,7 +25,7 @@
private Map<Button, KEY> checkBoxControls;
private Map<Combo, KEY> comboControls;
- private final Map<Combo, IComboSelectedValueProvider> comboValueProviders = new IdentityHashMap<Combo, IComboSelectedValueProvider>();
+ private final Map<Combo, IComboSelectedValueProvider> comboValueProviders = new IdentityHashMap<>();
private DependencyManager dependencyManager;
@@ -33,7 +33,7 @@
private Map<Button, KEY> radioControls;
private Map<Text, KEY> textControls;
- private final Map<Text, ITextConverter> textTransformers = new HashMap<Text, ITextConverter>();
+ private final Map<Text, ITextConverter> textTransformers = new HashMap<>();
private ValidatorManager validatorManager;
public static class DependencyMode {
@@ -49,10 +49,10 @@
public ControlBindingManager(IPreferenceDelegate<KEY> delegate,
IStatusChangeListener listener) {
- this.checkBoxControls = new HashMap<Button, KEY>();
- this.comboControls = new HashMap<Combo, KEY>();
- this.textControls = new HashMap<Text, KEY>();
- this.radioControls = new HashMap<Button, KEY>();
+ this.checkBoxControls = new HashMap<>();
+ this.comboControls = new HashMap<>();
+ this.textControls = new HashMap<>();
+ this.radioControls = new HashMap<>();
this.validatorManager = new ValidatorManager();
this.dependencyManager = new DependencyManager();
@@ -66,8 +66,9 @@
@Override
public String getValueAt(int index) {
- return index >= 0 && index < combo.getItemCount() ? combo
- .getItem(index) : null;
+ return index >= 0 && index < combo.getItemCount()
+ ? combo.getItem(index)
+ : null;
}
@Override
@@ -126,7 +127,8 @@
});
}
- public void bindControl(final Button button, final KEY key, Control[] slaves) {
+ public void bindControl(final Button button, final KEY key,
+ Control[] slaves) {
if (key != null) {
checkBoxControls.put(button, key);
}
@@ -329,9 +331,9 @@
}
/**
- */
+ */
class DependencyManager {
- private List<SelectionListener> masterSlaveListeners = new ArrayList<SelectionListener>();
+ private List<SelectionListener> masterSlaveListeners = new ArrayList<>();
public void createDependency(final Button master,
final Control[] slaves, final DependencyMode mode) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
index 88b2b57..e1483b0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
@@ -124,14 +124,14 @@
return;
boolean wasEnabled = isEnabled();
- boolean isEnabled = (fOperationTarget != null && fOperationTarget
- .canDoOperation(fOperationCode));
+ boolean isEnabled = (fOperationTarget != null
+ && fOperationTarget.canDoOperation(fOperationCode));
setEnabled(isEnabled);
if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE
- : Boolean.FALSE, isEnabled ? Boolean.TRUE
- : Boolean.FALSE);
+ firePropertyChange(ENABLED,
+ wasEnabled ? Boolean.TRUE : Boolean.FALSE,
+ isEnabled ? Boolean.TRUE : Boolean.FALSE);
}
}
@@ -158,9 +158,8 @@
private StatusInfo fValidationStatus;
private boolean fSuppressError = true; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=4354
- private Map<String, IAction> fGlobalActions = new HashMap<String, IAction>(
- 10);
- private List<String> fSelectionActions = new ArrayList<String>(3);
+ private Map<String, IAction> fGlobalActions = new HashMap<>(10);
+ private List<String> fSelectionActions = new ArrayList<>(3);
private String[][] fContextTypes;
private ContextTypeRegistry fContextTypeRegistry;
@@ -199,7 +198,7 @@
String delim = new Document().getLegalLineDelimiters()[0];
- List<String[]> contexts = new ArrayList<String[]>();
+ List<String[]> contexts = new ArrayList<>();
for (Iterator it = registry.contextTypes(); it.hasNext();) {
TemplateContextType type = (TemplateContextType) it.next();
if (type.getId().equals("javadoc")) //$NON-NLS-1$
@@ -215,8 +214,8 @@
fContextTypeRegistry = registry;
- TemplateContextType type = fContextTypeRegistry.getContextType(template
- .getContextTypeId());
+ TemplateContextType type = fContextTypeRegistry
+ .getContextType(template.getContextTypeId());
fTemplateProcessor.setContextType(type);
}
@@ -242,10 +241,14 @@
Composite parent = new Composite(ancestor, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.marginHeight = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_SPACING);
parent.setLayout(layout);
parent.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -299,8 +302,8 @@
createLabel(parent, PreferencesMessages.EditTemplateDialog_description);
- int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER
- | SWT.READ_ONLY;
+ int descFlags = fIsNameModifiable ? SWT.BORDER
+ : SWT.BORDER | SWT.READ_ONLY;
fDescriptionText = new Text(parent, descFlags);
fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -308,8 +311,8 @@
Label patternLabel = createLabel(parent,
PreferencesMessages.EditTemplateDialog_pattern);
- patternLabel.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_BEGINNING));
+ patternLabel
+ .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
fPatternEditor = createEditor(parent);
Label filler = new Label(parent, SWT.NONE);
@@ -324,8 +327,8 @@
fInsertVariableButton = new Button(composite, SWT.NONE);
fInsertVariableButton.setLayoutData(getButtonGridData());
- fInsertVariableButton
- .setText(PreferencesMessages.EditTemplateDialog_insert_variable);
+ fInsertVariableButton.setText(
+ PreferencesMessages.EditTemplateDialog_insert_variable);
fInsertVariableButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -359,14 +362,13 @@
updateStatusAndButtons();
} else if (w == fContextCombo) {
String contextId = getContextId();
- fTemplateProcessor.setContextType(fContextTypeRegistry
- .getContextType(contextId));
+ fTemplateProcessor.setContextType(
+ fContextTypeRegistry.getContextType(contextId));
IDocument document = fPatternEditor.getDocument();
String prefix = getPrefix();
document.set(prefix + getPattern());
- fPatternEditor.setVisibleRegion(prefix.length(), document
- .getLength()
- - prefix.length());
+ fPatternEditor.setVisibleRegion(prefix.length(),
+ document.getLength() - prefix.length());
updateStatusAndButtons();
} else if (w == fDescriptionText) {
// nothing
@@ -432,14 +434,15 @@
SourceViewer viewer = new ScriptSourceViewer(parent, null, null, false,
SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
ScriptSourceViewerConfiguration configuration = textTools
- .createSourceViewerConfiguraton(store, null, fTemplateProcessor);
+ .createSourceViewerConfiguraton(store, null,
+ fTemplateProcessor);
viewer.configure(configuration);
viewer.setEditable(true);
- viewer.setDocument(document, prefix.length(), document.getLength()
- - prefix.length());
+ viewer.setDocument(document, prefix.length(),
+ document.getLength() - prefix.length());
- Font font = JFaceResources.getFont(configuration
- .getFontPropertyPreferenceKey());
+ Font font = JFaceResources
+ .getFont(configuration.getFontPropertyPreferenceKey());
viewer.getTextWidget().setFont(font);
new ScriptSourcePreviewerUpdater(viewer, configuration, store);
@@ -461,7 +464,8 @@
doSourceChanged(event.getDocumentEvent().getDocument());
});
- viewer.addSelectionChangedListener(event -> updateSelectionDependentActions());
+ viewer.addSelectionChangedListener(
+ event -> updateSelectionDependentActions());
return viewer;
}
@@ -476,14 +480,14 @@
}
private void initializeActions() {
- final List<IHandlerActivation> handlerActivations = new ArrayList<IHandlerActivation>(
- 3);
- final IHandlerService handlerService = PlatformUI
- .getWorkbench().getAdapter(IHandlerService.class);
- final Expression expression = new ActiveShellExpression(fPatternEditor
- .getControl().getShell());
+ final List<IHandlerActivation> handlerActivations = new ArrayList<>(3);
+ final IHandlerService handlerService = PlatformUI.getWorkbench()
+ .getAdapter(IHandlerService.class);
+ final Expression expression = new ActiveShellExpression(
+ fPatternEditor.getControl().getShell());
- getShell().addDisposeListener(e -> handlerService.deactivateHandlers(handlerActivations));
+ getShell().addDisposeListener(
+ e -> handlerService.deactivateHandlers(handlerActivations));
fPatternEditor.getTextWidget().addFocusListener(new FocusListener() {
@Override
@@ -497,19 +501,15 @@
.get(ITextEditorActionConstants.REDO);
handlerActivations.add(handlerService.activateHandler(
IWorkbenchCommandConstants.EDIT_REDO,
- new ActionHandler(
- action), expression));
+ new ActionHandler(action), expression));
action = fGlobalActions.get(ITextEditorActionConstants.UNDO);
handlerActivations.add(handlerService.activateHandler(
IWorkbenchCommandConstants.EDIT_UNDO,
- new ActionHandler(
- action), expression));
+ new ActionHandler(action), expression));
action = fGlobalActions.get("ContentAssistProposal");
- handlerActivations
- .add(handlerService
- .activateHandler(
- ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
- new ActionHandler(action), expression));
+ handlerActivations.add(handlerService.activateHandler(
+ ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS,
+ new ActionHandler(action), expression));
}
});
@@ -518,7 +518,8 @@
action.setText(PreferencesMessages.EditTemplateDialog_undo);
fGlobalActions.put(ITextEditorActionConstants.UNDO, action);
- action = new TextViewerAction(fPatternEditor, ITextOperationTarget.REDO);
+ action = new TextViewerAction(fPatternEditor,
+ ITextOperationTarget.REDO);
action.setText(PreferencesMessages.EditTemplateDialog_redo);
fGlobalActions.put(ITextEditorActionConstants.REDO, action);
@@ -526,7 +527,8 @@
action.setText(PreferencesMessages.EditTemplateDialog_cut);
fGlobalActions.put(ITextEditorActionConstants.CUT, action);
- action = new TextViewerAction(fPatternEditor, ITextOperationTarget.COPY);
+ action = new TextViewerAction(fPatternEditor,
+ ITextOperationTarget.COPY);
action.setText(PreferencesMessages.EditTemplateDialog_copy);
fGlobalActions.put(ITextEditorActionConstants.COPY, action);
@@ -577,8 +579,8 @@
fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
- menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fGlobalActions
- .get("ContentAssistProposal")); //$NON-NLS-1$
+ menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE,
+ fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
protected void updateSelectionDependentActions() {
@@ -608,8 +610,8 @@
@Override
protected void okPressed() {
- String name = fNameText == null ? fTemplate.getName() : fNameText
- .getText();
+ String name = fNameText == null ? fTemplate.getName()
+ : fNameText.getText();
boolean isAutoInsertable = fAutoInsertCheckbox != null
&& fAutoInsertCheckbox.getSelection();
fTemplate = new Template(name, fDescriptionText.getText(),
@@ -623,13 +625,13 @@
&& fNameText.getText().length() == 0;
if (!fSuppressError && isEmpty) {
status = new StatusInfo();
- status
- .setError(PreferencesMessages.EditTemplateDialog_error_noname);
+ status.setError(
+ PreferencesMessages.EditTemplateDialog_error_noname);
} else if (fNameText != null
&& !isValidTemplateName(fNameText.getText())) {
status = new StatusInfo();
- status
- .setError(PreferencesMessages.EditTemplateDialog_error_invalidName);
+ status.setError(
+ PreferencesMessages.EditTemplateDialog_error_invalidName);
}
updateStatus(status);
}
@@ -670,8 +672,8 @@
IDocument doc = fPatternEditor.getDocument();
IRegion visible = fPatternEditor.getVisibleRegion();
try {
- return doc.get(visible.getOffset(), doc.getLength()
- - visible.getOffset());
+ return doc.get(visible.getOffset(),
+ doc.getLength() - visible.getOffset());
} catch (BadLocationException e) {
return ""; //$NON-NLS-1$
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditorConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditorConfigurationBlock.java
index b39fd86..6d71801 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditorConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditorConfigurationBlock.java
@@ -68,10 +68,9 @@
* @since 2.0
*/
protected EditorColorItem[] createColorListModel() {
- return new EditorColorItem[] {
- new EditorColorItem(
- PreferencesMessages.EditorPreferencePage_matchingBracketsHighlightColor,
- PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
+ return new EditorColorItem[] { new EditorColorItem(
+ PreferencesMessages.EditorPreferencePage_matchingBracketsHighlightColor,
+ PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
new EditorColorItem(
PreferencesMessages.EditorPreferencePage_backgroundForMethodParameters,
PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
@@ -97,8 +96,8 @@
public EditorConfigurationBlock(PreferencePage mainPreferencePage,
OverlayPreferenceStore store) {
- this(mainPreferencePage, store, FLAG_TAB_POLICY
- | FLAG_EDITOR_SMART_NAVIGATION);
+ this(mainPreferencePage, store,
+ FLAG_TAB_POLICY | FLAG_EDITOR_SMART_NAVIGATION);
}
/**
@@ -125,9 +124,10 @@
public EditorConfigurationBlock(PreferencePage mainPreferencePage,
OverlayPreferenceStore store, boolean disableSmart,
boolean tabAlwaysIndent) {
- this(mainPreferencePage, store, FLAG_TAB_POLICY
- | (disableSmart ? 0 : FLAG_EDITOR_SMART_NAVIGATION)
- | (tabAlwaysIndent ? FLAG_TAB_ALWAYS_INDENT : 0));
+ this(mainPreferencePage, store,
+ FLAG_TAB_POLICY
+ | (disableSmart ? 0 : FLAG_EDITOR_SMART_NAVIGATION)
+ | (tabAlwaysIndent ? FLAG_TAB_ALWAYS_INDENT : 0));
}
public EditorConfigurationBlock(PreferencePage mainPreferencePage,
@@ -140,13 +140,13 @@
} else {
fColorListModel = null;
}
- getPreferenceStore().addKeys(
- createOverlayStoreKeys(flags, fColorListModel));
+ getPreferenceStore()
+ .addKeys(createOverlayStoreKeys(flags, fColorListModel));
}
private static OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(
int flags, EditorColorItem[] colorItems) {
- ArrayList<OverlayKey> keys = new ArrayList<OverlayKey>();
+ ArrayList<OverlayKey> keys = new ArrayList<>();
if ((flags & FLAG_EDITOR_SMART_NAVIGATION) != 0) {
keys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
@@ -248,20 +248,17 @@
FormatterMessages.IndentationTabPage_general_group_option_tab_policy_TAB,
FormatterMessages.IndentationTabPage_general_group_option_tab_policy_MIXED };
- addComboBox(
- generalGroup,
+ addComboBox(generalGroup,
FormatterMessages.IndentationTabPage_general_group_option_tab_policy,
CodeFormatterConstants.FORMATTER_TAB_CHAR, tabPolicyLabels,
tabPolicyValues);
- addLabelledTextField(
- generalGroup,
+ addLabelledTextField(generalGroup,
FormatterMessages.IndentationTabPage_general_group_option_indent_size,
CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, 2, 1,
true);
- addLabelledTextField(
- generalGroup,
+ addLabelledTextField(generalGroup,
FormatterMessages.IndentationTabPage_general_group_option_tab_size,
CodeFormatterConstants.FORMATTER_TAB_SIZE, 2, 1, true);
}
@@ -327,15 +324,15 @@
layout.marginHeight = 0;
layout.marginWidth = 0;
editorComposite.setLayout(layout);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.FILL_VERTICAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
gd.horizontalSpan = 2;
editorComposite.setLayoutData(gd);
- colorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
- | SWT.BORDER);
- gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
- | GridData.FILL_HORIZONTAL);
+ colorList = new List(editorComposite,
+ SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
+ gd = new GridData(
+ GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
gd.heightHint = convertHeightInCharsToPixels(12);
colorList.setLayoutData(gd);
@@ -380,8 +377,8 @@
};
colorDefault = new Button(stylesComposite, SWT.CHECK);
- colorDefault
- .setText(PreferencesMessages.EditorPreferencePage_systemDefault);
+ colorDefault.setText(
+ PreferencesMessages.EditorPreferencePage_systemDefault);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
@@ -437,8 +434,8 @@
colorDefault.setVisible(false);
colorEditor.getButton().setEnabled(true);
} else {
- boolean systemDefault = getPreferenceStore().getBoolean(
- systemDefaultKey);
+ boolean systemDefault = getPreferenceStore()
+ .getBoolean(systemDefaultKey);
colorDefault.setSelection(systemDefault);
colorDefault.setVisible(true);
colorEditor.getButton().setEnabled(!systemDefault);
@@ -470,8 +467,8 @@
for (EditorColorItem item : fColorListModel) {
if (item.systemDefaultKey != null
&& getPreferenceStore().getBoolean(item.systemDefaultKey)) {
- RGB rgb = colorList.getDisplay().getSystemColor(
- item.systemColor).getRGB();
+ RGB rgb = colorList.getDisplay()
+ .getSystemColor(item.systemColor).getRGB();
PreferenceConverter.setValue(getPreferenceStore(),
item.colorKey, rgb);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java
index c7fa9af..d8aebff 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java
@@ -32,8 +32,8 @@
/**
* Configures Script Editor folding preferences.
*/
-public abstract class FoldingConfigurationBlock implements
- IPreferenceConfigurationBlock {
+public abstract class FoldingConfigurationBlock
+ implements IPreferenceConfigurationBlock {
private static class ErrorPreferences implements IFoldingPreferenceBlock {
private String fMessage;
@@ -104,7 +104,7 @@
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
@@ -186,8 +186,8 @@
protected void createCommentsFoldingCheckbox(Composite composite) {
fCommentsFoldingCheckbox = new Button(composite, SWT.CHECK);
- fCommentsFoldingCheckbox
- .setText(PreferencesMessages.FoldingConfigurationBlock_commentsEnable);
+ fCommentsFoldingCheckbox.setText(
+ PreferencesMessages.FoldingConfigurationBlock_commentsEnable);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
fCommentsFoldingCheckbox.setLayoutData(gd);
fCommentsFoldingCheckbox.addSelectionListener(new SelectionAdapter() {
@@ -269,8 +269,8 @@
boolean enabled = fStore
.getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
fFoldingCheckbox.setSelection(enabled);
- boolean commentsEnabled = fStore
- .getBoolean(PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED);
+ boolean commentsEnabled = fStore.getBoolean(
+ PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED);
if (fCommentsFoldingCheckbox != null) {
fCommentsFoldingCheckbox.setSelection(commentsEnabled);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ImprovedAbstractConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ImprovedAbstractConfigurationBlock.java
index 08a8dab..90b0bcb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ImprovedAbstractConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ImprovedAbstractConfigurationBlock.java
@@ -25,8 +25,8 @@
/**
* Configures preferences.
*/
-public abstract class ImprovedAbstractConfigurationBlock implements
- IPreferenceConfigurationBlock, IPreferenceDelegate<String> {
+public abstract class ImprovedAbstractConfigurationBlock
+ implements IPreferenceConfigurationBlock, IPreferenceDelegate<String> {
private PreferencePage page;
private OverlayPreferenceStore store;
@@ -38,8 +38,7 @@
this.page = page;
this.store = store;
- bindManager = new ControlBindingManager<String>(this,
- getStatusListener());
+ bindManager = new ControlBindingManager<>(this, getStatusListener());
addOverlayKeys();
}
@@ -172,8 +171,8 @@
private void addOverlayKeys() {
List<OverlayKey> overlayKeys = createOverlayKeys();
if (overlayKeys != null) {
- OverlayKey[] keys = overlayKeys.toArray(new OverlayKey[overlayKeys
- .size()]);
+ OverlayKey[] keys = overlayKeys
+ .toArray(new OverlayKey[overlayKeys.size()]);
store.addKeys(keys);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/MarkOccurrencesConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/MarkOccurrencesConfigurationBlock.java
index ee55381..53b87f2 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/MarkOccurrencesConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/MarkOccurrencesConfigurationBlock.java
@@ -40,12 +40,12 @@
*
* @since 2.1
*/
-public class MarkOccurrencesConfigurationBlock implements
- IPreferenceConfigurationBlock {
+public class MarkOccurrencesConfigurationBlock
+ implements IPreferenceConfigurationBlock {
private OverlayPreferenceStore fStore;
- private Map<Object, String> fCheckBoxes = new HashMap<Object, String>();
+ private Map<Object, String> fCheckBoxes = new HashMap<>();
private SelectionListener fCheckBoxListener = new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
@@ -64,7 +64,7 @@
* @see #createDependency(Button, String, Control)
* @since 3.0
*/
- private ArrayList<Object> fMasterSlaveListeners = new ArrayList<Object>();
+ private ArrayList<Object> fMasterSlaveListeners = new ArrayList<>();
private StatusInfo fStatus;
@@ -76,7 +76,7 @@
}
protected List<OverlayPreferenceStore.OverlayKey> createOverlayStoreKeys() {
- List<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
+ List<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
PreferenceConstants.EDITOR_MARK_OCCURRENCES));
@@ -104,7 +104,8 @@
composite.setLayout(layout);
Link link = new Link(composite, SWT.NONE);
- link.setText(PreferencesMessages.MarkOccurrencesConfigurationBlock_link);
+ link.setText(
+ PreferencesMessages.MarkOccurrencesConfigurationBlock_link);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -114,7 +115,8 @@
});
// TODO replace by link-specific tooltips when
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed
- link.setToolTipText(PreferencesMessages.MarkOccurrencesConfigurationBlock_link_tooltip);
+ link.setToolTipText(
+ PreferencesMessages.MarkOccurrencesConfigurationBlock_link_tooltip);
addFiller(composite);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/NewScriptProjectPreferencePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/NewScriptProjectPreferencePage.java
index f2de879..85853b9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/NewScriptProjectPreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/NewScriptProjectPreferencePage.java
@@ -96,7 +96,7 @@
public static IBuildpathEntry[] decodeInterpreterEnvironmentLibraryBuildpathEntries(
String encoded) {
StringTokenizer tok = new StringTokenizer(encoded, " "); //$NON-NLS-1$
- ArrayList<IBuildpathEntry> res = new ArrayList<IBuildpathEntry>();
+ ArrayList<IBuildpathEntry> res = new ArrayList<>();
while (tok.hasMoreTokens()) {
try {
tok.nextToken(); // desc: ignore
@@ -187,7 +187,8 @@
public NewScriptProjectPreferencePage() {
super();
setPreferenceStore(DLTKUIPlugin.getDefault().getPreferenceStore());
- setDescription(PreferencesMessages.NewScriptProjectPreferencePage_description);
+ setDescription(
+ PreferencesMessages.NewScriptProjectPreferencePage_description);
// title used when opened programatically
setTitle(PreferencesMessages.NewScriptProjectPreferencePage_title);
@@ -279,10 +280,12 @@
Composite result = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginHeight = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = 0;
layout.verticalSpacing = convertVerticalDLUsToPixels(10);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_SPACING);
layout.numColumns = 2;
result.setLayout(layout);
@@ -294,19 +297,17 @@
layout.numColumns = 2;
sourceFolderGroup.setLayout(layout);
sourceFolderGroup.setLayoutData(gd);
- sourceFolderGroup
- .setText(PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_label);
+ sourceFolderGroup.setText(
+ PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_label);
int indent = 0;
- fProjectAsSourceFolder = addRadioButton(
- sourceFolderGroup,
+ fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_project,
SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.FALSE, indent);
fProjectAsSourceFolder.addSelectionListener(fSelectionListener);
- fFoldersAsSourceFolder = addRadioButton(
- sourceFolderGroup,
+ fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_folder,
SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.TRUE, indent);
fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);
@@ -314,8 +315,8 @@
indent = convertWidthInCharsToPixels(4);
fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
- fSrcFolderNameLabel
- .setText(PreferencesMessages.NewScriptProjectPreferencePage_folders_src);
+ fSrcFolderNameLabel.setText(
+ PreferencesMessages.NewScriptProjectPreferencePage_folders_src);
fSrcFolderNameText = addTextControl(sourceFolderGroup,
fSrcFolderNameLabel, SRC_SRCNAME, indent);
fSrcFolderNameText.addModifyListener(fModifyListener);
@@ -351,8 +352,7 @@
if (useFolders) {
String srcName = fSrcFolderNameText.getText();
if (srcName.length() == 0) {
- updateStatus(new StatusInfo(
- IStatus.ERROR,
+ updateStatus(new StatusInfo(IStatus.ERROR,
PreferencesMessages.NewScriptProjectPreferencePage_folders_error_namesempty));
return;
}
@@ -365,10 +365,9 @@
status = workspace.validatePath(srcPath.toString(),
IResource.FOLDER);
if (!status.isOK()) {
- String message = Messages
- .format(
- PreferencesMessages.NewScriptProjectPreferencePage_folders_error_invalidsrcname,
- status.getMessage());
+ String message = Messages.format(
+ PreferencesMessages.NewScriptProjectPreferencePage_folders_error_invalidsrcname,
+ status.getMessage());
updateStatus(new StatusInfo(IStatus.ERROR, message));
return;
}
@@ -414,9 +413,8 @@
for (int i = 0; i < fRadioButtons.size(); i++) {
Button button = (Button) fRadioButtons.get(i);
String[] info = (String[]) button.getData();
- button
- .setSelection(info[1].equals(store
- .getDefaultString(info[0])));
+ button.setSelection(
+ info[1].equals(store.getDefaultString(info[0])));
}
for (int i = 0; i < fTextControls.size(); i++) {
Text text = (Text) fTextControls.get(i);
@@ -465,7 +463,7 @@
// String prefString=
// getPreferenceStore().getString(CLASSPATH_InterpreterEnvironmentLIBRARY_LIST);
// ArrayList list= new ArrayList();
- // StringTokenizer tok= new StringTokenizer(prefString, ";"); //$NON-NLS-1$
+ // StringTokenizer tok= new StringTokenizer(prefString, ";"); //$NON-NLS-1$
// while (tok.hasMoreTokens()) {
// list.add(decodeInterpreterEnvironmentLibraryDescription(tok.nextToken()));
// }
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptCorePreferenceBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptCorePreferenceBlock.java
index c411167..016fcea 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptCorePreferenceBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptCorePreferenceBlock.java
@@ -41,15 +41,15 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
-final class ScriptCorePreferenceBlock extends
- ImprovedAbstractConfigurationBlock {
+final class ScriptCorePreferenceBlock
+ extends ImprovedAbstractConfigurationBlock {
private final class ReindexOperation implements IRunnableWithProgress {
@Override
public void run(IProgressMonitor monitor) {
try {
- ResourcesPlugin.getWorkspace().build(
- IncrementalProjectBuilder.FULL_BUILD, monitor);
+ ResourcesPlugin.getWorkspace()
+ .build(IncrementalProjectBuilder.FULL_BUILD, monitor);
} catch (CoreException e) {
if (DLTKCore.DEBUG) {
e.printStackTrace();
@@ -58,7 +58,8 @@
}
}
- ScriptCorePreferenceBlock(OverlayPreferenceStore store, PreferencePage page) {
+ ScriptCorePreferenceBlock(OverlayPreferenceStore store,
+ PreferencePage page) {
super(store, page);
}
@@ -83,12 +84,9 @@
Messages.ScriptCorePreferenceBlock_editOptions, 2, 1,
GridData.FILL_HORIZONTAL);
- bindControl(
- SWTFactory.createCheckButton(
- editorGroup,
- PreferencesMessages.EditorPreferencePage_evaluateTemporaryProblems,
- 2),
- PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS);
+ bindControl(SWTFactory.createCheckButton(editorGroup,
+ PreferencesMessages.EditorPreferencePage_evaluateTemporaryProblems,
+ 2), PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS);
// Connection timeout
SWTFactory.createLabel(editorGroup,
Messages.ScriptCorePreferenceBlock_CodeAssistTimeout, 1);
@@ -101,22 +99,17 @@
Messages.ScriptCorePreferenceBlock_UI_Options, 1, 1,
GridData.FILL_HORIZONTAL);
- bindControl(
- SWTFactory
- .createCheckButton(
- uiGroup,
- Messages.EditorPreferencePage_ResourceShowError_InvalidResourceName),
+ bindControl(SWTFactory.createCheckButton(uiGroup,
+ Messages.EditorPreferencePage_ResourceShowError_InvalidResourceName),
PreferenceConstants.RESOURCE_SHOW_ERROR_INVALID_RESOURCE_NAME);
Group builderGroup = SWTFactory.createGroup(composite,
Messages.ScriptCorePreferenceBlock_Builder_Options, 2, 1,
GridData.FILL_HORIZONTAL);
- SWTFactory
- .createLabel(
- builderGroup,
- Messages.ScriptCorePreferenceBlock_Builder_CircularDependencies,
- 1);
+ SWTFactory.createLabel(builderGroup,
+ Messages.ScriptCorePreferenceBlock_Builder_CircularDependencies,
+ 1);
circularBuildPathCombo = SWTFactory.createCombo(builderGroup,
SWT.READ_ONLY | SWT.BORDER, 0, names);
createReIndex(composite);
@@ -165,7 +158,7 @@
@Override
protected List<OverlayKey> createOverlayKeys() {
- ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>();
+ ArrayList<OverlayKey> overlayKeys = new ArrayList<>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS));
@@ -218,8 +211,8 @@
final Preferences prefs = DLTKCore.getDefault()
.getPluginPreferences();
final String value = ids[buildPathIndex];
- if (!value
- .equals(prefs.getString(DLTKCore.CORE_CIRCULAR_BUILDPATH))) {
+ if (!value.equals(
+ prefs.getString(DLTKCore.CORE_CIRCULAR_BUILDPATH))) {
prefs.setValue(DLTKCore.CORE_CIRCULAR_BUILDPATH, value);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java
index 11cdb8b..efeab47 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java
@@ -58,8 +58,8 @@
/**
* Configures DLTK Editor hover preferences.
*/
-public class ScriptEditorHoverConfigurationBlock implements
- IPreferenceConfigurationBlock {
+public class ScriptEditorHoverConfigurationBlock
+ implements IPreferenceConfigurationBlock {
private static final String DELIMITER = PreferencesMessages.DLTKEditorHoverConfigurationBlock_delimiter;
@@ -80,8 +80,8 @@
}
}
- private class ScriptEditorTextHoverDescriptorLabelProvider implements
- ITableLabelProvider {
+ private class ScriptEditorTextHoverDescriptorLabelProvider
+ implements ITableLabelProvider {
@Override
public Image getColumnImage(Object element, int columnIndex) {
@@ -125,11 +125,12 @@
}
}
- private class ScriptEditorTextHoverDescriptorContentProvider implements
- IStructuredContentProvider {
+ private class ScriptEditorTextHoverDescriptorContentProvider
+ implements IStructuredContentProvider {
@Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
// Do nothing since the viewer listens to resource deltas
}
@@ -162,15 +163,15 @@
@Override
public void widgetDefaultSelected(SelectionEvent e) {
Button button = (Button) e.widget;
- fStore.setValue((String) fCheckBoxes.get(button), button
- .getSelection());
+ fStore.setValue((String) fCheckBoxes.get(button),
+ button.getSelection());
}
@Override
public void widgetSelected(SelectionEvent e) {
Button button = (Button) e.widget;
- fStore.setValue((String) fCheckBoxes.get(button), button
- .getSelection());
+ fStore.setValue((String) fCheckBoxes.get(button),
+ button.getSelection());
}
};
@@ -187,7 +188,7 @@
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
// overlayKeys.add(new
// OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
@@ -230,15 +231,15 @@
addFiller(hoverComposite);
Label label = new Label(hoverComposite, SWT.NONE);
- label
- .setText(PreferencesMessages.DLTKEditorHoverConfigurationBlock_hoverPreferences);
+ label.setText(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_hoverPreferences);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
label.setLayoutData(gd);
- TableLayoutComposite layouter = new TableLayoutComposite(
- hoverComposite, SWT.NONE);
+ TableLayoutComposite layouter = new TableLayoutComposite(hoverComposite,
+ SWT.NONE);
addColumnLayoutData(layouter);
// Hover table
@@ -269,26 +270,26 @@
fHoverTable.setLayout(tableLayout);
fNameColumn = new TableColumn(fHoverTable, SWT.NONE);
- fNameColumn
- .setText(PreferencesMessages.DLTKEditorHoverConfigurationBlock_nameColumnTitle);
+ fNameColumn.setText(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_nameColumnTitle);
fNameColumn.setResizable(true);
fModifierColumn = new TableColumn(fHoverTable, SWT.NONE);
- fModifierColumn
- .setText(PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierColumnTitle);
+ fModifierColumn.setText(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierColumnTitle);
fModifierColumn.setResizable(true);
fHoverTableViewer = new CheckboxTableViewer(fHoverTable);
fHoverTableViewer.setUseHashlookup(true);
- fHoverTableViewer
- .setContentProvider(new ScriptEditorTextHoverDescriptorContentProvider());
- fHoverTableViewer
- .setLabelProvider(new ScriptEditorTextHoverDescriptorLabelProvider());
+ fHoverTableViewer.setContentProvider(
+ new ScriptEditorTextHoverDescriptorContentProvider());
+ fHoverTableViewer.setLabelProvider(
+ new ScriptEditorTextHoverDescriptorLabelProvider());
((CheckboxTableViewer) fHoverTableViewer)
.addCheckStateListener(event -> {
- String id = ((EditorTextHoverDescriptor) event
- .getElement()).getId();
+ String id = ((EditorTextHoverDescriptor) event.getElement())
+ .getId();
if (id == null)
return;
EditorTextHoverDescriptor[] descriptors = getContributedHovers();
@@ -299,9 +300,8 @@
hoverConfig = fHoverConfigs[i];
hoverConfig.fIsEnabled = event.getChecked();
fModifierEditor.setEnabled(event.getChecked());
- fHoverTableViewer
- .setSelection(new StructuredSelection(
- descriptors[i]));
+ fHoverTableViewer.setSelection(
+ new StructuredSelection(descriptors[i]));
}
i++;
}
@@ -311,8 +311,8 @@
// Text field for modifier string
label = new Label(hoverComposite, SWT.LEFT);
- label
- .setText(PreferencesMessages.DLTKEditorHoverConfigurationBlock_keyModifier);
+ label.setText(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_keyModifier);
fModifierEditor = new Text(hoverComposite, SWT.BORDER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
fModifierEditor.setLayoutData(gd);
@@ -337,39 +337,34 @@
while (i > -1 && Character.isWhitespace(text.charAt(i))) {
i--;
}
- boolean needsPrefixDelimiter = i > -1
- && !String.valueOf(text.charAt(i))
- .equals(DELIMITER);
+ boolean needsPrefixDelimiter = i > -1 && !String
+ .valueOf(text.charAt(i)).equals(DELIMITER);
i = selection.y;
while (i < text.length()
&& Character.isWhitespace(text.charAt(i))) {
i++;
}
- boolean needsPostfixDelimiter = i < text.length()
- && !String.valueOf(text.charAt(i))
- .equals(DELIMITER);
+ boolean needsPostfixDelimiter = i < text.length() && !String
+ .valueOf(text.charAt(i)).equals(DELIMITER);
String insertString;
if (needsPrefixDelimiter && needsPostfixDelimiter)
- insertString = Messages
- .format(
- PreferencesMessages.DLTKEditorHoverConfigurationBlock_insertDelimiterAndModifierAndDelimiter,
- new String[] { Action
- .findModifierString(e.stateMask) });
+ insertString = Messages.format(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_insertDelimiterAndModifierAndDelimiter,
+ new String[] { Action
+ .findModifierString(e.stateMask) });
else if (needsPrefixDelimiter)
- insertString = Messages
- .format(
- PreferencesMessages.DLTKEditorHoverConfigurationBlock_insertDelimiterAndModifier,
- new String[] { Action
- .findModifierString(e.stateMask) });
+ insertString = Messages.format(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_insertDelimiterAndModifier,
+ new String[] { Action
+ .findModifierString(e.stateMask) });
else if (needsPostfixDelimiter)
- insertString = Messages
- .format(
- PreferencesMessages.DLTKEditorHoverConfigurationBlock_insertModifierAndDelimiter,
- new String[] { Action
- .findModifierString(e.stateMask) });
+ insertString = Messages.format(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_insertModifierAndDelimiter,
+ new String[] { Action
+ .findModifierString(e.stateMask) });
else
insertString = Action.findModifierString(e.stateMask);
@@ -383,13 +378,13 @@
// Description
Label descriptionLabel = new Label(hoverComposite, SWT.LEFT);
- descriptionLabel
- .setText(PreferencesMessages.DLTKEditorHoverConfigurationBlock_description);
+ descriptionLabel.setText(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_description);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gd.horizontalSpan = 2;
descriptionLabel.setLayoutData(gd);
- fDescription = new Text(hoverComposite, SWT.LEFT | SWT.WRAP | SWT.MULTI
- | SWT.READ_ONLY | SWT.BORDER);
+ fDescription = new Text(hoverComposite,
+ SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
fDescription.setLayoutData(gd);
@@ -415,9 +410,9 @@
EditorTextHoverDescriptor[] hoverDescs = getContributedHovers();
fHoverConfigs = new HoverConfig[hoverDescs.length];
for (int i = 0; i < hoverDescs.length; i++)
- fHoverConfigs[i] = new HoverConfig(hoverDescs[i]
- .getModifierString(), hoverDescs[i].getStateMask(),
- hoverDescs[i].isEnabled());
+ fHoverConfigs[i] = new HoverConfig(
+ hoverDescs[i].getModifierString(),
+ hoverDescs[i].getStateMask(), hoverDescs[i].isEnabled());
fHoverTableViewer.setInput(hoverDescs);
@@ -459,8 +454,8 @@
maskBuf.append(fHoverConfigs[i].fStateMask);
maskBuf.append(EditorTextHoverDescriptor.VALUE_SEPARATOR);
}
- fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS, buf
- .toString());
+ fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS,
+ buf.toString());
fStore.setValue(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS,
maskBuf.toString());
@@ -580,12 +575,9 @@
private void updateStatus(HoverConfig hoverConfig) {
if (hoverConfig != null && hoverConfig.fIsEnabled
&& hoverConfig.fStateMask == -1)
- fStatus = new StatusInfo(
- IStatus.ERROR,
- Messages
- .format(
- PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierIsNotValid,
- hoverConfig.fModifierString));
+ fStatus = new StatusInfo(IStatus.ERROR, Messages.format(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierIsNotValid,
+ hoverConfig.fModifierString));
else
fStatus = new StatusInfo();
@@ -594,26 +586,18 @@
while (fStatus.isOK() && i < fHoverConfigs.length) {
if (fHoverConfigs[i].fIsEnabled) {
String label = getContributedHovers()[i].getLabel();
- Integer stateMask = Integer.valueOf(fHoverConfigs[i].fStateMask);
+ Integer stateMask = Integer
+ .valueOf(fHoverConfigs[i].fStateMask);
if (fHoverConfigs[i].fStateMask == -1)
- fStatus = new StatusInfo(
- IStatus.ERROR,
- Messages
- .format(
- PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierIsNotValidForHover,
- new String[] {
- fHoverConfigs[i].fModifierString,
- label }));
+ fStatus = new StatusInfo(IStatus.ERROR, Messages.format(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierIsNotValidForHover,
+ new String[] { fHoverConfigs[i].fModifierString,
+ label }));
else if (stateMasks.containsKey(stateMask))
- fStatus = new StatusInfo(
- IStatus.ERROR,
- Messages
- .format(
- PreferencesMessages.DLTKEditorHoverConfigurationBlock_duplicateModifier,
- new String[] {
- label,
- (String) stateMasks
- .get(stateMask) }));
+ fStatus = new StatusInfo(IStatus.ERROR, Messages.format(
+ PreferencesMessages.DLTKEditorHoverConfigurationBlock_duplicateModifier,
+ new String[] { label,
+ (String) stateMasks.get(stateMask) }));
else
stateMasks.put(stateMask, label);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ModelElementOccurrencesFinder.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ModelElementOccurrencesFinder.java
index 7cda2c1..364ccc3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ModelElementOccurrencesFinder.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ModelElementOccurrencesFinder.java
@@ -65,16 +65,17 @@
@Override
public OccurrenceLocation[] getOccurrences() {
try {
- final List<OccurrenceLocation> result = new ArrayList<IOccurrencesFinder.OccurrenceLocation>();
+ final List<OccurrenceLocation> result = new ArrayList<>();
new SearchEngine().search(pattern,
- new SearchParticipant[] { SearchEngine
- .getDefaultSearchParticipant() }, SearchEngine
- .createSearchScope(module), new SearchRequestor() {
+ new SearchParticipant[] {
+ SearchEngine.getDefaultSearchParticipant() },
+ SearchEngine.createSearchScope(module),
+ new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match)
throws CoreException {
- result.add(new OccurrenceLocation(
- match.getOffset(), match.getLength(),
+ result.add(new OccurrenceLocation(match.getOffset(),
+ match.getLength(),
occurrenceLocationDescription));
}
}, null);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java
index e3a12dd..94efaed 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/search/ScriptSearchPage.java
@@ -68,8 +68,8 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.IWorkbenchAdapter;
-public abstract class ScriptSearchPage extends DialogPage implements
- ISearchPage, IDLTKSearchConstants {
+public abstract class ScriptSearchPage extends DialogPage
+ implements ISearchPage, IDLTKSearchConstants {
private static class SearchPatternData {
private int searchFor;
@@ -91,7 +91,8 @@
public SearchPatternData(int searchFor, int limitTo, String pattern,
boolean isCaseSensitive, IModelElement element, int scope,
- IWorkingSet[] workingSets, boolean includeInterpreterEnvironment) {
+ IWorkingSet[] workingSets,
+ boolean includeInterpreterEnvironment) {
this.searchFor = searchFor;
this.limitTo = limitTo;
this.pattern = pattern;
@@ -144,8 +145,9 @@
settings.put("scope", scope); //$NON-NLS-1$
settings.put("pattern", pattern); //$NON-NLS-1$
settings.put("limitTo", limitTo); //$NON-NLS-1$
- settings.put(
- "modelElement", modelElement != null ? modelElement.getHandleIdentifier() : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ settings.put("modelElement", //$NON-NLS-1$
+ modelElement != null ? modelElement.getHandleIdentifier()
+ : ""); //$NON-NLS-1$
settings.put("isCaseSensitive", isCaseSensitive); //$NON-NLS-1$
if (workingSets != null) {
String[] wsIds = new String[workingSets.length];
@@ -156,8 +158,8 @@
} else {
settings.put("workingSets", new String[0]); //$NON-NLS-1$
}
- settings.put(
- "includeInterpreterEnvironment", includeInterpreterEnvironment); //$NON-NLS-1$
+ settings.put("includeInterpreterEnvironment", //$NON-NLS-1$
+ includeInterpreterEnvironment);
}
public static SearchPatternData create(IDialogSettings settings) {
@@ -177,8 +179,8 @@
String[] wsIds = settings.getArray("workingSets"); //$NON-NLS-1$
IWorkingSet[] workingSets = null;
if (wsIds != null && wsIds.length > 0) {
- IWorkingSetManager workingSetManager = PlatformUI
- .getWorkbench().getWorkingSetManager();
+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
+ .getWorkingSetManager();
workingSets = new IWorkingSet[wsIds.length];
for (int i = 0; workingSets != null && i < wsIds.length; i++) {
workingSets[i] = workingSetManager.getWorkingSet(wsIds[i]);
@@ -200,7 +202,8 @@
includeInterpreterEnvironment = settings
.getBoolean("includeInterpreterEnvironment"); //$NON-NLS-1$
} else {
- includeInterpreterEnvironment = forceIncludeInterpreterEnvironment(limitTo);
+ includeInterpreterEnvironment = forceIncludeInterpreterEnvironment(
+ limitTo);
}
return new SearchPatternData(searchFor, limitTo, pattern,
isCaseSensitive, elem, scope, workingSets,
@@ -255,14 +258,14 @@
// SearchMessages.SearchPage_limitTo_implementors,
SearchMessages.SearchPage_limitTo_references,
SearchMessages.SearchPage_limitTo_allOccurrences
- // SearchMessages.SearchPage_limitTo_readReferences,
- // SearchMessages.SearchPage_limitTo_writeReferences
+ // SearchMessages.SearchPage_limitTo_readReferences,
+ // SearchMessages.SearchPage_limitTo_writeReferences
};
private Button fIncludeInterpreterEnvironmentCheckbox;
public ScriptSearchPage() {
- fPreviousSearchPatterns = new ArrayList<SearchPatternData>();
+ fPreviousSearchPatterns = new ArrayList<>();
}
@Override
@@ -283,8 +286,8 @@
switch (getContainer().getSelectedScope()) {
case ISearchPageContainer.WORKSPACE_SCOPE:
- scopeDescription = factory
- .getWorkspaceScopeDescription(includeInterpreterEnvironment);
+ scopeDescription = factory.getWorkspaceScopeDescription(
+ includeInterpreterEnvironment);
scope = factory.createWorkspaceScope(includeInterpreterEnvironment,
getLanguageToolkit());
break;
@@ -297,7 +300,7 @@
modelElements, includeInterpreterEnvironment);
break;
case ISearchPageContainer.SELECTED_PROJECTS_SCOPE: {
- ArrayList<String> res = new ArrayList<String>();
+ ArrayList<String> res = new ArrayList<>();
String[] projectNames = getContainer().getSelectedProjectNames();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
for (int i = 0; i < projectNames.length; i++) {
@@ -349,8 +352,8 @@
* @param root
* @param i
*/
- private void getEnclosingProjects(ArrayList<String> res,
- String projectName, IWorkspaceRoot root) {
+ private void getEnclosingProjects(ArrayList<String> res, String projectName,
+ IWorkspaceRoot root) {
if (res.contains(projectName))
return;
IScriptProject project = DLTKCore.create(root.getProject(projectName));
@@ -360,9 +363,10 @@
IBuildpathEntry[] resolvedBuildpath = project
.getResolvedBuildpath(true);
for (IBuildpathEntry buildpathEntry : resolvedBuildpath) {
- if (buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
- getEnclosingProjects(res, buildpathEntry.getPath()
- .lastSegment(), root);
+ if (buildpathEntry
+ .getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
+ getEnclosingProjects(res,
+ buildpathEntry.getPath().lastSegment(), root);
}
}
} catch (ModelException e) {
@@ -444,9 +448,9 @@
fPreviousSearchPatterns.remove(match);
}
match = new SearchPatternData(getSearchFor(), getLimitTo(), pattern,
- fCaseSensitive.getSelection(), fModelElement, getContainer()
- .getSelectedScope(), getContainer()
- .getSelectedWorkingSets(),
+ fCaseSensitive.getSelection(), fModelElement,
+ getContainer().getSelectedScope(),
+ getContainer().getSelectedWorkingSets(),
fIncludeInterpreterEnvironmentCheckbox.getSelection());
fPreviousSearchPatterns.add(0, match); // insert on top
@@ -497,24 +501,24 @@
Label separator = new Label(result, SWT.NONE);
separator.setVisible(false);
- GridData data = new GridData(GridData.FILL, GridData.FILL, false,
- false, 2, 1);
+ GridData data = new GridData(GridData.FILL, GridData.FILL, false, false,
+ 2, 1);
data.heightHint = convertHeightInCharsToPixels(1) / 3;
separator.setLayoutData(data);
Control searchFor = createSearchFor(result);
- searchFor.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
- true, false, 1, 1));
+ searchFor.setLayoutData(
+ new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1));
Control limitTo = createLimitTo(result);
- limitTo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
- false, 1, 1));
+ limitTo.setLayoutData(
+ new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1));
fIncludeInterpreterEnvironmentCheckbox = new Button(result, SWT.CHECK);
- fIncludeInterpreterEnvironmentCheckbox
- .setText(SearchMessages.SearchPage_searchInterpreterEnvironment_label);
- fIncludeInterpreterEnvironmentCheckbox.setLayoutData(new GridData(
- SWT.FILL, SWT.CENTER, false, false, 2, 1));
+ fIncludeInterpreterEnvironmentCheckbox.setText(
+ SearchMessages.SearchPage_searchInterpreterEnvironment_label);
+ fIncludeInterpreterEnvironmentCheckbox.setLayoutData(
+ new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
// createParticipants(result);
@@ -562,8 +566,8 @@
// Pattern text + info
Label label = new Label(result, SWT.LEFT);
label.setText(SearchMessages.SearchPage_expression_label);
- label.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false,
- false, 2, 1));
+ label.setLayoutData(
+ new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1));
// Pattern combo
fPattern = new Combo(result, SWT.SINGLE | SWT.BORDER);
@@ -595,8 +599,8 @@
fIsCaseSensitive = fCaseSensitive.getSelection();
}
});
- fCaseSensitive.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
- false, false, 1, 1));
+ fCaseSensitive.setLayoutData(
+ new GridData(GridData.FILL, GridData.FILL, false, false, 1, 1));
return result;
}
@@ -613,9 +617,9 @@
if (fModelElement != null) {
return true;
}
- return SearchPattern
- .createPattern(getPattern(), getSearchFor(), getLimitTo(),
- SearchPattern.R_EXACT_MATCH, getLanguageToolkit()) != null;
+ return SearchPattern.createPattern(getPattern(), getSearchFor(),
+ getLimitTo(), SearchPattern.R_EXACT_MATCH,
+ getLanguageToolkit()) != null;
}
@Override
@@ -688,8 +692,8 @@
// Fill with dummy radio buttons
Label filler = new Label(result, SWT.NONE);
filler.setVisible(false);
- filler.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1,
- 1));
+ filler.setLayoutData(
+ new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
return result;
}
@@ -766,7 +770,8 @@
fPattern.setText(initData.getPattern());
- boolean forceIncludeInterpreterEnvironment = forceIncludeInterpreterEnvironment(getLimitTo());
+ boolean forceIncludeInterpreterEnvironment = forceIncludeInterpreterEnvironment(
+ getLimitTo());
fIncludeInterpreterEnvironmentCheckbox
.setEnabled(!forceIncludeInterpreterEnvironment);
fIncludeInterpreterEnvironmentCheckbox
@@ -775,7 +780,8 @@
}
private void updateUseInterpreterEnvironment() {
- boolean forceIncludeInterpreterEnvironment = forceIncludeInterpreterEnvironment(getLimitTo());
+ boolean forceIncludeInterpreterEnvironment = forceIncludeInterpreterEnvironment(
+ getLimitTo());
fIncludeInterpreterEnvironmentCheckbox
.setEnabled(!forceIncludeInterpreterEnvironment);
boolean isSelected = true;
@@ -817,8 +823,8 @@
IWorkbenchAdapter adapter = ((IAdaptable) o)
.getAdapter(IWorkbenchAdapter.class);
if (adapter != null) {
- return new SearchPatternData(TYPE, REFERENCES,
- fIsCaseSensitive, adapter.getLabel(o), null, false);
+ return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive,
+ adapter.getLabel(o), null, false);
}
}
return res;
@@ -840,9 +846,8 @@
private SearchPatternData determineInitValuesFrom(IModelElement element) {
IDLTKLanguageToolkit toolkit = DLTKLanguageManager
.getLanguageToolkit(element);
- if (toolkit != null
- && !toolkit.getNatureId().equals(
- getLanguageToolkit().getNatureId())) {
+ if (toolkit != null && !toolkit.getNatureId()
+ .equals(getLanguageToolkit().getNatureId())) {
return null;
}
DLTKSearchScopeFactory factory = DLTKSearchScopeFactory.getInstance();
@@ -873,8 +878,8 @@
isInsideInterpreterEnvironment);
case IModelElement.SOURCE_MODULE: {
if (DLTKCore.DEBUG) {
- System.out
- .println("TODO: DLTKSearchPage: Add init values for source module support."); //$NON-NLS-1$
+ System.out.println(
+ "TODO: DLTKSearchPage: Add init values for source module support."); //$NON-NLS-1$
}
// IType mainType= ((ISourceModule) element).
// if (mainType != null) {
@@ -886,8 +891,8 @@
}
case IModelElement.FIELD:
return new SearchPatternData(FIELD, REFERENCES, true,
- PatternStrings.getFieldSignature((IField) element),
- element, isInsideInterpreterEnvironment);
+ PatternStrings.getFieldSignature((IField) element), element,
+ isInsideInterpreterEnvironment);
case IModelElement.METHOD:
IMethod method = (IMethod) element;
int searchFor = /* method.isConstructor() ? CONSTRUCTOR : */METHOD;
@@ -911,9 +916,8 @@
i++;
}
if (i > 0) {
- return new SearchPatternData(TYPE, REFERENCES,
- fIsCaseSensitive, selectedText.substring(0, i), null,
- true);
+ return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive,
+ selectedText.substring(0, i), null, true);
}
}
return null;
@@ -923,8 +927,8 @@
if (!fPreviousSearchPatterns.isEmpty()) {
return fPreviousSearchPatterns.get(0);
}
- return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive,
- "", null, false); //$NON-NLS-1$
+ return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive, "", //$NON-NLS-1$
+ null, false);
}
@Override
@@ -996,8 +1000,8 @@
IDialogSettings s = getDialogSettings();
s.put(STORE_CASE_SENSITIVE, fIsCaseSensitive);
- int historySize = Math
- .min(fPreviousSearchPatterns.size(), HISTORY_SIZE);
+ int historySize = Math.min(fPreviousSearchPatterns.size(),
+ HISTORY_SIZE);
s.put(STORE_HISTORY_SIZE, historySize);
for (int i = 0; i < historySize; i++) {
IDialogSettings histSettings = s.addNewSection(STORE_HISTORY + i);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplateCompletionProcessor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplateCompletionProcessor.java
index 55c725e..4fc3467 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplateCompletionProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/templates/ScriptTemplateCompletionProcessor.java
@@ -45,11 +45,11 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.IWorkbenchPartOrientation;
-public abstract class ScriptTemplateCompletionProcessor extends
- TemplateCompletionProcessor {
+public abstract class ScriptTemplateCompletionProcessor
+ extends TemplateCompletionProcessor {
- private static final class ProposalComparator implements
- Comparator<TemplateProposal> {
+ private static final class ProposalComparator
+ implements Comparator<TemplateProposal> {
@Override
public int compare(TemplateProposal o1, TemplateProposal o2) {
return o2.getRelevance() - o1.getRelevance();
@@ -70,8 +70,10 @@
return this.context;
}
- private static final String $_LINE_SELECTION = "${" + GlobalTemplateVariables.LineSelection.NAME + "}"; //$NON-NLS-1$ //$NON-NLS-2$
- private static final String $_WORD_SELECTION = "${" + GlobalTemplateVariables.WordSelection.NAME + "}"; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String $_LINE_SELECTION = "${" //$NON-NLS-1$
+ + GlobalTemplateVariables.LineSelection.NAME + "}"; //$NON-NLS-1$
+ private static final String $_WORD_SELECTION = "${" //$NON-NLS-1$
+ + GlobalTemplateVariables.WordSelection.NAME + "}"; //$NON-NLS-1$
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
@@ -84,7 +86,7 @@
if (selection.getOffset() == offset)
offset = selection.getOffset() + selection.getLength();
- List<TemplateProposal> matches = new ArrayList<TemplateProposal>();
+ List<TemplateProposal> matches = new ArrayList<>();
if (selection.getLength() == 0) {
String prefix = extractPrefix(viewer, offset);
@@ -98,8 +100,8 @@
return new ICompletionProposal[0];
// name of the selection variables {line, word}_selection
context.setVariable("selection", selection.getText()); //$NON-NLS-1$
- Template[] templates = getTemplates(context.getContextType()
- .getId());
+ Template[] templates = getTemplates(
+ context.getContextType().getId());
for (int i = 0; i != templates.length; i++) {
final Template template = templates[i];
try {
@@ -120,9 +122,10 @@
return new ICompletionProposal[0];
// name of the selection variables {line, word}_selection
context.setVariable("selection", selection.getText()); //$NON-NLS-1$
- Template[] templates = getTemplates(context.getContextType()
- .getId());
- final boolean multipleLinesSelected = areMultipleLinesSelected(viewer);
+ Template[] templates = getTemplates(
+ context.getContextType().getId());
+ final boolean multipleLinesSelected = areMultipleLinesSelected(
+ viewer);
for (int i = 0; i != templates.length; i++) {
final Template template = templates[i];
try {
@@ -189,7 +192,8 @@
}
@Override
- protected TemplateContext createContext(ITextViewer viewer, IRegion region) {
+ protected TemplateContext createContext(ITextViewer viewer,
+ IRegion region) {
TemplateContextType contextType = getContextType(viewer, region);
if (contextType instanceof ScriptTemplateContextType) {
IDocument document = viewer.getDocument();
@@ -220,8 +224,8 @@
if (editor instanceof IWorkbenchPartOrientation)
orientation = ((IWorkbenchPartOrientation) editor).getOrientation();
IDLTKLanguageToolkit toolkit = null;
- toolkit = DLTKLanguageManager.getLanguageToolkit(getContext()
- .getLanguageNatureID());
+ toolkit = DLTKLanguageManager
+ .getLanguageToolkit(getContext().getLanguageNatureID());
if ((toolkit == null) && (editor instanceof ScriptEditor))
toolkit = ((ScriptEditor) editor).getLanguageToolkit();
return new TemplateInformationControlCreator(orientation, toolkit);
@@ -233,8 +237,8 @@
@Override
protected Template[] getTemplates(String contextTypeId) {
- return getTemplateAccess().getTemplateStore().getTemplates(
- contextTypeId);
+ return getTemplateAccess().getTemplateStore()
+ .getTemplates(contextTypeId);
}
protected char[] getIgnore() {
@@ -245,8 +249,8 @@
protected TemplateContextType getContextType(ITextViewer viewer,
IRegion region) {
if (isValidLocation(viewer, region)) {
- return getTemplateAccess().getContextTypeRegistry().getContextType(
- getContextTypeId());
+ return getTemplateAccess().getContextTypeRegistry()
+ .getContextType(getContextTypeId());
}
return null;
}
@@ -287,8 +291,8 @@
final IDocument doc = viewer.getDocument();
final int regionEnd = region.getOffset() + region.getLength();
final IRegion line = doc.getLineInformationOfOffset(regionEnd);
- final String s = doc
- .get(line.getOffset(), regionEnd - line.getOffset());
+ final String s = doc.get(line.getOffset(),
+ regionEnd - line.getOffset());
final int spaceIndex = s.lastIndexOf(' ');
if (spaceIndex != -1) {
return s.substring(spaceIndex);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/AbstractScriptScanner.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/AbstractScriptScanner.java
index f7e3707..0e3d765 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/AbstractScriptScanner.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/AbstractScriptScanner.java
@@ -61,7 +61,7 @@
private IColorManager fColorManager;
private IPreferenceStore fPreferenceStore;
- private Map<String, Token> fTokenMap = new HashMap<String, Token>();
+ private Map<String, Token> fTokenMap = new HashMap<>();
private String[] fPropertyNamesColor;
/**
* Preference keys for boolean preferences which are <code>true</code>, iff
@@ -126,7 +126,8 @@
/**
* Creates an abstract script scanner.
*/
- public AbstractScriptScanner(IColorManager manager, IPreferenceStore store) {
+ public AbstractScriptScanner(IColorManager manager,
+ IPreferenceStore store) {
super();
fColorManager = manager;
fPreferenceStore = store;
@@ -147,8 +148,10 @@
for (int i = 0; i < length; i++) {
fPropertyNamesBold[i] = getBoldKey(fPropertyNamesColor[i]);
fPropertyNamesItalic[i] = getItalicKey(fPropertyNamesColor[i]);
- fPropertyNamesStrikethrough[i] = getStrikethroughKey(fPropertyNamesColor[i]);
- fPropertyNamesUnderline[i] = getUnderlineKey(fPropertyNamesColor[i]);
+ fPropertyNamesStrikethrough[i] = getStrikethroughKey(
+ fPropertyNamesColor[i]);
+ fPropertyNamesUnderline[i] = getUnderlineKey(
+ fPropertyNamesColor[i]);
}
fNeedsLazyColorLoading = Display.getCurrent() == null;
@@ -206,8 +209,7 @@
if (fNeedsLazyColorLoading && Display.getCurrent() != null) {
for (int i = 0; i < fPropertyNamesColor.length; i++) {
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i],
- fPropertyNamesItalic[i],
- fPropertyNamesStrikethrough[i],
+ fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i],
fPropertyNamesUnderline[i]);
}
fNeedsLazyColorLoading = false;
@@ -216,10 +218,8 @@
private void addTokenWithProxyAttribute(String colorKey, String boldKey,
String italicKey, String strikethroughKey, String underlineKey) {
- fTokenMap.put(
- colorKey,
- new Token(createTextAttribute(null, boldKey, italicKey,
- strikethroughKey, underlineKey)));
+ fTokenMap.put(colorKey, new Token(createTextAttribute(null, boldKey,
+ italicKey, strikethroughKey, underlineKey)));
}
private void addToken(String colorKey, String boldKey, String italicKey,
@@ -234,10 +234,8 @@
}
if (!fNeedsLazyColorLoading)
- fTokenMap.put(
- colorKey,
- new Token(createTextAttribute(colorKey, boldKey, italicKey,
- strikethroughKey, underlineKey)));
+ fTokenMap.put(colorKey, new Token(createTextAttribute(colorKey,
+ boldKey, italicKey, strikethroughKey, underlineKey)));
else {
Token token = fTokenMap.get(colorKey);
if (token != null)
@@ -394,12 +392,13 @@
Object data = token.getData();
if (data instanceof TextAttribute) {
TextAttribute oldAttr = (TextAttribute) data;
- boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;
+ boolean activeValue = (oldAttr.getStyle()
+ & styleAttribute) == styleAttribute;
if (activeValue != eventValue)
token.setData(new TextAttribute(oldAttr.getForeground(),
- oldAttr.getBackground(), eventValue ? oldAttr
- .getStyle() | styleAttribute : oldAttr
- .getStyle() & ~styleAttribute));
+ oldAttr.getBackground(),
+ eventValue ? oldAttr.getStyle() | styleAttribute
+ : oldAttr.getStyle() & ~styleAttribute));
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCommentScanner.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCommentScanner.java
index 950253f..06f72c1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCommentScanner.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCommentScanner.java
@@ -58,7 +58,7 @@
/**
* Uppercase words
*/
- private Map<CharacterBuffer, IToken> fUppercaseWords = new HashMap<CharacterBuffer, IToken>();
+ private Map<CharacterBuffer, IToken> fUppercaseWords = new HashMap<>();
/**
* <code>true</code> if task tag detection is case-sensitive.
@@ -148,8 +148,9 @@
public ScriptCommentScanner(ScriptSourceViewerConfiguration configuration,
String comment, String todoTag, ITodoTaskPreferences preferences) {
- this(configuration.getColorManager(), configuration
- .getPreferenceStore(), comment, todoTag, preferences, false);
+ this(configuration.getColorManager(),
+ configuration.getPreferenceStore(), comment, todoTag,
+ preferences, false);
this.fConfiguration = configuration;
initialize();
}
@@ -194,7 +195,7 @@
@Override
protected List<IRule> createRules() {
setDefaultReturnToken(getDefaultToken());
- List<IRule> list = new ArrayList<IRule>();
+ List<IRule> list = new ArrayList<>();
list.add(createTodoRule());
return list;
}
@@ -226,7 +227,7 @@
* @return the list of word matchers
*/
protected List<CombinedWordRule.WordMatcher> createMatchers() {
- List<CombinedWordRule.WordMatcher> list = new ArrayList<CombinedWordRule.WordMatcher>();
+ List<CombinedWordRule.WordMatcher> list = new ArrayList<>();
String[] tasks = preferences.getTagNames();
if (tasks != null && tasks.length != 0) {
fTaskTagMatcher = new TaskTagMatcher(getTodoToken());
@@ -268,9 +269,8 @@
fTaskTagMatcher.addTaskTags(preferences.getTagNames());
}
}
- } else if (fTaskTagMatcher != null
- && event.getProperty().equals(
- ITodoTaskPreferences.CASE_SENSITIVE)) {
+ } else if (fTaskTagMatcher != null && event.getProperty()
+ .equals(ITodoTaskPreferences.CASE_SENSITIVE)) {
Object value = event.getNewValue();
if (value instanceof String) {
boolean caseSensitive = Boolean.valueOf((String) value)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionAssistant.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionAssistant.java
index aa80ee2..d947841 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionAssistant.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionAssistant.java
@@ -126,8 +126,7 @@
// Let superclass deal with this
return super.showPossibleQuickAssists();
- ArrayList<Annotation> resultingAnnotations = new ArrayList<Annotation>(
- 20);
+ ArrayList<Annotation> resultingAnnotations = new ArrayList<>(20);
try {
Point selectedRange = fViewer.getSelectedRange();
int currOffset = selectedRange.x;
@@ -184,8 +183,8 @@
int rangeStart = lineInfo.getOffset();
int rangeEnd = rangeStart + lineInfo.getLength();
- ArrayList<Annotation> allAnnotations = new ArrayList<Annotation>();
- ArrayList<Position> allPositions = new ArrayList<Position>();
+ ArrayList<Annotation> allAnnotations = new ArrayList<>();
+ ArrayList<Position> allPositions = new ArrayList<>();
int bestOffset = Integer.MAX_VALUE;
while (iter.hasNext()) {
Annotation annot = iter.next();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionContext.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionContext.java
index 8626afc..ad5534d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionContext.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptCorrectionContext.java
@@ -41,7 +41,7 @@
@Override
public void addProposal(ICompletionProposal proposal) {
if (proposals == null) {
- proposals = new ArrayList<ICompletionProposal>();
+ proposals = new ArrayList<>();
}
proposals.add(proposal);
}
@@ -75,8 +75,8 @@
* @param module
*/
public ScriptCorrectionContext(
- IQuickAssistInvocationContext invocationContext,
- ITextEditor editor, ISourceModule module) {
+ IQuickAssistInvocationContext invocationContext, ITextEditor editor,
+ ISourceModule module) {
this.invocationContext = invocationContext;
this.editor = editor;
this.module = module;
@@ -117,7 +117,7 @@
public void setAttribute(String attributeName, Object value) {
if (value != null) {
if (attributes == null) {
- attributes = new HashMap<String, Object>();
+ attributes = new HashMap<>();
}
attributes.put(attributeName, value);
} else {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java
index 2731fb9..da277b1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptOutlineInformationControl.java
@@ -82,7 +82,7 @@
private LexicalSortingAction fLexicalSortingAction;
private SortByDefiningTypeAction fSortByDefiningTypeAction;
// private ShowOnlyMainTypeAction fShowOnlyMainTypeAction;
- protected Map<IType, ITypeHierarchy> fTypeHierarchies = new HashMap<IType, ITypeHierarchy>();
+ protected Map<IType, ITypeHierarchy> fTypeHierarchies = new HashMap<>();
private final IPreferenceStore fPreferenceStore;
/**
@@ -270,7 +270,7 @@
if (!isInnerType(type)) {
ITypeHierarchy th = getSuperTypeHierarchy(type);
if (th != null) {
- List<Object> children = new ArrayList<Object>();
+ List<Object> children = new ArrayList<>();
Collections.addAll(children, super.getChildren(type));
IType[] superClasses = th.getAllSupertypes(type);
for (int i = 0, scLength = superClasses.length; i < scLength; i++) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptSourceViewerConfiguration.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptSourceViewerConfiguration.java
index 4fee60d..71c4a41 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptSourceViewerConfiguration.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/ScriptSourceViewerConfiguration.java
@@ -70,8 +70,8 @@
import org.eclipse.ui.texteditor.HyperlinkDetectorRegistry;
import org.eclipse.ui.texteditor.ITextEditor;
-public abstract class ScriptSourceViewerConfiguration extends
- TextSourceViewerConfiguration {
+public abstract class ScriptSourceViewerConfiguration
+ extends TextSourceViewerConfiguration {
private IColorManager fColorManager;
private ITextEditor fTextEditor;
@@ -134,7 +134,8 @@
}
@Override
- public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
+ public String getConfiguredDocumentPartitioning(
+ ISourceViewer sourceViewer) {
if (fDocumentPartitioning != null)
return fDocumentPartitioning;
return super.getConfiguredDocumentPartitioning(sourceViewer);
@@ -162,8 +163,8 @@
ScriptCompositeReconcilingStrategy strategy = new ScriptCompositeReconcilingStrategy(
editor, getConfiguredDocumentPartitioning(sourceViewer),
createSpellCheckDelegate());
- ScriptReconciler reconciler = new ScriptReconciler(editor,
- strategy, false);
+ ScriptReconciler reconciler = new ScriptReconciler(editor, strategy,
+ false);
reconciler.setIsAllowedToModifyDocument(false);
reconciler.setIsIncrementalReconciler(false);
reconciler.setProgressMonitor(new NullProgressMonitor());
@@ -226,8 +227,8 @@
};
}
- public IInformationPresenter getOutlinePresenter(
- ISourceViewer sourceViewer, boolean doCodeResolve) {
+ public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer,
+ boolean doCodeResolve) {
InformationPresenter presenter;
if (doCodeResolve)
presenter = new InformationPresenter(
@@ -237,8 +238,8 @@
presenter = new InformationPresenter(
getOutlinePresenterControlCreator(sourceViewer,
IScriptEditorActionDefinitionIds.SHOW_OUTLINE));
- presenter
- .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+ presenter.setDocumentPartitioning(
+ getConfiguredDocumentPartitioning(sourceViewer));
presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
IInformationProvider provider = new ScriptElementProvider(getEditor(),
doCodeResolve);
@@ -274,8 +275,8 @@
}
protected IDialogSettings getSettings(String sectionName) {
- IDialogSettings settings = DLTKUIPlugin.getDefault()
- .getDialogSettings().getSection(sectionName);
+ IDialogSettings settings = DLTKUIPlugin.getDefault().getDialogSettings()
+ .getSection(sectionName);
if (settings == null)
settings = DLTKUIPlugin.getDefault().getDialogSettings()
.addNewSection(sectionName);
@@ -284,13 +285,14 @@
}
@Override
- public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- if (!fPreferenceStore
- .getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+ public IHyperlinkDetector[] getHyperlinkDetectors(
+ ISourceViewer sourceViewer) {
+ if (!fPreferenceStore.getBoolean(
+ AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
return null;
- final IHyperlinkDetector[] inheritedDetectors = super
- .getHyperlinkDetectors(sourceViewer);
+ final IHyperlinkDetector[] inheritedDetectors = super.getHyperlinkDetectors(
+ sourceViewer);
if (fTextEditor == null) {
return inheritedDetectors;
@@ -300,7 +302,8 @@
if (inheritedDetectors != null) {
resultLength += inheritedDetectors.length;
}
- final IHyperlinkDetector[] additionalDetectors = getAdditionalRegisteredHyperlinkDetectors(sourceViewer);
+ final IHyperlinkDetector[] additionalDetectors = getAdditionalRegisteredHyperlinkDetectors(
+ sourceViewer);
if (additionalDetectors != null) {
resultLength += additionalDetectors.length;
}
@@ -334,7 +337,8 @@
@Nullable
private final IHyperlinkDetector[] getAdditionalRegisteredHyperlinkDetectors(
ISourceViewer sourceViewer) {
- final Map<String, IAdaptable> targets = getAdditionalHyperlinkDetectorTargets(sourceViewer);
+ final Map<String, IAdaptable> targets = getAdditionalHyperlinkDetectorTargets(
+ sourceViewer);
Assert.isNotNull(targets);
if (targets.isEmpty()) {
return null;
@@ -348,13 +352,14 @@
target.getValue());
if (detectors != null && detectors.length != 0) {
if (result == null) {
- result = new ArrayList<IHyperlinkDetector>();
+ result = new ArrayList<>();
}
Collections.addAll(result, detectors);
}
}
- return result != null ? result.toArray(new IHyperlinkDetector[result
- .size()]) : null;
+ return result != null
+ ? result.toArray(new IHyperlinkDetector[result.size()])
+ : null;
}
/**
@@ -365,7 +370,7 @@
*/
protected Map<String, IAdaptable> getAdditionalHyperlinkDetectorTargets(
ISourceViewer sourceViewer) {
- return new HashMap<String, IAdaptable>();
+ return new HashMap<>();
}
/*
@@ -471,8 +476,8 @@
ISourceViewer sourceViewer) {
InformationPresenter presenter = new InformationPresenter(
getInformationPresenterControlCreator(sourceViewer));
- presenter
- .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+ presenter.setDocumentPartitioning(
+ getConfiguredDocumentPartitioning(sourceViewer));
IInformationProvider provider = new ScriptInformationProvider(
getEditor());
presenter.setInformationProvider(provider,
@@ -487,14 +492,14 @@
if (getEditor() != null) {
ContentAssistant assistant = new ContentAssistant();
- assistant
- .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- assistant
- .setRestoreCompletionProposalSize(getSettings("completion_proposal_size")); //$NON-NLS-1$
- assistant
- .setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- assistant
- .setInformationControlCreator(getInformationControlCreator(sourceViewer));
+ assistant.setDocumentPartitioning(
+ getConfiguredDocumentPartitioning(sourceViewer));
+ assistant.setRestoreCompletionProposalSize(
+ getSettings("completion_proposal_size")); //$NON-NLS-1$
+ assistant.setContextInformationPopupOrientation(
+ IContentAssistant.CONTEXT_INFO_ABOVE);
+ assistant.setInformationControlCreator(
+ getInformationControlCreator(sourceViewer));
alterContentAssistant(assistant);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalCategory.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalCategory.java
index c192c40..cd2dcbf 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalCategory.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalCategory.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.text.completion;
@@ -31,83 +30,94 @@
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.osgi.framework.Bundle;
-
/**
- * Describes a category extension to the "javaCompletionProposalComputer" extension point.
+ * Describes a category extension to the "javaCompletionProposalComputer"
+ * extension point.
*/
public final class CompletionProposalCategory {
/** The extension schema name of the icon attribute. */
- private static final String ICON= "icon"; //$NON-NLS-1$
+ private static final String ICON = "icon"; //$NON-NLS-1$
private final String fId;
private final String fName;
private final IConfigurationElement fElement;
- /** The image descriptor for this category, or <code>null</code> if none specified. */
+ /**
+ * The image descriptor for this category, or <code>null</code> if none
+ * specified.
+ */
private final ImageDescriptor fImage;
-
- private boolean fIsSeparateCommand= true;
- private boolean fIsEnabled= true;
- private boolean fIsIncluded= true;
+
+ private boolean fIsSeparateCommand = true;
+ private boolean fIsEnabled = true;
+ private boolean fIsIncluded = true;
private final CompletionProposalComputerRegistry fRegistry;
-
- private int fSortOrder= 0x10000;
- private String fLastError= null;
-
+
+ private int fSortOrder = 0x10000;
+ private String fLastError = null;
+
private String fToolkitID = null;
- CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry) {
- fElement= element;
- fRegistry= registry;
- IExtension parent= (IExtension) element.getParent();
- fId= parent.getUniqueIdentifier();
+ CompletionProposalCategory(IConfigurationElement element,
+ CompletionProposalComputerRegistry registry) {
+ fElement = element;
+ fRegistry = registry;
+ IExtension parent = (IExtension) element.getParent();
+ fId = parent.getUniqueIdentifier();
checkNotNull(fId, "id"); //$NON-NLS-1$
- String name= parent.getLabel();
+ String name = parent.getLabel();
if (name == null)
- fName= fId;
+ fName = fId;
else
- fName= name;
-
- String icon= element.getAttribute(ICON);
- ImageDescriptor img= null;
+ fName = name;
+
+ String icon = element.getAttribute(ICON);
+ ImageDescriptor img = null;
if (icon != null) {
- Bundle bundle= getBundle();
+ Bundle bundle = getBundle();
if (bundle != null) {
- Path path= new Path(icon);
- URL url= FileLocator.find(bundle, path, null);
- img= ImageDescriptor.createFromURL(url);
+ Path path = new Path(icon);
+ URL url = FileLocator.find(bundle, path, null);
+ img = ImageDescriptor.createFromURL(url);
}
}
- fImage= img;
- fToolkitID = element.getAttribute(CompletionProposalComputerDescriptor.TOOLKITID);
-
+ fImage = img;
+ fToolkitID = element
+ .getAttribute(CompletionProposalComputerDescriptor.TOOLKITID);
+
}
- CompletionProposalCategory(String id, String name, CompletionProposalComputerRegistry registry, String toolkitID) {
- fRegistry= registry;
- fId= id;
- fName= name;
- fElement= null;
- fImage= null;
+ CompletionProposalCategory(String id, String name,
+ CompletionProposalComputerRegistry registry, String toolkitID) {
+ fRegistry = registry;
+ fId = id;
+ fName = name;
+ fElement = null;
+ fImage = null;
fToolkitID = toolkitID;
}
private Bundle getBundle() {
- String namespace= fElement.getDeclaringExtension().getContributor().getName();
- Bundle bundle= Platform.getBundle(namespace);
+ String namespace = fElement.getDeclaringExtension().getContributor()
+ .getName();
+ Bundle bundle = Platform.getBundle(namespace);
return bundle;
}
/**
- * Checks an element that must be defined according to the extension
- * point schema. Throws an
- * <code>InvalidRegistryObjectException</code> if <code>obj</code>
- * is <code>null</code>.
+ * Checks an element that must be defined according to the extension point
+ * schema. Throws an <code>InvalidRegistryObjectException</code> if
+ * <code>obj</code> is <code>null</code>.
*/
- private void checkNotNull(Object obj, String attribute) throws InvalidRegistryObjectException {
+ private void checkNotNull(Object obj, String attribute)
+ throws InvalidRegistryObjectException {
if (obj == null) {
- Object[] args= { getId(), fElement.getContributor().getName(), attribute };
- String message= Messages.format(ScriptTextMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
- IStatus status= new Status(IStatus.WARNING, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, message, null);
+ Object[] args = { getId(), fElement.getContributor().getName(),
+ attribute };
+ String message = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerDescriptor_illegal_attribute_message,
+ args);
+ IStatus status = new Status(IStatus.WARNING, DLTKUIPlugin.PLUGIN_ID,
+ IStatus.OK, message, null);
DLTKUIPlugin.log(status);
throw new InvalidRegistryObjectException();
}
@@ -124,58 +134,59 @@
/**
* Returns the name of the described extension.
- *
+ *
* @return Returns the name
*/
public String getName() {
return fName;
}
-
+
/**
- * Returns the name of the described extension
- * without mnemonic hint in order to be displayed
- * in a message.
- *
+ * Returns the name of the described extension without mnemonic hint in
+ * order to be displayed in a message.
+ *
* @return Returns the name
*/
public String getDisplayName() {
return LegacyActionTools.removeMnemonics(fName);
}
-
+
/**
* Returns the image descriptor of the described category.
- *
+ *
* @return the image descriptor of the described category
*/
public ImageDescriptor getImageDescriptor() {
return fImage;
}
-
+
/**
* Sets the separate command state of the category.
- *
- * @param enabled the new enabled state.
+ *
+ * @param enabled
+ * the new enabled state.
*/
public void setSeparateCommand(boolean enabled) {
- fIsSeparateCommand= enabled;
+ fIsSeparateCommand = enabled;
}
-
+
/**
* Returns the enablement state of the category.
- *
+ *
* @return the enablement state of the category
*/
public boolean isSeparateCommand() {
return fIsSeparateCommand;
}
-
+
/**
- * @param included the included
+ * @param included
+ * the included
*/
public void setIncluded(boolean included) {
- fIsIncluded= included;
+ fIsIncluded = included;
}
-
+
/**
* @return included
*/
@@ -188,15 +199,15 @@
}
public void setEnabled(boolean isEnabled) {
- fIsEnabled= isEnabled;
+ fIsEnabled = isEnabled;
}
/**
- * Returns <code>true</code> if the category contains any computers, <code>false</code>
- * otherwise.
- *
- * @return <code>true</code> if the category contains any computers, <code>false</code>
- * otherwise
+ * Returns <code>true</code> if the category contains any computers,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the category contains any computers,
+ * <code>false</code> otherwise
*/
public boolean hasComputers() {
List<CompletionProposalComputerDescriptor> descriptors = fRegistry
@@ -209,14 +220,15 @@
}
return false;
}
-
+
/**
- * Returns <code>true</code> if the category contains any computers in the given partition, <code>false</code>
- * otherwise.
- *
- * @param partition the partition
- * @return <code>true</code> if the category contains any computers, <code>false</code>
- * otherwise
+ * Returns <code>true</code> if the category contains any computers in the
+ * given partition, <code>false</code> otherwise.
+ *
+ * @param partition
+ * the partition
+ * @return <code>true</code> if the category contains any computers,
+ * <code>false</code> otherwise
*/
public boolean hasComputers(String partition) {
List<CompletionProposalComputerDescriptor> descriptors = fRegistry
@@ -229,95 +241,107 @@
}
return false;
}
-
+
/**
* @return sortOrder
*/
public int getSortOrder() {
return fSortOrder;
}
-
+
/**
- * @param sortOrder the sortOrder
+ * @param sortOrder
+ * the sortOrder
*/
public void setSortOrder(int sortOrder) {
- fSortOrder= sortOrder;
+ fSortOrder = sortOrder;
}
/**
- * Safely computes completion proposals of all computers of this category through their
- * extension. If an extension is disabled, throws an exception or otherwise does not adhere to
- * the contract described in {@link IScriptCompletionProposalComputer}, it is disabled.
- *
- * @param context the invocation context passed on to the extension
- * @param partition the partition type where to invocation occurred
- * @param monitor the progress monitor passed on to the extension
+ * Safely computes completion proposals of all computers of this category
+ * through their extension. If an extension is disabled, throws an exception
+ * or otherwise does not adhere to the contract described in
+ * {@link IScriptCompletionProposalComputer}, it is disabled.
+ *
+ * @param context
+ * the invocation context passed on to the extension
+ * @param partition
+ * the partition type where to invocation occurred
+ * @param monitor
+ * the progress monitor passed on to the extension
* @return the list of computed completion proposals (element type:
* {@link org.eclipse.jface.text.contentassist.ICompletionProposal})
*/
public List<ICompletionProposal> computeCompletionProposals(
ContentAssistInvocationContext context, String partition,
IProgressMonitor monitor) {
- fLastError= null;
-
- List<ICompletionProposal> result = new ArrayList<ICompletionProposal>();
- List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<CompletionProposalComputerDescriptor>(
+ fLastError = null;
+
+ List<ICompletionProposal> result = new ArrayList<>();
+ List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<>(
fRegistry.getProposalComputerDescriptors(partition));
for (Iterator<CompletionProposalComputerDescriptor> it = descriptors
.iterator(); it.hasNext();) {
CompletionProposalComputerDescriptor desc = it.next();
- if(context instanceof ScriptContentAssistInvocationContext ) {
- ScriptContentAssistInvocationContext scriptContext = (ScriptContentAssistInvocationContext)context;
- if( !scriptContext.getLanguageNatureID().equals(desc.getLanguageToolkitID())) {
+ if (context instanceof ScriptContentAssistInvocationContext) {
+ ScriptContentAssistInvocationContext scriptContext = (ScriptContentAssistInvocationContext) context;
+ if (!scriptContext.getLanguageNatureID()
+ .equals(desc.getLanguageToolkitID())) {
continue;
}
}
if (desc.getCategory() == this)
- result.addAll(desc.computeCompletionProposals(context, monitor));
+ result.addAll(
+ desc.computeCompletionProposals(context, monitor));
if (fLastError == null)
- fLastError= desc.getErrorMessage();
+ fLastError = desc.getErrorMessage();
}
return result;
}
/**
- * Safely computes context information objects of all computers of this category through their
- * extension. If an extension is disabled, throws an exception or otherwise does not adhere to
- * the contract described in {@link IScriptCompletionProposalComputer}, it is disabled.
- *
- * @param context the invocation context passed on to the extension
- * @param partition the partition type where to invocation occurred
- * @param monitor the progress monitor passed on to the extension
+ * Safely computes context information objects of all computers of this
+ * category through their extension. If an extension is disabled, throws an
+ * exception or otherwise does not adhere to the contract described in
+ * {@link IScriptCompletionProposalComputer}, it is disabled.
+ *
+ * @param context
+ * the invocation context passed on to the extension
+ * @param partition
+ * the partition type where to invocation occurred
+ * @param monitor
+ * the progress monitor passed on to the extension
* @return the list of computed context information objects (element type:
* {@link org.eclipse.jface.text.contentassist.IContextInformation})
*/
public List<IContextInformation> computeContextInformation(
ContentAssistInvocationContext context, String partition,
IProgressMonitor monitor) {
- fLastError= null;
- List<IContextInformation> result = new ArrayList<IContextInformation>();
- List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<CompletionProposalComputerDescriptor>(
+ fLastError = null;
+ List<IContextInformation> result = new ArrayList<>();
+ List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<>(
fRegistry.getProposalComputerDescriptors(partition));
for (Iterator<CompletionProposalComputerDescriptor> it = descriptors
.iterator(); it.hasNext();) {
CompletionProposalComputerDescriptor desc = it.next();
- if(context instanceof ScriptContentAssistInvocationContext ) {
- ScriptContentAssistInvocationContext scriptContext = (ScriptContentAssistInvocationContext)context;
- if( !scriptContext.getLanguageNatureID().equals(desc.getLanguageToolkitID())) {
+ if (context instanceof ScriptContentAssistInvocationContext) {
+ ScriptContentAssistInvocationContext scriptContext = (ScriptContentAssistInvocationContext) context;
+ if (!scriptContext.getLanguageNatureID()
+ .equals(desc.getLanguageToolkitID())) {
continue;
}
}
if (desc.getCategory() == this)
result.addAll(desc.computeContextInformation(context, monitor));
if (fLastError == null)
- fLastError= desc.getErrorMessage();
+ fLastError = desc.getErrorMessage();
}
return result;
}
/**
* Returns the error message from the computers in this category.
- *
+ *
* @return the error message from the computers in this category
*/
public String getErrorMessage() {
@@ -325,10 +349,11 @@
}
/**
- * Notifies the computers in this category of a proposal computation session start.
+ * Notifies the computers in this category of a proposal computation session
+ * start.
*/
public void sessionStarted() {
- List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<CompletionProposalComputerDescriptor>(
+ List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<>(
fRegistry.getProposalComputerDescriptors());
for (Iterator<CompletionProposalComputerDescriptor> it = descriptors
.iterator(); it.hasNext();) {
@@ -336,15 +361,16 @@
if (desc.getCategory() == this)
desc.sessionStarted();
if (fLastError == null)
- fLastError= desc.getErrorMessage();
+ fLastError = desc.getErrorMessage();
}
}
-
+
/**
- * Notifies the computers in this category of a proposal computation session end.
+ * Notifies the computers in this category of a proposal computation session
+ * end.
*/
public void sessionEnded() {
- List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<CompletionProposalComputerDescriptor>(
+ List<CompletionProposalComputerDescriptor> descriptors = new ArrayList<>(
fRegistry.getProposalComputerDescriptors());
for (Iterator<CompletionProposalComputerDescriptor> it = descriptors
.iterator(); it.hasNext();) {
@@ -352,9 +378,10 @@
if (desc.getCategory() == this)
desc.sessionEnded();
if (fLastError == null)
- fLastError= desc.getErrorMessage();
+ fLastError = desc.getErrorMessage();
}
}
+
public String getToolkitID() {
return fToolkitID;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerDescriptor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerDescriptor.java
index 8634888..d7d120d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerDescriptor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerDescriptor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.text.completion;
@@ -37,9 +36,9 @@
* <code>org.eclipse.dltk.ui.javaCompletionProposalComputer</code> extension
* point. Instances are immutable. Instances can be obtained from a
* {@link CompletionProposalComputerRegistry}.
- *
+ *
* @see CompletionProposalComputerRegistry
- *
+ *
*/
final class CompletionProposalComputerDescriptor {
/** The default category id. */
@@ -58,7 +57,7 @@
public static final String TOOLKITID = "toolkitId"; //$NON-NLS-1$
/** Set of Script partition types. */
- private static final Set<String> PARTITION_SET = new HashSet<String>();
+ private static final Set<String> PARTITION_SET = new HashSet<>();
/** The name of the performance event used to trace extensions. */
private static final String PERFORMANCE_EVENT = DLTKUIPlugin.getPluginId()
+ "/perf/content_assist/extensions"; //$NON-NLS-1$
@@ -127,7 +126,7 @@
/**
* Creates a new descriptor.
- *
+ *
* @param element
* the configuration element to read
* @param registry
@@ -152,7 +151,7 @@
else
fName = name;
- Set<String> partitions = new HashSet<String>();
+ Set<String> partitions = new HashSet<>();
IConfigurationElement[] children = element.getChildren(PARTITION);
if (children.length == 0) {
fPartitions = PARTITION_SET; // add to all partition types if no
@@ -184,7 +183,7 @@
}
String toolkitId = element.getAttribute(TOOLKITID);
- this.fToolkitID = toolkitId;
+ this.fToolkitID = toolkitId;
if (category == null) {
// create a category if it does not exist
fCategory = new CompletionProposalCategory(categoryId, fName,
@@ -194,6 +193,7 @@
fCategory = category;
}
}
+
public String getLanguageToolkitID() {
return this.fToolkitID;
}
@@ -208,12 +208,11 @@
if (obj == null) {
Object[] args = { getId(), fElement.getContributor().getName(),
attribute };
- String message = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerDescriptor_illegal_attribute_message,
- args);
- IStatus status = new Status(IStatus.WARNING, DLTKUIPlugin
- .getPluginId(), IStatus.OK, message, null);
+ String message = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerDescriptor_illegal_attribute_message,
+ args);
+ IStatus status = new Status(IStatus.WARNING,
+ DLTKUIPlugin.getPluginId(), IStatus.OK, message, null);
DLTKUIPlugin.log(status);
throw new InvalidRegistryObjectException();
}
@@ -221,7 +220,7 @@
/**
* Returns the identifier of the described extension.
- *
+ *
* @return Returns the id
*/
public String getId() {
@@ -230,7 +229,7 @@
/**
* Returns the name of the described extension.
- *
+ *
* @return Returns the name
*/
public String getName() {
@@ -239,7 +238,7 @@
/**
* Returns the partition types of the described extension.
- *
+ *
* @return the set of partition types (element type: {@link String})
*/
public Set<String> getPartitions() {
@@ -248,7 +247,7 @@
/**
* Tells whether we tried to load the computer.
- *
+ *
* @since 3.0
*/
private boolean fTriedLoadingComputer = false;
@@ -257,7 +256,7 @@
* Returns a cached instance of the computer as described in the extension's
* xml. The computer is {@link #createComputer() created} the first time
* that this method is called and then cached.
- *
+ *
* @return a new instance of the completion proposal computer as described
* by this descriptor
* @throws CoreException
@@ -292,12 +291,13 @@
/**
* Returns a new instance of the computer as described in the extension's
* xml. Note that the safest way to access the computer is by using the
- * {@linkplain #computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) computeCompletionProposals}
- * and
- * {@linkplain #computeContextInformation(ContentAssistInvocationContext, IProgressMonitor) computeContextInformation}
- * methods. These delegate the functionality to the contributed computer,
- * but handle instance creation and any exceptions thrown.
- *
+ * {@linkplain #computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor)
+ * computeCompletionProposals} and
+ * {@linkplain #computeContextInformation(ContentAssistInvocationContext, IProgressMonitor)
+ * computeContextInformation} methods. These delegate the functionality to
+ * the contributed computer, but handle instance creation and any exceptions
+ * thrown.
+ *
* @return a new instance of the completion proposal computer as described
* by this descriptor
* @throws CoreException
@@ -317,7 +317,7 @@
* the extension is disabled, throws an exception or otherwise does not
* adhere to the contract described in
* {@link IScriptCompletionProposalComputer}, an empty list is returned.
- *
+ *
* @param context
* the invocation context passed on to the extension
* @param monitor
@@ -339,8 +339,7 @@
try {
PerformanceStats stats = startMeter(context, computer);
List<ICompletionProposal> proposals = computer
- .computeCompletionProposals(context,
- monitor);
+ .computeCompletionProposals(context, monitor);
stopMeter(stats, COMPUTE_COMPLETION_PROPOSALS);
if (proposals != null) {
@@ -350,7 +349,6 @@
} finally {
fIsReportingDelay = true;
-
}
status = createAPIViolationStatus(COMPUTE_COMPLETION_PROPOSALS);
} catch (InvalidRegistryObjectException x) {
@@ -373,7 +371,7 @@
* extension. If the extension is disabled, throws an exception or otherwise
* does not adhere to the contract described in
* {@link IScriptCompletionProposalComputer}, an empty list is returned.
- *
+ *
* @param context
* the invocation context passed on to the extension
* @param monitor
@@ -394,8 +392,7 @@
PerformanceStats stats = startMeter(context, computer);
List<IContextInformation> proposals = computer
- .computeContextInformation(context,
- monitor);
+ .computeContextInformation(context, monitor);
stopMeter(stats, COMPUTE_CONTEXT_INFORMATION);
if (proposals != null) {
@@ -422,10 +419,8 @@
/**
* Notifies the described extension of a proposal computation session start.
* <p>
- * <em>
- * Note: This method is called every time code assist is invoked and
- * is <strong>not</strong> filtered by partition type.
- * </em>
+ * <em> Note: This method is called every time code assist is invoked and is
+ * <strong>not</strong> filtered by partition type. </em>
* </p>
*/
public void sessionStarted() {
@@ -457,10 +452,8 @@
/**
* Notifies the described extension of a proposal computation session end.
* <p>
- * <em>
- * Note: This method is called every time code assist is invoked and
- * is <strong>not</strong> filtered by partition type.
- * </em>
+ * <em> Note: This method is called every time code assist is invoked and is
+ * <strong>not</strong> filtered by partition type. </em>
* </p>
*/
public void sessionEnded() {
@@ -537,8 +530,8 @@
// unable to instantiate the extension - log & disable
String blame = createBlameMessage();
String reason = ScriptTextMessages.CompletionProposalComputerDescriptor_reason_instantiation;
- return new Status(IStatus.ERROR, DLTKUIPlugin.getPluginId(),
- IStatus.OK, blame + " " + reason, x); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, DLTKUIPlugin.getPluginId(), IStatus.OK,
+ blame + " " + reason, x); //$NON-NLS-1$
}
private IStatus createExceptionStatus(RuntimeException x) {
@@ -552,10 +545,9 @@
private IStatus createAPIViolationStatus(String operation) {
String blame = createBlameMessage();
Object[] args = { operation };
- String reason = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerDescriptor_reason_API,
- args);
+ String reason = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerDescriptor_reason_API,
+ args);
return new Status(IStatus.WARNING, DLTKUIPlugin.getPluginId(),
IStatus.OK, blame + " " + reason, null); //$NON-NLS-1$
}
@@ -563,10 +555,9 @@
private IStatus createPerformanceStatus(String operation) {
String blame = createBlameMessage();
Object[] args = { operation };
- String reason = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerDescriptor_reason_performance,
- args);
+ String reason = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerDescriptor_reason_performance,
+ args);
return new Status(IStatus.WARNING, DLTKUIPlugin.getPluginId(),
IStatus.OK, blame + " " + reason, null); //$NON-NLS-1$
}
@@ -574,16 +565,15 @@
private String createBlameMessage() {
Object[] args = { getName(),
fElement.getDeclaringExtension().getContributor().getName() };
- String disable = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerDescriptor_blame_message,
- args);
+ String disable = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerDescriptor_blame_message,
+ args);
return disable;
}
/**
* Returns the enablement state of the described extension.
- *
+ *
* @return the enablement state of the described extension
*/
private boolean isEnabled() {
@@ -596,7 +586,7 @@
/**
* Returns the error message from the described extension.
- *
+ *
* @return the error message from the described extension
*/
public String getErrorMessage() {
@@ -605,7 +595,7 @@
/**
* Returns the contributor of the described extension.
- *
+ *
* @return the contributor of the described extension
*/
IContributor getContributor() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerRegistry.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerRegistry.java
index edf9b30..d5434e1 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerRegistry.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/CompletionProposalComputerRegistry.java
@@ -70,26 +70,26 @@
* {@link String}, value type: {@linkplain List
* List<CompletionProposalComputerDescriptor>}).
*/
- private final Map<String, List<CompletionProposalComputerDescriptor>> fDescriptorsByPartition = new HashMap<String, List<CompletionProposalComputerDescriptor>>();
+ private final Map<String, List<CompletionProposalComputerDescriptor>> fDescriptorsByPartition = new HashMap<>();
/**
* Unmodifiable versions of the sets stored in
* <code>fDescriptorsByPartition</code> (key type: {@link String}, value
* type: {@linkplain List List<CompletionProposalComputerDescriptor>}
* ).
*/
- private final Map<String, List<CompletionProposalComputerDescriptor>> fPublicDescriptorsByPartition = new HashMap<String, List<CompletionProposalComputerDescriptor>>();
+ private final Map<String, List<CompletionProposalComputerDescriptor>> fPublicDescriptorsByPartition = new HashMap<>();
/**
* All descriptors (element type:
* {@link CompletionProposalComputerDescriptor}).
*/
- private final List<CompletionProposalComputerDescriptor> fDescriptors = new ArrayList<CompletionProposalComputerDescriptor>();
+ private final List<CompletionProposalComputerDescriptor> fDescriptors = new ArrayList<>();
/**
* Unmodifiable view of <code>fDescriptors</code>
*/
private final List<CompletionProposalComputerDescriptor> fPublicDescriptors = Collections
.unmodifiableList(fDescriptors);
- private final List<CompletionProposalCategory> fCategories = new ArrayList<CompletionProposalCategory>();
+ private final List<CompletionProposalCategory> fCategories = new ArrayList<>();
private final List<CompletionProposalCategory> fPublicCategories = Collections
.unmodifiableList(fCategories);
/**
@@ -137,8 +137,9 @@
ensureExtensionPointRead();
List<CompletionProposalComputerDescriptor> result = fPublicDescriptorsByPartition
.get(partition);
- return result != null ? result : Collections
- .<CompletionProposalComputerDescriptor> emptyList();
+ return result != null ? result
+ : Collections
+ .<CompletionProposalComputerDescriptor> emptyList();
}
/**
@@ -208,12 +209,12 @@
*/
public void reload() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
- List<IConfigurationElement> elements = new ArrayList<IConfigurationElement>(
- Arrays.asList(registry.getConfigurationElementsFor(DLTKUIPlugin
- .getPluginId(), EXTENSION_POINT)));
+ List<IConfigurationElement> elements = new ArrayList<>(
+ Arrays.asList(registry.getConfigurationElementsFor(
+ DLTKUIPlugin.getPluginId(), EXTENSION_POINT)));
- Map<String, List<CompletionProposalComputerDescriptor>> map = new HashMap<String, List<CompletionProposalComputerDescriptor>>();
- List<CompletionProposalComputerDescriptor> all = new ArrayList<CompletionProposalComputerDescriptor>();
+ Map<String, List<CompletionProposalComputerDescriptor>> map = new HashMap<>();
+ List<CompletionProposalComputerDescriptor> all = new ArrayList<>();
List<CompletionProposalCategory> categories = getCategories(elements);
for (Iterator<IConfigurationElement> iter = elements.iterator(); iter
@@ -227,7 +228,7 @@
List<CompletionProposalComputerDescriptor> list = map
.get(partition);
if (list == null) {
- list = new ArrayList<CompletionProposalComputerDescriptor>();
+ list = new ArrayList<>();
map.put(partition, list);
}
list.add(desc);
@@ -241,12 +242,11 @@
* extension in the list and inform the user about it.
*/
Object[] args = { element.toString() };
- String message = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerRegistry_invalid_message,
- args);
- IStatus status = new Status(IStatus.WARNING, DLTKUIPlugin
- .getPluginId(), IStatus.OK, message, x);
+ String message = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerRegistry_invalid_message,
+ args);
+ IStatus status = new Status(IStatus.WARNING,
+ DLTKUIPlugin.getPluginId(), IStatus.OK, message, x);
informUser(status);
}
}
@@ -269,8 +269,8 @@
old.addAll(current);
} else {
fDescriptorsByPartition.put(partition, current);
- fPublicDescriptorsByPartition.put(partition, Collections
- .unmodifiableList(current));
+ fPublicDescriptorsByPartition.put(partition,
+ Collections.unmodifiableList(current));
}
}
@@ -284,11 +284,11 @@
IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore();
String preference = store
.getString(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
- Set<String> disabled = new HashSet<String>();
+ Set<String> disabled = new HashSet<>();
StringTokenizer tok = new StringTokenizer(preference, "\0"); //$NON-NLS-1$
while (tok.hasMoreTokens())
disabled.add(tok.nextToken());
- Map<String, Integer> ordered = new HashMap<String, Integer>();
+ Map<String, Integer> ordered = new HashMap<>();
preference = store
.getString(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
tok = new StringTokenizer(preference, "\0"); //$NON-NLS-1$
@@ -299,7 +299,7 @@
ordered.put(id, Integer.valueOf(rank));
}
- List<CompletionProposalCategory> categories = new ArrayList<CompletionProposalCategory>();
+ List<CompletionProposalCategory> categories = new ArrayList<>();
for (Iterator<IConfigurationElement> iter = elements.iterator(); iter
.hasNext();) {
IConfigurationElement element = iter.next();
@@ -326,12 +326,11 @@
* extension in the list and inform the user about it.
*/
Object[] args = { element.toString() };
- String message = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerRegistry_invalid_message,
- args);
- IStatus status = new Status(IStatus.WARNING, DLTKUIPlugin
- .getPluginId(), IStatus.OK, message, x);
+ String message = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerRegistry_invalid_message,
+ args);
+ IStatus status = new Status(IStatus.WARNING,
+ DLTKUIPlugin.getPluginId(), IStatus.OK, message, x);
informUser(status);
}
}
@@ -352,29 +351,26 @@
String title = ScriptTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
CompletionProposalCategory category = descriptor.getCategory();
IContributor culprit = descriptor.getContributor();
- Set<String> affectedPlugins = getAffectedContributors(category, culprit);
+ Set<String> affectedPlugins = getAffectedContributors(category,
+ culprit);
final String avoidHint;
final String culpritName = culprit == null ? null : culprit.getName();
if (affectedPlugins.isEmpty())
- avoidHint = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint,
- new Object[] { culpritName,
- category.getDisplayName() });
+ avoidHint = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint,
+ new Object[] { culpritName, category.getDisplayName() });
else
- avoidHint = Messages
- .format(
- ScriptTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning,
- new Object[] { culpritName,
- category.getDisplayName(),
- toString(affectedPlugins) });
+ avoidHint = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning,
+ new Object[] { culpritName, category.getDisplayName(),
+ toString(affectedPlugins) });
String message = status.getMessage();
// inlined from MessageDialog.openError
- MessageDialog dialog = new MessageDialog(DLTKUIPlugin
- .getActiveWorkbenchShell(), title, null /* default image */,
- message, MessageDialog.ERROR,
+ MessageDialog dialog = new MessageDialog(
+ DLTKUIPlugin.getActiveWorkbenchShell(), title,
+ null /* default image */, message, MessageDialog.ERROR,
new String[] { IDialogConstants.OK_LABEL }, 0) {
@Override
protected Control createCustomArea(Composite parent) {
@@ -383,10 +379,9 @@
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- PreferencesUtil
- .createPreferenceDialogOn(
- getShell(),
- "org.eclipse.dltk.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$
+ PreferencesUtil.createPreferenceDialogOn(getShell(),
+ "org.eclipse.dltk.ui.preferences.CodeAssistPreferenceAdvanced", //$NON-NLS-1$
+ null, null).open();
}
});
GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true,
@@ -412,7 +407,7 @@
*/
private Set<String> getAffectedContributors(
CompletionProposalCategory category, IContributor culprit) {
- Set<String> affectedPlugins = new HashSet<String>();
+ Set<String> affectedPlugins = new HashSet<>();
for (Iterator<CompletionProposalComputerDescriptor> it = getProposalComputerDescriptors()
.iterator(); it.hasNext();) {
CompletionProposalComputerDescriptor desc = it.next();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java
index 59e2b7d..0153881 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ContentAssistProcessor.java
@@ -83,8 +83,10 @@
*
*
*/
-public abstract class ContentAssistProcessor implements IContentAssistProcessor {
- private static final boolean DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.dltk.ui/debug/ResultCollector")); //$NON-NLS-1$//$NON-NLS-2$
+public abstract class ContentAssistProcessor
+ implements IContentAssistProcessor {
+ private static final boolean DEBUG = "true".equalsIgnoreCase(Platform //$NON-NLS-1$
+ .getDebugOption("org.eclipse.dltk.ui/debug/ResultCollector")); //$NON-NLS-1$
/**
* Dialog settings key for the "all categories are disabled" warning dialog.
@@ -101,7 +103,8 @@
private char[] fCompletionAutoActivationCharacters;
- private static final Comparator<CompletionProposalCategory> ORDER_COMPARATOR = (d1, d2) -> d1.getSortOrder() - d2.getSortOrder();
+ private static final Comparator<CompletionProposalCategory> ORDER_COMPARATOR = (
+ d1, d2) -> d1.getSortOrder() - d2.getSortOrder();
/* cycling stuff */
private int fRepetition = -1;
@@ -114,8 +117,8 @@
private String fErrorMessage;
- class CompletionListener implements ICompletionListener,
- ICompletionListenerExtension {
+ class CompletionListener
+ implements ICompletionListener, ICompletionListenerExtension {
@Override
public void assistSessionStarted(ContentAssistEvent event) {
@@ -190,9 +193,8 @@
extension.setStatusLineVisible(false);
if (extension instanceof IContentAssistantExtension3) {
IContentAssistantExtension3 ext3 = (IContentAssistantExtension3) extension;
- ((ContentAssistant) ext3)
- .setRepeatedInvocationTrigger(KeySequence
- .getInstance());
+ ((ContentAssistant) ext3).setRepeatedInvocationTrigger(
+ KeySequence.getInstance());
}
}
}
@@ -209,7 +211,8 @@
}
- public ContentAssistProcessor(ContentAssistant assistant, String partition) {
+ public ContentAssistProcessor(ContentAssistant assistant,
+ String partition) {
Assert.isNotNull(partition);
Assert.isNotNull(assistant);
@@ -236,14 +239,14 @@
ContentAssistInvocationContext context = createContext(viewer, offset);
final long setupTime = System.currentTimeMillis();
- monitor
- .subTask(ScriptTextMessages.ContentAssistProcessor_collecting_proposals);
+ monitor.subTask(
+ ScriptTextMessages.ContentAssistProcessor_collecting_proposals);
final List<ICompletionProposal> proposals = collectProposals(viewer,
offset, monitor, context);
final long collectTime = System.currentTimeMillis();
- monitor
- .subTask(ScriptTextMessages.ContentAssistProcessor_sorting_proposals);
+ monitor.subTask(
+ ScriptTextMessages.ContentAssistProcessor_sorting_proposals);
final List<ICompletionProposal> filtered = filterAndSortProposals(
proposals, monitor, context);
@@ -256,14 +259,14 @@
monitor.done();
if (DEBUG) {
- System.err
- .println("Code Assist stats of " + result.length + " proposals:"); //$NON-NLS-1$ //$NON-NLS-2$
- System.err
- .println("Code Assist (setup):\t" + (setupTime - startTime)); //$NON-NLS-1$
- System.err
- .println("Code Assist (collect):\t" + (collectTime - setupTime)); //$NON-NLS-1$
- System.err
- .println("Code Assist (sort):\t" + (filterTime - collectTime)); //$NON-NLS-1$
+ System.err.println(
+ "Code Assist stats of " + result.length + " proposals:"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println(
+ "Code Assist (setup):\t" + (setupTime - startTime)); //$NON-NLS-1$
+ System.err.println(
+ "Code Assist (collect):\t" + (collectTime - setupTime)); //$NON-NLS-1$
+ System.err.println(
+ "Code Assist (sort):\t" + (filterTime - collectTime)); //$NON-NLS-1$
}
return result;
@@ -277,13 +280,12 @@
private List<ICompletionProposal> collectProposals(ITextViewer viewer,
int offset, IProgressMonitor monitor,
ContentAssistInvocationContext context) {
- List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- Set<ICompletionProposal> proposalSet = new HashSet<ICompletionProposal>();
+ List<ICompletionProposal> proposals = new ArrayList<>();
+ Set<ICompletionProposal> proposalSet = new HashSet<>();
List<CompletionProposalCategory> providers = getCategories();
for (CompletionProposalCategory cat : providers) {
- List<ICompletionProposal> computed = cat
- .computeCompletionProposals(context, fPartition,
- new SubProgressMonitor(monitor, 1));
+ List<ICompletionProposal> computed = cat.computeCompletionProposals(
+ context, fPartition, new SubProgressMonitor(monitor, 1));
proposalSet.addAll(computed);
if (fErrorMessage == null) {
fErrorMessage = cat.getErrorMessage();
@@ -323,13 +325,13 @@
ScriptTextMessages.ContentAssistProcessor_computing_contexts,
fCategories.size() + 1);
- monitor
- .subTask(ScriptTextMessages.ContentAssistProcessor_collecting_contexts);
+ monitor.subTask(
+ ScriptTextMessages.ContentAssistProcessor_collecting_contexts);
final List<IContextInformation> proposals = collectContextInformation(
viewer, offset, monitor);
- monitor
- .subTask(ScriptTextMessages.ContentAssistProcessor_sorting_contexts);
+ monitor.subTask(
+ ScriptTextMessages.ContentAssistProcessor_sorting_contexts);
List<IContextInformation> filtered = filterAndSortContextInformation(
proposals, monitor);
fNumberOfComputedResults = filtered.size();
@@ -343,7 +345,7 @@
private List<IContextInformation> collectContextInformation(
ITextViewer viewer, int offset, IProgressMonitor monitor) {
- List<IContextInformation> proposals = new ArrayList<IContextInformation>();
+ List<IContextInformation> proposals = new ArrayList<>();
ContentAssistInvocationContext context = createContext(viewer, offset);
setContextInformationMode(context);
@@ -460,7 +462,7 @@
}
private List<List<CompletionProposalCategory>> getCategoryIteration() {
- List<List<CompletionProposalCategory>> sequence = new ArrayList<List<CompletionProposalCategory>>();
+ List<List<CompletionProposalCategory>> sequence = new ArrayList<>();
sequence.add(getDefaultCategories());
for (Iterator<CompletionProposalCategory> it = getSeparateCategories()
.iterator(); it.hasNext();) {
@@ -484,7 +486,7 @@
}
private List<CompletionProposalCategory> getDefaultCategoriesUnchecked() {
- List<CompletionProposalCategory> included = new ArrayList<CompletionProposalCategory>();
+ List<CompletionProposalCategory> included = new ArrayList<>();
for (CompletionProposalCategory category : fCategories) {
if (category.isIncluded() && category.hasComputers(fPartition))
included.add(category);
@@ -505,17 +507,16 @@
// see PreferencePage#createControl for the 'defaults' label
final String restoreButtonLabel = JFaceResources
.getString("defaults"); //$NON-NLS-1$
- final String linkMessage = Messages
- .format(
- ScriptTextMessages.ContentAssistProcessor_all_disabled_preference_link,
- LegacyActionTools
- .removeMnemonics(restoreButtonLabel));
+ final String linkMessage = Messages.format(
+ ScriptTextMessages.ContentAssistProcessor_all_disabled_preference_link,
+ LegacyActionTools.removeMnemonics(restoreButtonLabel));
final int restoreId = IDialogConstants.CLIENT_ID + 10;
final OptionalMessageDialog dialog = new OptionalMessageDialog(
PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title,
null /* default image */, message, MessageDialog.WARNING,
new String[] { restoreButtonLabel,
- IDialogConstants.CLOSE_LABEL }, 1) {
+ IDialogConstants.CLOSE_LABEL },
+ 1) {
@Override
protected Control createCustomArea(Composite composite) {
// wrap link and checkbox in one composite without space
@@ -528,9 +529,12 @@
Composite linkComposite = new Composite(parent, SWT.NONE);
layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.marginHeight = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_MARGIN);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_SPACING);
linkComposite.setLayout(layout);
Link link = new Link(linkComposite, SWT.NONE);
@@ -539,10 +543,9 @@
@Override
public void widgetSelected(SelectionEvent e) {
close();
- PreferencesUtil
- .createPreferenceDialogOn(
- shell,
- "org.eclipse.dltk.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$
+ PreferencesUtil.createPreferenceDialogOn(shell,
+ "org.eclipse.dltk.ui.preferences.CodeAssistPreferenceAdvanced", //$NON-NLS-1$
+ null, null).open();
}
});
GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING,
@@ -561,8 +564,7 @@
Button[] buttons = new Button[2];
buttons[0] = createButton(parent, restoreId,
restoreButtonLabel, false);
- buttons[1] = createButton(parent,
- IDialogConstants.CLOSE_ID,
+ buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID,
IDialogConstants.CLOSE_LABEL, true);
setButtons(buttons);
}
@@ -575,10 +577,10 @@
*/
IPreferenceStore store = DLTKUIPlugin.getDefault()
.getPreferenceStore();
- store
- .setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
- store
- .setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
+ store.setToDefault(
+ PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
+ store.setToDefault(
+ PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry
.getDefault();
registry.reload();
@@ -591,7 +593,7 @@
protected abstract IPreferenceStore getPreferenceStore();
private List<CompletionProposalCategory> getSeparateCategories() {
- ArrayList<CompletionProposalCategory> sorted = new ArrayList<CompletionProposalCategory>();
+ ArrayList<CompletionProposalCategory> sorted = new ArrayList<>();
for (CompletionProposalCategory category : fCategories) {
if (category.isSeparateCommand()
&& category.hasComputers(fPartition))
@@ -608,12 +610,10 @@
}
private String createIterationMessage() {
- return Messages
- .format(
- ScriptTextMessages.ContentAssistProcessor_toggle_affordance_update_message,
- new String[] { getCategoryLabel(fRepetition),
- fIterationGesture,
- getCategoryLabel(fRepetition + 1) });
+ return Messages.format(
+ ScriptTextMessages.ContentAssistProcessor_toggle_affordance_update_message,
+ new String[] { getCategoryLabel(fRepetition), fIterationGesture,
+ getCategoryLabel(fRepetition + 1) });
}
private String getCategoryLabel(int repetition) {
@@ -629,18 +629,17 @@
private String getIterationGesture() {
TriggerSequence binding = getIterationBinding();
- return binding != null ? Messages
- .format(
- ScriptTextMessages.ContentAssistProcessor_toggle_affordance_press_gesture,
- new Object[] { binding.format() })
+ return binding != null ? Messages.format(
+ ScriptTextMessages.ContentAssistProcessor_toggle_affordance_press_gesture,
+ new Object[] { binding.format() })
: ScriptTextMessages.ContentAssistProcessor_toggle_affordance_click_gesture;
}
private KeySequence getIterationBinding() {
- final IBindingService bindingSvc = PlatformUI
- .getWorkbench().getAdapter(IBindingService.class);
- TriggerSequence binding = bindingSvc
- .getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ final IBindingService bindingSvc = PlatformUI.getWorkbench()
+ .getAdapter(IBindingService.class);
+ TriggerSequence binding = bindingSvc.getBestActiveBindingFor(
+ ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if (binding instanceof KeySequence)
return (KeySequence) binding;
return null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ProposalSorterRegistry.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ProposalSorterRegistry.java
index c5aa8e6..185784e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ProposalSorterRegistry.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ProposalSorterRegistry.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* 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
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.text.completion;
@@ -30,14 +29,16 @@
import org.eclipse.jface.preference.IPreferenceStore;
public final class ProposalSorterRegistry {
- private static final String EXTENSION_POINT= "scriptCompletionProposalSorters"; //$NON-NLS-1$
- private static final String DEFAULT_ID= "org.eclipse.dltk.ui.RelevanceSorter"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT = "scriptCompletionProposalSorters"; //$NON-NLS-1$
+ private static final String DEFAULT_ID = "org.eclipse.dltk.ui.RelevanceSorter"; //$NON-NLS-1$
private static ProposalSorterRegistry fInstance;
public static synchronized ProposalSorterRegistry getDefault() {
if (fInstance == null)
- fInstance= new ProposalSorterRegistry(DLTKUIPlugin.getDefault().getPreferenceStore(), PreferenceConstants.CODEASSIST_SORTER);
+ fInstance = new ProposalSorterRegistry(
+ DLTKUIPlugin.getDefault().getPreferenceStore(),
+ PreferenceConstants.CODEASSIST_SORTER);
return fInstance;
}
@@ -47,16 +48,17 @@
private Map<String, ProposalSorterHandle> fSorters = null;
private ProposalSorterHandle fDefaultSorter;
- private ProposalSorterRegistry(final IPreferenceStore preferenceStore, final String key) {
+ private ProposalSorterRegistry(final IPreferenceStore preferenceStore,
+ final String key) {
Assert.isTrue(preferenceStore != null);
Assert.isTrue(key != null);
- fPreferenceStore= preferenceStore;
- fKey= key;
+ fPreferenceStore = preferenceStore;
+ fKey = key;
}
public ProposalSorterHandle getCurrentSorter() {
ensureSortersRead();
- String id= fPreferenceStore.getString(fKey);
+ String id = fPreferenceStore.getString(fKey);
ProposalSorterHandle sorter = fSorters.get(id);
return sorter != null ? sorter : fDefaultSorter;
}
@@ -65,43 +67,47 @@
if (fSorters != null)
return;
- Map<String, ProposalSorterHandle> sorters = new LinkedHashMap<String, ProposalSorterHandle>();
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- List<IConfigurationElement> elements = new ArrayList<IConfigurationElement>(
+ Map<String, ProposalSorterHandle> sorters = new LinkedHashMap<>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ List<IConfigurationElement> elements = new ArrayList<>(
Arrays.asList(registry.getConfigurationElementsFor(
DLTKUIPlugin.PLUGIN_ID, EXTENSION_POINT)));
for (IConfigurationElement element : elements) {
-
+
try {
-
- ProposalSorterHandle handle= new ProposalSorterHandle(element);
- final String id= handle.getId();
+
+ ProposalSorterHandle handle = new ProposalSorterHandle(element);
+ final String id = handle.getId();
sorters.put(id, handle);
if (DEFAULT_ID.equals(id))
- fDefaultSorter= handle;
+ fDefaultSorter = handle;
} catch (InvalidRegistryObjectException x) {
/*
- * Element is not valid any longer as the contributing plug-in was unloaded or for
- * some other reason. Do not include the extension in the list and inform the user
- * about it.
+ * Element is not valid any longer as the contributing plug-in
+ * was unloaded or for some other reason. Do not include the
+ * extension in the list and inform the user about it.
*/
- Object[] args= { element.toString() };
- String message= Messages.format(ScriptTextMessages.CompletionProposalComputerRegistry_invalid_message, args);
- IStatus status= new Status(IStatus.WARNING, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, message, x);
+ Object[] args = { element.toString() };
+ String message = Messages.format(
+ ScriptTextMessages.CompletionProposalComputerRegistry_invalid_message,
+ args);
+ IStatus status = new Status(IStatus.WARNING,
+ DLTKUIPlugin.PLUGIN_ID, IStatus.OK, message, x);
informUser(status);
}
}
-
- fSorters= sorters;
+
+ fSorters = sorters;
}
private void informUser(IStatus status) {
DLTKUIPlugin.log(status);
- String title= ScriptTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
- String message= status.getMessage();
- MessageDialog.openError(DLTKUIPlugin.getActiveWorkbenchShell(), title, message);
+ String title = ScriptTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
+ String message = status.getMessage();
+ MessageDialog.openError(DLTKUIPlugin.getActiveWorkbenchShell(), title,
+ message);
}
public ProposalSorterHandle[] getSorters() {
@@ -112,8 +118,8 @@
public void select(ProposalSorterHandle handle) {
Assert.isTrue(handle != null);
- String id= handle.getId();
-
+ String id = handle.getId();
+
fPreferenceStore.setValue(fKey, id);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ReplacementBuffer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ReplacementBuffer.java
index a76beff..e4d067c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ReplacementBuffer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ReplacementBuffer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 NumberFour AG
+ * Copyright (c) 2011, 2017 NumberFour AG and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -30,7 +30,7 @@
}
}
- final List<Argument> arguments = new ArrayList<Argument>();
+ final List<Argument> arguments = new ArrayList<>();
@Deprecated
public void addArgument(int offset, int length) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalCollector.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalCollector.java
index 64c6eff..eb183ef 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalCollector.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalCollector.java
@@ -69,8 +69,8 @@
*
*
*/
-public abstract class ScriptCompletionProposalCollector extends
- CompletionRequestor implements ICompletionRequestorExtension {
+public abstract class ScriptCompletionProposalCollector
+ extends CompletionRequestor implements ICompletionRequestorExtension {
/**
* Intermediate attribute of {@link CompletionProposal} used to limit the
* number of displayed method parameters.
@@ -81,7 +81,8 @@
+ "CompletionProposal#ParameterLimit";
/** Tells whether this class is in debug mode. */
- private static final boolean DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.dltk.ui/debug/ResultCollector")); //$NON-NLS-1$//$NON-NLS-2$
+ private static final boolean DEBUG = "true".equalsIgnoreCase(Platform //$NON-NLS-1$
+ .getDebugOption("org.eclipse.dltk.ui/debug/ResultCollector")); //$NON-NLS-1$
/** Triggers for method proposals without parameters. Do not modify. */
/** Triggers for variables. Do not modify. */
@@ -90,13 +91,13 @@
private final ImageDescriptorRegistry fRegistry = DLTKUIPlugin
.getImageDescriptorRegistry();
- private final List<IScriptCompletionProposal> fScriptProposals = new ArrayList<IScriptCompletionProposal>();
+ private final List<IScriptCompletionProposal> fScriptProposals = new ArrayList<>();
- private final List<CompletionProposal> fUnprocessedCompletionProposals = new ArrayList<CompletionProposal>();
+ private final List<CompletionProposal> fUnprocessedCompletionProposals = new ArrayList<>();
- private final List<IScriptCompletionProposal> fKeywords = new ArrayList<IScriptCompletionProposal>();
+ private final List<IScriptCompletionProposal> fKeywords = new ArrayList<>();
- private final Set<String> fSuggestedMethodNames = new HashSet<String>();
+ private final Set<String> fSuggestedMethodNames = new HashSet<>();
private final ISourceModule fSourceModule;
@@ -188,7 +189,8 @@
*/
public final ScriptContentAssistInvocationContext getInvocationContext() {
if (fInvocationContext == null) {
- setInvocationContext(createScriptContentAssistInvocationContext(getSourceModule()));
+ setInvocationContext(createScriptContentAssistInvocationContext(
+ getSourceModule()));
}
return fInvocationContext;
@@ -204,8 +206,7 @@
* {@inheritDoc}
* <p>
* Subclasses may replace, but usually should not need to. Consider
- * replacing
- * {@linkplain #createScriptCompletionProposal(CompletionProposal)
+ * replacing {@linkplain #createScriptCompletionProposal(CompletionProposal)
* createScriptCompletionProposal} instead.
* </p>
*/
@@ -280,8 +281,8 @@
*/
public final IScriptCompletionProposal[] getScriptCompletionProposals() {
processUnprocessedProposals();
- return fScriptProposals
- .toArray(new IScriptCompletionProposal[fScriptProposals.size()]);
+ return fScriptProposals.toArray(
+ new IScriptCompletionProposal[fScriptProposals.size()]);
}
private void processUnprocessedProposals() {
@@ -302,12 +303,11 @@
// all signature processing method may throw IAEs
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84657
// don't abort, but log and show all the valid proposals
- DLTKUIPlugin
- .log(new Status(
- IStatus.ERROR,
- DLTKUIPlugin.getPluginId(),
- IStatus.OK,
- "Exception when processing proposal for: " + String.valueOf(proposal.getCompletion()), e)); //$NON-NLS-1$
+ DLTKUIPlugin.log(new Status(IStatus.ERROR,
+ DLTKUIPlugin.getPluginId(), IStatus.OK,
+ "Exception when processing proposal for: " //$NON-NLS-1$
+ + String.valueOf(proposal.getCompletion()),
+ e));
}
}
@@ -318,20 +318,24 @@
}
protected void processUnprocessedProposal(CompletionProposal proposal) {
- if (proposal.getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION) {
+ if (proposal
+ .getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION) {
acceptPotentialMethodDeclaration(proposal);
} else {
if (proposal.getKind() == CompletionProposal.METHOD_REF
&& !isContextInformationMode()) {
final String[] params = proposal.findParameterNames(null);
final Integer requiredParamCount = (Integer) proposal
- .getAttribute(CompletionProposal.ATTR_REQUIRED_PARAM_COUNT);
+ .getAttribute(
+ CompletionProposal.ATTR_REQUIRED_PARAM_COUNT);
if (params != null && requiredParamCount != null
&& params.length > requiredParamCount.intValue()) {
- for (int i = requiredParamCount.intValue(); i <= params.length; ++i) {
+ for (int i = requiredParamCount
+ .intValue(); i <= params.length; ++i) {
final CompletionProposal copy = proposal.clone();
copy.setAttribute(ATTR_PARAM_LIMIT, i);
- final IScriptCompletionProposal scriptProposal = createScriptCompletionProposal(copy);
+ final IScriptCompletionProposal scriptProposal = createScriptCompletionProposal(
+ copy);
if (scriptProposal != null) {
addProposal(scriptProposal, copy);
}
@@ -339,7 +343,8 @@
return;
}
}
- final IScriptCompletionProposal scriptProposal = createScriptCompletionProposal(proposal);
+ final IScriptCompletionProposal scriptProposal = createScriptCompletionProposal(
+ proposal);
if (scriptProposal != null) {
addProposal(scriptProposal, proposal);
}
@@ -457,8 +462,8 @@
return createPackageProposal(proposal);
case CompletionProposal.TYPE_REF:
return createTypeProposal(proposal);
- // case CompletionProposal.JAVADOC_TYPE_REF:
- // return createJavadocLinkTypeProposal(proposal);
+ // case CompletionProposal.JAVADOC_TYPE_REF:
+ // return createJavadocLinkTypeProposal(proposal);
case CompletionProposal.FIELD_REF:
// case CompletionProposal.JAVADOC_FIELD_REF:
// case CompletionProposal.JAVADOC_VALUE_REF:
@@ -474,18 +479,18 @@
case CompletionProposal.LOCAL_VARIABLE_REF:
case CompletionProposal.VARIABLE_DECLARATION:
return createLocalVariableProposal(proposal);
- // case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
- // return createAnnotationAttributeReferenceProposal(proposal);
- // case CompletionProposal.JAVADOC_BLOCK_TAG:
- // case CompletionProposal.JAVADOC_PARAM_REF:
- // return createJavadocSimpleProposal(proposal);
- // case CompletionProposal.JAVADOC_INLINE_TAG:
- // return createJavadocInlineTagProposal(proposal);
+ // case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
+ // return createAnnotationAttributeReferenceProposal(proposal);
+ // case CompletionProposal.JAVADOC_BLOCK_TAG:
+ // case CompletionProposal.JAVADOC_PARAM_REF:
+ // return createJavadocSimpleProposal(proposal);
+ // case CompletionProposal.JAVADOC_INLINE_TAG:
+ // return createJavadocInlineTagProposal(proposal);
case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
default:
return new ScriptCompletionProposal(proposal.getCompletion(),
- proposal.getReplaceStart(), proposal.getReplaceEnd()
- - proposal.getReplaceStart(), null,
+ proposal.getReplaceStart(),
+ proposal.getReplaceEnd() - proposal.getReplaceStart(), null,
proposal.getName(), proposal.getRelevance());
}
}
@@ -501,7 +506,8 @@
*/
protected final IContextInformation createMethodContextInformation(
CompletionProposal methodProposal) {
- Assert.isTrue(methodProposal.getKind() == CompletionProposal.METHOD_REF);
+ Assert.isTrue(
+ methodProposal.getKind() == CompletionProposal.METHOD_REF);
return new ProposalContextInformation(methodProposal);
}
@@ -606,8 +612,8 @@
// int completionEnd = proposal.getReplaceEnd();
// int relevance = computeRelevance(proposal);
try {
- IModelElement element = fSourceModule.getElementAt(proposal
- .getCompletionLocation());
+ IModelElement element = fSourceModule
+ .getElementAt(proposal.getCompletionLocation());
if (element != null) {
IType type = (IType) element.getAncestor(IModelElement.TYPE);
if (type != null) {
@@ -619,8 +625,8 @@
// completionStart, completionEnd - completionStart,
// relevance, fSuggestedMethodNames, fJavaProposals);
if (DLTKCore.DEBUG) {
- System.out
- .println("TODO: Add method completion proposal support here..."); //$NON-NLS-1$
+ System.out.println(
+ "TODO: Add method completion proposal support here..."); //$NON-NLS-1$
}
}
}
@@ -703,8 +709,8 @@
ScriptCompletionProposal scriptProposal;
CompletionProposalLabelProvider labelProvider = getLabelProvider();
- Image image = getImage(getLabelProvider().createFieldImageDescriptor(
- proposal));
+ Image image = getImage(
+ getLabelProvider().createFieldImageDescriptor(proposal));
if (labelProvider instanceof ICompletionProposalLabelProviderExtension) {
@@ -720,8 +726,8 @@
}
if (fScriptProject != null)
- scriptProposal.setProposalInfo(new FieldProposalInfo(
- fScriptProject, proposal));
+ scriptProposal.setProposalInfo(
+ new FieldProposalInfo(fScriptProject, proposal));
scriptProposal.setTriggerCharacters(getVarTrigger());
return scriptProposal;
}
@@ -736,8 +742,8 @@
ScriptCompletionProposal scriptProposal;
CompletionProposalLabelProvider labelProvider = getLabelProvider();
- Image image = getImage(getLabelProvider().createImageDescriptor(
- proposal));
+ Image image = getImage(
+ getLabelProvider().createImageDescriptor(proposal));
if (labelProvider instanceof ICompletionProposalLabelProviderExtension) {
@@ -752,8 +758,8 @@
}
if (fScriptProject != null) {
- scriptProposal.setProposalInfo(new ProposalInfo(fScriptProject,
- proposal.getName()));
+ scriptProposal.setProposalInfo(
+ new ProposalInfo(fScriptProject, proposal.getName()));
}
return scriptProposal;
@@ -769,8 +775,8 @@
ScriptCompletionProposal scriptProposal;
CompletionProposalLabelProvider labelProvider = getLabelProvider();
- Image image = getImage(getLabelProvider().createImageDescriptor(
- proposal));
+ Image image = getImage(
+ getLabelProvider().createImageDescriptor(proposal));
if (labelProvider instanceof ICompletionProposalLabelProviderExtension) {
@@ -822,8 +828,8 @@
ScriptCompletionProposal scriptProposal;
CompletionProposalLabelProvider labelProvider = getLabelProvider();
- Image image = getImage(getLabelProvider().createLocalImageDescriptor(
- proposal));
+ Image image = getImage(
+ getLabelProvider().createLocalImageDescriptor(proposal));
if (labelProvider instanceof ICompletionProposalLabelProviderExtension) {
@@ -832,8 +838,8 @@
scriptProposal = createScriptCompletionProposal(completion, start,
length, image, label, relevance, false);
} else {
- String label = getLabelProvider().createSimpleLabelWithType(
- proposal);
+ String label = getLabelProvider()
+ .createSimpleLabelWithType(proposal);
scriptProposal = createScriptCompletionProposal(completion, start,
length, image, label, relevance, false);
}
@@ -882,8 +888,8 @@
if (scriptProposal == null)
return null;
- scriptProposal.setImage(getImage(getLabelProvider()
- .createMethodImageDescriptor(proposal)));
+ scriptProposal.setImage(getImage(
+ getLabelProvider().createMethodImageDescriptor(proposal)));
ProposalInfo info = new MethodProposalInfo(fScriptProject, proposal);
scriptProposal.setProposalInfo(info);
@@ -895,7 +901,8 @@
private IScriptCompletionProposal createMethodReferenceProposal0(
CompletionProposal methodProposal) {
- IScriptCompletionProposal proposal = createMethodReferenceProposal(methodProposal);
+ IScriptCompletionProposal proposal = createMethodReferenceProposal(
+ methodProposal);
if (proposal instanceof AbstractScriptCompletionProposal) {
adaptLength((AbstractScriptCompletionProposal) proposal,
methodProposal);
@@ -927,8 +934,8 @@
ScriptCompletionProposal scriptProposal;
CompletionProposalLabelProvider labelProvider = getLabelProvider();
- Image image = getImage(getLabelProvider().createTypeImageDescriptor(
- proposal));
+ Image image = getImage(
+ getLabelProvider().createTypeImageDescriptor(proposal));
if (labelProvider instanceof ICompletionProposalLabelProviderExtension) {
@@ -941,8 +948,8 @@
scriptProposal = createScriptCompletionProposal(completion, start,
length, image, label, relevance, false);
}
- scriptProposal.setProposalInfo(new TypeProposalInfo(fScriptProject,
- proposal));
+ scriptProposal.setProposalInfo(
+ new TypeProposalInfo(fScriptProject, proposal));
return scriptProposal;
}
@@ -983,7 +990,7 @@
}
} else {
if (attributes == null) {
- attributes = new HashMap<Object, Object>();
+ attributes = new HashMap<>();
}
attributes.put(key, value);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalComputer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalComputer.java
index 75b318c..01bd957 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalComputer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptCompletionProposalComputer.java
@@ -34,17 +34,18 @@
/**
* Computes Script completion proposals and context infos.
*/
-public abstract class ScriptCompletionProposalComputer extends
- AbstractScriptCompletionProposalComputer implements
- IScriptCompletionProposalComputer {
+public abstract class ScriptCompletionProposalComputer
+ extends AbstractScriptCompletionProposalComputer
+ implements IScriptCompletionProposalComputer {
- private static final class ContextInformationWrapper implements
- IContextInformation, IContextInformationExtension {
+ private static final class ContextInformationWrapper
+ implements IContextInformation, IContextInformationExtension {
private final IContextInformation fContextInformation;
private int fPosition;
- public ContextInformationWrapper(IContextInformation contextInformation) {
+ public ContextInformationWrapper(
+ IContextInformation contextInformation) {
fContextInformation = contextInformation;
}
@@ -75,8 +76,8 @@
@Override
public boolean equals(Object object) {
if (object instanceof ContextInformationWrapper)
- return fContextInformation
- .equals(((ContextInformationWrapper) object).fContextInformation);
+ return fContextInformation.equals(
+ ((ContextInformationWrapper) object).fContextInformation);
else
return fContextInformation.equals(object);
}
@@ -89,8 +90,7 @@
IProgressMonitor monitor) {
List<ICompletionProposal> proposals = computeScriptCompletionProposals(
offset, context, monitor);
- List<IContextInformation> result = new ArrayList<IContextInformation>(
- proposals.size());
+ List<IContextInformation> result = new ArrayList<>(proposals.size());
for (ICompletionProposal proposal : proposals) {
IContextInformation contextInformation = proposal
@@ -113,32 +113,29 @@
&& !module.getScriptProject().isOnBuildpath(module)) {
IPreferenceStore store = DLTKUIPlugin.getDefault()
.getPreferenceStore();
- boolean value = store
- .getBoolean(PreferenceConstants.NOTIFICATION_NOT_ON_BUILDPATH_MESSAGE);
+ boolean value = store.getBoolean(
+ PreferenceConstants.NOTIFICATION_NOT_ON_BUILDPATH_MESSAGE);
if (!value) {
- MessageDialog
- .openInformation(
- shell,
- ScriptTextMessages.CompletionProcessor_error_notOnBuildPath_title,
- ScriptTextMessages.CompletionProcessor_error_notOnBuildPath_message);
+ MessageDialog.openInformation(shell,
+ ScriptTextMessages.CompletionProcessor_error_notOnBuildPath_title,
+ ScriptTextMessages.CompletionProcessor_error_notOnBuildPath_message);
}
store.setValue(
PreferenceConstants.NOTIFICATION_NOT_ON_BUILDPATH_MESSAGE,
true);
} else
- ErrorDialog
- .openError(
- shell,
- ScriptTextMessages.CompletionProcessor_error_accessing_title,
- ScriptTextMessages.CompletionProcessor_error_accessing_message,
- e.getStatus());
+ ErrorDialog.openError(shell,
+ ScriptTextMessages.CompletionProcessor_error_accessing_title,
+ ScriptTextMessages.CompletionProcessor_error_accessing_message,
+ e.getStatus());
}
// Code template completion proposals for script language
protected List<ICompletionProposal> computeTemplateCompletionProposals(
int offset, ScriptContentAssistInvocationContext context,
IProgressMonitor monitor) {
- TemplateCompletionProcessor templateProcessor = createTemplateProposalComputer(context);
+ TemplateCompletionProcessor templateProcessor = createTemplateProposalComputer(
+ context);
if (templateProcessor != null) {
ICompletionProposal[] proposals = templateProcessor
.computeCompletionProposals(context.getViewer(), offset);
@@ -238,7 +235,7 @@
if (context instanceof ScriptContentAssistInvocationContext) {
ScriptContentAssistInvocationContext scriptContext = (ScriptContentAssistInvocationContext) context;
- List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+ List<ICompletionProposal> proposals = new ArrayList<>();
// Language specific proposals (already sorted and etc.)
proposals.addAll(computeScriptCompletionProposals(
@@ -266,7 +263,8 @@
if (context instanceof ScriptContentAssistInvocationContext) {
ScriptContentAssistInvocationContext scriptContext = (ScriptContentAssistInvocationContext) context;
- int contextInformationPosition = guessContextInformationPosition(scriptContext);
+ int contextInformationPosition = guessContextInformationPosition(
+ scriptContext);
List<IContextInformation> result = addContextInformations(
scriptContext, contextInformationPosition, monitor);
return result;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTemplateCompletionProposalComputer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTemplateCompletionProposalComputer.java
index d3a5166..a427821 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTemplateCompletionProposalComputer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/completion/ScriptTemplateCompletionProposalComputer.java
@@ -28,9 +28,9 @@
*
* @since 4.1
*/
-public abstract class ScriptTemplateCompletionProposalComputer extends
- AbstractScriptCompletionProposalComputer implements
- IScriptCompletionProposalComputer {
+public abstract class ScriptTemplateCompletionProposalComputer
+ extends AbstractScriptCompletionProposalComputer
+ implements IScriptCompletionProposalComputer {
@Override
public List<ICompletionProposal> computeCompletionProposals(
@@ -43,7 +43,8 @@
// if (unit == null)
// return Collections.emptyList();
- final TemplateCompletionProcessor processor = createCompletionProcessor(scriptContext);
+ final TemplateCompletionProcessor processor = createCompletionProcessor(
+ scriptContext);
if (processor == null)
return Collections.emptyList();
@@ -51,7 +52,7 @@
.computeCompletionProposals(scriptContext.getViewer(),
scriptContext.getInvocationOffset());
updateTemplateProposalRelevance(scriptContext, templateProposals);
- final List<ICompletionProposal> result = new ArrayList<ICompletionProposal>(
+ final List<ICompletionProposal> result = new ArrayList<>(
templateProposals.length);
Collections.addAll(result, templateProposals);
return result;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
index edcb8ac..8ba4cf4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
@@ -90,7 +90,7 @@
private final ProjectionAnnotationModel fModel;
private final IDocument fDocument;
private final boolean fAllowCollapsing;
- protected LinkedHashMap<Annotation, Position> fMap = new LinkedHashMap<Annotation, Position>();
+ protected LinkedHashMap<Annotation, Position> fMap = new LinkedHashMap<>();
public FoldingStructureComputationContext(IDocument document,
ProjectionAnnotationModel model, boolean allowCollapsing) {
@@ -726,9 +726,9 @@
private void update(FoldingStructureComputationContext ctx) {
if (ctx == null)
return;
- Map<Annotation, Position> additions = new HashMap<Annotation, Position>();
- List<Annotation> deletions = new ArrayList<Annotation>();
- List<Annotation> updates = new ArrayList<Annotation>();
+ Map<Annotation, Position> additions = new HashMap<>();
+ List<Annotation> deletions = new ArrayList<>();
+ List<Annotation> updates = new ArrayList<>();
if (!computeFoldingStructure(ctx)) {
return;
}
@@ -1138,7 +1138,7 @@
private Map<SourceRangeStamp, List<Tuple>> computeCurrentStructure(
FoldingStructureComputationContext ctx) {
- Map<SourceRangeStamp, List<Tuple>> map = new HashMap<SourceRangeStamp, List<Tuple>>();
+ Map<SourceRangeStamp, List<Tuple>> map = new HashMap<>();
ProjectionAnnotationModel model = ctx.getModel();
Iterator<Annotation> e = model.getAnnotationIterator();
while (e.hasNext()) {
@@ -1148,7 +1148,7 @@
Position position = model.getPosition(ann);
List<Tuple> list = map.get(ann.getStamp());
if (list == null) {
- list = new ArrayList<Tuple>(2);
+ list = new ArrayList<>(2);
map.put(ann.getStamp(), list);
}
list.add(new Tuple(ann, position));
@@ -1189,7 +1189,7 @@
ProjectionAnnotationModel model = getModel();
if (model == null)
return;
- List<Annotation> modified = new ArrayList<Annotation>();
+ List<Annotation> modified = new ArrayList<>();
Iterator<Annotation> iter = model.getAnnotationIterator();
while (iter.hasNext()) {
Annotation annotation = iter.next();
@@ -1229,7 +1229,7 @@
}
protected static class FoldingASTVisitor extends ASTVisitor {
- private final List<CodeBlock> result = new ArrayList<CodeBlock>();
+ private final List<CodeBlock> result = new ArrayList<>();
private final int offset;
protected FoldingASTVisitor(int offset) {
@@ -1472,7 +1472,7 @@
return new IRegion[0];
Document d = new Document(contents);
installDocumentStuff(d);
- List<ITypedRegion> docRegionList = new ArrayList<ITypedRegion>();
+ List<ITypedRegion> docRegionList = new ArrayList<>();
int offset = 0;
for (;;) {
try {
@@ -1485,7 +1485,7 @@
}
ITypedRegion start = null;
ITypedRegion lastRegion = null;
- List<IRegion> regions = new ArrayList<IRegion>();
+ List<IRegion> regions = new ArrayList<>();
for (ITypedRegion region : docRegionList) {
if (region.getType().equals(partition)
&& startsAtLineBegin(d, region)) {
@@ -1562,7 +1562,7 @@
}
public static class MethodCollector implements IModelElementVisitor {
- private final Map<SourceRange, IModelElement> methodByNameRange = new HashMap<SourceRange, IModelElement>();
+ private final Map<SourceRange, IModelElement> methodByNameRange = new HashMap<>();
@Override
public boolean visit(IModelElement element) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractContributedFoldingPreferenceBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractContributedFoldingPreferenceBlock.java
index 278383c..0e4f985 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractContributedFoldingPreferenceBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractContributedFoldingPreferenceBlock.java
@@ -29,8 +29,8 @@
@Override
public Control createControl(Composite parent) {
- Composite composite = SWTFactory.createComposite(parent, parent
- .getFont(), 1, 1, GridData.FILL);
+ Composite composite = SWTFactory.createComposite(parent,
+ parent.getFont(), 1, 1, GridData.FILL);
createOptionsControl(composite);
@@ -69,7 +69,7 @@
@Override
protected final List<OverlayKey> createOverlayKeys() {
- ArrayList<OverlayKey> keys = new ArrayList<OverlayKey>();
+ ArrayList<OverlayKey> keys = new ArrayList<>();
addOverlayKeys(keys);
return keys;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DefaultFoldingPreferenceConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DefaultFoldingPreferenceConfigurationBlock.java
index dc20590..1e95912 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DefaultFoldingPreferenceConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DefaultFoldingPreferenceConfigurationBlock.java
@@ -29,8 +29,8 @@
/**
*/
-public class DefaultFoldingPreferenceConfigurationBlock extends
- ImprovedAbstractConfigurationBlock {
+public class DefaultFoldingPreferenceConfigurationBlock
+ extends ImprovedAbstractConfigurationBlock {
private static int DEFAULT_MIN_LINES = 2;
@@ -49,8 +49,8 @@
@Override
public Control createControl(Composite parent) {
- Composite composite = SWTFactory.createComposite(parent, parent
- .getFont(), 1, 1, GridData.FILL_BOTH);
+ Composite composite = SWTFactory.createComposite(parent,
+ parent.getFont(), 1, 1, GridData.FILL_BOTH);
Button enableFolding = SWTFactory.createCheckButton(composite,
PreferencesMessages.FoldingConfigurationBlock_enable);
@@ -66,14 +66,14 @@
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
TabItem comments = new TabItem(tabFolder, SWT.NONE);
- comments
- .setText(PreferencesMessages.FoldingConfigurationBlock_docTabName);
+ comments.setText(
+ PreferencesMessages.FoldingConfigurationBlock_docTabName);
comments.setControl(documentationBlock.createControl((tabFolder)));
if (sourceCodeBlock != null) {
TabItem blocks = new TabItem(tabFolder, SWT.NONE);
- blocks
- .setText(PreferencesMessages.FoldingConfigurationBlock_srcTabName);
+ blocks.setText(
+ PreferencesMessages.FoldingConfigurationBlock_srcTabName);
blocks.setControl(sourceCodeBlock.createControl(tabFolder));
}
@@ -116,7 +116,7 @@
@Override
protected List<OverlayKey> createOverlayKeys() {
- ArrayList<OverlayKey> keys = new ArrayList<OverlayKey>();
+ ArrayList<OverlayKey> keys = new ArrayList<>();
keys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
@@ -154,19 +154,15 @@
}
private void createMinLines(Composite parent) {
- Composite composite = SWTFactory.createComposite(parent, parent
- .getFont(), 2, 1, GridData.FILL);
+ Composite composite = SWTFactory.createComposite(parent,
+ parent.getFont(), 2, 1, GridData.FILL);
((GridLayout) composite.getLayout()).marginWidth = 0;
int minLines = defaultMinLines();
- SWTFactory
- .createLabel(
- composite,
- NLS
- .bind(
- PreferencesMessages.FoldingConfigurationBlock_minLinesToEnableFolding,
- Integer.valueOf(minLines)), 0, 1);
+ SWTFactory.createLabel(composite, NLS.bind(
+ PreferencesMessages.FoldingConfigurationBlock_minLinesToEnableFolding,
+ Integer.valueOf(minLines)), 0, 1);
Text textBox = SWTFactory.createText(composite, SWT.BORDER, 1,
Util.EMPTY_STRING);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java
index fecb37a..4a8cc43 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/DelegatingFoldingStructureProvider.java
@@ -68,7 +68,7 @@
private final ProjectionAnnotationModel fModel;
private final IDocument fDocument;
private final boolean fAllowCollapsing;
- protected LinkedHashMap<Annotation, Position> fMap = new LinkedHashMap<Annotation, Position>();
+ protected LinkedHashMap<Annotation, Position> fMap = new LinkedHashMap<>();
public FoldingStructureComputationContext(IDocument document,
ProjectionAnnotationModel model, boolean allowCollapsing) {
@@ -671,9 +671,9 @@
}
private void update0(FoldingStructureComputationContext ctx) {
- Map<Annotation, Position> additions = new HashMap<Annotation, Position>();
- List<Annotation> deletions = new ArrayList<Annotation>();
- List<Annotation> updates = new ArrayList<Annotation>();
+ Map<Annotation, Position> additions = new HashMap<>();
+ List<Annotation> deletions = new ArrayList<>();
+ List<Annotation> updates = new ArrayList<>();
if (!computeFoldingStructure(ctx)) {
return;
}
@@ -894,7 +894,7 @@
private Map<AnnotationKey, List<Tuple>> computeCurrentStructure(
FoldingStructureComputationContext ctx) {
- Map<AnnotationKey, List<Tuple>> map = new HashMap<AnnotationKey, List<Tuple>>();
+ Map<AnnotationKey, List<Tuple>> map = new HashMap<>();
ProjectionAnnotationModel model = ctx.getModel();
Iterator<Annotation> e = model.getAnnotationIterator();
while (e.hasNext()) {
@@ -904,7 +904,7 @@
Position position = model.getPosition(ann);
List<Tuple> list = map.get(ann.stamp);
if (list == null) {
- list = new ArrayList<Tuple>(2);
+ list = new ArrayList<>(2);
map.put(ann.stamp, list);
}
list.add(new Tuple(ann, position));
@@ -945,7 +945,7 @@
ProjectionAnnotationModel model = getModel();
if (model == null)
return;
- List<Annotation> modified = new ArrayList<Annotation>();
+ List<Annotation> modified = new ArrayList<>();
Iterator<Annotation> iter = model.getAnnotationIterator();
while (iter.hasNext()) {
Annotation annotation = iter.next();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/PartitioningFoldingBlockProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/PartitioningFoldingBlockProvider.java
index eea08da..2295c0c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/PartitioningFoldingBlockProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/PartitioningFoldingBlockProvider.java
@@ -37,8 +37,8 @@
*
* @since 2.0
*/
-public abstract class PartitioningFoldingBlockProvider implements
- IFoldingBlockProvider {
+public abstract class PartitioningFoldingBlockProvider
+ implements IFoldingBlockProvider {
private final IPartitioningProvider partitioningProvider;
@@ -61,14 +61,14 @@
.getInt(PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT);
fDocsFolding = preferenceStore
.getBoolean(PreferenceConstants.EDITOR_DOCS_FOLDING_ENABLED);
- fCommentsFolding = preferenceStore
- .getBoolean(PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED);
- fFoldNewLines = preferenceStore
- .getBoolean(PreferenceConstants.EDITOR_COMMENT_FOLDING_JOIN_NEWLINES);
+ fCommentsFolding = preferenceStore.getBoolean(
+ PreferenceConstants.EDITOR_COMMENTS_FOLDING_ENABLED);
+ fFoldNewLines = preferenceStore.getBoolean(
+ PreferenceConstants.EDITOR_COMMENT_FOLDING_JOIN_NEWLINES);
fInitCollapseComments = preferenceStore
.getBoolean(PreferenceConstants.EDITOR_FOLDING_INIT_COMMENTS);
- fInitCollapseHeaderComments = preferenceStore
- .getBoolean(PreferenceConstants.EDITOR_FOLDING_INIT_HEADER_COMMENTS);
+ fInitCollapseHeaderComments = preferenceStore.getBoolean(
+ PreferenceConstants.EDITOR_FOLDING_INIT_HEADER_COMMENTS);
fInitCollapseDocs = preferenceStore
.getBoolean(PreferenceConstants.EDITOR_FOLDING_INIT_DOCS);
}
@@ -139,7 +139,7 @@
private List<ITypedRegion> computePartitioning(Document d) {
// TODO TextUtilities.computePartitioning() ?
- List<ITypedRegion> docRegionList = new ArrayList<ITypedRegion>();
+ List<ITypedRegion> docRegionList = new ArrayList<>();
int offset = 0;
for (;;) {
try {
@@ -165,15 +165,14 @@
installDocumentStuff(document);
ITypedRegion start = null;
ITypedRegion lastRegion = null;
- List<IRegion> regions = new ArrayList<IRegion>();
+ List<IRegion> regions = new ArrayList<>();
for (ITypedRegion region : computePartitioning(document)) {
if (region.getType().equals(partition)
&& startsAtLineBegin(document, region)) {
if (start == null)
start = region;
- } else if (start != null
- && (isBlankRegion(document, region) || isEmptyRegion(
- document, region)
+ } else if (start != null && (isBlankRegion(document, region)
+ || isEmptyRegion(document, region)
&& isJoinCommentsSeparatedByEmptyLines())) {
// blanks or empty lines
// TODO introduce line limit for collapseEmptyLines() ?
@@ -183,9 +182,8 @@
int offset0 = start.getOffset();
int length0 = lastRegion.getOffset()
+ lastRegion.getLength() - offset0 - 1;
- length0 = contents
- .substring(offset0, offset0 + length0).trim()
- .length();
+ length0 = contents.substring(offset0, offset0 + length0)
+ .trim().length();
regions.add(new Region(offset0, length0));
}
start = null;
@@ -221,8 +219,9 @@
for (IRegion region : regions) {
// TODO
Object element = null;
- requestor.acceptBlock(region.getOffset(), region.getOffset()
- + region.getLength(), kind, element, collapse);
+ requestor.acceptBlock(region.getOffset(),
+ region.getOffset() + region.getLength(), kind, element,
+ collapse);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/heredoc/HereDocEnabledPartitionScanner.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/heredoc/HereDocEnabledPartitionScanner.java
index abd74c1..3e3ba30 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/heredoc/HereDocEnabledPartitionScanner.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/heredoc/HereDocEnabledPartitionScanner.java
@@ -12,169 +12,159 @@
/**
* A slightly modified version of a <code>RuleBasedPartitionScanner</code> that
* knows how to properly scan for heredoc partitions.
- *
+ *
* <p>
* There is no need to use this partition scanner if heredoc is not supported by
* the underlying dynamic language.
* </p>
- *
+ *
* <p>
* If you do use this partitioner, you <b>must</b> also use the
* <code>HereDocEnabledPartitioner</code> partitioner as it knows how to
* properly manage heredoc partitions.
* </p>
- *
+ *
* @see HereDocPartitionRule
* @see HereDocEnabledPartitioner
* @see HereDocEnabledPresentationReconciler
*/
-public class HereDocEnabledPartitionScanner extends RuleBasedPartitionScanner
-{
- private List<TokenContainer> buffer = new ArrayList<TokenContainer>();
+public class HereDocEnabledPartitionScanner extends RuleBasedPartitionScanner {
+ private List<TokenContainer> buffer = new ArrayList<>();
- private HereDocPartitionRule hereDocRule;
+ private HereDocPartitionRule hereDocRule;
- /**
- * Creates a new heredoc partition scanner
- *
- * @param rules list of predicate rules that should be used to create document partitions
- * @param hereDocRule heredoc partitioning rule
- */
- public HereDocEnabledPartitionScanner(List<IPredicateRule> rules, HereDocPartitionRule hereDocRule)
- {
- this.hereDocRule = hereDocRule;
-
- IPredicateRule[] result = new IPredicateRule[rules.size()];
- setPredicateRules(rules.toArray(result));
- }
-
- @Override public IToken nextToken()
- {
- if (HereDocUtils.isHereDocContent(fContentType))
- {
- return handleHereDoc();
- }
+ /**
+ * Creates a new heredoc partition scanner
+ *
+ * @param rules
+ * list of predicate rules that should be used to create document
+ * partitions
+ * @param hereDocRule
+ * heredoc partitioning rule
+ */
+ public HereDocEnabledPartitionScanner(List<IPredicateRule> rules,
+ HereDocPartitionRule hereDocRule) {
+ this.hereDocRule = hereDocRule;
- if (!buffer.isEmpty())
- {
- return buffer.remove(0).getToken();
- }
+ IPredicateRule[] result = new IPredicateRule[rules.size()];
+ setPredicateRules(rules.toArray(result));
+ }
- return getNextToken(false);
- }
+ @Override
+ public IToken nextToken() {
+ if (HereDocUtils.isHereDocContent(fContentType)) {
+ return handleHereDoc();
+ }
- @Override public void setPartialRange(IDocument document, int offset, int length, String contentType,
- int partitionOffset)
- {
- /*
- * clear out any tokens that may be sitting in the buffer before the 'nextToken()' is requested. this method is
- * only called if the document changes, which means the 'manual' rule should be passed all the information it
- * needs to finish it's evaluation piggy-backed off the passed content type.
- */
- buffer.clear();
- super.setPartialRange(document, offset, length, contentType, partitionOffset);
- }
+ if (!buffer.isEmpty()) {
+ return buffer.remove(0).getToken();
+ }
- private IToken evalPossibleHereDoc(boolean inScan)
- {
- // our token is going to start wherever the scanner is
- fTokenOffset = fOffset;
+ return getNextToken(false);
+ }
- IToken token = hereDocRule.evaluate(this);
+ @Override
+ public void setPartialRange(IDocument document, int offset, int length,
+ String contentType, int partitionOffset) {
+ /*
+ * clear out any tokens that may be sitting in the buffer before the
+ * 'nextToken()' is requested. this method is only called if the
+ * document changes, which means the 'manual' rule should be passed all
+ * the information it needs to finish it's evaluation piggy-backed off
+ * the passed content type.
+ */
+ buffer.clear();
+ super.setPartialRange(document, offset, length, contentType,
+ partitionOffset);
+ }
- if (token.isUndefined() || inScan)
- {
- return token;
- }
-
- buffer.add(new TokenContainer(token));
-
- int c;
- while ((c = read()) != ICharacterScanner.EOF)
- {
- unread();
-
- IToken next = getNextToken(true);
- buffer.add(new TokenContainer(next));
-
- if (c == '\n')
- {
- break;
- }
- }
-
- if (c != ICharacterScanner.EOF)
- {
- consumeHereDoc();
- }
-
- return buffer.remove(0).getToken();
- }
-
- private void consumeHereDoc()
- {
- // need to work w/ a copy otherwise we get concurrent modification exception
- for (TokenContainer container : new ArrayList<TokenContainer>(buffer))
- {
- if (HereDocUtils.isHereDocContent(container.getContentType()))
- {
- fTokenOffset = fOffset;
- fColumn = UNDEFINED;
+ private IToken evalPossibleHereDoc(boolean inScan) {
+ // our token is going to start wherever the scanner is
+ fTokenOffset = fOffset;
- IToken body = hereDocRule.evaluate(this, container.getContentType());
- buffer.add(new TokenContainer(body));
- }
- }
- }
+ IToken token = hereDocRule.evaluate(this);
- private IToken getNextToken(boolean inScan)
- {
- IToken token = evalPossibleHereDoc(inScan);
- if (token.isUndefined())
- {
- token = super.nextToken();
- }
+ if (token.isUndefined() || inScan) {
+ return token;
+ }
- return token;
- }
+ buffer.add(new TokenContainer(token));
- private IToken handleHereDoc()
- {
- // reset to partition start so we get all the characters
- fTokenOffset = fPartitionOffset;
+ int c;
+ while ((c = read()) != ICharacterScanner.EOF) {
+ unread();
- IToken token = hereDocRule.evaluate(this, fContentType);
+ IToken next = getNextToken(true);
+ buffer.add(new TokenContainer(next));
- // we found our rule, reset the contentType just like our parent would
- fContentType = null;
- return token;
- }
-
- private class TokenContainer
- {
- private int offset;
- private IToken token;
- private int tokenOffset;
+ if (c == '\n') {
+ break;
+ }
+ }
- TokenContainer(IToken token)
- {
- this.offset = fOffset;
- this.tokenOffset = fTokenOffset;
+ if (c != ICharacterScanner.EOF) {
+ consumeHereDoc();
+ }
- this.token = token;
- }
+ return buffer.remove(0).getToken();
+ }
- String getContentType()
- {
- return (String) token.getData();
- }
-
- IToken getToken()
- {
- fOffset = offset;
- fTokenOffset = tokenOffset;
+ private void consumeHereDoc() {
+ // need to work w/ a copy otherwise we get concurrent modification
+ // exception
+ for (TokenContainer container : new ArrayList<>(buffer)) {
+ if (HereDocUtils.isHereDocContent(container.getContentType())) {
+ fTokenOffset = fOffset;
+ fColumn = UNDEFINED;
- return token;
- }
- }
+ IToken body = hereDocRule.evaluate(this,
+ container.getContentType());
+ buffer.add(new TokenContainer(body));
+ }
+ }
+ }
+
+ private IToken getNextToken(boolean inScan) {
+ IToken token = evalPossibleHereDoc(inScan);
+ if (token.isUndefined()) {
+ token = super.nextToken();
+ }
+
+ return token;
+ }
+
+ private IToken handleHereDoc() {
+ // reset to partition start so we get all the characters
+ fTokenOffset = fPartitionOffset;
+
+ IToken token = hereDocRule.evaluate(this, fContentType);
+
+ // we found our rule, reset the contentType just like our parent would
+ fContentType = null;
+ return token;
+ }
+
+ private class TokenContainer {
+ private int offset;
+ private IToken token;
+ private int tokenOffset;
+
+ TokenContainer(IToken token) {
+ this.offset = fOffset;
+ this.tokenOffset = fTokenOffset;
+
+ this.token = token;
+ }
+
+ String getContentType() {
+ return (String) token.getData();
+ }
+
+ IToken getToken() {
+ fOffset = offset;
+ fTokenOffset = tokenOffset;
+
+ return token;
+ }
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/CombinedWordRule.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/CombinedWordRule.java
index 31d915f..37c46fb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/CombinedWordRule.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/CombinedWordRule.java
@@ -46,7 +46,7 @@
public static class WordMatcher {
/** The table of predefined words and token for this matcher */
- private Map<CharacterBuffer, IToken> fWords = new HashMap<CharacterBuffer, IToken>();
+ private Map<CharacterBuffer, IToken> fWords = new HashMap<>();
/**
* Adds a word and the token to be returned if it is detected.
@@ -75,7 +75,8 @@
* @return the token or <code>null</code> if none is associated by this
* matcher
*/
- public IToken evaluate(ICharacterScanner scanner, CharacterBuffer word) {
+ public IToken evaluate(ICharacterScanner scanner,
+ CharacterBuffer word) {
IToken token = fWords.get(word);
if (token != null)
return token;
@@ -244,7 +245,7 @@
private CharacterBuffer fBuffer = new CharacterBuffer(16);
/** List of word matchers */
- private List<WordMatcher> fMatchers = new ArrayList<WordMatcher>();
+ private List<WordMatcher> fMatchers = new ArrayList<>();
/**
* Creates a rule which, with the help of an word detector, will return the
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/ScriptWordRule.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/ScriptWordRule.java
index d2a0a83..65f386a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/ScriptWordRule.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/rules/ScriptWordRule.java
@@ -31,9 +31,9 @@
* </p>
*
* <p>
- * If an <code>IScriptWordDetector</code> implementation is used, the rule
- * will also check that character prior to the word start character is valid for
- * the start of the word to occur. For instance, this could be used to prevent
+ * If an <code>IScriptWordDetector</code> implementation is used, the rule will
+ * also check that character prior to the word start character is valid for the
+ * start of the word to occur. For instance, this could be used to prevent
* method names that also match builtin keywords from being hightlighted as
* such.
* </p>
@@ -56,7 +56,7 @@
/** The column constraint */
protected int fColumn = UNDEFINED;
/** The table of predefined words and token for this rule */
- protected Map<String, IToken> fWords = new HashMap<String, IToken>();
+ protected Map<String, IToken> fWords = new HashMap<>();
/** Buffer used for pattern detection */
private StringBuffer fBuffer = new StringBuffer();
@@ -64,7 +64,7 @@
private int fLastSeenEnd = 0;
private String fLastSeen = Util.EMPTY_STRING;
- private Map<String, IToken> fNext = new HashMap<String, IToken>();
+ private Map<String, IToken> fNext = new HashMap<>();
/**
* Creates a rule which, with the help of an word detector, will return the
@@ -179,7 +179,8 @@
@Override
public IToken evaluate(ICharacterScanner scanner) {
// don't unwind the scanner if we're at the beginning
- if (fDetector instanceof IScriptWordDetector && scanner.getColumn() > 0) {
+ if (fDetector instanceof IScriptWordDetector
+ && scanner.getColumn() > 0) {
scanner.unread();
int c = scanner.read();
if (!((IScriptWordDetector) fDetector).isPriorCharValid((char) c)) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/spelling/SpellCheckDelegate.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/spelling/SpellCheckDelegate.java
index a3d649a..5902336 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/spelling/SpellCheckDelegate.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/spelling/SpellCheckDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 NumberFour AG
+ * Copyright (c) 2011, 2017 NumberFour AG and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -30,12 +30,12 @@
}
}
- private final Set<String> ignoredContentTypes = new HashSet<String>();
+ private final Set<String> ignoredContentTypes = new HashSet<>();
/**
* returns the (sub-)regions to be checked in the specified partition or
* <code>null</code> if partition shouldn't be checked at all.
- *
+ *
* @param partition
* @return
*/
@@ -49,7 +49,7 @@
/**
* Returns the specified region as array of the length 1
- *
+ *
* @param region
* @return
*/
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/ProjectTemplateStore.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/ProjectTemplateStore.java
index 935a7e9..ea186be 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/ProjectTemplateStore.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/ProjectTemplateStore.java
@@ -35,7 +35,8 @@
private final TemplateStore fInstanceStore;
private final TemplateStore fProjectStore;
- public ProjectTemplateStore(ITemplateAccess templateAccess, IProject project) {
+ public ProjectTemplateStore(ITemplateAccess templateAccess,
+ IProject project) {
this.fTemplateAccess = templateAccess;
this.fInstanceStore = templateAccess.getTemplateStore();
if (project == null
@@ -89,9 +90,9 @@
return false;
}
final ITemplateAccessInternal internal = (ITemplateAccessInternal) fTemplateAccess;
- final String pref = new ProjectScope(project).getNode(
- internal.getPreferenceQualifier()).get(
- internal.getPreferenceKey(), null);
+ final String pref = new ProjectScope(project)
+ .getNode(internal.getPreferenceQualifier())
+ .get(internal.getPreferenceKey(), null);
if (pref != null && pref.trim().length() > 0) {
Reader input = new StringReader(pref);
TemplateReaderWriter reader = new TemplateReaderWriter();
@@ -128,7 +129,7 @@
if (fProjectStore != null) {
fProjectStore.load();
- Set<String> datas = new HashSet<String>();
+ Set<String> datas = new HashSet<>();
TemplatePersistenceData[] data = fProjectStore
.getTemplateData(false);
for (int i = 0; i < data.length; i++) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
index 136d531..d4e4995 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 xored software, Inc.
+ * Copyright (c) 2009, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -60,7 +60,7 @@
if (fContextType == null)
return null;
- List<TemplateVariableProposal> proposals = new ArrayList<TemplateVariableProposal>();
+ List<TemplateVariableProposal> proposals = new ArrayList<>();
String text = viewer.getDocument().get();
int start = getStart(text, documentOffset);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/util/TabStyle.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/util/TabStyle.java
index 1ea64c8..a310972 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/util/TabStyle.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/util/TabStyle.java
@@ -36,7 +36,7 @@
return name;
}
- private static final Map<String, TabStyle> byName = new HashMap<String, TabStyle>();
+ private static final Map<String, TabStyle> byName = new HashMap<>();
static {
byName.put(TAB.getName(), TAB);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/CodeGeneration.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/CodeGeneration.java
index f351eac..a1aed99 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/CodeGeneration.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/CodeGeneration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -46,7 +46,8 @@
public class CodeGeneration {
public static String evaluateTemplate(TemplateContext context,
- Template template, String[] fullLineVariables) throws CoreException {
+ Template template, String[] fullLineVariables)
+ throws CoreException {
TemplateBuffer buffer;
try {
buffer = context.evaluate(template);
@@ -66,12 +67,12 @@
// remove lines for empty variables, prefix multi-line variables
private static String fixFullLineVariables(TemplateBuffer buffer,
- String[] variables) throws MalformedTreeException,
- BadLocationException {
+ String[] variables)
+ throws MalformedTreeException, BadLocationException {
IDocument doc = new Document(buffer.getString());
int nLines = doc.getNumberOfLines();
MultiTextEdit edit = new MultiTextEdit();
- Set<Integer> removedLines = new HashSet<Integer>();
+ Set<Integer> removedLines = new HashSet<>();
for (int i = 0; i < variables.length; i++) {
TemplateVariable position = findVariable(buffer, variables[i]);
if (position == null) {
@@ -84,14 +85,16 @@
try {
int startLine = doc.getLineOfOffset(offset);
int startOffset = doc.getLineOffset(startLine);
- int endLine = doc.getLineOfOffset(offset
- + position.getLength());
- String prefix = doc.get(startOffset, offset
- - startOffset);
+ int endLine = doc
+ .getLineOfOffset(offset + position.getLength());
+ String prefix = doc.get(startOffset,
+ offset - startOffset);
if (prefix.length() > 0 && startLine < endLine) {
- for (int line = startLine + 1; line <= endLine; ++line) {
+ for (int line = startLine
+ + 1; line <= endLine; ++line) {
int lineOffset = doc.getLineOffset(line);
- edit.addChild(new InsertEdit(lineOffset, prefix));
+ edit.addChild(
+ new InsertEdit(lineOffset, prefix));
}
}
} catch (BadLocationException exc) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java
index e776a90..1747cf6 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/util/ElementValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* 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
@@ -26,7 +26,7 @@
/**
* Helper class to check if a set of <tt>IJavaElement</tt> objects can be
* modified by an operation.
- *
+ *
* @since 2.1
*/
public class ElementValidator {
@@ -37,7 +37,7 @@
/**
* Checks if the given element is in sync with the underlying file system.
- *
+ *
* @param element
* the element to be checked
* @param parent
@@ -57,7 +57,7 @@
/**
* Checks if the given array of elements is in sync with the underlying file
* system.
- *
+ *
* @param elements
* the array of elements to be checked
* @param parent
@@ -80,7 +80,7 @@
* <code>validateEdit</code> was able to make the file writable the method
* additionally checks if the file has been changed by calling
* <code>validateEdit</code>.
- *
+ *
* @param element
* the element to be checked
* @param parent
@@ -92,13 +92,14 @@
* @return boolean <code>true</code> if the element is writable and its
* content didn't change by calling <code>validateEdit</code>.
* Otherwise <code>false</code> is returned
- *
+ *
* @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
* java.lang.Object)
*/
- public static boolean checkValidateEdit(IModelElement element,
- Shell parent, String title) {
- return checkValidateEdit(new IModelElement[] { element }, parent, title);
+ public static boolean checkValidateEdit(IModelElement element, Shell parent,
+ String title) {
+ return checkValidateEdit(new IModelElement[] { element }, parent,
+ title);
}
/**
@@ -107,7 +108,7 @@
* <code>validateEdit</code> was able to make the file writable the method
* additionally checks if the file has been changed by calling
* <code>validateEdit</code>.
- *
+ *
* @param elements
* the elements to be checked
* @param parent
@@ -119,7 +120,7 @@
* @return boolean <code>true</code> if all elements are writable and their
* content didn't change by calling <code>validateEdit</code>.
* Otherwise <code>false</code> is returned
- *
+ *
* @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
* java.lang.Object)
*/
@@ -135,7 +136,7 @@
* <code>checkValidateEdit</code> is performed since the editor does a in
* sync check on focus change. If <code>editor</code> is <code>false</code>
* both checks are performed.
- *
+ *
* @param element
* the element to be checked
* @param parent
@@ -148,7 +149,7 @@
* specifies if we are in the editor
* @return boolean <code>true</code> if the element passed the checks.
* Otherwise <code>false</code> is returned
- *
+ *
* @see #checkInSync(IAdaptable, Shell, String)
* @see #checkValidateEdit(IJavaElement, Shell, String)
*/
@@ -164,7 +165,7 @@
* <code>checkValidateEdit</code> is performed since the editor does a in
* sync check on focus change. If <code>editor</code> is <code>false</code>
* both checks are performed.
- *
+ *
* @param elements
* the elements to be checked
* @param parent
@@ -177,7 +178,7 @@
* specifies if we are in the editor
* @return boolean <code>true</code> if all elements pass the checks.
* Otherwise <code>false</code> is returned
- *
+ *
* @see #checkInSync(IAdaptable[], Shell, String)
* @see #checkValidateEdit(IJavaElement[], Shell, String)
*/
@@ -211,7 +212,7 @@
}
private static IResource[] getResources(IAdaptable[] elements) {
- Set<IResource> result = new HashSet<IResource>();
+ Set<IResource> result = new HashSet<>();
for (int i = 0; i < elements.length; i++) {
IAdaptable element = elements[i];
IResource resource = null;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/HistoryListAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/HistoryListAction.java
index fe088da..7f6f394 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/HistoryListAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/HistoryListAction.java
@@ -41,7 +41,7 @@
/*package*/class HistoryListAction<E> extends Action {
private class HistoryListDialog extends StatusDialog {
- private static final int MAX_MAX_ENTRIES= 100;
+ private static final int MAX_MAX_ENTRIES = 100;
private ListDialogField fHistoryList;
private StringDialogField fMaxEntriesField;
private int fMaxEntries;
@@ -58,11 +58,13 @@
}
private void createHistoryList() {
- IListAdapter adapter= new IListAdapter() {
+ IListAdapter adapter = new IListAdapter() {
@Override
- public void customButtonPressed(ListDialogField field, int index) {
+ public void customButtonPressed(ListDialogField field,
+ int index) {
doCustomButtonPressed(index);
}
+
@Override
public void selectionChanged(ListDialogField field) {
doSelectionChanged();
@@ -73,9 +75,12 @@
doDoubleClicked();
}
};
- String[] buttonLabels= new String[] { DLTKUIMessages.HistoryListAction_remove, DLTKUIMessages.HistoryListAction_remove_all };
- LabelProvider labelProvider= new TestRunLabelProvider();
- fHistoryList= new ListDialogField(adapter, buttonLabels, labelProvider);
+ String[] buttonLabels = new String[] {
+ DLTKUIMessages.HistoryListAction_remove,
+ DLTKUIMessages.HistoryListAction_remove_all };
+ LabelProvider labelProvider = new TestRunLabelProvider();
+ fHistoryList = new ListDialogField(adapter, buttonLabels,
+ labelProvider);
fHistoryList.setLabelText(fHistory.getHistoryListDialogMessage());
List<E> historyEntries = fHistory.getHistoryEntries();
@@ -84,51 +89,59 @@
E currentEntry = fHistory.getCurrentEntry();
ISelection sel;
if (currentEntry != null) {
- sel= new StructuredSelection(currentEntry);
+ sel = new StructuredSelection(currentEntry);
} else {
- sel= new StructuredSelection();
+ sel = new StructuredSelection();
}
fHistoryList.selectElements(sel);
}
private void createMaxEntriesField() {
- fMaxEntriesField= new StringDialogField();
+ fMaxEntriesField = new StringDialogField();
fMaxEntriesField.setLabelText(fHistory.getMaxEntriesMessage());
fMaxEntriesField.setDialogFieldListener(field -> {
- String maxString= fMaxEntriesField.getText();
+ String maxString = fMaxEntriesField.getText();
boolean valid;
try {
- fMaxEntries= Integer.parseInt(maxString);
- valid= fMaxEntries > 0 && fMaxEntries < MAX_MAX_ENTRIES;
+ fMaxEntries = Integer.parseInt(maxString);
+ valid = fMaxEntries > 0 && fMaxEntries < MAX_MAX_ENTRIES;
} catch (NumberFormatException e) {
- valid= false;
+ valid = false;
}
if (valid)
updateStatus(StatusInfo.OK_STATUS);
else
- updateStatus(new StatusInfo(IStatus.ERROR, Messages.format(DLTKUIMessages.HistoryListAction_max_entries_constraint, Integer.toString(MAX_MAX_ENTRIES))));
+ updateStatus(new StatusInfo(IStatus.ERROR, Messages.format(
+ DLTKUIMessages.HistoryListAction_max_entries_constraint,
+ Integer.toString(MAX_MAX_ENTRIES))));
});
- fMaxEntriesField.setText(Integer.toString(fHistory.getMaxEntries()));
+ fMaxEntriesField
+ .setText(Integer.toString(fHistory.getMaxEntries()));
}
@Override
protected Control createDialogArea(Composite parent) {
initializeDialogUnits(parent);
- Composite composite= (Composite) super.createDialogArea(parent);
+ Composite composite = (Composite) super.createDialogArea(parent);
- Composite inner= new Composite(composite, SWT.NONE);
+ Composite inner = new Composite(composite, SWT.NONE);
inner.setLayoutData(new GridData(GridData.FILL_BOTH));
inner.setFont(composite.getFont());
- LayoutUtil.doDefaultLayout(inner, new DialogField[] { fHistoryList, new Separator() }, true);
- LayoutUtil.setHeightHint(fHistoryList.getListControl(null), convertHeightInCharsToPixels(12));
+ LayoutUtil.doDefaultLayout(inner,
+ new DialogField[] { fHistoryList, new Separator() }, true);
+ LayoutUtil.setHeightHint(fHistoryList.getListControl(null),
+ convertHeightInCharsToPixels(12));
LayoutUtil.setHorizontalGrabbing(fHistoryList.getListControl(null));
- Composite additionalControls= new Composite(inner, SWT.NONE);
- additionalControls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- LayoutUtil.doDefaultLayout(additionalControls, new DialogField[] { fMaxEntriesField }, false);
- LayoutUtil.setHorizontalGrabbing(fMaxEntriesField.getTextControl(null));
+ Composite additionalControls = new Composite(inner, SWT.NONE);
+ additionalControls.setLayoutData(
+ new GridData(SWT.FILL, SWT.FILL, true, false));
+ LayoutUtil.doDefaultLayout(additionalControls,
+ new DialogField[] { fMaxEntriesField }, false);
+ LayoutUtil.setHorizontalGrabbing(
+ fMaxEntriesField.getTextControl(null));
applyDialogFont(composite);
return composite;
@@ -136,16 +149,16 @@
private void doCustomButtonPressed(int index) {
switch (index) {
- case 0: // remove
- fHistoryList.removeElements(fHistoryList.getSelectedElements());
- fHistoryList.selectFirstElement();
- break;
+ case 0: // remove
+ fHistoryList.removeElements(fHistoryList.getSelectedElements());
+ fHistoryList.selectFirstElement();
+ break;
- case 1: // remove all
- fHistoryList.removeAllElements();
+ case 1: // remove all
+ fHistoryList.removeAllElements();
- default:
- break;
+ default:
+ break;
}
}
@@ -156,9 +169,9 @@
private void doSelectionChanged() {
List<E> selected = fHistoryList.getSelectedElements();
if (selected.size() >= 1) {
- fResult= selected.get(0);
+ fResult = selected.get(0);
} else {
- fResult= null;
+ fResult = null;
}
fHistoryList.enableButton(0, selected.size() != 0);
}
@@ -184,7 +197,7 @@
}
private final class TestRunLabelProvider extends LabelProvider {
- private final HashMap<ImageDescriptor, Image> fImages = new HashMap<ImageDescriptor, Image>();
+ private final HashMap<ImageDescriptor, Image> fImages = new HashMap<>();
@Override
public String getText(Object element) {
@@ -202,7 +215,8 @@
Image cached = fImages.get(imageDescriptor);
if (cached != null)
return cached;
- Image image= imageDescriptor.createImage(fHistory.getShell().getDisplay());
+ Image image = imageDescriptor
+ .createImage(fHistory.getShell().getDisplay());
fImages.put(imageDescriptor, image);
return image;
}
@@ -220,18 +234,18 @@
public HistoryListAction(ViewHistory history) {
super(null, IAction.AS_RADIO_BUTTON);
- fHistory= history;
+ fHistory = history;
fHistory.configureHistoryListAction(this);
}
@Override
public void run() {
- HistoryListDialog dialog= new HistoryListDialog();
+ HistoryListDialog dialog = new HistoryListDialog();
if (dialog.open() == Window.OK) {
- fHistory.setHistoryEntries(dialog.getRemaining(), dialog.getResult());
+ fHistory.setHistoryEntries(dialog.getRemaining(),
+ dialog.getResult());
fHistory.setMaxEntries(dialog.getMaxEntries());
}
}
}
-
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImageDescriptorRegistry.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImageDescriptorRegistry.java
index b2387a2..d4457db 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImageDescriptorRegistry.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImageDescriptorRegistry.java
@@ -18,8 +18,7 @@
public class ImageDescriptorRegistry {
- private final HashMap<ImageDescriptor, Image> fRegistry = new HashMap<ImageDescriptor, Image>(
- 10);
+ private final HashMap<ImageDescriptor, Image> fRegistry = new HashMap<>(10);
private final Display fDisplay;
@@ -52,7 +51,8 @@
* for
* @since 2.0
*/
- public ImageDescriptorRegistry(Display display, boolean disposeWithDisplay) {
+ public ImageDescriptorRegistry(Display display,
+ boolean disposeWithDisplay) {
fDisplay = display;
if (disposeWithDisplay) {
hookDisplay();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImagesOnFileSystemRegistry.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImagesOnFileSystemRegistry.java
index fbad913..6b3e832 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImagesOnFileSystemRegistry.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ImagesOnFileSystemRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* 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
@@ -23,7 +23,7 @@
/**
* Image registry that keeps its images on the local file system.
- *
+ *
* @since 4.0
*/
public class ImagesOnFileSystemRegistry {
@@ -35,7 +35,7 @@
private int fImageCount;
public ImagesOnFileSystemRegistry() {
- fURLMap = new HashMap<ImageDescriptor, URL>();
+ fURLMap = new HashMap<>();
fTempDir = getTempDir();
fImageCount = 0;
}
@@ -52,8 +52,8 @@
imageDir.mkdir();
}
if (!imageDir.isDirectory()) {
- DLTKUIPlugin
- .logErrorMessage("Failed to create image directory " + imageDir.toString()); //$NON-NLS-1$
+ DLTKUIPlugin.logErrorMessage("Failed to create image directory " //$NON-NLS-1$
+ + imageDir.toString());
return null;
}
return imageDir;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java
index d20b148..02e4b43 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java
@@ -107,7 +107,7 @@
@Override
public void resourceChanged(IResourceChangeEvent event) {
- HashSet<IResource> changedElements = new HashSet<IResource>();
+ HashSet<IResource> changedElements = new HashSet<>();
try {
IResourceDelta delta = event.getDelta();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ScriptUILabelProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ScriptUILabelProvider.java
index f5c0c28..2aea887 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ScriptUILabelProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ScriptUILabelProvider.java
@@ -304,7 +304,7 @@
public void addLabelDecorator(ILabelDecorator decorator) {
if (fLabelDecorators == null) {
- fLabelDecorators = new ArrayList<ILabelDecorator>(2);
+ fLabelDecorators = new ArrayList<>(2);
}
fLabelDecorators.add(decorator);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/SelectionListenerWithASTManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/SelectionListenerWithASTManager.java
index 7b980e9..d74af9f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/SelectionListenerWithASTManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/SelectionListenerWithASTManager.java
@@ -224,7 +224,7 @@
private Map<ITextEditor, PartListenerGroup> fListenerGroups;
private SelectionListenerWithASTManager() {
- fListenerGroups = new HashMap<ITextEditor, PartListenerGroup>();
+ fListenerGroups = new HashMap<>();
}
/**
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StorageLabelProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StorageLabelProvider.java
index bb5eec3..ca54c10 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StorageLabelProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/StorageLabelProvider.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* 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
*
-
+
*******************************************************************************/
package org.eclipse.dltk.ui.viewsupport;
@@ -29,7 +29,7 @@
public class StorageLabelProvider extends LabelProvider {
private IEditorRegistry fEditorRegistry = null;
- private Map<String, Image> fImageMap = new HashMap<String, Image>(10);
+ private Map<String, Image> fImageMap = new HashMap<>(10);
private Image fDefaultImage;
@@ -39,11 +39,6 @@
return fEditorRegistry;
}
- /*
- * (non-Javadoc)
- *
- * @see ILabelProvider#getImage
- */
@Override
public Image getImage(Object element) {
if (element instanceof ISourceModule) {
@@ -55,11 +50,6 @@
return super.getImage(element);
}
- /*
- * (non-Javadoc)
- *
- * @see ILabelProvider#getText
- */
@Override
public String getText(Object element) {
if (element instanceof IStorage)
@@ -68,11 +58,6 @@
return super.getText(element);
}
- /*
- * (non-Javadoc)
- *
- * @see IBaseLabelProvider#dispose
- */
@Override
public void dispose() {
if (fImageMap != null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ViewHistory.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ViewHistory.java
index d699448..5fe8c16 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ViewHistory.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ViewHistory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2017 IBM Corporation and others.
* 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
@@ -20,7 +20,7 @@
/**
* History support for a view.
- *
+ *
* @param <E>
* the type of elements managed by this history
*/
@@ -29,7 +29,7 @@
/**
* Configure the history List action. Clients typically want to set a text
* and an image.
- *
+ *
* @param action
* the action
*/
@@ -38,7 +38,7 @@
/**
* Configure the history drop down action. Clients typically want to set a
* tooltip and an image.
- *
+ *
* @param action
* the action
*/
@@ -101,7 +101,7 @@
* @return a history drop down action, ready for inclusion in a view toolbar
*/
public final IAction createHistoryDropDownAction() {
- return new HistoryDropDownAction<E>(this);
+ return new HistoryDropDownAction<>(this);
}
public abstract void addMenuEntries(MenuManager manager);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/BuildpathsBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/BuildpathsBlock.java
index d6493c6..81951f8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/BuildpathsBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/BuildpathsBlock.java
@@ -166,21 +166,21 @@
/* 2 */null,
NewWizardMessages.BuildPathsBlock_buildpath_checkall_button,
NewWizardMessages.BuildPathsBlock_buildpath_uncheckall_button };
- fBuildPathList = new CheckedListDialogField<BPListElement>(null,
- buttonLabels, new BPListLabelProvider());
+ fBuildPathList = new CheckedListDialogField<>(null, buttonLabels,
+ new BPListLabelProvider());
fBuildPathList.setDialogFieldListener(adapter);
- fBuildPathList
- .setLabelText(NewWizardMessages.BuildPathsBlock_buildpath_label);
+ fBuildPathList.setLabelText(
+ NewWizardMessages.BuildPathsBlock_buildpath_label);
fBuildPathList.setUpButtonIndex(0);
fBuildPathList.setDownButtonIndex(1);
fBuildPathList.setCheckAllButtonIndex(3);
fBuildPathList.setUncheckAllButtonIndex(4);
fBuildPathDialogField = new StringButtonDialogField(adapter);
- fBuildPathDialogField
- .setButtonLabel(NewWizardMessages.BuildPathsBlock_buildpath_button);
+ fBuildPathDialogField.setButtonLabel(
+ NewWizardMessages.BuildPathsBlock_buildpath_button);
fBuildPathDialogField.setDialogFieldListener(adapter);
- fBuildPathDialogField
- .setLabelText(NewWizardMessages.BuildPathsBlock_buildpath_label);
+ fBuildPathDialogField.setLabelText(
+ NewWizardMessages.BuildPathsBlock_buildpath_label);
fBuildPathStatus = new StatusInfo();
fPathStatus = new StatusInfo();
fCurrScriptProject = null;
@@ -207,8 +207,8 @@
TabItem item;
item = new TabItem(folder, SWT.NONE);
item.setText(NewWizardMessages.BuildPathsBlock_tab_source);
- item.setImage(DLTKPluginImages
- .get(DLTKPluginImages.IMG_OBJS_PACKFRAG_ROOT));
+ item.setImage(
+ DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_PACKFRAG_ROOT));
if (fUseNewPage) {
fSourceContainerPage = new NewSourceContainerWorkbookPage(
fBuildPathList, fRunnableContext, getPreferenceStore());
@@ -219,9 +219,10 @@
item.setData(fSourceContainerPage);
item.setControl(fSourceContainerPage.getControl(folder));
IWorkbench workbench = DLTKUIPlugin.getDefault().getWorkbench();
- Image projectImage = workbench.getSharedImages().getImage(
- IDE.SharedImages.IMG_OBJ_PROJECT);
- fProjectsPage = new ProjectsWorkbookPage(fBuildPathList, fPageContainer);
+ Image projectImage = workbench.getSharedImages()
+ .getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
+ fProjectsPage = new ProjectsWorkbookPage(fBuildPathList,
+ fPageContainer);
item = new TabItem(folder, SWT.NONE);
item.setText(NewWizardMessages.BuildPathsBlock_tab_projects);
item.setImage(projectImage);
@@ -288,7 +289,8 @@
* - if the project is an existing script project - the buildpath
* entries of the existing project
*/
- public void init(IScriptProject jproject, IBuildpathEntry[] buildpathEntries) {
+ public void init(IScriptProject jproject,
+ IBuildpathEntry[] buildpathEntries) {
fCurrScriptProject = jproject;
boolean projectExists = false;
List<BPListElement> newBuildpath = null;
@@ -306,7 +308,7 @@
if (newBuildpath == null) {
newBuildpath = getDefaultBuildpath(jproject);
}
- List<BPListElement> exportedEntries = new ArrayList<BPListElement>();
+ List<BPListElement> exportedEntries = new ArrayList<>();
for (int i = 0; i < newBuildpath.size(); i++) {
BPListElement curr = newBuildpath.get(i);
if (curr.isExported()
@@ -383,20 +385,19 @@
private List<BPListElement> getExistingEntries(
IBuildpathEntry[] buildpathEntries) {
- List<BPListElement> newBuildpath = new ArrayList<BPListElement>();
+ List<BPListElement> newBuildpath = new ArrayList<>();
for (int i = 0; i < buildpathEntries.length; i++) {
IBuildpathEntry curr = buildpathEntries[i];
- newBuildpath.add(BPListElement.createFromExisting(curr,
- fCurrScriptProject));
+ newBuildpath.add(
+ BPListElement.createFromExisting(curr, fCurrScriptProject));
}
return newBuildpath;
}
// -------- public api --------
/**
- * @return Returns the script project. Can return
- * <code>null<code> if the page has not
- * been initialized.
+ * @return Returns the script project. Can return <code>null<code> if the
+ * page has not been initialized.
*/
public IScriptProject getScriptProject() {
return fCurrScriptProject;
@@ -454,7 +455,7 @@
}
private List<BPListElement> getDefaultBuildpath(IScriptProject jproj) {
- List<BPListElement> list = new ArrayList<BPListElement>();
+ List<BPListElement> list = new ArrayList<>();
final IDLTKUILanguageToolkit toolkit = getUILanguageToolkit();
if (toolkit != null) {
final IResource srcFolder;
@@ -479,8 +480,8 @@
return list;
}
- private class BuildPathAdapter implements IStringButtonAdapter,
- IDialogFieldListener {
+ private class BuildPathAdapter
+ implements IStringButtonAdapter, IDialogFieldListener {
// -------- IStringButtonAdapter --------
@Override
public void changeControlPressed(DialogField field) {
@@ -498,8 +499,8 @@
if (field == fBuildPathDialogField) {
IContainer container = chooseContainer();
if (container != null) {
- fBuildPathDialogField.setText(container.getFullPath()
- .toString());
+ fBuildPathDialogField
+ .setText(container.getFullPath().toString());
}
}
}
@@ -520,8 +521,8 @@
}
private IStatus findMostSevereStatus() {
- return StatusUtil.getMostSevere(new IStatus[] { fPathStatus,
- fBuildPathStatus });
+ return StatusUtil
+ .getMostSevere(new IStatus[] { fPathStatus, fBuildPathStatus });
}
/**
@@ -560,10 +561,9 @@
NewWizardMessages.BuildPathsBlock_warning_EntryMissing,
entryMissing.getPath().toString()));
} else {
- fPathStatus
- .setWarning(Messages
- .format(NewWizardMessages.BuildPathsBlock_warning_EntriesMissing,
- String.valueOf(nEntriesMissing)));
+ fPathStatus.setWarning(Messages.format(
+ NewWizardMessages.BuildPathsBlock_warning_EntriesMissing,
+ String.valueOf(nEntriesMissing)));
}
}
@@ -577,8 +577,8 @@
BPListElement currElement = elements.get(i);
entries[i] = currElement.getBuildpathEntry();
}
- IModelStatus status = BuildpathEntry.validateBuildpath(
- fCurrScriptProject, entries);
+ IModelStatus status = BuildpathEntry
+ .validateBuildpath(fCurrScriptProject, entries);
if (!status.isOK()) {
fBuildPathStatus.setError(status.getMessage());
return;
@@ -599,9 +599,8 @@
if (!project.exists()) {
IProjectDescription desc = project.getWorkspace()
.newProjectDescription(project.getName());
- if (locationURI != null
- && ResourcesPlugin.getWorkspace().getRoot()
- .getLocationURI().equals(locationURI)) {
+ if (locationURI != null && ResourcesPlugin.getWorkspace()
+ .getRoot().getLocationURI().equals(locationURI)) {
locationURI = null;
}
desc.setLocationURI(locationURI);
@@ -639,7 +638,8 @@
if (monitor == null) {
monitor = new NullProgressMonitor();
}
- monitor.setTaskName(NewWizardMessages.BuildPathsBlock_operationdesc_Script);
+ monitor.setTaskName(
+ NewWizardMessages.BuildPathsBlock_operationdesc_Script);
monitor.beginTask("", buildpathEntries.size() * 4 + 4); //$NON-NLS-1$
try {
IProject project = javaProject.getProject();
@@ -695,9 +695,8 @@
}
} else {
if (projPath.isPrefixOf(orginalPath)) {
- orginalPath = orginalPath
- .removeFirstSegments(projPath
- .segmentCount());
+ orginalPath = orginalPath.removeFirstSegments(
+ projPath.segmentCount());
}
IFolder orginalFolder = project.getFolder(orginalPath);
if (entry.getLinkTarget() == null) {
@@ -707,9 +706,8 @@
IPath parentPath = entry.getPath()
.removeLastSegments(1);
if (projPath.isPrefixOf(parentPath)) {
- parentPath = parentPath
- .removeFirstSegments(projPath
- .segmentCount());
+ parentPath = parentPath.removeFirstSegments(
+ projPath.segmentCount());
}
if (parentPath.segmentCount() > 0) {
IFolder parentFolder = project
@@ -729,9 +727,8 @@
new SubProgressMonitor(monitor, 1));
}
} else {
- if (!folder.exists()
- || !entry.getLinkTarget().equals(
- entry.getOrginalLinkTarget())) {
+ if (!folder.exists() || !entry.getLinkTarget()
+ .equals(entry.getOrginalLinkTarget())) {
orginalFolder.delete(true,
new SubProgressMonitor(monitor, 1));
folder.createLink(entry.getLinkTarget(),
@@ -747,8 +744,8 @@
throw new OperationCanceledException();
}
}
- javaProject.setRawBuildpath(buildpath, new SubProgressMonitor(
- monitor, 2));
+ javaProject.setRawBuildpath(buildpath,
+ new SubProgressMonitor(monitor, 2));
} finally {
monitor.done();
}
@@ -817,7 +814,7 @@
ISelectionStatusValidator validator = new TypedElementSelectionValidator(
acceptedClasses, false);
IProject[] allProjects = fWorkspaceRoot.getProjects();
- ArrayList<IProject> rejectedElements = new ArrayList<IProject>(
+ ArrayList<IProject> rejectedElements = new ArrayList<>(
allProjects.length);
IProject currProject = fCurrScriptProject.getProject();
for (int i = 0; i < allProjects.length; i++) {
@@ -830,11 +827,13 @@
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
IResource initSelection = null;
- FolderSelectionDialog dialog = new FolderSelectionDialog(getShell(),
- lp, cp);
- dialog.setTitle(NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_title);
+ FolderSelectionDialog dialog = new FolderSelectionDialog(getShell(), lp,
+ cp);
+ dialog.setTitle(
+ NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_title);
dialog.setValidator(validator);
- dialog.setMessage(NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_description);
+ dialog.setMessage(
+ NewWizardMessages.BuildPathsBlock_ChooseOutputFolderDialog_description);
dialog.addFilter(filter);
dialog.setInput(fWorkspaceRoot);
dialog.setInitialSelection(initSelection);
@@ -901,7 +900,7 @@
}
BuildPathBasePage page = (BuildPathBasePage) fTabFolder
.getItem(pageIndex).getData();
- List<Object> selection = new ArrayList<Object>(1);
+ List<Object> selection = new ArrayList<>(1);
selection.add(elementToSelect);
page.setSelection(selection, true);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ControlDecorationManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ControlDecorationManager.java
index bcab1d2..1b25984 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ControlDecorationManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ControlDecorationManager.java
@@ -29,7 +29,7 @@
*/
public class ControlDecorationManager implements IControlDecorationManager {
- private Map<Control, ControlDecoration> decorations = new IdentityHashMap<Control, ControlDecoration>();
+ private Map<Control, ControlDecoration> decorations = new IdentityHashMap<>();
@Override
public void show(Control control, IStatus status) {
@@ -56,10 +56,10 @@
protected Image getImageFor(IStatus status) {
final Image image = DLTKUIPlugin.getImageDescriptorRegistry().get(
- // status.getSeverity() == IStatus.ERROR ?
+ // status.getSeverity() == IStatus.ERROR ?
DLTKPluginImages.DESC_OVR_ERROR
// : DLTKPluginImages.DESC_OVR_WARNING
- );
+ );
return image;
}
@@ -87,11 +87,11 @@
// empty
}
- private static class ControlDecorationManagerWorkingCopy implements
- IControlDecorationManager {
+ private static class ControlDecorationManagerWorkingCopy
+ implements IControlDecorationManager {
private final ControlDecorationManager manager;
- private Map<Control, ControlDecoration> activeDecorations = new IdentityHashMap<Control, ControlDecoration>();
+ private Map<Control, ControlDecoration> activeDecorations = new IdentityHashMap<>();
public ControlDecorationManagerWorkingCopy(
ControlDecorationManager manager) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceFolderWizardPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceFolderWizardPage.java
index d7d7d42..d3da006 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceFolderWizardPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceFolderWizardPage.java
@@ -104,22 +104,22 @@
fProjectField = new StringButtonDialogField(adapter);
fProjectField.setDialogFieldListener(adapter);
- fProjectField
- .setLabelText(NewWizardMessages.NewSourceFolderWizardPage_project_label);
- fProjectField
- .setButtonLabel(NewWizardMessages.NewSourceFolderWizardPage_project_button);
+ fProjectField.setLabelText(
+ NewWizardMessages.NewSourceFolderWizardPage_project_label);
+ fProjectField.setButtonLabel(
+ NewWizardMessages.NewSourceFolderWizardPage_project_button);
fRootDialogField = new StringButtonDialogField(adapter);
fRootDialogField.setDialogFieldListener(adapter);
- fRootDialogField
- .setLabelText(NewWizardMessages.NewSourceFolderWizardPage_root_label);
- fRootDialogField
- .setButtonLabel(NewWizardMessages.NewSourceFolderWizardPage_root_button);
+ fRootDialogField.setLabelText(
+ NewWizardMessages.NewSourceFolderWizardPage_root_label);
+ fRootDialogField.setButtonLabel(
+ NewWizardMessages.NewSourceFolderWizardPage_root_button);
fExcludeInOthersFields = new SelectionButtonDialogField(SWT.CHECK);
fExcludeInOthersFields.setDialogFieldListener(adapter);
- fExcludeInOthersFields
- .setLabelText(NewWizardMessages.NewSourceFolderWizardPage_exclude_label);
+ fExcludeInOthersFields.setLabelText(
+ NewWizardMessages.NewSourceFolderWizardPage_exclude_label);
fExcludeInOthersFields.setEnabled(DLTKCore.ENABLED.equals(DLTKCore
.getOption(DLTKCore.CORE_ENABLE_BUILDPATH_EXCLUSION_PATTERNS)));
@@ -184,9 +184,8 @@
// -------- UI Creation ---------
/*
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.
+ * widgets .Composite)
*/
@Override
public void createControl(Composite parent) {
@@ -232,8 +231,8 @@
// -------- ContainerFieldAdapter --------
- private class RootFieldAdapter implements IStringButtonAdapter,
- IDialogFieldListener {
+ private class RootFieldAdapter
+ implements IStringButtonAdapter, IDialogFieldListener {
// -------- IStringButtonAdapter
@Override
@@ -285,20 +284,20 @@
String str = fProjectField.getText();
if (str.length() == 0) {
- fProjectStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_EnterProjectName);
+ fProjectStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_EnterProjectName);
return;
}
IPath path = new Path(str);
if (path.segmentCount() != 1) {
- fProjectStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_InvalidProjectPath);
+ fProjectStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_InvalidProjectPath);
return;
}
IProject project = fWorkspaceRoot.getProject(path.toString());
if (!project.exists()) {
- fProjectStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_ProjectNotExists);
+ fProjectStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_ProjectNotExists);
return;
}
try {
@@ -312,8 +311,8 @@
DLTKUIPlugin.log(e);
fCurrJProject = null;
}
- fProjectStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_NotAScriptProject);
+ fProjectStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_NotAScriptProject);
}
private void updateRootStatus() {
@@ -327,28 +326,23 @@
IPath projPath = fCurrJProject.getProject().getFullPath();
String str = fRootDialogField.getText();
if (str.length() == 0) {
- fRootStatus
- .setError(Messages
- .format(
- NewWizardMessages.NewSourceFolderWizardPage_error_EnterRootName,
- fCurrJProject.getProject().getFullPath()
- .toString()));
+ fRootStatus.setError(Messages.format(
+ NewWizardMessages.NewSourceFolderWizardPage_error_EnterRootName,
+ fCurrJProject.getProject().getFullPath().toString()));
} else {
IPath path = projPath.append(str);
- IStatus validate = fWorkspaceRoot.getWorkspace().validatePath(
- path.toString(), IResource.FOLDER);
+ IStatus validate = fWorkspaceRoot.getWorkspace()
+ .validatePath(path.toString(), IResource.FOLDER);
if (validate.matches(IStatus.ERROR)) {
- fRootStatus
- .setError(Messages
- .format(
- NewWizardMessages.NewSourceFolderWizardPage_error_InvalidRootName,
- validate.getMessage()));
+ fRootStatus.setError(Messages.format(
+ NewWizardMessages.NewSourceFolderWizardPage_error_InvalidRootName,
+ validate.getMessage()));
} else {
IResource res = fWorkspaceRoot.findMember(path);
if (res != null) {
if (res.getType() != IResource.FOLDER) {
- fRootStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_NotAFolder);
+ fRootStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_NotAFolder);
return;
}
} else {
@@ -359,8 +353,8 @@
IFileStore store = EFS.getStore(projLocation)
.getChild(str);
if (store.fetchInfo().exists()) {
- fRootStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExistingDifferentCase);
+ fRootStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExistingDifferentCase);
return;
}
} catch (CoreException e) {
@@ -372,7 +366,7 @@
}
}
}
- List<IBuildpathEntry> newEntries = new ArrayList<IBuildpathEntry>(
+ List<IBuildpathEntry> newEntries = new ArrayList<>(
fEntries.length + 1);
int projectEntryIndex = -1;
@@ -380,8 +374,8 @@
IBuildpathEntry curr = fEntries[i];
if (curr.getEntryKind() == IBuildpathEntry.BPE_SOURCE) {
if (path.equals(curr.getPath())) {
- fRootStatus
- .setError(NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExisting);
+ fRootStatus.setError(
+ NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExisting);
return;
}
if (projPath.equals(curr.getPath())) {
@@ -393,7 +387,7 @@
IBuildpathEntry newEntry = DLTKCore.newSourceEntry(path);
- Set<IBuildpathEntry> modified = new HashSet<IBuildpathEntry>();
+ Set<IBuildpathEntry> modified = new HashSet<>();
if (fExcludeInOthersFields.isSelected()) {
addExclusionPatterns(newEntry, newEntries, modified);
IBuildpathEntry entry = DLTKCore.newSourceEntry(path);
@@ -408,25 +402,23 @@
}
}
- fNewEntries = newEntries.toArray(new IBuildpathEntry[newEntries
- .size()]);
+ fNewEntries = newEntries
+ .toArray(new IBuildpathEntry[newEntries.size()]);
- IModelStatus status = BuildpathEntry.validateBuildpath(
- fCurrJProject, fNewEntries);
+ IModelStatus status = BuildpathEntry
+ .validateBuildpath(fCurrJProject, fNewEntries);
if (!status.isOK()) {
fRootStatus.setError(status.getMessage());
return;
} else if (fIsProjectAsSourceFolder) {
- fRootStatus
- .setInfo(NewWizardMessages.NewSourceFolderWizardPage_warning_ReplaceSF);
+ fRootStatus.setInfo(
+ NewWizardMessages.NewSourceFolderWizardPage_warning_ReplaceSF);
return;
}
if (!modified.isEmpty()) {
- fRootStatus
- .setInfo(Messages
- .format(
- NewWizardMessages.NewSourceFolderWizardPage_warning_AddedExclusions,
- String.valueOf(modified.size())));
+ fRootStatus.setInfo(Messages.format(
+ NewWizardMessages.NewSourceFolderWizardPage_warning_AddedExclusions,
+ String.valueOf(modified.size())));
return;
}
}
@@ -439,7 +431,8 @@
IBuildpathEntry[] elements = entries
.toArray(new IBuildpathEntry[length]);
int i = 0;
- while (i < length && elements[i].getEntryKind() != entry.getEntryKind()) {
+ while (i < length
+ && elements[i].getEntryKind() != entry.getEntryKind()) {
i++;
}
if (i < length) {
@@ -466,7 +459,8 @@
}
private void addExclusionPatterns(IBuildpathEntry newEntry,
- List<IBuildpathEntry> existing, Set<IBuildpathEntry> modifiedEntries) {
+ List<IBuildpathEntry> existing,
+ Set<IBuildpathEntry> modifiedEntries) {
IPath entryPath = newEntry.getPath();
for (int i = 0; i < existing.size(); i++) {
IBuildpathEntry curr = existing.get(i);
@@ -474,11 +468,13 @@
if (curr.getEntryKind() == IBuildpathEntry.BPE_SOURCE
&& currPath.isPrefixOf(entryPath)) {
IPath[] exclusionFilters = curr.getExclusionPatterns();
- if (!ScriptModelUtil
- .isExcludedPath(entryPath, exclusionFilters)) {
- IPath pathToExclude = entryPath.removeFirstSegments(
- currPath.segmentCount()).addTrailingSeparator();
- IPath[] newExclusionFilters = new IPath[exclusionFilters.length + 1];
+ if (!ScriptModelUtil.isExcludedPath(entryPath,
+ exclusionFilters)) {
+ IPath pathToExclude = entryPath
+ .removeFirstSegments(currPath.segmentCount())
+ .addTrailingSeparator();
+ IPath[] newExclusionFilters = new IPath[exclusionFilters.length
+ + 1];
System.arraycopy(exclusionFilters, 0, newExclusionFilters,
0, exclusionFilters.length);
newExclusionFilters[exclusionFilters.length] = pathToExclude;
@@ -507,8 +503,8 @@
if (monitor == null) {
monitor = new NullProgressMonitor();
}
- monitor.beginTask(
- NewWizardMessages.NewSourceFolderWizardPage_operation, 3);
+ monitor.beginTask(NewWizardMessages.NewSourceFolderWizardPage_operation,
+ 3);
try {
// IPath projPath= fCurrJProject.getProject().getFullPath();
@@ -523,8 +519,8 @@
throw new InterruptedException();
}
- fCurrJProject.setRawBuildpath(fNewEntries, new SubProgressMonitor(
- monitor, 2));
+ fCurrJProject.setRawBuildpath(fNewEntries,
+ new SubProgressMonitor(monitor, 2));
fCreatedRoot = fCurrJProject.getProjectFragment(folder);
} finally {
@@ -534,7 +530,8 @@
// ------------- choose dialogs
- private IFolder chooseFolder(String title, String message, IPath initialPath) {
+ private IFolder chooseFolder(String title, String message,
+ IPath initialPath) {
Class<?>[] acceptedClasses = new Class[] { IFolder.class };
ISelectionStatusValidator validator = new TypedElementSelectionValidator(
acceptedClasses, false);
@@ -577,10 +574,10 @@
ModelElementLabelProvider.SHOW_DEFAULT);
ElementListSelectionDialog dialog = new ElementListSelectionDialog(
getShell(), labelProvider);
- dialog
- .setTitle(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_title);
- dialog
- .setMessage(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_description);
+ dialog.setTitle(
+ NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_title);
+ dialog.setMessage(
+ NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_description);
dialog.setElements(projects);
dialog.setInitialSelections(new Object[] { fCurrJProject });
dialog.setHelpAvailable(false);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleInPackagePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleInPackagePage.java
index 38bc173..c2d2a9a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleInPackagePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleInPackagePage.java
@@ -91,8 +91,8 @@
*/
private IPath currentPackagePath = null;
- private class PackageFieldAdapter implements IStringButtonAdapter,
- IDialogFieldListener {
+ private class PackageFieldAdapter
+ implements IStringButtonAdapter, IDialogFieldListener {
@Override
public void dialogFieldChanged(DialogField field) {
@@ -110,8 +110,8 @@
PackageFieldAdapter packageFieldAdapter = new PackageFieldAdapter();
fPackageDialogField = new StringButtonDialogField(packageFieldAdapter);
fPackageDialogField.setDialogFieldListener(packageFieldAdapter);
- fPackageDialogField
- .setButtonLabel(NewWizardMessages.NewSourceModuleInPackagePage_package_button);
+ fPackageDialogField.setButtonLabel(
+ NewWizardMessages.NewSourceModuleInPackagePage_package_button);
fPackageDialogField.setLabelText(getPackageLabel());
packageStatus = new StatusInfo();
@@ -132,7 +132,8 @@
* finished with non-exisiting packages in case this is set to false.
* Default value (after constrution) is false.
*/
- public void setAutoCreateMissingPackages(boolean autoCreateMissingPackages) {
+ public void setAutoCreateMissingPackages(
+ boolean autoCreateMissingPackages) {
this.autoCreateMissingPackages = autoCreateMissingPackages;
}
@@ -156,7 +157,7 @@
if (currentPackagePath == null) {
fPackageDialogField.setText("");
} else {
- String str = currentPackagePath.toString(); //$NON-NLS-1$
+ String str = currentPackagePath.toString(); // $NON-NLS-1$
fPackageDialogField.setText(str);
}
fPackageDialogField.setEnabled(canBeModified);
@@ -282,15 +283,13 @@
DLTKUIPlugin.log(e);
}
StatusInfo statusInfo = new StatusInfo();
- statusInfo
- .setError(NewWizardMessages.NewSourceModuleInPackagePage_error_ContainerIsNoSourceFolder);
+ statusInfo.setError(
+ NewWizardMessages.NewSourceModuleInPackagePage_error_ContainerIsNoSourceFolder);
status = statusInfo;
}
return status;
}
-
-
private void packageChangeControlPressed() {
IScriptFolder packageFolder = choosePackage();
if (packageFolder == null) {
@@ -299,12 +298,12 @@
IProjectFragment projectFragment = (IProjectFragment) packageFolder
.getAncestor(IModelElement.PROJECT_FRAGMENT);
if (projectFragment != null) {
- IPath path = packageFolder.getPath().makeRelativeTo(
- projectFragment.getPath());
+ IPath path = packageFolder.getPath()
+ .makeRelativeTo(projectFragment.getPath());
setPackage(path, true);
} else {
- DLTKUIPlugin
- .logErrorMessage("Illegal state, chosen package is not contained in a project fragment"); //$NON-NLS-N$
+ DLTKUIPlugin.logErrorMessage(
+ "Illegal state, chosen package is not contained in a project fragment"); // $NON-NLS-N$
}
}
@@ -330,9 +329,12 @@
getShell(), labelProvider);
dialog.setIgnoreCase(false);
- dialog.setTitle(NewWizardMessages.NewSourceModuleInPackagePage_ChoosePackageDialog_title);
- dialog.setMessage(NewWizardMessages.NewSourceModuleInPackagePage_ChoosePackageDialog_description);
- dialog.setEmptyListMessage(NewWizardMessages.NewSourceModuleInPackagePage_ChoosePackageDialog_empty);
+ dialog.setTitle(
+ NewWizardMessages.NewSourceModuleInPackagePage_ChoosePackageDialog_title);
+ dialog.setMessage(
+ NewWizardMessages.NewSourceModuleInPackagePage_ChoosePackageDialog_description);
+ dialog.setEmptyListMessage(
+ NewWizardMessages.NewSourceModuleInPackagePage_ChoosePackageDialog_empty);
dialog.setElements(packages);
dialog.setHelpAvailable(false);
@@ -359,7 +361,7 @@
* </p>
*/
protected IScriptFolder[] getAllPackages() {
- Collection<IScriptFolder> packages = new ArrayList<IScriptFolder>();
+ Collection<IScriptFolder> packages = new ArrayList<>();
IProjectFragment sourceFolder = getProjectFragment();
if (sourceFolder != null) {
try {
@@ -376,7 +378,6 @@
return packages.toArray(new IScriptFolder[packages.size()]);
}
-
private void packageDialogFieldChanged() {
packageStatus = packageChanged();
// tell all others
@@ -391,7 +392,8 @@
String packName = getPackageText();
if (packName.length() == 0) {
- status.setError(NewWizardMessages.NewPackageWizardPage_error_EnterName);
+ status.setError(
+ NewWizardMessages.NewPackageWizardPage_error_EnterName);
return status;
}
@@ -409,11 +411,13 @@
if (location != null) {
IFileStore store = EFS.getStore(location);
if (store.fetchInfo().exists()) {
- status.setError(NewWizardMessages.NewPackageWizardPage_error_PackageExistsDifferentCase);
+ status.setError(
+ NewWizardMessages.NewPackageWizardPage_error_PackageExistsDifferentCase);
}
}
if (!status.isError() && !autoCreateMissingPackages) {
- status.setError(NewWizardMessages.NewSourceModuleInPackagePage_error_PackageDoesNotExist);
+ status.setError(
+ NewWizardMessages.NewSourceModuleInPackagePage_error_PackageDoesNotExist);
}
}
} catch (CoreException e) {
@@ -424,8 +428,6 @@
return status;
}
-
-
/**
* Hook method that gets called when a field on this page has changed. For
* this page the method gets called when the source folder field changes.
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModulePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModulePage.java
index 8ff444f..93d2174 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModulePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModulePage.java
@@ -91,7 +91,7 @@
* The status of the last validation of the file (i.e. source module).
*/
protected IStatus sourceModuleStatus;
- private final List<IStatus> extensionStatus = new ArrayList<IStatus>();
+ private final List<IStatus> extensionStatus = new ArrayList<>();
private StringDialogField fileDialogField;
@@ -108,7 +108,8 @@
ISourceModule module = getScriptFolder()
.getSourceModule(getFileName());
if (module.exists()) {
- status.setError(Messages.NewSourceModulePage_fileAlreadyExists);
+ status.setError(
+ Messages.NewSourceModulePage_fileAlreadyExists);
} else {
IResource resource = module.getResource();
if (resource != null) {
@@ -117,10 +118,12 @@
try {
IFileStore store = EFS.getStore(location);
if (store.fetchInfo().exists()) {
- status.setError(Messages.NewSourceModulePage_error_TypeNameExistsDifferentCase);
+ status.setError(
+ Messages.NewSourceModulePage_error_TypeNameExistsDifferentCase);
}
} catch (CoreException e) {
- status.setError(Messages.NewSourceModulePage_error_uri_location_unkown);
+ status.setError(
+ Messages.NewSourceModulePage_error_uri_location_unkown);
}
}
}
@@ -185,7 +188,7 @@
}
Map<String, Object> data = null;
if (templateName != null) {
- data = new HashMap<String, Object>();
+ data = new HashMap<>();
data.put(CodeTemplatesPreferencePage.DATA_SELECT_TEMPLATE,
templateName);
}
@@ -247,7 +250,7 @@
}
protected Template[] getApplicableTemplates() {
- final List<Template> result = new ArrayList<Template>();
+ final List<Template> result = new ArrayList<>();
final ICodeTemplateArea templateArea = getTemplateArea();
if (templateArea != null) {
final TemplateStore store = templateArea.getTemplateAccess()
@@ -255,7 +258,8 @@
final String[] contextTypeIds = getCodeTemplateContextTypeIds();
for (int i = 0; i < contextTypeIds.length; ++i) {
Template[] templates = store.getTemplates(contextTypeIds[i]);
- Arrays.sort(templates, (t0, t1) -> t0.getName().compareToIgnoreCase(t1.getName()));
+ Arrays.sort(templates, (t0, t1) -> t0.getName()
+ .compareToIgnoreCase(t1.getName()));
for (int j = 0; j < templates.length; ++j) {
result.add(templates[j]);
}
@@ -273,8 +277,9 @@
*/
protected String getLastUsedTemplateName() {
final IDialogSettings dialogSettings = getDialogSettings();
- return dialogSettings != null ? dialogSettings
- .get(getLastUsedTemplateKey()) : null;
+ return dialogSettings != null
+ ? dialogSettings.get(getLastUsedTemplateKey())
+ : null;
}
/**
@@ -343,7 +348,7 @@
}
}
}
- final List<IStatus> statuses = new ArrayList<IStatus>();
+ final List<IStatus> statuses = new ArrayList<>();
if (containerStatus != null) {
statuses.add(containerStatus);
}
@@ -408,7 +413,7 @@
}
- final List<StepEntry> entries = new ArrayList<StepEntry>();
+ final List<StepEntry> entries = new ArrayList<>();
@Override
public void addStep(String kind, int priority, ICreateStep step) {
@@ -417,7 +422,7 @@
@Override
public ICreateStep[] getSteps(String kind) {
- final List<StepEntry> selection = new ArrayList<StepEntry>();
+ final List<StepEntry> selection = new ArrayList<>();
for (StepEntry entry : entries) {
if (kind.equals(entry.kind)) {
selection.add(entry);
@@ -487,7 +492,7 @@
for (ISourceModuleWizardExtension extension : getExtensions()) {
extension.prepare(context);
}
- final List<ICreateStep> steps = new ArrayList<ICreateStep>();
+ final List<ICreateStep> steps = new ArrayList<>();
Collections.addAll(steps, context.getSteps(ICreateStep.KIND_PREPARE));
Collections.addAll(steps, context.getSteps(ICreateStep.KIND_EXECUTE));
Collections.addAll(steps, context.getSteps(ICreateStep.KIND_FINALIZE));
@@ -574,7 +579,7 @@
}
- final List<ModeEntry> modes = new ArrayList<ModeEntry>();
+ final List<ModeEntry> modes = new ArrayList<>();
private ModeEntry getActiveMode() {
for (ModeEntry f : modes) {
@@ -609,12 +614,13 @@
* @param composite
* @param nColumns
*/
- protected void createContentControls(Composite composite, final int nColumns) {
+ protected void createContentControls(Composite composite,
+ final int nColumns) {
createContainerControls(composite, nColumns);
// createPackageControls(composite, nColumns);
createFileControls(composite, nColumns);
- final List<ISourceModuleWizardMode> modes = new ArrayList<ISourceModuleWizardMode>();
+ final List<ISourceModuleWizardMode> modes = new ArrayList<>();
for (ISourceModuleWizardExtension extension : getExtensions()) {
modes.addAll(extension.getModes());
}
@@ -625,8 +631,10 @@
ggd.horizontalSpan = nColumns;
contents.setLayoutData(ggd);
contents.setLayout(new GridLayout(nColumns, false));
- ModeEntry wsEntry = addMode(contents, nColumns, new WorkspaceMode());
- ((GridData) wsEntry.field.getSelectionButton().getLayoutData()).horizontalSpan = nColumns;
+ ModeEntry wsEntry = addMode(contents, nColumns,
+ new WorkspaceMode());
+ ((GridData) wsEntry.field.getSelectionButton()
+ .getLayoutData()).horizontalSpan = nColumns;
for (ISourceModuleWizardMode template : modes) {
addMode(contents, nColumns, template);
}
@@ -735,7 +743,8 @@
dialog.setIgnoreCase(false);
dialog.setTitle(Messages.NewSourceModulePage_selectScriptFolder);
dialog.setMessage(Messages.NewSourceModulePage_selectScriptFolder);
- dialog.setEmptyListMessage(Messages.NewSourceModulePage_noFoldersAvailable);
+ dialog.setEmptyListMessage(
+ Messages.NewSourceModulePage_noFoldersAvailable);
IProjectFragment projectFragment = getProjectFragment();
if (projectFragment != null) {
@@ -796,8 +805,8 @@
final ICodeTemplateArea templateArea = getTemplateArea();
if (templateArea != null) {
final Template template = getSelectedTemplate();
- saveLastUsedTemplateName(template != null ? template.getName()
- : NO_TEMPLATE);
+ saveLastUsedTemplateName(
+ template != null ? template.getName() : NO_TEMPLATE);
if (template != null) {
final TemplateContextType contextType = templateArea
.getTemplateAccess().getContextTypeRegistry()
@@ -808,13 +817,14 @@
CodeGeneration.getLineDelimiterUsed(module));
// String fileComment = getFileComment(file, lineDelimiter);
// context.setVariable(CodeTemplateContextType.FILE_COMMENT,
- // fileComment != null ? fileComment : ""); //$NON-NLS-1$
+ // fileComment != null ? fileComment : ""); //$NON-NLS-1$
// ICProject cproject = CoreModel.getDefault().create(
// file.getProject());
// String includeGuardSymbol = generateIncludeGuardSymbol(file
// .getName(), cproject);
// context.setVariable(CodeTemplateContextType.INCLUDE_GUARD_SYMBOL,
- // includeGuardSymbol != null ? includeGuardSymbol : ""); //$NON-NLS-1$
+ // includeGuardSymbol != null ? includeGuardSymbol : "");
+ // //$NON-NLS-1$
context.setSourceModuleVariables(module);
final String[] fullLine = {};
final String result = CodeGeneration.evaluateTemplate(context,
@@ -832,8 +842,8 @@
protected IEnvironment getEnvironment() {
final IProjectFragment fragment = getProjectFragment();
if (fragment != null) {
- return EnvironmentManager.getEnvironment(fragment
- .getScriptProject().getProject());
+ return EnvironmentManager
+ .getEnvironment(fragment.getScriptProject().getProject());
}
return null;
}
@@ -844,8 +854,8 @@
void setMode(String mode) {
for (ModeEntry entry : modes) {
- entry.setSelection(mode != null
- && mode.equals(entry.template.getId()));
+ entry.setSelection(
+ mode != null && mode.equals(entry.template.getId()));
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleWizard.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleWizard.java
index 8e95505..e290618 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleWizard.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/NewSourceModuleWizard.java
@@ -73,7 +73,7 @@
protected abstract NewSourceModulePage createNewSourceModulePage();
- private final List<ISourceModuleWizardExtension> extensions = new ArrayList<ISourceModuleWizardExtension>();
+ private final List<ISourceModuleWizardExtension> extensions = new ArrayList<>();
@Override
public void addPages() {
@@ -230,7 +230,7 @@
}
} else {
if (disabledModes == null) {
- disabledModes = new HashSet<String>();
+ disabledModes = new HashSet<>();
}
disabledModes.add(mode);
}
@@ -255,7 +255,7 @@
public void addFieldChangeListener(String field,
IFieldChangeListener listener) {
if (listeners == null) {
- listeners = new HashMap<String, ListenerList<IFieldChangeListener>>();
+ listeners = new HashMap<>();
}
ListenerList<IFieldChangeListener> list = listeners.get(field);
if (list == null) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectCreator.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectCreator.java
index 98af2a6..80b5276 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectCreator.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectCreator.java
@@ -92,9 +92,9 @@
if (projectFileBackup == null) {
projectFileBackup = new ProjectMetadataBackup();
}
- projectFileBackup.backup(projectLocation, new String[] {
- IScriptProjectFilenames.PROJECT_FILENAME,
- IScriptProjectFilenames.BUILDPATH_FILENAME });
+ projectFileBackup.backup(projectLocation,
+ new String[] { IScriptProjectFilenames.PROJECT_FILENAME,
+ IScriptProjectFilenames.BUILDPATH_FILENAME });
}
private void restoreExistingFiles(IProgressMonitor monitor)
@@ -139,9 +139,8 @@
3);
try {
try {
- boolean removeContent = !fKeepContent
- && fCurrProject
- .isSynchronized(IResource.DEPTH_INFINITE);
+ boolean removeContent = !fKeepContent && fCurrProject
+ .isSynchronized(IResource.DEPTH_INFINITE);
fCurrProject.delete(removeContent, false,
new SubProgressMonitor(monitor, 2));
@@ -178,8 +177,8 @@
}
- public static abstract class ProjectCreateStep implements
- IProjectCreateStep {
+ public static abstract class ProjectCreateStep
+ implements IProjectCreateStep {
@Override
public boolean isCancelable() {
@@ -217,7 +216,7 @@
private static class StepTracker implements IStepTracker {
- private final Set<StepState> executed = new HashSet<StepState>();
+ private final Set<StepState> executed = new HashSet<>();
public void reset() {
executed.clear();
@@ -266,7 +265,7 @@
private static class FinishStepTracker extends FilteredStepTracker {
- private final Set<StepState> executed = new HashSet<StepState>();
+ private final Set<StepState> executed = new HashSet<>();
public FinishStepTracker(IStepTracker target) {
super(target);
@@ -291,8 +290,8 @@
super(target);
}
- final int currentPageIndex = indexOfPage(owner.getContainer()
- .getCurrentPage());
+ final int currentPageIndex = indexOfPage(
+ owner.getContainer().getCurrentPage());
@Override
protected boolean select(StepState state) {
@@ -302,7 +301,7 @@
}
}
- private final List<StepState> fSteps = new ArrayList<StepState>();
+ private final List<StepState> fSteps = new ArrayList<>();
private final IStepTracker fStepTracker = new StepTracker();
@@ -333,9 +332,9 @@
* @throws InvocationTargetException
*/
private void executeSteps(IStepTracker stepTracker, String kind,
- IProgressMonitor monitor) throws CoreException,
- InterruptedException {
- final List<StepState> selection = new ArrayList<StepState>();
+ IProgressMonitor monitor)
+ throws CoreException, InterruptedException {
+ final List<StepState> selection = new ArrayList<>();
for (StepState state : fSteps) {
if (kind.equals(state.kind) && owner.isEnabledPage(state.page)
&& stepTracker.canExecute(state)) {
@@ -396,20 +395,20 @@
final boolean cancelable = isCancelable(stepTracker);
final IRunnableWithProgress op = monitor -> {
-try {
- if (fIsAutobuild == null) {
- fIsAutobuild = Boolean.valueOf(CoreUtility
- .enableAutoBuild(false));
- }
- updateProject(monitor, stepTracker);
-} catch (CoreException e1) {
- throw new InvocationTargetException(e1);
-} catch (OperationCanceledException e2) {
- throw new InterruptedException();
-} finally {
- monitor.done();
-}
-};
+ try {
+ if (fIsAutobuild == null) {
+ fIsAutobuild = Boolean
+ .valueOf(CoreUtility.enableAutoBuild(false));
+ }
+ updateProject(monitor, stepTracker);
+ } catch (CoreException e1) {
+ throw new InvocationTargetException(e1);
+ } catch (OperationCanceledException e2) {
+ throw new InterruptedException();
+ } finally {
+ monitor.done();
+ }
+ };
try {
getContainer().run(true, cancelable,
@@ -430,7 +429,7 @@
* @return
*/
private boolean isCancelable(IStepTracker stepTracker) {
- final List<String> kinds = new ArrayList<String>();
+ final List<String> kinds = new ArrayList<>();
kinds.add(IProjectCreateStep.KIND_INIT);
kinds.add(IProjectCreateStep.KIND_INIT_UI);
kinds.add(IProjectCreateStep.KIND_FINISH);
@@ -469,9 +468,10 @@
* windows the path keeps the leading slash, e.g.
* "/C:/Users/alex/...")
*/
- realLocation = new URI(rootLocation.getScheme(), null, Path
- .fromPortableString(rootLocation.getPath())
- .append(fCurrProject.getName()).toString(), null);
+ realLocation = new URI(rootLocation.getScheme(), null,
+ Path.fromPortableString(rootLocation.getPath())
+ .append(fCurrProject.getName()).toString(),
+ null);
} catch (URISyntaxException e) {
Assert.isTrue(false, "Can't happen"); //$NON-NLS-1$
}
@@ -527,9 +527,8 @@
if (projectInterpreter == null) {
final String nature = getScriptNature();
if (nature != null) {
- projectInterpreter = ScriptRuntime
- .getDefaultInterpreterInstall(nature,
- fLocation.getEnvironment());
+ projectInterpreter = ScriptRuntime.getDefaultInterpreterInstall(
+ nature, fLocation.getEnvironment());
}
}
if (projectInterpreter != null) {
@@ -550,8 +549,8 @@
* @throws CoreException
* @throws InterruptedException
*/
- public void performFinish(IProgressMonitor monitor) throws CoreException,
- InterruptedException {
+ public void performFinish(IProgressMonitor monitor)
+ throws CoreException, InterruptedException {
try {
monitor.beginTask(
NewWizardMessages.ScriptProjectWizardSecondPage_operation_create,
@@ -630,11 +629,12 @@
protected IBuildpathEntry[] initBuildpath(IProgressMonitor monitor)
throws CoreException {
if (fLocation.getDetect()) {
- if (!fCurrProject.getFile(
- IScriptProjectFilenames.BUILDPATH_FILENAME).exists()) {
+ if (!fCurrProject
+ .getFile(IScriptProjectFilenames.BUILDPATH_FILENAME)
+ .exists()) {
final IBuildpathDetector detector = createBuildpathDetector();
- detector.detectBuildpath(new SubProgressMonitor(monitor,
- WORK_INIT_BP));
+ detector.detectBuildpath(
+ new SubProgressMonitor(monitor, WORK_INIT_BP));
return detector.getBuildpath();
} else {
monitor.worked(WORK_INIT_BP);
@@ -642,8 +642,9 @@
}
} else if (fLocation.isSrc()) {
final IDLTKUILanguageToolkit toolkit = getUILanguageToolkit();
- final IPath srcPath = toolkit != null ? new Path(
- toolkit.getString(PreferenceConstants.SRC_SRCNAME))
+ final IPath srcPath = toolkit != null
+ ? new Path(
+ toolkit.getString(PreferenceConstants.SRC_SRCNAME))
: Path.EMPTY;
if (srcPath.segmentCount() > 0) {
final IFolder folder = fCurrProject.getFolder(srcPath);
@@ -655,13 +656,13 @@
final IPath projectPath = fCurrProject.getFullPath();
// configure the buildpath entries, including the default
// InterpreterEnvironment library.
- List<IBuildpathEntry> cpEntries = new ArrayList<IBuildpathEntry>();
+ List<IBuildpathEntry> cpEntries = new ArrayList<>();
cpEntries.add(DLTKCore.newSourceEntry(projectPath.append(srcPath)));
cpEntries.addAll(getDefaultBuildpathEntries());
return cpEntries.toArray(new IBuildpathEntry[cpEntries.size()]);
} else {
IPath projectPath = fCurrProject.getFullPath();
- List<IBuildpathEntry> cpEntries = new ArrayList<IBuildpathEntry>();
+ List<IBuildpathEntry> cpEntries = new ArrayList<>();
cpEntries.add(DLTKCore.newSourceEntry(projectPath));
cpEntries.addAll(getDefaultBuildpathEntries());
monitor.worked(WORK_INIT_BP);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectMetadataBackup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectMetadataBackup.java
index bad9f1e..055aecd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectMetadataBackup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectMetadataBackup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2017 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -66,7 +66,7 @@
}
- private final Map<BackupKey, File> entries = new HashMap<BackupKey, File>();
+ private final Map<BackupKey, File> entries = new HashMap<>();
/**
* @param projectLocation
@@ -124,19 +124,17 @@
monitor.worked(2);
continue;
}
- final IFileStore projectFile = EFS.getStore(
- entry.getKey().location).getChild(
- entry.getKey().filename);
- projectFile.delete(EFS.NONE, new SubProgressMonitor(
- monitor, 1));
- copyFile(backup, projectFile, new SubProgressMonitor(
- monitor, 1));
+ final IFileStore projectFile = EFS
+ .getStore(entry.getKey().location)
+ .getChild(entry.getKey().filename);
+ projectFile.delete(EFS.NONE,
+ new SubProgressMonitor(monitor, 1));
+ copyFile(backup, projectFile,
+ new SubProgressMonitor(monitor, 1));
backup.delete();
} catch (IOException e) {
- IStatus status = new Status(
- IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
- IStatus.ERROR,
+ IStatus status = new Status(IStatus.ERROR,
+ DLTKUIPlugin.PLUGIN_ID, IStatus.ERROR,
NewWizardMessages.ScriptProjectWizardSecondPage_problem_restore_project,
e);
throw new CoreException(status);
@@ -154,20 +152,18 @@
copyFile(source, bak);
return bak;
} catch (IOException e) {
- IStatus status = new Status(
+ IStatus status = new Status(IStatus.ERROR, DLTKUIPlugin.PLUGIN_ID,
IStatus.ERROR,
- DLTKUIPlugin.PLUGIN_ID,
- IStatus.ERROR,
- Messages
- .format(
- NewWizardMessages.ScriptProjectWizardSecondPage_problem_backup,
- name), e);
+ Messages.format(
+ NewWizardMessages.ScriptProjectWizardSecondPage_problem_backup,
+ name),
+ e);
throw new CoreException(status);
}
}
- private void copyFile(IFileStore source, File target) throws IOException,
- CoreException {
+ private void copyFile(IFileStore source, File target)
+ throws IOException, CoreException {
InputStream is = source.openInputStream(EFS.NONE, null);
FileOutputStream os = new FileOutputStream(target);
copyFile(is, os);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java
index c59919b..1dd9515 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage.java
@@ -82,8 +82,8 @@
*
* @since 2.0
*/
-public abstract class ProjectWizardFirstPage extends WizardPage implements
- ILocationGroup, IProjectWizardPage {
+public abstract class ProjectWizardFirstPage extends WizardPage
+ implements ILocationGroup, IProjectWizardPage {
/**
* @since 2.0
@@ -95,20 +95,20 @@
* Request a project name. Fires an event whenever the text field is
* changed, regardless of its content.
*/
- public final class NameGroup extends Observable implements
- IDialogFieldListener {
+ public final class NameGroup extends Observable
+ implements IDialogFieldListener {
protected final StringDialogField fNameField;
public NameGroup(Composite composite, String initialName) {
final Composite nameComposite = new Composite(composite, SWT.NONE);
nameComposite.setFont(composite.getFont());
- nameComposite.setLayout(initGridLayout(new GridLayout(2, false),
- false));
+ nameComposite
+ .setLayout(initGridLayout(new GridLayout(2, false), false));
nameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// text field for project name
fNameField = new StringDialogField();
- fNameField
- .setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_NameGroup_label_text);
+ fNameField.setLabelText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_NameGroup_label_text);
fNameField.setDialogFieldListener(this);
setName(initialName);
fNameField.doFillIntoGrid(nameComposite, 2);
@@ -143,8 +143,8 @@
* field is changed, regardless of whether the change originates from the
* user or has been invoked programmatically.
*/
- public class LocationGroup extends Observable implements Observer,
- IStringButtonAdapter, IDialogFieldListener {
+ public class LocationGroup extends Observable
+ implements Observer, IStringButtonAdapter, IDialogFieldListener {
protected final SelectionButtonDialogField fWorkspaceRadio;
protected final SelectionButtonDialogField fExternalRadio;
protected final StringButtonDialogField fLocation;
@@ -162,24 +162,24 @@
fWorkspaceRadio = new SelectionButtonDialogField(SWT.RADIO);
fWorkspaceRadio.setDialogFieldListener(this);
- fWorkspaceRadio
- .setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_workspace_desc);
+ fWorkspaceRadio.setLabelText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_workspace_desc);
fExternalRadio = new SelectionButtonDialogField(SWT.RADIO);
fExternalRadio.setDialogFieldListener(this);
- fExternalRadio
- .setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_external_desc);
+ fExternalRadio.setLabelText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_external_desc);
fLocation = new StringButtonDialogField(this);
fLocation.setDialogFieldListener(this);
- fLocation
- .setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_locationLabel_desc);
- fLocation
- .setButtonLabel(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_browseButton_desc);
+ fLocation.setLabelText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_locationLabel_desc);
+ fLocation.setButtonLabel(
+ NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_browseButton_desc);
fEnvironment = new ComboDialogField(SWT.DROP_DOWN | SWT.READ_ONLY);
- fEnvironment
- .setLabelText(NewWizardMessages.ProjectWizardFirstPage_host);
+ fEnvironment.setLabelText(
+ NewWizardMessages.ProjectWizardFirstPage_host);
fEnvironment.setDialogFieldListener(this);
fEnvironment.setDialogFieldListener(field -> updateInterpreters());
}
@@ -188,10 +188,10 @@
final int numColumns = 3;
final Group group = new Group(composite, SWT.NONE);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- group.setLayout(initGridLayout(new GridLayout(numColumns, false),
- true));
- group
- .setText(NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_title);
+ group.setLayout(
+ initGridLayout(new GridLayout(numColumns, false), true));
+ group.setText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_LocationGroup_title);
createModeControls(group, numColumns);
createEnvironmentControls(group, numColumns);
createLocationControls(group, numColumns);
@@ -223,7 +223,8 @@
/**
* @since 2.0
*/
- protected void createEnvironmentControls(Composite group, int numColumns) {
+ protected void createEnvironmentControls(Composite group,
+ int numColumns) {
environmentChangedListener = new EnvironmentChangedListener() {
@Override
public void environmentsModified() {
@@ -374,13 +375,14 @@
if (environmentUI != null) {
String directoryName = fLocation.getText().trim();
if (directoryName.length() == 0) {
- final String prevLocation = loadLastExternalLocation(environment);
+ final String prevLocation = loadLastExternalLocation(
+ environment);
if (prevLocation != null) {
directoryName = prevLocation;
}
}
- final String selectedDirectory = environmentUI.selectFolder(
- getShell(), directoryName);
+ final String selectedDirectory = environmentUI
+ .selectFolder(getShell(), directoryName);
if (selectedDirectory != null) {
fLocation.setText(selectedDirectory);
@@ -478,8 +480,8 @@
protected void dispose() {
if (environmentChangedListener != null) {
- EnvironmentManager
- .removeEnvironmentChangedListener(environmentChangedListener);
+ EnvironmentManager.removeEnvironmentChangedListener(
+ environmentChangedListener);
environmentChangedListener = null;
}
}
@@ -488,14 +490,12 @@
final String location = getLocation().toOSString();
// check whether location is empty
if (location.length() == 0) {
- return new StatusInfo(
- IStatus.WARNING,
+ return new StatusInfo(IStatus.WARNING,
NewWizardMessages.ScriptProjectWizardFirstPage_Message_enterLocation);
}
// check whether the location is a syntactically correct path
if (!Path.EMPTY.isValidPath(location)) {
- return new StatusInfo(
- IStatus.ERROR,
+ return new StatusInfo(IStatus.ERROR,
NewWizardMessages.ScriptProjectWizardFirstPage_Message_invalidDirectory);
}
final IPath projectPath = Path.fromOSString(location);
@@ -503,8 +503,7 @@
// check whether the location has the workspace as prefix
if (!isInWorkspace() && environment.isLocal()
&& Platform.getLocation().isPrefixOf(projectPath)) {
- return new StatusInfo(
- IStatus.ERROR,
+ return new StatusInfo(IStatus.ERROR,
NewWizardMessages.ScriptProjectWizardFirstPage_Message_cannotCreateInWorkspace);
}
if (!isInWorkspace() && environment.isLocal()) {
@@ -513,8 +512,8 @@
final IStatus locationStatus = DLTKUIPlugin.getWorkspace()
.validateProjectLocation(handle, projectPath);
if (!locationStatus.isOK()) {
- return new StatusInfo(IStatus.ERROR, locationStatus
- .getMessage());
+ return new StatusInfo(IStatus.ERROR,
+ locationStatus.getMessage());
}
}
return Status.OK_STATUS;
@@ -565,12 +564,12 @@
fGroup = new Group(composite, SWT.NONE);
fGroup.setFont(composite.getFont());
fGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- final GridLayout groupLayout = initGridLayout(new GridLayout(3,
- false), true);
+ final GridLayout groupLayout = initGridLayout(
+ new GridLayout(3, false), true);
groupLayout.marginHeight /= 2;
fGroup.setLayout(groupLayout);
- fGroup
- .setText(NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_title);
+ fGroup.setText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_title);
fUseDefaultInterpreter = new SelectionButtonDialogField(SWT.RADIO);
fUseDefaultInterpreter.setLabelText(getDefaultInterpreterLabel());
@@ -579,15 +578,15 @@
fPreferenceLink = new Link(fGroup, SWT.NONE);
fPreferenceLink.setFont(fGroup.getFont());
- fPreferenceLink
- .setText(NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_link_description);
- fPreferenceLink.setLayoutData(new GridData(GridData.END,
- GridData.CENTER, false, false));
+ fPreferenceLink.setText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_link_description);
+ fPreferenceLink.setLayoutData(
+ new GridData(GridData.END, GridData.CENTER, false, false));
fPreferenceLink.addSelectionListener(this);
fUseProjectInterpreter = new SelectionButtonDialogField(SWT.RADIO);
- fUseProjectInterpreter
- .setLabelText(NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_specific_compliance);
+ fUseProjectInterpreter.setLabelText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_specific_compliance);
fUseProjectInterpreter.doFillIntoGrid(fGroup, 1);
fUseProjectInterpreter.setDialogFieldListener(this);
@@ -644,7 +643,7 @@
}
private IInterpreterInstall[] getWorkspaceInterpeters() {
- List<IInterpreterInstall> standins = new ArrayList<IInterpreterInstall>();
+ List<IInterpreterInstall> standins = new ArrayList<>();
IInterpreterInstallType[] types = ScriptRuntime
.getInterpreterInstallTypes(getCurrentLanguageNature());
IEnvironment environment = getEnvironment();
@@ -673,10 +672,9 @@
}
private String getDefaultInterpreterLabel() {
- return Messages
- .format(
- NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_default_compliance,
- getDefaultInterpreterName());
+ return Messages.format(
+ NewWizardMessages.ScriptProjectWizardFirstPage_InterpreterEnvironmentGroup_default_compliance,
+ getDefaultInterpreterName());
}
@Override
@@ -691,8 +689,8 @@
&& interpretersPresent;
fUseDefaultInterpreter.setEnabled(!detect);
fUseProjectInterpreter.setEnabled(!detect);
- fInterpreterCombo.setEnabled(!detect
- && fUseProjectInterpreter.isSelected());
+ fInterpreterCombo
+ .setEnabled(!detect && fUseProjectInterpreter.isSelected());
fPreferenceLink.setEnabled(!detect);
fGroup.setEnabled(!detect);
}
@@ -860,8 +858,8 @@
public void createControl(Composite composite) {
Group workingSetGroup = new Group(composite, SWT.NONE);
workingSetGroup.setFont(composite.getFont());
- workingSetGroup
- .setText(NewWizardMessages.ProjectWizardFirstPage_WorkingSets_group);
+ workingSetGroup.setText(
+ NewWizardMessages.ProjectWizardFirstPage_WorkingSets_group);
workingSetGroup
.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
workingSetGroup.setLayout(new GridLayout(1, false));
@@ -882,16 +880,16 @@
/**
* Show a warning when the project location contains files.
*/
- protected final class DetectGroup extends Observable implements Observer,
- SelectionListener {
+ protected final class DetectGroup extends Observable
+ implements Observer, SelectionListener {
private final Link fHintText;
private Label fIcon;
private boolean fDetect;
public DetectGroup(Composite parent) {
Composite composite = new Composite(parent, SWT.WRAP);
- composite
- .setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ composite.setLayoutData(
+ new GridData(SWT.FILL, SWT.TOP, true, false));
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
@@ -931,8 +929,8 @@
} else {
final IEnvironment environment = EnvironmentManager
.getLocalEnvironment();
- final IFileHandle directory = environment.getFile(location
- .append(getProjectName()));
+ final IFileHandle directory = environment
+ .getFile(location.append(getProjectName()));
return directory.isDirectory();
}
} else {
@@ -955,12 +953,12 @@
setChanged();
notifyObservers();
if (fDetect) {
- fIcon.setImage(Dialog
- .getImage(Dialog.DLG_IMG_MESSAGE_INFO));
+ fIcon.setImage(
+ Dialog.getImage(Dialog.DLG_IMG_MESSAGE_INFO));
fIcon.setVisible(true);
fHintText.setVisible(true);
- fHintText
- .setText(NewWizardMessages.ScriptProjectWizardFirstPage_DetectGroup_message);
+ fHintText.setText(
+ NewWizardMessages.ScriptProjectWizardFirstPage_DetectGroup_message);
fHintText.getParent().layout();
} else {
fIcon.setVisible(false);
@@ -986,8 +984,8 @@
@Override
public void widgetDefaultSelected(SelectionEvent e) {
if (DLTKCore.DEBUG) {
- System.err
- .println("DetectGroup show compilancePreferencePage..."); //$NON-NLS-1$
+ System.err.println(
+ "DetectGroup show compilancePreferencePage..."); //$NON-NLS-1$
}
if (supportInterpreter()) {
handlePossibleInterpreterChange();
@@ -1005,8 +1003,7 @@
final String name = fNameGroup.getName();
// check whether the project name field is empty
if (name.length() == 0) {
- return new StatusInfo(
- IStatus.OK,
+ return new StatusInfo(IStatus.OK,
NewWizardMessages.ScriptProjectWizardFirstPage_Message_enterProjectName);
}
// check whether the project name is valid
@@ -1019,8 +1016,7 @@
// check whether project already exists
final IProject handle = getProjectHandle();
if (handle.exists()) {
- return new StatusInfo(
- IStatus.ERROR,
+ return new StatusInfo(IStatus.ERROR,
NewWizardMessages.ScriptProjectWizardFirstPage_Message_projectAlreadyExists);
}
IPath projectLocation = workspace.getRoot().getLocation().append(name);
@@ -1035,13 +1031,9 @@
}
String existingName = projectLocation.lastSegment();
if (!existingName.equals(fNameGroup.getName())) {
- return new StatusInfo(
- IStatus.ERROR,
- NLS
- .bind(
- NewWizardMessages.ScriptProjectWizardFirstPage_Message_invalidProjectNameForWorkspaceRoot,
- BasicElementLabels
- .getResourceName(existingName)));
+ return new StatusInfo(IStatus.ERROR, NLS.bind(
+ NewWizardMessages.ScriptProjectWizardFirstPage_Message_invalidProjectNameForWorkspaceRoot,
+ BasicElementLabels.getResourceName(existingName)));
}
}
return null;
@@ -1088,8 +1080,9 @@
final ControlStatus cStatus = (ControlStatus) projectStatus;
decorations.show(cStatus.getControl(), cStatus);
} else {
- decorations.show(fLocationGroup.fLocation
- .getTextControl(), projectStatus);
+ decorations.show(
+ fLocationGroup.fLocation.getTextControl(),
+ projectStatus);
}
}
} else {
@@ -1108,14 +1101,12 @@
}
if (supportInterpreter() && interpeterRequired()) {
if (!fInterpreterGroup.isInterpreterPresent()) {
- setErrorMessage(NewWizardMessages.ProjectWizardFirstPage_atLeastOneInterpreterMustBeConfigured);
+ setErrorMessage(
+ NewWizardMessages.ProjectWizardFirstPage_atLeastOneInterpreterMustBeConfigured);
setPageComplete(false);
- decorations
- .show(
- fInterpreterGroup.getDecorationTarget(),
- new StatusInfo(
- IStatus.ERROR,
- NewWizardMessages.ProjectWizardFirstPage_atLeastOneInterpreterMustBeConfigured));
+ decorations.show(fInterpreterGroup.getDecorationTarget(),
+ new StatusInfo(IStatus.ERROR,
+ NewWizardMessages.ProjectWizardFirstPage_atLeastOneInterpreterMustBeConfigured));
return;
}
}
@@ -1146,7 +1137,8 @@
super(PAGE_NAME);
setPageComplete(false);
setTitle(NewWizardMessages.ScriptProjectWizardFirstPage_page_title);
- setDescription(NewWizardMessages.ScriptProjectWizardFirstPage_page_description);
+ setDescription(
+ NewWizardMessages.ScriptProjectWizardFirstPage_page_description);
fInitialName = ""; //$NON-NLS-1$
}
@@ -1209,8 +1201,9 @@
*/
@Override
public IInterpreterInstall getInterpreter() {
- return fInterpreterGroup != null ? fInterpreterGroup
- .getSelectedInterpreter() : null;
+ return fInterpreterGroup != null
+ ? fInterpreterGroup.getSelectedInterpreter()
+ : null;
}
private IInterpreterGroup fInterpreterGroup;
@@ -1341,8 +1334,8 @@
*/
@Override
public IProject getProjectHandle() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(
- fNameGroup.getName());
+ return ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(fNameGroup.getName());
}
@Override
@@ -1393,11 +1386,15 @@
* Initialize a grid layout with the default Dialog settings.
*/
protected GridLayout initGridLayout(GridLayout layout, boolean margins) {
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_SPACING);
if (margins) {
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(
+ IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginHeight = convertVerticalDLUsToPixels(
+ IDialogConstants.VERTICAL_MARGIN);
} else {
layout.marginWidth = 0;
layout.marginHeight = 0;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/WorkingSetDetector.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/WorkingSetDetector.java
index 19d13fa..9ee96a4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/WorkingSetDetector.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/wizards/WorkingSetDetector.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2017 xored software, Inc. and others.
*
* 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
+ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* xored software, Inc. - initial API and Implementation (Alex Panchenko)
@@ -28,7 +28,7 @@
/**
* Detects {@link IWorkingSet}s selected before project wizard was called.
- *
+ *
* @since 2.0
*/
public class WorkingSetDetector {
@@ -37,7 +37,7 @@
/**
* Detects workings sets currently selected
- *
+ *
* @param selection
* @param workbench
* @return
@@ -59,7 +59,8 @@
return EMPTY_WORKING_SET_ARRAY;
ScriptExplorerPart explorerPart = (ScriptExplorerPart) activePart;
- if (explorerPart.getRootMode() == ScriptExplorerPart.PROJECTS_AS_ROOTS) {
+ if (explorerPart
+ .getRootMode() == ScriptExplorerPart.PROJECTS_AS_ROOTS) {
// Get active filter
IWorkingSet filterWorkingSet = explorerPart.getFilterWorkingSet();
if (filterWorkingSet == null)
@@ -94,7 +95,8 @@
return null;
}
- private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) {
+ private IWorkingSet[] getSelectedWorkingSet(
+ IStructuredSelection selection) {
if (!(selection instanceof ITreeSelection))
return EMPTY_WORKING_SET_ARRAY;
@@ -124,7 +126,7 @@
return EMPTY_WORKING_SET_ARRAY;
}
- List<IWorkingSet> result = new ArrayList<IWorkingSet>();
+ List<IWorkingSet> result = new ArrayList<>();
for (Iterator<?> iterator = elements.iterator(); iterator.hasNext();) {
Object element = iterator.next();
if (element instanceof IWorkingSet) {
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java
index 1afc0c2..17539c4 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java
@@ -151,8 +151,8 @@
private final ILabelProvider fLabelProvider;
private ClipboardCopier(IResource[] resources,
- IModelElement[] modelElements, Clipboard clipboard,
- Shell shell, boolean autoRepeatOnFailure) {
+ IModelElement[] modelElements, Clipboard clipboard, Shell shell,
+ boolean autoRepeatOnFailure) {
Assert.isNotNull(resources);
Assert.isNotNull(modelElements);
Assert.isNotNull(clipboard);
@@ -167,17 +167,16 @@
public void copyToClipboard() throws CoreException {
// Set<String> fileNames
- Set<String> fileNames = new HashSet<String>(
- fResources.length
- + fScriptElements.length);
+ Set<String> fileNames = new HashSet<>(
+ fResources.length + fScriptElements.length);
StringBuffer namesBuf = new StringBuffer();
processResources(fileNames, namesBuf);
processScriptElements(fileNames, namesBuf);
List typesList = ReorgUtils.getElementsOfType(fScriptElements,
IModelElement.TYPE);
- IType types[] = (IType[]) typesList.toArray(new IType[typesList
- .size()]);
+ IType types[] = (IType[]) typesList
+ .toArray(new IType[typesList.size()]);
ISourceModule[] cusOfMainTypes = ReorgUtils.getSourceModules(types);
IResource[] resourcesOfMainTypes = ReorgUtils
.getResources(cusOfMainTypes);
@@ -189,15 +188,16 @@
IResource[] resourcesForClipboard = ReorgUtils.union(fResources,
ReorgUtils.union(cuResources, resourcesOfMainTypes));
- IModelElement[] modelElementsForClipboard = ReorgUtils.union(
- fScriptElements, cusOfMainTypes);
+ IModelElement[] modelElementsForClipboard = ReorgUtils
+ .union(fScriptElements, cusOfMainTypes);
// TypedSource[] typedSources=
// TypedSource.createTypedSources(modelElementsForClipboard);
String[] fileNameArray = fileNames
.toArray(new String[fileNames.size()]);
- copyToClipboard(resourcesForClipboard, fileNameArray, namesBuf
- .toString(), modelElementsForClipboard/* , typedSources */, 0);
+ copyToClipboard(resourcesForClipboard, fileNameArray,
+ namesBuf.toString(),
+ modelElementsForClipboard/* , typedSources */, 0);
}
private static IModelElement[] getSourceModules(
@@ -218,7 +218,8 @@
}
}
- private void processScriptElements(Set fileNames, StringBuffer namesBuf) {
+ private void processScriptElements(Set fileNames,
+ StringBuffer namesBuf) {
for (int i = 0; i < fScriptElements.length; i++) {
IModelElement element = fScriptElements[i];
switch (element.getElementType()) {
@@ -256,17 +257,17 @@
}
private void copyToClipboard(IResource[] resources, String[] fileNames,
- String names, IModelElement[] modelElements, /*
- * TypedSource[]
- * typedSources,
- */int repeat) {
+ String names, IModelElement[] modelElements,
+ /*
+ * TypedSource[] typedSources,
+ */int repeat) {
final int repeat_max_count = 10;
try {
- fClipboard
- .setContents(createDataArray(resources, modelElements,
- fileNames, names/* , typedSources */),
- createDataTypeArray(resources, modelElements,
- fileNames/* , typedSources */));
+ fClipboard.setContents(
+ createDataArray(resources, modelElements, fileNames,
+ names/* , typedSources */),
+ createDataTypeArray(resources, modelElements,
+ fileNames/* , typedSources */));
} catch (SWTError e) {
if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD
|| repeat >= repeat_max_count)
@@ -278,22 +279,20 @@
// do nothing.
}
}
- if (fAutoRepeatOnFailure
- || MessageDialog.openQuestion(fShell,
- ReorgMessages.CopyToClipboardAction_4,
- ReorgMessages.CopyToClipboardAction_5))
+ if (fAutoRepeatOnFailure || MessageDialog.openQuestion(fShell,
+ ReorgMessages.CopyToClipboardAction_4,
+ ReorgMessages.CopyToClipboardAction_5))
copyToClipboard(resources, fileNames, names,
modelElements/* , typedSources */, repeat + 1);
}
}
private static Transfer[] createDataTypeArray(IResource[] resources,
- IModelElement[] modelElements, String[] fileNames/*
- * ,
- * TypedSource[]
- * typedSources
- */) {
- List<Transfer> result = new ArrayList<Transfer>(4);
+ IModelElement[] modelElements,
+ String[] fileNames/*
+ * , TypedSource[] typedSources
+ */) {
+ List<Transfer> result = new ArrayList<>(4);
if (resources.length != 0)
result.add(ResourceTransfer.getInstance());
if (modelElements.length != 0)
@@ -307,13 +306,10 @@
}
private static Object[] createDataArray(IResource[] resources,
- IModelElement[] modelElements, String[] fileNames, String names/*
- * ,
- * TypedSource
- * [
- * ]
- * typedSources
- */) {
+ IModelElement[] modelElements, String[] fileNames,
+ String names/*
+ * , TypedSource [ ] typedSources
+ */) {
List result = new ArrayList(4);
if (resources.length != 0)
result.add(resources);
@@ -344,8 +340,8 @@
}
}
- private static class CopyToClipboardEnablementPolicy implements
- IReorgEnablementPolicy {
+ private static class CopyToClipboardEnablementPolicy
+ implements IReorgEnablementPolicy {
private final IResource[] fResources;
private final IModelElement[] fScriptElements;
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java
index 13128c6..bf4c162 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java
@@ -52,69 +52,78 @@
import org.eclipse.ui.actions.CopyProjectOperation;
import org.eclipse.ui.part.ResourceTransfer;
-
-public class PasteAction extends SelectionDispatchAction{
+public class PasteAction extends SelectionDispatchAction {
private final Clipboard fClipboard;
public PasteAction(IWorkbenchSite site, Clipboard clipboard) {
super(site);
Assert.isNotNull(clipboard);
- fClipboard= clipboard;
+ fClipboard = clipboard;
setText(ReorgMessages.PasteAction_4);
setDescription(ReorgMessages.PasteAction_5);
- ISharedImages workbenchImages= DLTKUIPlugin.getDefault().getWorkbench().getSharedImages();
- setDisabledImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
- setImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- setHoverImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
+ ISharedImages workbenchImages = DLTKUIPlugin.getDefault().getWorkbench()
+ .getSharedImages();
+ setDisabledImageDescriptor(workbenchImages
+ .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
+ setImageDescriptor(workbenchImages
+ .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
+ setHoverImageDescriptor(workbenchImages
+ .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
if (DLTKCore.DEBUG) {
System.err.println("Add help support here..."); //$NON-NLS-1$
}
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IScriptHelpContextIds.PASTE_ACTION);
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ // IScriptHelpContextIds.PASTE_ACTION);
}
@Override
public void selectionChanged(IStructuredSelection selection) {
- // Moved condition checking to run (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=78450)
+ // Moved condition checking to run (see
+ // http://bugs.eclipse.org/bugs/show_bug.cgi?id=78450)
}
- private Paster[] createEnabledPasters(TransferData[] availableDataTypes) throws ModelException {
+ private Paster[] createEnabledPasters(TransferData[] availableDataTypes)
+ throws ModelException {
Paster paster;
Shell shell = getShell();
- List<Paster> result = new ArrayList<Paster>(2);
- paster= new ProjectPaster(shell, fClipboard);
+ List<Paster> result = new ArrayList<>(2);
+ paster = new ProjectPaster(shell, fClipboard);
if (paster.canEnable(availableDataTypes))
result.add(paster);
- paster= new ModelElementAndResourcePaster(shell, fClipboard);
+ paster = new ModelElementAndResourcePaster(shell, fClipboard);
if (paster.canEnable(availableDataTypes))
result.add(paster);
- paster= new FilePaster(shell, fClipboard);
+ paster = new FilePaster(shell, fClipboard);
if (paster.canEnable(availableDataTypes))
result.add(paster);
- paster= new WorkingSetPaster(shell, fClipboard);
+ paster = new WorkingSetPaster(shell, fClipboard);
if (paster.canEnable(availableDataTypes))
result.add(paster);
return result.toArray(new Paster[result.size()]);
}
- private static Object getContents(final Clipboard clipboard, final Transfer transfer, Shell shell) {
- //see bug 33028 for explanation why we need this
- final Object[] result= new Object[1];
+ private static Object getContents(final Clipboard clipboard,
+ final Transfer transfer, Shell shell) {
+ // see bug 33028 for explanation why we need this
+ final Object[] result = new Object[1];
shell.getDisplay()
.syncExec(() -> result[0] = clipboard.getContents(transfer));
return result[0];
}
- private static boolean isAvailable(Transfer transfer, TransferData[] availableDataTypes) {
- for (int i= 0; i < availableDataTypes.length; i++) {
- if (transfer.isSupportedType(availableDataTypes[i])) return true;
+ private static boolean isAvailable(Transfer transfer,
+ TransferData[] availableDataTypes) {
+ for (int i = 0; i < availableDataTypes.length; i++) {
+ if (transfer.isSupportedType(availableDataTypes[i]))
+ return true;
}
return false;
}
@@ -122,92 +131,126 @@
@Override
public void run(IStructuredSelection selection) {
try {
- TransferData[] availableTypes= fClipboard.getAvailableTypes();
- List elements= selection.toList();
- IResource[] resources= ReorgUtils.getResources(elements);
- IModelElement[] modelElements= ReorgUtils.getModelElements(elements);
- IWorkingSet[] workingSets= ReorgUtils.getWorkingSets(elements);
- Paster[] pasters= createEnabledPasters(availableTypes);
- for (int i= 0; i < pasters.length; i++) {
- if (pasters[i].canPasteOn(modelElements, resources, workingSets)) {
- pasters[i].paste(modelElements, resources, workingSets, availableTypes);
+ TransferData[] availableTypes = fClipboard.getAvailableTypes();
+ List elements = selection.toList();
+ IResource[] resources = ReorgUtils.getResources(elements);
+ IModelElement[] modelElements = ReorgUtils
+ .getModelElements(elements);
+ IWorkingSet[] workingSets = ReorgUtils.getWorkingSets(elements);
+ Paster[] pasters = createEnabledPasters(availableTypes);
+ for (int i = 0; i < pasters.length; i++) {
+ if (pasters[i].canPasteOn(modelElements, resources,
+ workingSets)) {
+ pasters[i].paste(modelElements, resources, workingSets,
+ availableTypes);
return;// one is enough
}
}
- MessageDialog.openError(DLTKUIPlugin.getActiveWorkbenchShell(), RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_disabled);
+ MessageDialog.openError(DLTKUIPlugin.getActiveWorkbenchShell(),
+ RefactoringMessages.OpenRefactoringWizardAction_refactoring,
+ RefactoringMessages.OpenRefactoringWizardAction_disabled);
} catch (ModelException e) {
- ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
+ ExceptionHandler.handle(e,
+ RefactoringMessages.OpenRefactoringWizardAction_refactoring,
+ RefactoringMessages.OpenRefactoringWizardAction_exception);
} catch (InvocationTargetException e) {
- ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
+ ExceptionHandler.handle(e,
+ RefactoringMessages.OpenRefactoringWizardAction_refactoring,
+ RefactoringMessages.OpenRefactoringWizardAction_exception);
} catch (InterruptedException e) {
// OK
}
}
- private abstract static class Paster{
+ private abstract static class Paster {
private final Shell fShell;
private final Clipboard fClipboard2;
- protected Paster(Shell shell, Clipboard clipboard){
- fShell= shell;
- fClipboard2= clipboard;
+
+ protected Paster(Shell shell, Clipboard clipboard) {
+ fShell = shell;
+ fClipboard2 = clipboard;
}
+
protected final Shell getShell() {
return fShell;
}
+
protected final Clipboard getClipboard() {
return fClipboard2;
}
- protected final IResource[] getClipboardResources(TransferData[] availableDataTypes) {
- Transfer transfer= ResourceTransfer.getInstance();
+ protected final IResource[] getClipboardResources(
+ TransferData[] availableDataTypes) {
+ Transfer transfer = ResourceTransfer.getInstance();
if (isAvailable(transfer, availableDataTypes)) {
- return (IResource[])getContents(fClipboard2, transfer, getShell());
+ return (IResource[]) getContents(fClipboard2, transfer,
+ getShell());
}
return null;
}
- protected final IModelElement[] getClipboardScriptElements(TransferData[] availableDataTypes) {
- Transfer transfer= ModelElementTransfer.getInstance();
+ protected final IModelElement[] getClipboardScriptElements(
+ TransferData[] availableDataTypes) {
+ Transfer transfer = ModelElementTransfer.getInstance();
if (isAvailable(transfer, availableDataTypes)) {
- return (IModelElement[])getContents(fClipboard2, transfer, getShell());
+ return (IModelElement[]) getContents(fClipboard2, transfer,
+ getShell());
}
return null;
}
- public abstract void paste(IModelElement[] selectedScriptElements, IResource[] selectedResources, IWorkingSet[] selectedWorkingSets, TransferData[] availableTypes) throws ModelException, InterruptedException, InvocationTargetException;
- public abstract boolean canEnable(TransferData[] availableTypes) throws ModelException;
- public abstract boolean canPasteOn(IModelElement[] selectedScriptElements, IResource[] selectedResources, IWorkingSet[] selectedWorkingSets) throws ModelException;
+ public abstract void paste(IModelElement[] selectedScriptElements,
+ IResource[] selectedResources,
+ IWorkingSet[] selectedWorkingSets,
+ TransferData[] availableTypes) throws ModelException,
+ InterruptedException, InvocationTargetException;
+
+ public abstract boolean canEnable(TransferData[] availableTypes)
+ throws ModelException;
+
+ public abstract boolean canPasteOn(
+ IModelElement[] selectedScriptElements,
+ IResource[] selectedResources,
+ IWorkingSet[] selectedWorkingSets) throws ModelException;
}
-
private static class WorkingSetPaster extends Paster {
protected WorkingSetPaster(Shell shell, Clipboard clipboard) {
super(shell, clipboard);
}
+
@Override
- public void paste(IModelElement[] selectedScriptElements, IResource[] selectedResources, IWorkingSet[] selectedWorkingSets, TransferData[] availableTypes) throws ModelException, InterruptedException, InvocationTargetException {
- IWorkingSet workingSet= selectedWorkingSets[0];
- Set<IAdaptable> elements = new HashSet<IAdaptable>(
+ public void paste(IModelElement[] selectedScriptElements,
+ IResource[] selectedResources,
+ IWorkingSet[] selectedWorkingSets,
+ TransferData[] availableTypes) throws ModelException,
+ InterruptedException, InvocationTargetException {
+ IWorkingSet workingSet = selectedWorkingSets[0];
+ Set<IAdaptable> elements = new HashSet<>(
Arrays.asList(workingSet.getElements()));
- IModelElement[] modelElements= getClipboardScriptElements(availableTypes);
+ IModelElement[] modelElements = getClipboardScriptElements(
+ availableTypes);
if (modelElements != null) {
- for (int i= 0; i < modelElements.length; i++) {
- if (!ReorgUtils.containsElementOrParent(elements, modelElements[i]))
+ for (int i = 0; i < modelElements.length; i++) {
+ if (!ReorgUtils.containsElementOrParent(elements,
+ modelElements[i]))
elements.add(modelElements[i]);
}
}
- IResource[] resources= getClipboardResources(availableTypes);
+ IResource[] resources = getClipboardResources(availableTypes);
if (resources != null) {
- List realScriptElements= new ArrayList();
- List realResource= new ArrayList();
- ReorgUtils.splitIntoModelElementsAndResources(resources, realScriptElements, realResource);
- for (Iterator iter= realScriptElements.iterator(); iter.hasNext();) {
- IModelElement element= (IModelElement)iter.next();
+ List realScriptElements = new ArrayList();
+ List realResource = new ArrayList();
+ ReorgUtils.splitIntoModelElementsAndResources(resources,
+ realScriptElements, realResource);
+ for (Iterator iter = realScriptElements.iterator(); iter
+ .hasNext();) {
+ IModelElement element = (IModelElement) iter.next();
if (!ReorgUtils.containsElementOrParent(elements, element))
elements.add(element);
}
- for (Iterator iter= realResource.iterator(); iter.hasNext();) {
- IResource element= (IResource)iter.next();
+ for (Iterator iter = realResource.iterator(); iter.hasNext();) {
+ IResource element = (IResource) iter.next();
if (!ReorgUtils.containsElementOrParent(elements, element))
elements.add(element);
}
@@ -215,39 +258,52 @@
workingSet.setElements(
elements.toArray(new IAdaptable[elements.size()]));
}
+
@Override
- public boolean canEnable(TransferData[] availableTypes) throws ModelException {
- return isAvailable(ResourceTransfer.getInstance(), availableTypes) ||
- isAvailable(ModelElementTransfer.getInstance(), availableTypes);
+ public boolean canEnable(TransferData[] availableTypes)
+ throws ModelException {
+ return isAvailable(ResourceTransfer.getInstance(), availableTypes)
+ || isAvailable(ModelElementTransfer.getInstance(),
+ availableTypes);
}
+
@Override
- public boolean canPasteOn(IModelElement[] selectedScriptElements, IResource[] selectedResources, IWorkingSet[] selectedWorkingSets) throws ModelException {
- if (selectedResources.length != 0 || selectedScriptElements.length != 0 || selectedWorkingSets.length != 1)
+ public boolean canPasteOn(IModelElement[] selectedScriptElements,
+ IResource[] selectedResources,
+ IWorkingSet[] selectedWorkingSets) throws ModelException {
+ if (selectedResources.length != 0
+ || selectedScriptElements.length != 0
+ || selectedWorkingSets.length != 1)
return false;
- IWorkingSet ws= selectedWorkingSets[0];
+ IWorkingSet ws = selectedWorkingSets[0];
return !WorkingSetIDs.OTHERS.equals(ws.getId());
}
}
- private static class ProjectPaster extends Paster{
+ private static class ProjectPaster extends Paster {
- protected ProjectPaster(Shell shell, Clipboard clipboard) {
+ protected ProjectPaster(Shell shell, Clipboard clipboard) {
super(shell, clipboard);
}
@Override
public boolean canEnable(TransferData[] availableDataTypes) {
- boolean resourceTransfer= isAvailable(ResourceTransfer.getInstance(), availableDataTypes);
- boolean modelElementTransfer= isAvailable(ModelElementTransfer.getInstance(), availableDataTypes);
- if (! modelElementTransfer)
+ boolean resourceTransfer = isAvailable(
+ ResourceTransfer.getInstance(), availableDataTypes);
+ boolean modelElementTransfer = isAvailable(
+ ModelElementTransfer.getInstance(), availableDataTypes);
+ if (!modelElementTransfer)
return canPasteSimpleProjects(availableDataTypes);
- if (! resourceTransfer)
+ if (!resourceTransfer)
return canPasteScriptProjects(availableDataTypes);
- return canPasteScriptProjects(availableDataTypes) && canPasteSimpleProjects(availableDataTypes);
- }
+ return canPasteScriptProjects(availableDataTypes)
+ && canPasteSimpleProjects(availableDataTypes);
+ }
@Override
- public void paste(IModelElement[] modelElements, IResource[] resources, IWorkingSet[] selectedWorkingSets, TransferData[] availableTypes) {
+ public void paste(IModelElement[] modelElements, IResource[] resources,
+ IWorkingSet[] selectedWorkingSets,
+ TransferData[] availableTypes) {
pasteProjects(availableTypes);
}
@@ -255,67 +311,82 @@
pasteProjects(getProjectsToPaste(availableTypes));
}
- private void pasteProjects(IProject[] projects){
- Shell shell= getShell();
+ private void pasteProjects(IProject[] projects) {
+ Shell shell = getShell();
for (int i = 0; i < projects.length; i++) {
new CopyProjectOperation(shell).copyProject(projects[i]);
}
}
+
private IProject[] getProjectsToPaste(TransferData[] availableTypes) {
- IResource[] resources= getClipboardResources(availableTypes);
- IModelElement[] modelElements= getClipboardScriptElements(availableTypes);
- Set result= new HashSet();
+ IResource[] resources = getClipboardResources(availableTypes);
+ IModelElement[] modelElements = getClipboardScriptElements(
+ availableTypes);
+ Set result = new HashSet();
if (resources != null)
result.addAll(Arrays.asList(resources));
if (modelElements != null)
- result.addAll(Arrays.asList(ReorgUtils.getNotNulls(ReorgUtils.getResources(modelElements))));
+ result.addAll(Arrays.asList(ReorgUtils
+ .getNotNulls(ReorgUtils.getResources(modelElements))));
Assert.isTrue(result.size() > 0);
return (IProject[]) result.toArray(new IProject[result.size()]);
}
@Override
- public boolean canPasteOn(IModelElement[] modelElements, IResource[] resources, IWorkingSet[] selectedWorkingSets) {
- return selectedWorkingSets.length == 0; // Can't paste on working sets here
+ public boolean canPasteOn(IModelElement[] modelElements,
+ IResource[] resources, IWorkingSet[] selectedWorkingSets) {
+ return selectedWorkingSets.length == 0; // Can't paste on working
+ // sets here
}
- private boolean canPasteScriptProjects(TransferData[] availableDataTypes) {
- IModelElement[] modelElements= getClipboardScriptElements(availableDataTypes);
- return modelElements != null &&
- modelElements.length != 0 &&
- ! ReorgUtils.hasElementsNotOfType(modelElements, IModelElement.SCRIPT_PROJECT);
+ private boolean canPasteScriptProjects(
+ TransferData[] availableDataTypes) {
+ IModelElement[] modelElements = getClipboardScriptElements(
+ availableDataTypes);
+ return modelElements != null && modelElements.length != 0
+ && !ReorgUtils.hasElementsNotOfType(modelElements,
+ IModelElement.SCRIPT_PROJECT);
}
- private boolean canPasteSimpleProjects(TransferData[] availableDataTypes) {
- IResource[] resources= getClipboardResources(availableDataTypes);
- if (resources == null || resources.length == 0) return false;
- for (int i= 0; i < resources.length; i++) {
- if (resources[i].getType() != IResource.PROJECT || ! ((IProject)resources[i]).isOpen())
+ private boolean canPasteSimpleProjects(
+ TransferData[] availableDataTypes) {
+ IResource[] resources = getClipboardResources(availableDataTypes);
+ if (resources == null || resources.length == 0)
+ return false;
+ for (int i = 0; i < resources.length; i++) {
+ if (resources[i].getType() != IResource.PROJECT
+ || !((IProject) resources[i]).isOpen())
return false;
}
return true;
}
- }
+ }
- private static class FilePaster extends Paster{
+ private static class FilePaster extends Paster {
protected FilePaster(Shell shell, Clipboard clipboard) {
super(shell, clipboard);
}
@Override
- public void paste(IModelElement[] modelElements, IResource[] resources, IWorkingSet[] selectedWorkingSets, TransferData[] availableTypes) throws ModelException {
- String[] fileData= getClipboardFiles(availableTypes);
+ public void paste(IModelElement[] modelElements, IResource[] resources,
+ IWorkingSet[] selectedWorkingSets,
+ TransferData[] availableTypes) throws ModelException {
+ String[] fileData = getClipboardFiles(availableTypes);
if (fileData == null)
return;
- IContainer container= getAsContainer(getTarget(modelElements, resources));
+ IContainer container = getAsContainer(
+ getTarget(modelElements, resources));
if (container == null)
return;
- new CopyFilesAndFoldersOperation(getShell()).copyFiles(fileData, container);
+ new CopyFilesAndFoldersOperation(getShell()).copyFiles(fileData,
+ container);
}
- private Object getTarget(IModelElement[] modelElements, IResource[] resources) {
- if (modelElements.length + resources.length == 1){
+ private Object getTarget(IModelElement[] modelElements,
+ IResource[] resources) {
+ if (modelElements.length + resources.length == 1) {
if (modelElements.length == 1)
return modelElements[0];
else
@@ -325,86 +396,109 @@
}
@Override
- public boolean canPasteOn(IModelElement[] modelElements, IResource[] resources, IWorkingSet[] selectedWorkingSets) throws ModelException {
- Object target= getTarget(modelElements, resources);
- return target != null && canPasteFilesOn(getAsContainer(target)) && selectedWorkingSets.length == 0;
+ public boolean canPasteOn(IModelElement[] modelElements,
+ IResource[] resources, IWorkingSet[] selectedWorkingSets)
+ throws ModelException {
+ Object target = getTarget(modelElements, resources);
+ return target != null && canPasteFilesOn(getAsContainer(target))
+ && selectedWorkingSets.length == 0;
}
@Override
- public boolean canEnable(TransferData[] availableDataTypes) throws ModelException {
+ public boolean canEnable(TransferData[] availableDataTypes)
+ throws ModelException {
return isAvailable(FileTransfer.getInstance(), availableDataTypes);
}
private boolean canPasteFilesOn(Object target) {
- boolean isScriptFolder= target instanceof IProjectFragment;
- boolean isScriptProject= target instanceof IScriptProject;
- boolean isProjectFragment= target instanceof IProjectFragment;
- boolean isContainer= target instanceof IContainer;
+ boolean isScriptFolder = target instanceof IProjectFragment;
+ boolean isScriptProject = target instanceof IScriptProject;
+ boolean isProjectFragment = target instanceof IProjectFragment;
+ boolean isContainer = target instanceof IContainer;
- if( target instanceof ExternalProjectFragment || target instanceof ExternalScriptFolder || target instanceof ExternalSourceModule ) {
+ if (target instanceof ExternalProjectFragment
+ || target instanceof ExternalScriptFolder
+ || target instanceof ExternalSourceModule) {
return false;
}
- if (!(isScriptFolder || isScriptProject || isProjectFragment || isContainer))
+ if (!(isScriptFolder || isScriptProject || isProjectFragment
+ || isContainer))
return false;
if (isContainer) {
return true;
} else {
- IModelElement element= (IModelElement)target;
+ IModelElement element = (IModelElement) target;
return !element.isReadOnly();
}
}
- private IContainer getAsContainer(Object target) throws ModelException{
+ private IContainer getAsContainer(Object target) throws ModelException {
if (target == null)
return null;
if (target instanceof IContainer)
- return (IContainer)target;
+ return (IContainer) target;
if (target instanceof IFile)
- return ((IFile)target).getParent();
- return getAsContainer(((IModelElement)target).getCorrespondingResource());
+ return ((IFile) target).getParent();
+ return getAsContainer(
+ ((IModelElement) target).getCorrespondingResource());
}
private String[] getClipboardFiles(TransferData[] availableDataTypes) {
- Transfer transfer= FileTransfer.getInstance();
+ Transfer transfer = FileTransfer.getInstance();
if (isAvailable(transfer, availableDataTypes)) {
- return (String[])getContents(getClipboard(), transfer, getShell());
+ return (String[]) getContents(getClipboard(), transfer,
+ getShell());
}
return null;
}
- private Object getCommonParent(IModelElement[] modelElements, IResource[] resources) {
- return new ParentChecker(resources, modelElements).getCommonParent();
- }
- }
- private static class ModelElementAndResourcePaster extends Paster {
- protected ModelElementAndResourcePaster(Shell shell, Clipboard clipboard) {
+ private Object getCommonParent(IModelElement[] modelElements,
+ IResource[] resources) {
+ return new ParentChecker(resources, modelElements)
+ .getCommonParent();
+ }
+ }
+
+ private static class ModelElementAndResourcePaster extends Paster {
+
+ protected ModelElementAndResourcePaster(Shell shell,
+ Clipboard clipboard) {
super(shell, clipboard);
}
private TransferData[] fAvailableTypes;
@Override
- public void paste(IModelElement[] modelElements, IResource[] resources, IWorkingSet[] selectedWorkingSets, TransferData[] availableTypes) throws ModelException, InterruptedException, InvocationTargetException{
- IResource[] clipboardResources= getClipboardResources(availableTypes);
+ public void paste(IModelElement[] modelElements, IResource[] resources,
+ IWorkingSet[] selectedWorkingSets,
+ TransferData[] availableTypes) throws ModelException,
+ InterruptedException, InvocationTargetException {
+ IResource[] clipboardResources = getClipboardResources(
+ availableTypes);
if (clipboardResources == null)
- clipboardResources= new IResource[0];
- IModelElement[] clipboardScriptElements= getClipboardScriptElements(availableTypes);
+ clipboardResources = new IResource[0];
+ IModelElement[] clipboardScriptElements = getClipboardScriptElements(
+ availableTypes);
if (clipboardScriptElements == null)
- clipboardScriptElements= new IModelElement[0];
+ clipboardScriptElements = new IModelElement[0];
- Object destination= getTarget(modelElements, resources);
+ Object destination = getTarget(modelElements, resources);
if (destination instanceof IModelElement) {
- ReorgCopyStarter.create(clipboardScriptElements, clipboardResources, (IModelElement)destination).run(getShell());
- }
- else if (destination instanceof IResource) {
- ReorgCopyStarter.create(clipboardScriptElements, clipboardResources, (IResource)destination).run(getShell());
+ ReorgCopyStarter.create(clipboardScriptElements,
+ clipboardResources, (IModelElement) destination)
+ .run(getShell());
+ } else if (destination instanceof IResource) {
+ ReorgCopyStarter.create(clipboardScriptElements,
+ clipboardResources, (IResource) destination)
+ .run(getShell());
}
}
- private Object getTarget(IModelElement[] modelElements, IResource[] resources) {
- if (modelElements.length + resources.length == 1){
+ private Object getTarget(IModelElement[] modelElements,
+ IResource[] resources) {
+ if (modelElements.length + resources.length == 1) {
if (modelElements.length == 1)
return modelElements[0];
else
@@ -413,35 +507,47 @@
return getCommonParent(modelElements, resources);
}
- private Object getCommonParent(IModelElement[] modelElements, IResource[] resources) {
- return new ParentChecker(resources, modelElements).getCommonParent();
+ private Object getCommonParent(IModelElement[] modelElements,
+ IResource[] resources) {
+ return new ParentChecker(resources, modelElements)
+ .getCommonParent();
}
@Override
- public boolean canPasteOn(IModelElement[] modelElements, IResource[] resources, IWorkingSet[] selectedWorkingSets) throws ModelException {
+ public boolean canPasteOn(IModelElement[] modelElements,
+ IResource[] resources, IWorkingSet[] selectedWorkingSets)
+ throws ModelException {
if (selectedWorkingSets.length != 0)
return false;
- IResource[] clipboardResources= getClipboardResources(fAvailableTypes);
+ IResource[] clipboardResources = getClipboardResources(
+ fAvailableTypes);
if (clipboardResources == null)
- clipboardResources= new IResource[0];
- IModelElement[] clipboardScriptElements= getClipboardScriptElements(fAvailableTypes);
+ clipboardResources = new IResource[0];
+ IModelElement[] clipboardScriptElements = getClipboardScriptElements(
+ fAvailableTypes);
if (clipboardScriptElements == null)
- clipboardScriptElements= new IModelElement[0];
- Object destination= getTarget(modelElements, resources);
+ clipboardScriptElements = new IModelElement[0];
+ Object destination = getTarget(modelElements, resources);
if (destination instanceof IModelElement) {
- return ReorgCopyStarter.create(clipboardScriptElements, clipboardResources, (IModelElement)destination) != null;
+ return ReorgCopyStarter.create(clipboardScriptElements,
+ clipboardResources,
+ (IModelElement) destination) != null;
}
if (destination instanceof IResource) {
- return ReorgCopyStarter.create(clipboardScriptElements, clipboardResources, (IResource)destination) != null;
+ return ReorgCopyStarter.create(clipboardScriptElements,
+ clipboardResources, (IResource) destination) != null;
}
return false;
}
@Override
public boolean canEnable(TransferData[] availableTypes) {
- fAvailableTypes= availableTypes;
- return isAvailable(ModelElementTransfer.getInstance(), availableTypes) || isAvailable(ResourceTransfer.getInstance(), availableTypes);
+ fAvailableTypes = availableTypes;
+ return isAvailable(ModelElementTransfer.getInstance(),
+ availableTypes)
+ || isAvailable(ResourceTransfer.getInstance(),
+ availableTypes);
}
- }
+ }
}
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java
index eb98566..27364b0 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java
@@ -236,7 +236,7 @@
.computeAffectedNaturs(fCopyPolicy.getScriptElements());
String[] rNatures = ResourceProcessors
.computeAffectedNatures(fCopyPolicy.getResources());
- Set<String> result = new HashSet<String>();
+ Set<String> result = new HashSet<>();
result.addAll(Arrays.asList(jNatures));
result.addAll(Arrays.asList(rNatures));
return result.toArray(new String[result.size()]);
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java
index 3442923..53997ea 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java
@@ -46,9 +46,10 @@
import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
-
-public final class ScriptMoveProcessor extends MoveProcessor implements IScriptableRefactoring, ICommentProvider, IQualifiedNameUpdating, IReorgDestinationValidator {
- //TODO: offer IMovePolicy getMovePolicy(); IReorgPolicy getReorgPolicy();
+public final class ScriptMoveProcessor extends MoveProcessor
+ implements IScriptableRefactoring, ICommentProvider,
+ IQualifiedNameUpdating, IReorgDestinationValidator {
+ // TODO: offer IMovePolicy getMovePolicy(); IReorgPolicy getReorgPolicy();
// and remove delegate methods (also for CopyRefactoring)?
private IReorgQueries fReorgQueries;
@@ -57,14 +58,14 @@
private boolean fWasCanceled;
private String fComment;
- public static final String IDENTIFIER= "org.eclipse.dltk.ui.MoveProcessor"; //$NON-NLS-1$
+ public static final String IDENTIFIER = "org.eclipse.dltk.ui.MoveProcessor"; //$NON-NLS-1$
public ScriptMoveProcessor(IMovePolicy policy) {
- fMovePolicy= policy;
+ fMovePolicy = policy;
}
protected Object getDestination() {
- IModelElement je= fMovePolicy.getScriptElementDestination();
+ IModelElement je = fMovePolicy.getScriptElementDestination();
if (je != null)
return je;
return fMovePolicy.getResourceDestination();
@@ -72,7 +73,7 @@
@Override
public Object[] getElements() {
- List result= new ArrayList();
+ List result = new ArrayList();
result.addAll(Arrays.asList(fMovePolicy.getScriptElements()));
result.addAll(Arrays.asList(fMovePolicy.getResources()));
return result.toArray();
@@ -89,14 +90,18 @@
}
@Override
- public RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants shared) throws CoreException {
- return fMovePolicy.loadParticipants(status, this, getAffectedProjectNatures(), shared);
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ SharableParticipants shared) throws CoreException {
+ return fMovePolicy.loadParticipants(status, this,
+ getAffectedProjectNatures(), shared);
}
private String[] getAffectedProjectNatures() throws CoreException {
- String[] jNatures= ScriptProcessors.computeAffectedNaturs(fMovePolicy.getScriptElements());
- String[] rNatures= ResourceProcessors.computeAffectedNatures(fMovePolicy.getResources());
- Set<String> result = new HashSet<String>();
+ String[] jNatures = ScriptProcessors
+ .computeAffectedNaturs(fMovePolicy.getScriptElements());
+ String[] rNatures = ResourceProcessors
+ .computeAffectedNatures(fMovePolicy.getResources());
+ Set<String> result = new HashSet<>();
result.addAll(Arrays.asList(jNatures));
result.addAll(Arrays.asList(rNatures));
return result.toArray(new String[result.size()]);
@@ -107,21 +112,26 @@
}
@Override
- public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException {
pm.beginTask("", 1); //$NON-NLS-1$
try {
- RefactoringStatus result= new RefactoringStatus();
- result.merge(RefactoringStatus.create(Resources.checkInSync(ReorgUtils.getNotNulls(fMovePolicy.getResources()))));
- IResource[] javaResources= ReorgUtils.getResources(fMovePolicy.getScriptElements());
- result.merge(RefactoringStatus.create(Resources.checkInSync(ReorgUtils.getNotNulls(javaResources))));
+ RefactoringStatus result = new RefactoringStatus();
+ result.merge(RefactoringStatus.create(Resources.checkInSync(
+ ReorgUtils.getNotNulls(fMovePolicy.getResources()))));
+ IResource[] javaResources = ReorgUtils
+ .getResources(fMovePolicy.getScriptElements());
+ result.merge(RefactoringStatus.create(Resources
+ .checkInSync(ReorgUtils.getNotNulls(javaResources))));
return result;
} finally {
pm.done();
}
}
- public Object getCommonParentForInputElements(){
- return new ParentChecker(fMovePolicy.getResources(), fMovePolicy.getScriptElements()).getCommonParent();
+ public Object getCommonParentForInputElements() {
+ return new ParentChecker(fMovePolicy.getResources(),
+ fMovePolicy.getScriptElements()).getCommonParent();
}
public IModelElement[] getScriptElements() {
@@ -132,11 +142,13 @@
return fMovePolicy.getResources();
}
- public RefactoringStatus setDestination(IModelElement destination) throws ModelException{
+ public RefactoringStatus setDestination(IModelElement destination)
+ throws ModelException {
return fMovePolicy.setDestination(destination);
}
- public RefactoringStatus setDestination(IResource destination) throws ModelException{
+ public RefactoringStatus setDestination(IResource destination)
+ throws ModelException {
return fMovePolicy.setDestination(destination);
}
@@ -144,58 +156,66 @@
public boolean canChildrenBeDestinations(IModelElement modelElement) {
return fMovePolicy.canChildrenBeDestinations(modelElement);
}
+
@Override
public boolean canChildrenBeDestinations(IResource resource) {
return fMovePolicy.canChildrenBeDestinations(resource);
}
+
@Override
public boolean canElementBeDestination(IModelElement modelElement) {
return fMovePolicy.canElementBeDestination(modelElement);
}
+
@Override
public boolean canElementBeDestination(IResource resource) {
return fMovePolicy.canElementBeDestination(resource);
}
- public void setReorgQueries(IReorgQueries queries){
+ public void setReorgQueries(IReorgQueries queries) {
Assert.isNotNull(queries);
- fReorgQueries= queries;
+ fReorgQueries = queries;
}
@Override
- public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException {
- try{
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException {
+ try {
Assert.isNotNull(fReorgQueries);
- fWasCanceled= false;
+ fWasCanceled = false;
return fMovePolicy.checkFinalConditions(pm, context, fReorgQueries);
} catch (OperationCanceledException e) {
- fWasCanceled= true;
+ fWasCanceled = true;
throw e;
}
}
@Override
public Change createChange(IProgressMonitor pm) throws CoreException {
- Assert.isTrue(fMovePolicy.getScriptElementDestination() == null || fMovePolicy.getResourceDestination() == null);
- Assert.isTrue(fMovePolicy.getScriptElementDestination() != null || fMovePolicy.getResourceDestination() != null);
+ Assert.isTrue(fMovePolicy.getScriptElementDestination() == null
+ || fMovePolicy.getResourceDestination() == null);
+ Assert.isTrue(fMovePolicy.getScriptElementDestination() != null
+ || fMovePolicy.getResourceDestination() != null);
try {
- final DynamicValidationStateChange result= new DynamicValidationStateChange(RefactoringCoreMessages.ScriptMoveProcessor_change_name) {
+ final DynamicValidationStateChange result = new DynamicValidationStateChange(
+ RefactoringCoreMessages.ScriptMoveProcessor_change_name) {
@Override
- public Change perform(IProgressMonitor pm2) throws CoreException {
- Change change= super.perform(pm2);
- Change[] changes= getChildren();
- for (int index= 0; index < changes.length; index++) {
+ public Change perform(IProgressMonitor pm2)
+ throws CoreException {
+ Change change = super.perform(pm2);
+ Change[] changes = getChildren();
+ for (int index = 0; index < changes.length; index++) {
if (!(changes[index] instanceof TextEditBasedChange))
return null;
}
return change;
}
};
- Change change= fMovePolicy.createChange(pm);
- if (change instanceof CompositeChange){
- CompositeChange subComposite= (CompositeChange)change;
+ Change change = fMovePolicy.createChange(pm);
+ if (change instanceof CompositeChange) {
+ CompositeChange subComposite = (CompositeChange) change;
result.merge(subComposite);
- } else{
+ } else {
result.add(change);
}
return result;
@@ -205,7 +225,8 @@
}
@Override
- public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException {
+ public Change postCreateChange(Change[] participantChanges,
+ IProgressMonitor pm) throws CoreException {
return fMovePolicy.postCreateChange(participantChanges, pm);
}
@@ -214,11 +235,11 @@
return RefactoringCoreMessages.MoveRefactoring_0;
}
- public boolean canUpdateReferences(){
+ public boolean canUpdateReferences() {
return fMovePolicy.canUpdateReferences();
}
- public void setUpdateReferences(boolean update){
+ public void setUpdateReferences(boolean update) {
fMovePolicy.setUpdateReferences(update);
}
@@ -260,20 +281,25 @@
public boolean hasAllInputSet() {
return fMovePolicy.hasAllInputSet();
}
+
public boolean hasDestinationSet() {
- return fMovePolicy.getScriptElementDestination() != null || fMovePolicy.getResourceDestination() != null;
+ return fMovePolicy.getScriptElementDestination() != null
+ || fMovePolicy.getResourceDestination() != null;
}
- public void setCreateTargetQueries(ICreateTargetQueries queries){
+ public void setCreateTargetQueries(ICreateTargetQueries queries) {
Assert.isNotNull(queries);
- fCreateTargetQueries= queries;
+ fCreateTargetQueries = queries;
}
+
/**
- * @return the create target queries, or <code>null</code> if creating new targets is not supported
+ * @return the create target queries, or <code>null</code> if creating new
+ * targets is not supported
*/
public ICreateTargetQuery getCreateTargetQuery() {
return fMovePolicy.getCreateTargetQuery(fCreateTargetQueries);
}
+
public boolean isTextualMove() {
return fMovePolicy.isTextualMove();
}
@@ -296,6 +322,6 @@
@Override
public void setComment(String comment) {
- fComment= comment;
+ fComment = comment;
}
}