diff options
author | Mike Rennie | 2013-07-31 16:44:16 +0000 |
---|---|---|
committer | Mike Rennie | 2013-07-31 16:44:16 +0000 |
commit | d975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch) | |
tree | c7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.ui.externaltools | |
parent | 4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff) | |
download | eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip |
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.ui.externaltools')
29 files changed, 648 insertions, 559 deletions
diff --git a/org.eclipse.ui.externaltools/.classpath b/org.eclipse.ui.externaltools/.classpath index 435706608..c2eb13176 100644 --- a/org.eclipse.ui.externaltools/.classpath +++ b/org.eclipse.ui.externaltools/.classpath @@ -1,8 +1,8 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="External Tools Base"/>
- <classpathentry kind="src" path="Program Tools Support"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="External Tools Base"/> + <classpathentry kind="src" path="Program Tools Support"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eclipse.ui.externaltools/.settings/.api_filters b/org.eclipse.ui.externaltools/.settings/.api_filters new file mode 100644 index 000000000..8203854ac --- /dev/null +++ b/org.eclipse.ui.externaltools/.settings/.api_filters @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<component id="org.eclipse.ui.externaltools" version="2"> + <resource path="External Tools Base/org/eclipse/ui/externaltools/internal/menu/OpenExternalToolsConfigurations.java" type="org.eclipse.ui.externaltools.internal.menu.OpenExternalToolsConfigurations"> + <filter comment="Known illegal extension" id="571473929"> + <message_arguments> + <message_argument value="OpenLaunchDialogAction"/> + <message_argument value="OpenExternalToolsConfigurations"/> + </message_arguments> + </filter> + </resource> +</component> diff --git a/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs index 5d7a22fe3..74c3aeb02 100644 --- a/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs @@ -14,17 +14,17 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 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.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=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 @@ -33,9 +33,9 @@ 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=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=error org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore @@ -53,10 +53,10 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +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.missingHashCodeMethod=error org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public @@ -65,7 +65,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=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 @@ -78,11 +78,11 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error 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.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=error org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore @@ -91,18 +91,18 @@ 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.suppressOptionalErrors=enabled 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.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error 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.unhandledWarningToken=error org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning @@ -119,9 +119,9 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java index 3610f2b95..6b5596b70 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * dakshinamurthy.karra@gmail.com - bug 165371 @@ -57,29 +57,30 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { // Check Buttons private Button fBuildButton; - + // Group box private Group fGroup; - + // Radio Buttons private Button fProjectButton; private Button fSpecificProjectsButton; private Button fWorkspaceButton; - + // Push Button private Button fSelectButton; - + // whether to include referenced projects private Button fReferencedProjects; - + // projects to build (empty if none) - private List fProjects = new ArrayList(); - + private List<IProject> fProjects = new ArrayList<IProject>(); + class ProjectsContentProvider implements IStructuredContentProvider { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ + @Override public Object[] getElements(Object inputElement) { return ((IWorkspace)inputElement).getRoot().getProjects(); } @@ -87,27 +88,30 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ + @Override public void dispose() { } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } - + } - + /** * Constructor */ public ExternalToolsBuildTab() { setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILD_TAB); } - + /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.NONE); setControl(mainComposite); @@ -117,15 +121,16 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { mainComposite.setLayout(layout); mainComposite.setLayoutData(gd); mainComposite.setFont(parent.getFont()); - + fBuildButton = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_1); fBuildButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateEnabledState(); updateLaunchConfigurationDialog(); } }); - + fGroup = new Group(mainComposite, SWT.NONE); fGroup.setFont(mainComposite.getFont()); layout = new GridLayout(); @@ -137,6 +142,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { fGroup.setLayoutData(gd); SelectionAdapter adapter = new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { if (((Button)e.getSource()).getSelection()) { updateEnabledState(); @@ -144,34 +150,35 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { } } }; - + fWorkspaceButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_2); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; fWorkspaceButton.setLayoutData(gd); fWorkspaceButton.addSelectionListener(adapter); - + fProjectButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_3); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; - fProjectButton.setLayoutData(gd); + fProjectButton.setLayoutData(gd); fProjectButton.addSelectionListener(adapter); - + fSpecificProjectsButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_4); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 1; fSpecificProjectsButton.setLayoutData(gd); - fSpecificProjectsButton.addSelectionListener(adapter); - + fSpecificProjectsButton.addSelectionListener(adapter); + fSelectButton = createPushButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_5, null); gd = (GridData)fSelectButton.getLayoutData(); gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; fSelectButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { selectResources(); } }); - + createVerticalSpacer(mainComposite, 1); fReferencedProjects = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_6); } @@ -186,28 +193,30 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { return; } Object[] res = dialog.getResult(); - fProjects = new ArrayList(res.length); + fProjects = new ArrayList<IProject>(res.length); for (int i = 0; i < res.length; i++) { - fProjects.add(res[i]); + fProjects.add((IProject) res[i]); } updateLaunchConfigurationDialog(); } - + /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { } /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { updateScope(configuration); updateReferencedProjects(configuration); - updateEnabledState(); + updateEnabledState(); } - + private void updateReferencedProjects(ILaunchConfiguration configuration) { boolean ref = false; try { @@ -245,7 +254,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { } else if (scope.startsWith("${projects:")) { //$NON-NLS-1$ fSpecificProjectsButton.setSelection(true); IProject[] projects = getBuildProjects(configuration, IExternalToolConstants.ATTR_BUILD_SCOPE); - fProjects = new ArrayList(projects.length); + fProjects = new ArrayList<IProject>(projects.length); for (int i = 0; i < projects.length; i++) { fProjects.add(projects[i]); } @@ -255,6 +264,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { String scope = generateScopeMemento(); configuration.setAttribute(IExternalToolConstants.ATTR_BUILD_SCOPE, scope); @@ -281,7 +291,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { return getBuildScopeAttribute(fProjects); } return null; - + } return "${none}"; //$NON-NLS-1$ } @@ -289,10 +299,11 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_8; } - + /** * Updates the enablement state of the fields. */ @@ -314,14 +325,16 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { } fReferencedProjects.setEnabled(fBuildButton.getSelection() && (fProjectButton.getSelection() || fSpecificProjectsButton.getSelection())); } - + /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return ExternalToolsImages.getImage(org.eclipse.ui.externaltools.internal.model.IExternalToolConstants.IMG_TAB_BUILD); } + @Override public boolean isValid(ILaunchConfiguration launchConfig) { setErrorMessage(null); setMessage(null); @@ -331,10 +344,10 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { } return true; } - + /** * Returns a collection of projects referenced by a build scope attribute. - * + * * @return collection of projects referred to by configuration */ public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId) { @@ -342,11 +355,11 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { buildScopeId); } - + /** * Whether referenced projects should be considered when building. Only valid * when a set of projects is to be built. - * + * * @param configuration * @return whether referenced projects should be considerd when building * @throws CoreException if unable to access the associated attribute @@ -355,20 +368,20 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { return ExternalToolsCoreUtil.isIncludeReferencedProjects(configuration, includeReferencedProjectsId); } - + /** * Creates and returns a memento for the given project set, to be used as a * build scope attribute. - * + * * @param projects list of projects * @return an equivalent refresh attribute */ - public static String getBuildScopeAttribute(List projects) { + public static String getBuildScopeAttribute(List<IProject> projects) { StringBuffer buf = new StringBuffer(); buf.append("${projects:"); //$NON-NLS-1$ - Iterator iterator = projects.iterator(); + Iterator<IProject> iterator = projects.iterator(); while (iterator.hasNext()) { - IProject project = (IProject) iterator.next(); + IProject project = iterator.next(); buf.append(project.getName()); if (iterator.hasNext()) { buf.append(","); //$NON-NLS-1$ @@ -377,10 +390,11 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { buf.append("}"); //$NON-NLS-1$ return buf.toString(); } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing on activation } @@ -388,6 +402,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing on deactivation } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java index cc6aea404..dc1563edc 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * dakshinamurthy.karra@gmail.com - bug 165371 @@ -67,11 +67,11 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { protected Button workingSetButton; protected Button specifyResources; protected Button fLaunchInBackgroundButton; - protected IWorkingSet workingSet; + protected IWorkingSet workingSet; protected ILaunchConfiguration fConfiguration; - + private boolean fCreateBuildScheduleComponent= true; - + // Console Output widgets private Button fConsoleOutput; private Button fFileOutput; @@ -80,14 +80,14 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { private Button fVariables; private Button fAppend; private Button fWorkspaceBrowse; - + /** * Constructor */ public ExternalToolsBuilderTab() { setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB); } - + /** * Constructor * @param createBuildScheduleComponent @@ -96,11 +96,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { fCreateBuildScheduleComponent= createBuildScheduleComponent; setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB); } - + protected SelectionListener selectionListener= new SelectionAdapter() { /* (non-Javadoc) * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ + @Override public void widgetSelected(SelectionEvent e) { boolean enabled= !fCreateBuildScheduleComponent || autoBuildButton.getSelection() || manualBuild.getSelection(); workingSetButton.setEnabled(enabled); @@ -109,11 +110,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { } }; + @Override public void createControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.NONE); setControl(mainComposite); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpContextId()); - + GridLayout layout = new GridLayout(); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 2; @@ -126,7 +128,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { createLaunchInBackgroundComposite(mainComposite); createBuildScheduleComponent(mainComposite); } - + /** * Creates the controls needed to edit the launch in background * attribute of an external tool @@ -139,12 +141,13 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { data.horizontalSpan = 2; fLaunchInBackgroundButton.setLayoutData(data); fLaunchInBackgroundButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); } - + protected void createBuildScheduleComponent(Composite parent) { if (fCreateBuildScheduleComponent) { Label label= new Label(parent, SWT.NONE); @@ -152,17 +155,18 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { label.setFont(parent.getFont()); afterClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Full_builds_2, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Full, 2); manualBuild= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Incremental_builds_4, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Inc, 2); - autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2); + autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2); fDuringClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_0, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_1, 2); - + createVerticalSpacer(parent, 2); } - + workingSetButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_label, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_tooltip, 1); specifyResources= createPushButton(parent, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_13, null); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END); specifyResources.setLayoutData(gd); specifyResources.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { selectResources(); } @@ -171,54 +175,56 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_2); label.setFont(parent.getFont()); } - + private void createOutputCaptureComponent(Composite parent) { Group group = new Group(parent, SWT.NONE); - group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17); + group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17); GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); gd.horizontalSpan = 2; group.setLayoutData(gd); GridLayout layout = new GridLayout(5, false); group.setLayout(layout); group.setFont(parent.getFont()); - - fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18); + + fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18); gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); gd.horizontalSpan = 5; fConsoleOutput.setLayoutData(gd); - + fConsoleOutput.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); - - fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19); + + fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19); fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false)); - + fFileText = new Text(group, SWT.SINGLE | SWT.BORDER); gd = new GridData(SWT.FILL, SWT.NORMAL, true, false); gd.horizontalSpan = 4; fFileText.setLayoutData(gd); fFileText.setFont(parent.getFont()); - + Label spacer = new Label(group,SWT.NONE); gd = new GridData(SWT.FILL, SWT.NORMAL, true, false); gd.horizontalSpan=2; spacer.setLayoutData(gd); - fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null); - fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null); - fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null); + fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null); + fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null); + fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null); spacer = new Label(group,SWT.NONE); spacer.setLayoutData(new GridData(SWT.FILL, SWT.NORMAL, false, false)); - fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23); + fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23); gd = new GridData(SWT.LEFT, SWT.TOP, true, false); gd.horizontalSpan = 4; fAppend.setLayoutData(gd); - + fFileOutput.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { boolean enabled = fFileOutput.getSelection(); fFileText.setEnabled(enabled); fFileBrowse.setEnabled(enabled); @@ -228,19 +234,21 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { updateLaunchConfigurationDialog(); } }); - + fAppend.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); - + fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); - dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24); - dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25); - dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); + dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24); + dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25); + dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); int buttonId = dialog.open(); if (buttonId == IDialogConstants.OK_ID) { @@ -251,27 +259,30 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { } } }); - + fFileBrowse.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { String filePath = fFileText.getText(); FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); - + filePath = dialog.open(); if (filePath != null) { fFileText.setText(filePath); } } }); - + fFileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { updateLaunchConfigurationDialog(); } }); - + fVariables.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); dialog.open(); String variable = dialog.getVariableExpression(); @@ -279,11 +290,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { fFileText.insert(variable); } } - public void widgetDefaultSelected(SelectionEvent e) { + @Override + public void widgetDefaultSelected(SelectionEvent e) { } }); } - + /* * Creates a check button in the given composite with the given text */ @@ -300,11 +312,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { StringBuffer buffer= new StringBuffer(IExternalToolConstants.BUILD_TYPE_FULL); buffer.append(','); buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL); - buffer.append(','); + buffer.append(','); configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString()); configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); configuration.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); @@ -313,6 +326,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { fConfiguration= configuration; if (fCreateBuildScheduleComponent) { @@ -329,14 +343,14 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { buildScope= configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String)null); } catch (CoreException e) { } - + workingSetButton.setSelection(buildScope != null); workingSetButton.setEnabled(buildScope != null); - + if (buildScope != null) { workingSet = RefreshTab.getWorkingSet(buildScope); } - + if (fCreateBuildScheduleComponent) { int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString); for (int i = 0; i < buildTypes.length; i++) { @@ -353,10 +367,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { case IncrementalProjectBuilder.CLEAN_BUILD: fDuringClean.setSelection(true); break; + default: + break; } } } - + boolean enabled= true; if (fCreateBuildScheduleComponent) { enabled= autoBuildButton.getSelection() || manualBuild.getSelection(); @@ -366,23 +382,23 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { updateRunInBackground(configuration); updateConsoleOutput(configuration); } - - protected void updateRunInBackground(ILaunchConfiguration configuration) { + + protected void updateRunInBackground(ILaunchConfiguration configuration) { fLaunchInBackgroundButton.setSelection(ExternalToolsCoreUtil.isAsynchronousBuild(configuration)); } - + private void updateConsoleOutput(ILaunchConfiguration configuration) { boolean outputToConsole = true; String outputFile = null; boolean append = false; - + try { outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null); append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false); } catch (CoreException e) { } - + fConsoleOutput.setSelection(outputToConsole); fAppend.setSelection(append); boolean haveOutputFile= outputFile != null; @@ -400,19 +416,20 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { if (fCreateBuildScheduleComponent) { StringBuffer buffer= new StringBuffer(); if (afterClean.getSelection()) { buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(','); - } + } if (manualBuild.getSelection()){ - buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(','); - } + buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(','); + } if (autoBuildButton.getSelection()) { buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(','); } - + if (fDuringClean.getSelection()) { buffer.append(IExternalToolConstants.BUILD_TYPE_CLEAN); } @@ -425,7 +442,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { configuration.setAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String)null); } configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, fLaunchInBackgroundButton.getSelection()); - + boolean captureOutput = false; if (fConsoleOutput.getSelection()) { captureOutput = true; @@ -445,7 +462,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { } else { configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null); } - + if (!captureOutput) { configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false); } else { @@ -456,20 +473,23 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Build_Options_9; } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT); } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public boolean isValid(ILaunchConfiguration launchConfig) { setErrorMessage(null); setMessage(null); @@ -484,12 +504,13 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_16); return false; } - + return validateRedirectFile(); } /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave() */ + @Override public boolean canSave() { return isValid(null); } @@ -499,14 +520,14 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { */ private void selectResources() { IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager(); - + if (workingSet == null){ workingSet = workingSetManager.createWorkingSet(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_15, new IAdaptable[0]); } IWorkingSetEditWizard wizard= workingSetManager.createWorkingSetEditWizard(workingSet); WizardDialog dialog = new WizardDialog(ExternalToolsPlugin.getStandardDisplay().getActiveShell(), wizard); - dialog.create(); - + dialog.create(); + if (dialog.open() == Window.CANCEL) { return; } @@ -516,6 +537,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing on activation } @@ -523,15 +545,16 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing on deactivation } - + private boolean validateRedirectFile() { if(fFileOutput.getSelection()) { int len = fFileText.getText().trim().length(); if (len == 0) { - setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_26); + setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_26); return false; } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java index 56fe08449..a23aa54db 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -72,16 +72,17 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa protected Button argumentVariablesButton; protected SelectionAdapter selectionAdapter; - + protected boolean fInitializing= false; private boolean userEdited= false; protected WidgetListener fListener= new WidgetListener(); - + /** * A listener to update for text modification and widget selection. */ protected class WidgetListener extends SelectionAdapter implements ModifyListener { + @Override public void modifyText(ModifyEvent e) { if (!fInitializing) { setDirty(true); @@ -89,6 +90,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa updateLaunchConfigurationDialog(); } } + @Override public void widgetSelected(SelectionEvent e) { setDirty(true); Object source= e.getSource(); @@ -110,10 +112,11 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.NONE); setControl(mainComposite); @@ -128,14 +131,14 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa createWorkDirectoryComponent(mainComposite); createArgumentComponent(mainComposite); createVerticalSpacer(mainComposite, 1); - + Dialog.applyDialogFont(parent); } - + /** * Creates the controls needed to edit the location * attribute of an external tool - * + * * @param parent the composite to create the controls in */ protected void createLocationComponent(Composite parent) { @@ -143,41 +146,41 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa String locationLabel = getLocationLabel(); group.setText(locationLabel); GridLayout layout = new GridLayout(); - layout.numColumns = 1; + layout.numColumns = 1; GridData gridData = new GridData(GridData.FILL_HORIZONTAL); group.setLayout(layout); group.setLayoutData(gridData); - + locationField = new Text(group, SWT.BORDER); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; locationField.setLayoutData(gridData); locationField.addModifyListener(fListener); addControlAccessibleListener(locationField, group.getText()); - + Composite buttonComposite = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.marginHeight = 0; - layout.marginWidth = 0; + layout.marginWidth = 0; layout.numColumns = 3; gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); buttonComposite.setLayout(layout); buttonComposite.setLayoutData(gridData); buttonComposite.setFont(parent.getFont()); - + workspaceLocationButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab__Browse_Workspace____3, null); workspaceLocationButton.addSelectionListener(fListener); addControlAccessibleListener(workspaceLocationButton, group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$ - + fileLocationButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Brows_e_File_System____4, null); fileLocationButton.addSelectionListener(fListener); addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$ - + variablesLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_31, null); - variablesLocationButton.addSelectionListener(fListener); + variablesLocationButton.addSelectionListener(fListener); addControlAccessibleListener(variablesLocationButton, group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$ } - + /** * Returns the label used for the location widgets. Subclasses may wish to override. */ @@ -188,7 +191,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa /** * Creates the controls needed to edit the working directory * attribute of an external tool - * + * * @param parent the composite to create the controls in */ protected void createWorkDirectoryComponent(Composite parent) { @@ -200,14 +203,14 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa GridData gridData = new GridData(GridData.FILL_HORIZONTAL); group.setLayout(layout); group.setLayoutData(gridData); - + workDirectoryField = new Text(group, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; workDirectoryField.setLayoutData(data); workDirectoryField.addModifyListener(fListener); addControlAccessibleListener(workDirectoryField,group.getText()); - + Composite buttonComposite = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; @@ -217,20 +220,20 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa buttonComposite.setLayout(layout); buttonComposite.setLayoutData(gridData); buttonComposite.setFont(parent.getFont()); - + workspaceWorkingDirectoryButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Browse_Wor_kspace____6, null); workspaceWorkingDirectoryButton.addSelectionListener(fListener); addControlAccessibleListener(workspaceWorkingDirectoryButton, group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$ - + fileWorkingDirectoryButton= createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Browse_F_ile_System____7, null); fileWorkingDirectoryButton.addSelectionListener(fListener); addControlAccessibleListener(fileWorkingDirectoryButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$ - + variablesWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_32, null); variablesWorkingDirectoryButton.addSelectionListener(fListener); addControlAccessibleListener(variablesWorkingDirectoryButton, group.getText() + " " + variablesWorkingDirectoryButton.getText()); //$NON-NLS-1$ } - + /** * Return the String to use as the label for the working directory field. * Subclasses may wish to override. @@ -238,7 +241,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa protected String getWorkingDirectoryLabel() { return ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Working__Directory__5; } - + /** * Creates the controls needed to edit the argument and * prompt for argument attributes of an external tool @@ -248,30 +251,31 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa protected void createArgumentComponent(Composite parent) { Group group = new Group(parent, SWT.NONE); String groupName = ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab__Arguments___1; - group.setText(groupName); + group.setText(groupName); GridLayout layout = new GridLayout(); layout.numColumns = 1; GridData gridData = new GridData(GridData.FILL_BOTH); group.setLayout(layout); group.setLayoutData(gridData); group.setFont(parent.getFont()); - + argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); argumentField.addTraverseListener(new TraverseListener() { + @Override public void keyTraversed(TraverseEvent event) { if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) { event.doit= true; } } }); - + gridData = new GridData(GridData.FILL_BOTH); gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; gridData.heightHint = 30; argumentField.setLayoutData(gridData); argumentField.addModifyListener(fListener); addControlAccessibleListener(argumentField, group.getText()); - + Composite composite = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.numColumns= 1; @@ -281,7 +285,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa composite.setLayout(layout); composite.setLayoutData(gridData); composite.setFont(parent.getFont()); - + argumentVariablesButton= createPushButton(composite, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Varia_bles____2, null); argumentVariablesButton.addSelectionListener(fListener); addControlAccessibleListener(argumentVariablesButton, argumentVariablesButton.getText()); // need to strip the mnemonic from buttons @@ -292,10 +296,11 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa gridData.horizontalSpan = 2; instruction.setLayoutData(gridData); } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { configuration.setAttribute(FIRST_EDIT, true); } @@ -303,6 +308,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { fInitializing= true; updateLocation(configuration); @@ -311,29 +317,29 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa fInitializing= false; setDirty(false); } - + /** * Updates the working directory widgets to match the state of the given launch * configuration. */ protected void updateWorkingDirectory(ILaunchConfiguration configuration) { - String workingDir= IExternalToolConstants.EMPTY_STRING; + String workingDir= IExternalToolConstants.EMPTY_STRING; try { - workingDir= configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, IExternalToolConstants.EMPTY_STRING); + workingDir= configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, IExternalToolConstants.EMPTY_STRING); } catch (CoreException ce) { ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Error_reading_configuration_10, ce); } workDirectoryField.setText(workingDir); } - + /** * Updates the location widgets to match the state of the given launch * configuration. */ protected void updateLocation(ILaunchConfiguration configuration) { - String location= IExternalToolConstants.EMPTY_STRING; + String location= IExternalToolConstants.EMPTY_STRING; try { - location= configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, IExternalToolConstants.EMPTY_STRING); + location= configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, IExternalToolConstants.EMPTY_STRING); } catch (CoreException ce) { ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Error_reading_configuration_10, ce); } @@ -345,9 +351,9 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa * configuration. */ protected void updateArgument(ILaunchConfiguration configuration) { - String arguments= IExternalToolConstants.EMPTY_STRING; + String arguments= IExternalToolConstants.EMPTY_STRING; try { - arguments= configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, IExternalToolConstants.EMPTY_STRING); + arguments= configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, IExternalToolConstants.EMPTY_STRING); } catch (CoreException ce) { ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Error_reading_configuration_7, ce); } @@ -357,6 +363,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { String location= locationField.getText().trim(); if (location.length() == 0) { @@ -364,7 +371,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } else { configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, location); } - + String workingDirectory= workDirectoryField.getText().trim(); if (workingDirectory.length() == 0) { configuration.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String)null); @@ -378,7 +385,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } else { configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); } - + if(userEdited) { configuration.setAttribute(FIRST_EDIT, (String)null); } @@ -387,13 +394,15 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab__Main_17; } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public boolean isValid(ILaunchConfiguration launchConfig) { setErrorMessage(null); setMessage(null); @@ -405,7 +414,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } return validateLocation(newConfig) && validateWorkDirectory(); } - + /** * Validates the content of the location field. */ @@ -421,7 +430,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } return false; } - + String expandedLocation= null; try { expandedLocation= resolveValue(location); @@ -432,7 +441,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa setErrorMessage(e.getStatus().getMessage()); return false; } - + File file = new File(expandedLocation); if (!file.exists()) { // The file does not exist. if (!newConfig) { @@ -448,10 +457,10 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } return true; } - + /** * Validates the variables of the given string to determine if all variables are valid - * + * * @param expression expression with variables * @exception CoreException if a variable is specified that does not exist */ @@ -459,7 +468,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); manager.validateStringVariables(expression); } - + private String resolveValue(String expression) throws CoreException { String expanded= null; try { @@ -470,10 +479,10 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } return expanded; } - + /** * Validates the value of the given string to determine if any/all variables are valid - * + * * @param expression expression with variables * @return whether the expression contained any variable values * @exception CoreException if variable resolution fails @@ -502,7 +511,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa setErrorMessage(e.getStatus().getMessage()); return false; } - + File file = new File(expandedDir); if (!file.exists()) { // The directory does not exist. setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_External_tool_working_directory_does_not_exist_or_is_invalid_21); @@ -514,7 +523,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } return true; } - + /** * Prompts the user to choose a location from the filesystem and * sets the location as the full path of the selected file. @@ -527,7 +536,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa locationField.setText(text); } } - + /** * Prompts the user for a workspace location within the workspace and sets * the location as a String containing the workspace_loc variable or @@ -544,7 +553,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa IResource resource = (IResource)results[0]; locationField.setText(newVariableExpression("workspace_loc", resource.getFullPath().toString())); //$NON-NLS-1$ } - + /** * Prompts the user for a working directory location within the workspace * and sets the working directory as a String containing the workspace_loc @@ -553,7 +562,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa protected void handleWorkspaceWorkingDirectoryButtonSelected() { ContainerSelectionDialog containerDialog; containerDialog = new ContainerSelectionDialog( - getShell(), + getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_23); @@ -567,7 +576,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa workDirectoryField.setText(text); } } - + /** * Returns a new variable expression with the given variable and the given argument. * @see IStringVariableManager#generateVariableExpression(String, String) @@ -575,7 +584,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa protected String newVariableExpression(String varName, String arg) { return VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression(varName, arg); } - + /** * Prompts the user to choose a working directory from the filesystem. */ @@ -588,7 +597,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa workDirectoryField.setText(text); } } - + /** * A variable entry button has been pressed for the given text * field. Prompt the user for a variable and enter the result @@ -610,26 +619,29 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa dialog.open(); return dialog.getVariableExpression(); } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return ExternalToolsImages.getImage(org.eclipse.ui.externaltools.internal.model.IExternalToolConstants.IMG_TAB_MAIN); } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { } - + /* * Fix for Bug 60163 Accessibility: New Builder Dialog missing object info for textInput controls */ @@ -642,15 +654,17 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa } control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString())); } - + private class ControlAccessibleListener extends AccessibleAdapter { private String controlName; ControlAccessibleListener(String name) { controlName = name; } + + @Override public void getName(AccessibleEvent e) { e.result = controlName; } - + } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java index ab3f41e18..84aef55ad 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/IgnoreWhiteSpaceComparator.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -12,25 +12,27 @@ package org.eclipse.ui.externaltools.internal.launchConfigurations; import java.util.Comparator; -public class IgnoreWhiteSpaceComparator implements Comparator { +public class IgnoreWhiteSpaceComparator implements Comparator<String> { - /* (non-Javadoc) - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) { - String one= (String)o1; - String two= (String)o2; + @Override + public int compare(String o1, String o2) { + if (o1 == null || o2 == null) { + if (o1 == o2) { + return 0; + } + return -1; + } int i1 = 0; int i2 = 0; - int l1 = one.length(); - int l2 = two.length(); + int l1 = o1.length(); + int l2 = o2.length(); char ch1 = ' '; char ch2 = ' '; while (i1 < l1 && i2 < l2) { - while (i1 < l1 && Character.isWhitespace(ch1 = one.charAt(i1))) { + while (i1 < l1 && Character.isWhitespace(ch1 = o1.charAt(i1))) { i1++; } - while (i2 < l2 && Character.isWhitespace(ch2 = two.charAt(i2))) { + while (i2 < l2 && Character.isWhitespace(ch2 = o2.charAt(i2))) { i2++; } if (i1 == l1 && i2 == l2) { @@ -38,7 +40,7 @@ public class IgnoreWhiteSpaceComparator implements Comparator { } if (ch1 != ch2) { return -1; - } + } i1++; i2++; } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java index a92fc2da6..52c784d2e 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/WorkingSetComparator.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -19,27 +19,26 @@ import org.eclipse.ui.IWorkingSet; * Comparator for refresh scope launch configuration attribute * <code>ATTR_REFRESH_SCOPE</code>. */ -public class WorkingSetComparator implements Comparator { +public class WorkingSetComparator implements Comparator<String> { /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ - public int compare(Object o1, Object o2) { - String one= (String)o1; - String two= (String)o2; - if (one == null || two == null) { - if (one == two) { + @Override + public int compare(String o1, String o2) { + if (o1 == null || o2 == null) { + if (o1 == o2) { return 0; - } + } return -1; } - if (one.startsWith("${working_set:") && two.startsWith("${working_set:")) { //$NON-NLS-1$//$NON-NLS-2$ - IWorkingSet workingSet1 = RefreshTab.getWorkingSet(one); - IWorkingSet workingSet2 = RefreshTab.getWorkingSet(two); + if (o1.startsWith("${working_set:") && o2.startsWith("${working_set:")) { //$NON-NLS-1$//$NON-NLS-2$ + IWorkingSet workingSet1 = RefreshTab.getWorkingSet(o1); + IWorkingSet workingSet2 = RefreshTab.getWorkingSet(o2); if (workingSet1 == null || workingSet2 == null) { if (workingSet1 == workingSet2) { return 0; - } + } return -1; } if (workingSet1.equals(workingSet2)) { @@ -47,6 +46,6 @@ public class WorkingSetComparator implements Comparator { } return -1; } - return one.compareTo(two); + return o1.compareTo(o2); } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java index a5dc2081c..dc7bf2816 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/menu/ExternalToolMenuDelegate.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -21,17 +21,18 @@ import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; * external tools launch configuration dialog. */ public class ExternalToolMenuDelegate extends AbstractLaunchToolbarAction { - + /** * Creates the action delegate */ public ExternalToolMenuDelegate() { super(IExternalToolConstants.ID_EXTERNAL_TOOLS_LAUNCH_GROUP); } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.actions.AbstractLaunchToolbarAction#getOpenDialogAction() */ + @Override protected IAction getOpenDialogAction() { IAction action= new OpenExternalToolsConfigurations(); action.setActionDefinitionId("org.eclipse.ui.externalTools.commands.OpenExternalToolsConfigurations"); //$NON-NLS-1$ diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java index 82115029d..10c4c91f3 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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,28 +31,28 @@ import org.eclipse.swt.widgets.Shell; * Utility methods for working with external tool project builders. */ public class BuilderUtils { - + // Extension point constants. private static final String TAG_CONFIGURATION_MAP = "configurationMap"; //$NON-NLS-1$ private static final String TAG_SOURCE_TYPE = "sourceType"; //$NON-NLS-1$ - private static final String TAG_BUILDER_TYPE = "builderType"; //$NON-NLS-1$ + private static final String TAG_BUILDER_TYPE = "builderType"; //$NON-NLS-1$ /** * Returns a launch configuration from the given ICommand arguments. If the * given arguments are from an old-style external tool, an unsaved working * copy will be created from the arguments and returned. - * + * * @param commandArgs the builder ICommand arguments * @return a launch configuration, a launch configuration working copy, or * <code>null</code> if not possible. */ - public static ILaunchConfiguration configFromBuildCommandArgs(IProject project, Map commandArgs, String[] version) { + public static ILaunchConfiguration configFromBuildCommandArgs(IProject project, Map<String, String> commandArgs, String[] version) { return BuilderCoreUtils.configFromBuildCommandArgs(project, commandArgs, version); } /** * Returns an <code>ICommand</code> from the given launch configuration. - * + * * @param project the project the ICommand is relevant to * @param config the launch configuration to create the command from * @return the new command. <code>null</code> can be returned if problems occur during @@ -73,7 +73,7 @@ public class BuilderUtils { } return newCommand; } - + public static void configureTriggers(ILaunchConfiguration config, ICommand newCommand) throws CoreException { BuilderCoreUtils.configureTriggers(config, newCommand); } @@ -101,14 +101,14 @@ public class BuilderUtils { public static ICommand toBuildCommand(IProject project, ILaunchConfiguration config, ICommand command) throws CoreException { return BuilderCoreUtils.toBuildCommand(project, config, command); } - + /** * Returns the type of launch configuration that should be created when * duplicating the given configuration as a project builder. Queries to see * if an extension has been specified to explicitly declare the mapping. */ public static ILaunchConfigurationType getConfigurationDuplicationType(ILaunchConfiguration config) throws CoreException { - IExtensionPoint ep= Platform.getExtensionRegistry().getExtensionPoint(ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS); + IExtensionPoint ep= Platform.getExtensionRegistry().getExtensionPoint(ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS); IConfigurationElement[] elements = ep.getConfigurationElements(); String sourceType= config.getType().getIdentifier(); String builderType= null; @@ -143,7 +143,7 @@ public class BuilderUtils { * IExternalToolConstants.EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS. */ public static ILaunchConfiguration duplicateConfiguration(IProject project, ILaunchConfiguration config) throws CoreException { - Map attributes= config.getAttributes(); + Map<String, Object> attributes = config.getAttributes(); String newName= new StringBuffer(config.getName()).append(ExternalToolsModelMessages.BuilderUtils_7).toString(); newName= DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(newName); ILaunchConfigurationType newType= getConfigurationDuplicationType(config); @@ -160,7 +160,7 @@ public class BuilderUtils { * may be changed during the migration. The name of the configuration will * only be changed if the current name is not a valid name for a saved * config. - * + * * @param workingCopy the launch configuration containing attributes from an * old-style project builder. * @return ILaunchConfiguration a new, saved launch configuration whose @@ -171,7 +171,7 @@ public class BuilderUtils { public static ILaunchConfiguration migrateBuilderConfiguration(IProject project, ILaunchConfigurationWorkingCopy workingCopy) throws CoreException { return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy); } - + /** * Converts the build types string into an array of * build kinds. @@ -181,5 +181,5 @@ public class BuilderUtils { */ public static int[] buildTypesToArray(String buildTypes) { return BuilderCoreUtils.buildTypesToArray(buildTypes); - } + } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java index 16c945a2e..3cafc26f2 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -42,14 +42,14 @@ import org.osgi.framework.BundleContext; */ public final class ExternalToolsPlugin extends AbstractUIPlugin implements ILaunchListener { - + public static final String PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$ - + /** * Status representing no problems encountered during operation. */ public static final IStatus OK_STATUS = new Status(IStatus.OK, PLUGIN_ID, 0, IExternalToolConstants.EMPTY_STRING, null); - + private static ExternalToolsPlugin plugin; private static IWindowListener fWindowListener; @@ -61,12 +61,15 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements * workbench closes. Programs are killed when the VM exits. */ private class ProgramLaunchWindowListener implements IWindowListener { + @Override public void windowActivated(IWorkbenchWindow window) { } + @Override public void windowDeactivated(IWorkbenchWindow window) { } + @Override public void windowClosed(IWorkbenchWindow window) { IWorkbenchWindow windows[] = PlatformUI.getWorkbench() .getWorkbenchWindows(); @@ -107,6 +110,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements } } + @Override public void windowOpened(IWorkbenchWindow window) { } } @@ -132,8 +136,8 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements */ public static IStatus newErrorStatus(String message, Throwable exception) { if (message == null) { - return new Status(IStatus.ERROR, PLUGIN_ID, 0, IExternalToolConstants.EMPTY_STRING, exception); - } + return new Status(IStatus.ERROR, PLUGIN_ID, 0, IExternalToolConstants.EMPTY_STRING, exception); + } return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception); } @@ -146,14 +150,14 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements /** * Writes the message to the plug-in's log - * + * * @param message the text to write to the log */ public void log(String message, Throwable exception) { IStatus status = newErrorStatus(message, exception); getLog().log(status); } - + public void log(Throwable exception) { //this message is intentionally not internationalized, as an exception may // be due to the resource bundle itself @@ -162,7 +166,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements /** * Returns the ImageDescriptor for the icon with the given path - * + * * @return the ImageDescriptor object */ public ImageDescriptor getImageDescriptor(String path) { @@ -182,7 +186,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); } - + /** * Returns the active workbench page or <code>null</code> if none. */ @@ -193,7 +197,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements } return null; } - + /** * Returns the active workbench shell or <code>null</code> if none. */ @@ -221,6 +225,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements /* (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry() */ + @Override protected ImageRegistry createImageRegistry() { return ExternalToolsImages.initializeImageRegistry(); } @@ -228,6 +233,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements /* (non-Javadoc) * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ + @Override public void stop(BundleContext context) throws Exception { try { ExternalToolsImages.disposeImageDescriptorRegistry(); @@ -236,6 +242,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements } } + @Override public void start(BundleContext context) throws Exception { super.start(context); // Listen to launches to lazily create "launch processors" @@ -255,6 +262,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements /* (non-Javadoc) * @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch) */ + @Override public void launchAdded(ILaunch launch) { ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration(); try { @@ -275,12 +283,14 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements /* (non-Javadoc) * @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch) */ + @Override public void launchChanged(ILaunch launch) { } /* (non-Javadoc) * @see org.eclipse.debug.core.ILaunchListener#launchRemoved(org.eclipse.debug.core.ILaunch) */ + @Override public void launchRemoved(ILaunch launch) { } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java index b7bbb8b37..e91aadaa1 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. + * Copyright (c) 2004, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -21,9 +21,10 @@ public class ExternalToolsPreferenceInitializer extends AbstractPreferenceInitia /* * (non-Javadoc) - * + * * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() */ + @Override public void initializeDefaultPreferences() { IPreferenceStore prefs = ExternalToolsPlugin.getDefault().getPreferenceStore(); prefs.setDefault(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION, true); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java index 4c8dd3ca1..d31770464 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IExternalToolConstants.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * dakshinamurthy.karra@gmail.com - bug 165371 @@ -34,33 +34,39 @@ public interface IExternalToolConstants { * Variable that expands to the workspace root object (value <code>workspace</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#VAR_WORKSPACE} */ + @Deprecated public static final String VAR_WORKSPACE = org.eclipse.core.externaltools.internal.IExternalToolConstants.VAR_WORKSPACE; /** * Variable that expands to the project resource (value <code>project</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#VAR_PROJECT} */ + @Deprecated public static final String VAR_PROJECT = org.eclipse.core.externaltools.internal.IExternalToolConstants.VAR_PROJECT; /** * Variable that expands to the container resource (value <code>container</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#VAR_CONTAINER} */ + @Deprecated public static final String VAR_CONTAINER = org.eclipse.core.externaltools.internal.IExternalToolConstants.VAR_CONTAINER; /** * Variable that expands to a resource (value <code>resource</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#VAR_RESOURCE} */ + @Deprecated public static final String VAR_RESOURCE = org.eclipse.core.externaltools.internal.IExternalToolConstants.VAR_RESOURCE; /** * Variable that expands to the working set object (value <code>working_set</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#VAR_WORKING_SET} */ + @Deprecated public static final String VAR_WORKING_SET = org.eclipse.core.externaltools.internal.IExternalToolConstants.VAR_WORKING_SET; // ------- Tool Types ------- /** - * External tool type for programs such as executables, batch files, + * External tool type for programs such as executables, batch files, * shell scripts, etc (value <code>programType</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#TOOL_TYPE_PROGRAM} */ + @Deprecated public static final String TOOL_TYPE_PROGRAM = org.eclipse.core.externaltools.internal.IExternalToolConstants.TOOL_TYPE_PROGRAM; // ------- Build Types ------- @@ -69,6 +75,7 @@ public interface IExternalToolConstants { * the external tool running as a builder (value <code>incremental</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#BUILD_TYPE_INCREMENTAL} */ + @Deprecated public static final String BUILD_TYPE_INCREMENTAL = org.eclipse.core.externaltools.internal.IExternalToolConstants.BUILD_TYPE_INCREMENTAL; /** @@ -76,6 +83,7 @@ public interface IExternalToolConstants { * the external tool running as a builder (value <code>full</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#BUILD_TYPE_FULL} */ + @Deprecated public static final String BUILD_TYPE_FULL = org.eclipse.core.externaltools.internal.IExternalToolConstants.BUILD_TYPE_FULL; /** @@ -83,13 +91,15 @@ public interface IExternalToolConstants { * the external tool running as a builder (value <code>auto</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#BUILD_TYPE_AUTO} */ + @Deprecated public static final String BUILD_TYPE_AUTO = org.eclipse.core.externaltools.internal.IExternalToolConstants.BUILD_TYPE_AUTO; - + /** * Build type indicating a clean project build request for * the external tool running as a builder (value <code>clean</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#BUILD_TYPE_CLEAN} */ + @Deprecated public static final String BUILD_TYPE_CLEAN = org.eclipse.core.externaltools.internal.IExternalToolConstants.BUILD_TYPE_CLEAN; /** @@ -97,6 +107,7 @@ public interface IExternalToolConstants { * the external tool running as a builder (value <code>none</code>). * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#BUILD_TYPE_NONE} */ + @Deprecated public static final String BUILD_TYPE_NONE = org.eclipse.core.externaltools.internal.IExternalToolConstants.BUILD_TYPE_NONE; // ------- Images ------- @@ -116,15 +127,17 @@ public interface IExternalToolConstants { * Program launch configuration type identifier. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE} */ + @Deprecated public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = org.eclipse.core.externaltools.internal.IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE; - + /** * Program builder launch configuration type identifier. Program project * builders are of this type. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE} */ + @Deprecated public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = org.eclipse.core.externaltools.internal.IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE; - + // ------- Launch configuration category -------- /** * Identifier for external tools launch configuration category. Launch @@ -132,6 +145,7 @@ public interface IExternalToolConstants { * launch configuration dialog should belong to this category. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY} */ + @Deprecated public static final String ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY = org.eclipse.core.externaltools.internal.IExternalToolConstants.ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY; /** * Identifier for external tools launch configuration builders category. @@ -139,6 +153,7 @@ public interface IExternalToolConstants { * belong to this category. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY} */ + @Deprecated public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY = org.eclipse.core.externaltools.internal.IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY; // ------- Launch configuration groups -------- @@ -160,12 +175,14 @@ public interface IExternalToolConstants { * Default value is <code>false</code>. * @deprecated since 3.1 Replaced by <code>org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT</code> */ + @Deprecated public static final String ATTR_CAPTURE_OUTPUT = PLUGIN_ID + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$ /** * String attribute identifying the location of an external. Default value * is <code>null</code>. Encoding is tool specific. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_LOCATION} */ + @Deprecated public static final String ATTR_LOCATION = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_LOCATION; /** @@ -174,28 +191,32 @@ public interface IExternalToolConstants { * THIS ATTRIBUTE IS NOT USED. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_PROMPT_FOR_ARGUMENTS} */ + @Deprecated public static final String ATTR_PROMPT_FOR_ARGUMENTS = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS; - + /** - * String attribute identifying the scope of resources that should trigger an + * String attribute identifying the scope of resources that should trigger an * external tool to run. Default value is <code>null</code> * indicating that the builder will be triggered for all changes. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_BUILDER_SCOPE} */ + @Deprecated public static final String ATTR_BUILDER_SCOPE = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_BUILDER_SCOPE; - + /** * String attribute containing an array of build kinds for which an * external tool builder should be run. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_RUN_BUILD_KINDS} */ + @Deprecated public static final String ATTR_RUN_BUILD_KINDS = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_RUN_BUILD_KINDS; - + /** * Boolean attribute indicating if the console should be shown on external * tool output. Default value is <code>false</code>. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_SHOW_CONSOLE} */ + @Deprecated public static final String ATTR_SHOW_CONSOLE = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_SHOW_CONSOLE; /** @@ -203,6 +224,7 @@ public interface IExternalToolConstants { * tool. Default value is <code>null</code>, and encoding is tool specific. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_TOOL_ARGUMENTS} */ + @Deprecated public static final String ATTR_TOOL_ARGUMENTS = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_TOOL_ARGUMENTS; /** @@ -211,20 +233,23 @@ public interface IExternalToolConstants { * directory, which is tool specific. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_WORKING_DIRECTORY} */ + @Deprecated public static final String ATTR_WORKING_DIRECTORY = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_WORKING_DIRECTORY; - + /** * String attribute identifying whether an external tool builder configuration * is enabled. The default value is <code>true</code>, which indicates * that the configuration will be executed as appropriate by the builder. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_BUILDER_ENABLED} */ + @Deprecated public static final String ATTR_BUILDER_ENABLED = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_BUILDER_ENABLED; - + /** * Status code indicating an unexpected internal error. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ERR_INTERNAL_ERROR} */ + @Deprecated public static final int ERR_INTERNAL_ERROR = org.eclipse.core.externaltools.internal.IExternalToolConstants.ERR_INTERNAL_ERROR; /** @@ -232,14 +257,16 @@ public interface IExternalToolConstants { * The value is the name of the disabled builder. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_DISABLED_BUILDER} */ + @Deprecated public static final String ATTR_DISABLED_BUILDER = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_DISABLED_BUILDER; - + /** * boolean attribute identifying that an external tool builder has been configured for triggering * using the <code>ICommand.setBuilding(int)</code> mechanism * @since 3.1 * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_TRIGGERS_CONFIGURED} */ + @Deprecated public static final String ATTR_TRIGGERS_CONFIGURED = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED; /** @@ -247,13 +274,15 @@ public interface IExternalToolConstants { * <code>null</code> indicates the default workspace build. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_BUILD_SCOPE} */ + @Deprecated public static final String ATTR_BUILD_SCOPE = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_BUILD_SCOPE; /** - * Attribute identifier specifying whether referenced projects should be + * Attribute identifier specifying whether referenced projects should be * considered when computing the projects to build. Default value is * <code>true</code>. * @deprecated use {@link org.eclipse.core.externaltools.internal.IExternalToolConstants#ATTR_INCLUDE_REFERENCED_PROJECTS} */ + @Deprecated public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS; } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java index 346f60c85..f82f2c25f 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ImageDescriptorRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -10,9 +10,8 @@ *******************************************************************************/ package org.eclipse.ui.externaltools.internal.model; - + import java.util.HashMap; -import java.util.Iterator; import org.eclipse.core.runtime.Assert; import org.eclipse.jface.resource.ImageDescriptor; @@ -24,9 +23,9 @@ import org.eclipse.swt.widgets.Display; */ public class ImageDescriptorRegistry { - private HashMap fRegistry= new HashMap(10); + private HashMap<ImageDescriptor, Image> fRegistry = new HashMap<ImageDescriptor, Image>(10); private Display fDisplay; - + /** * Creates a new image descriptor registry for the current or default display, * respectively. @@ -34,57 +33,56 @@ public class ImageDescriptorRegistry { public ImageDescriptorRegistry() { this(ExternalToolsPlugin.getStandardDisplay()); } - + /** * Creates a new image descriptor registry for the given display. All images * managed by this registry will be disposed when the display gets disposed. - * - * @param display the display the images managed by this registry are allocated for + * + * @param display the display the images managed by this registry are allocated for */ public ImageDescriptorRegistry(Display display) { fDisplay= display; Assert.isNotNull(fDisplay); hookDisplay(); } - + /** * Returns the image associated with the given image descriptor. - * + * * @param descriptor the image descriptor for which the registry manages an image * @return the image associated with the image descriptor or <code>null</code> * if the image descriptor can't create the requested image. */ public Image get(ImageDescriptor descriptor) { - if (descriptor == null) - descriptor= ImageDescriptor.getMissingImageDescriptor(); - - Image result= (Image)fRegistry.get(descriptor); - if (result != null) + Image result = fRegistry.get(descriptor != null ? descriptor : ImageDescriptor.getMissingImageDescriptor()); + if (result != null) { return result; - + } + Assert.isTrue(fDisplay == ExternalToolsPlugin.getStandardDisplay(), ExternalToolsModelMessages.ImageDescriptorRegistry_Allocating_image_for_wrong_display_1); - result= descriptor.createImage(); - if (result != null) + result = descriptor != null ? descriptor.createImage() : ImageDescriptor.getMissingImageDescriptor().createImage(); + if (result != null) { fRegistry.put(descriptor, result); + } return result; } /** * Disposes all images managed by this registry. - */ + */ public void dispose() { - for (Iterator iter= fRegistry.values().iterator(); iter.hasNext(); ) { - Image image= (Image)iter.next(); + for (Image image : fRegistry.values()) { image.dispose(); } fRegistry.clear(); } - + private void hookDisplay() { fDisplay.disposeExec(new Runnable() { + @Override public void run() { dispose(); - } + } }); } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java index 3d6dc5b61..77fbd4f81 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -34,7 +34,8 @@ class BuilderLabelProvider extends LabelProvider { private Image builderImage = ExternalToolsPlugin.getDefault().getImageDescriptor(IMG_BUILDER).createImage(); private Image invalidBuildToolImage = ExternalToolsPlugin.getDefault().getImageDescriptor(IMG_INVALID_BUILD_TOOL).createImage(); - + + @Override public String getText(Object element) { if (element instanceof ICommand) { return getCommandText((ICommand) element); @@ -45,7 +46,8 @@ class BuilderLabelProvider extends LabelProvider { } return super.getText(element); } - + + @Override public Image getImage(Object element) { if (element instanceof ICommand) { return getCommandImage(); @@ -56,12 +58,12 @@ class BuilderLabelProvider extends LabelProvider { } return super.getImage(element); } - + public String getCommandText(ICommand command) { String builderID = command.getBuilderName(); return getBuilderName(builderID); } - + private String getBuilderName(String builderID) { // Get the human-readable name of the builder IExtension extension = Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, builderID); @@ -73,16 +75,16 @@ class BuilderLabelProvider extends LabelProvider { } return builderName; } - + /** * Returns the image for build commands. - * + * * @return the build command image */ public Image getCommandImage() { return builderImage; } - + /** * Returns a text label for the given object from a debug * model presentation. @@ -102,7 +104,7 @@ class BuilderLabelProvider extends LabelProvider { } return debugModelPresentation.getText(element); } - + /** * Returns an image for the given object from a debug * model presentation. @@ -125,6 +127,7 @@ class BuilderLabelProvider extends LabelProvider { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() */ + @Override public void dispose() { builderImage.dispose(); invalidBuildToolImage.dispose(); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java index caac40406..483b652c6 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java @@ -95,22 +95,22 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta private static final String COMMAND_ENABLED= "CommandEnabled"; //$NON-NLS-1$ private Button upButton, downButton, newButton, importButton, editButton, removeButton; - + private boolean userHasMadeChanges= false; - - private List configsToBeDeleted= null; - private List commandsToBeDeleted= null; - + + private List<ILaunchConfiguration> configsToBeDeleted = null; + private List<ICommand> commandsToBeDeleted = null; + private CheckboxTableViewer viewer= null; - + private boolean fWarned = false; /** * Flag to know if we can perform an edit of the selected element(s) */ private boolean fCanEdit = false; - + private ILabelProvider labelProvider= new BuilderLabelProvider(); - + /** * Error configs are objects representing entries pointing to * invalid launch configurations @@ -124,23 +124,24 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta return command; } } - + /** * Collection of configurations created while the page is open. * Stored here so they can be deleted if the page is cancelled. */ - private List newConfigList= new ArrayList(); - + private List<ILaunchConfiguration> newConfigList = new ArrayList<ILaunchConfiguration>(); + private SelectionListener buttonListener= new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { handleButtonPressed((Button) e.widget); } }; - + /** * Launch configuration listener which is responsible for updating items in * the tree when the user renames configurations in the dialog. - * + * * This is necessary because when we tell the configuration dialog to open * on a launch config and the user renames that config, the old config (the * one in the tree) is made obsolete and a new config is created. This @@ -153,6 +154,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta * movedFrom a configuration in the tree, replace the old config with * the new. */ + @Override public void launchConfigurationAdded(final ILaunchConfiguration configuration) { ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfiguration oldConfig= manager.getMovedFrom(configuration); @@ -163,15 +165,16 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if (newConfigList.remove(oldConfig)) { newConfigList.add(configuration); } - - Display.getDefault().asyncExec(new Runnable() { + + Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { TableItem[] items= viewer.getTable().getItems(); for (int i = 0; i < items.length; i++) { TableItem item = items[i]; Object data= item.getData(); if (data == oldConfig) { - // Found the movedFrom config in the tree. Replace it with the new config + // Found the movedFrom config in the tree. Replace it with the new config item.setData(configuration); viewer.update(configuration, null); break; @@ -180,8 +183,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } }); } + @Override public void launchConfigurationChanged(ILaunchConfiguration configuration) { } + @Override public void launchConfigurationRemoved(ILaunchConfiguration configuration) { } }; @@ -210,7 +215,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta handleException(e); return; } - + boolean projectNeedsMigration= false; for (int i = 0; i < commands.length; i++) { String[] version= new String[] {IExternalToolConstants.EMPTY_STRING}; @@ -290,14 +295,15 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); return button; } - + /* (non-Javadoc) * Method declared on PreferencePage. */ + @Override protected Control createContents(Composite parent) { - + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IExternalToolsHelpContextIds.EXTERNAL_TOOLS_BUILDER_PROPERTY_PAGE); - + Font font = parent.getFont(); Composite topLevel = new Composite(parent, SWT.NONE); @@ -328,12 +334,14 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta builderTable.setLayoutData(new GridData(GridData.FILL_BOTH)); builderTable.setFont(font); builderTable.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { handleTableSelectionChanged(); } }); - + builderTable.addListener(SWT.MouseDoubleClick, new Listener() { + @Override public void handleEvent(Event event) { //we must not allow editing of elements that cannot be edited via the selection changed logic //https://bugs.eclipse.org/bugs/show_bug.cgi?id=386820 @@ -342,7 +350,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } } }); - + //button area Composite buttonArea = new Composite(tableAndButtons, SWT.NONE); layout = new GridLayout(); @@ -362,12 +370,12 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta newButton.setEnabled(true); importButton.setEnabled(true); - //populate widget contents + //populate widget contents addBuildersToTable(); return topLevel; } - + /** * Turns auto-building on or off in the workspace. */ @@ -424,6 +432,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta /* (non-Javadoc) * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) */ + @Override public void checkStateChanged(CheckStateChangedEvent event) { Object element= event.getElement(); boolean checked = event.getChecked(); @@ -441,7 +450,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if(MessageDialog.openConfirm(shell, ExternalToolsUIMessages.BuilderPropertyPage_6, ExternalToolsUIMessages.BuilderPropertyPage_7)) { fWarned = true; } - } + } if(fWarned) { enableCommand((ICommand)element, checked); } @@ -450,7 +459,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta viewer.setChecked(element, true); viewer.addCheckStateListener(this); } - + } } @@ -478,11 +487,11 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } userHasMadeChanges= true; } - + private void enableCommand(ICommand command, boolean enable) { - Map/*<String, String>*/ args= command.getArguments(); + Map<String, String> args = command.getArguments(); if (args == null) { - args= new HashMap(1); + args = new HashMap<String, String>(1); } args.put(COMMAND_ENABLED, Boolean.toString(enable)); command.setArguments(args); @@ -492,15 +501,14 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta /** * The user has pressed the import button. Prompt them to select a * configuration to import from the workspace. - */ + */ private void handleImportButtonPressed() { ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); - List toolTypes= getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY); - List configurations= new ArrayList(); - Iterator iter= toolTypes.iterator(); - while (iter.hasNext()) { + List<ILaunchConfigurationType> toolTypes = getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY); + List<ILaunchConfiguration> configurations = new ArrayList<ILaunchConfiguration>(); + for (ILaunchConfigurationType type : toolTypes) { try { - ILaunchConfiguration[] configs= manager.getLaunchConfigurations((ILaunchConfigurationType) iter.next()); + ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); for (int i = 0; i < configs.length; i++) { ILaunchConfiguration launchConfiguration = configs[i]; if (!DebugUITools.isPrivate(launchConfiguration)) { @@ -547,7 +555,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta newConfigList.add(newConfig); } } - + /** * The user has pressed the remove button. Delete the selected builder. */ @@ -556,25 +564,25 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if (selection != null) { int numSelected= selection.size(); userHasMadeChanges= true; - Iterator iterator= selection.iterator(); + Iterator<?> iterator = selection.iterator(); while (iterator.hasNext()) { Object item= iterator.next(); if (item instanceof ILaunchConfiguration) { if (configsToBeDeleted == null) { - configsToBeDeleted= new ArrayList(numSelected); + configsToBeDeleted = new ArrayList<ILaunchConfiguration>(numSelected); } - configsToBeDeleted.add(item); + configsToBeDeleted.add((ILaunchConfiguration) item); } else if (item instanceof ICommand) { if (commandsToBeDeleted == null) { - commandsToBeDeleted= new ArrayList(numSelected); + commandsToBeDeleted = new ArrayList<ICommand>(numSelected); } - commandsToBeDeleted.add(item); + commandsToBeDeleted.add((ICommand) item); } viewer.remove(item); } } } - + /** * The user has pressed the new button. Create a new configuration and open * the launch configuration edit dialog on the new config. @@ -588,8 +596,8 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta try { ILaunchConfigurationWorkingCopy workingCopy = null; String name= DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(ExternalToolsUIMessages.BuilderPropertyPage_New_Builder_7); - workingCopy = type.newInstance(BuilderUtils.getBuilderFolder(getInputProject(), true), name); - + workingCopy = type.newInstance(BuilderUtils.getBuilderFolder(getInputProject(), true), name); + StringBuffer buffer= new StringBuffer(IExternalToolConstants.BUILD_TYPE_FULL); buffer.append(','); buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL); @@ -611,7 +619,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta userHasMadeChanges= true; //retrieve the last "new" config //may have been changed by the user pressing apply in the edit dialog - config= (ILaunchConfiguration)newConfigList.get(newConfigList.size() - 1); + config= newConfigList.get(newConfigList.size() - 1); viewer.add(config); viewer.setChecked(config, isEnabled(config)); } @@ -625,7 +633,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } } } - + /** * Prompts the user to edit the given launch configuration. Returns the * return code from opening the launch configuration dialog. @@ -641,17 +649,17 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta manager.removeLaunchConfigurationListener(configurationListener); return code; } - + /** * Prompts the user to choose a launch configuration type to create and * returns the type the user selected or <code>null</code> if the user * cancelled. - * + * * @return the configuration type selected by the user or <code>null</code> * if the user cancelled. */ private ILaunchConfigurationType promptForConfigurationType() { - List externalToolTypes= getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY); + List<ILaunchConfigurationType> externalToolTypes = getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY); Shell shell= getShell(); if (shell == null) { return null; @@ -668,13 +676,13 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } return (ILaunchConfigurationType) result[0]; } - + /** * Returns the launch configuration types of the given category */ - private List getConfigurationTypes(String category) { + private List<ILaunchConfigurationType> getConfigurationTypes(String category) { ILaunchConfigurationType types[] = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); - List externalToolTypes = new ArrayList(); + List<ILaunchConfigurationType> externalToolTypes = new ArrayList<ILaunchConfigurationType>(); for (int i = 0; i < types.length; i++) { ILaunchConfigurationType configurationType = types[i]; if (category.equals(configurationType.getCategory())) { @@ -683,7 +691,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } return externalToolTypes; } - + /** * The user has pressed the edit button or double-clicked. Open the launch configuration edit * dialog on the selection after migrating the tool if necessary. @@ -729,13 +737,13 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta ICommand command= (ICommand) data; if (command.isConfigurable()) { if (editCommand(command)) { - userHasMadeChanges= true; + userHasMadeChanges= true; } } } } } - + private boolean editCommand(ICommand data) { EditCommandDialog dialog= new EditCommandDialog(getShell(), data); return Window.OK == dialog.open(); @@ -745,7 +753,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta * Prompts the user to proceed with the migration of a project builder from * the old format to the new, launch configuration-based, format and returns * whether or not the user wishes to proceed with the migration. - * + * * @return boolean whether or not the user wishes to proceed with migration */ private boolean shouldProceedWithMigration() { @@ -758,12 +766,12 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta return false; } // Warn the user that editing an old config will cause storage migration. - MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(getShell(), + MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(getShell(), ExternalToolsUIMessages.BuilderPropertyPage_Migrate_project_builder_10, ExternalToolsUIMessages.BuilderPropertyPage_Not_Support, ExternalToolsUIMessages.BuilderPropertyPage_Prompt, false, - ExternalToolsPlugin.getDefault().getPreferenceStore(), + ExternalToolsPlugin.getDefault().getPreferenceStore(), IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION); return dialog.getReturnCode() == IDialogConstants.YES_ID; } @@ -779,7 +787,8 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta status[0] = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, ExternalToolsUIMessages.BuilderPropertyPage_statusMessage, e); } Display.getDefault().asyncExec(new Runnable() { - public void run() { + @Override + public void run() { Shell shell= getShell(); if (shell != null) { ErrorDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_errorTitle, @@ -851,18 +860,18 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta upButton.setEnabled(enableUp); downButton.setEnabled(enableDown); } - + /** * Returns whether the given element (command or launch config) * is enabled. - * + * * @param element the element * @return whether the given element is enabled */ private boolean isEnabled(Object element) { if (element instanceof ICommand) { ICommand command = (ICommand) element; - String val = (String)command.getArguments().get(COMMAND_ENABLED); + String val = command.getArguments().get(COMMAND_ENABLED); if(val != null) { //null means enabled, see #doPerformOk Boolean enabled = new Boolean(val); @@ -931,6 +940,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta /* (non-Javadoc) * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ + @Override public boolean performOk() { if (!userHasMadeChanges) { return super.performOk(); @@ -943,6 +953,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta itemData[i]= builderTable.getItem(i).getData(); } IRunnableWithProgress runnable= new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { doPerformOk(monitor, itemData); @@ -951,28 +962,28 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } } }; - + IProgressService service= PlatformUI.getWorkbench().getProgressService(); try { service.busyCursorWhile(runnable); } catch (InvocationTargetException e) { return false; } catch (InterruptedException e) { - return false; + return false; } return super.performOk(); } - + private void doPerformOk(IProgressMonitor monitor, Object[] itemData) { if (monitor.isCanceled()) { return; } - + IProject project = getInputProject(); //get all the build commands int numCommands = itemData.length; monitor.beginTask(ExternalToolsUIMessages.BuilderPropertyPage_3, numCommands + 1); - List possibleCommands= new ArrayList(numCommands); + List<ICommand> possibleCommands = new ArrayList<ICommand>(numCommands); for (int i = 0; i < numCommands; i++) { Object data = itemData[i]; if (data instanceof ICommand) { @@ -982,8 +993,8 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta continue; } ICommand command= (ICommand)data; - Map/*<String, String>*/ args = command.getArguments(); - String val = (String)args.get(COMMAND_ENABLED); + Map<String, String> args = command.getArguments(); + String val = args.get(COMMAND_ENABLED); if(val != null) { Boolean enabled = new Boolean(val); if (!enabled.booleanValue()) { @@ -1007,7 +1018,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } } catch (CoreException e1) { } - + if (!BuilderUtils.isUnmigratedConfig(config) && (config instanceof ILaunchConfigurationWorkingCopy)) { ILaunchConfigurationWorkingCopy workingCopy= ((ILaunchConfigurationWorkingCopy) config); // Save any changes to the config (such as enable/disable) @@ -1026,8 +1037,8 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } else if (data instanceof ErrorConfig) { data= ((ErrorConfig) data).getCommand(); } - if (data != null) { - possibleCommands.add(data); + if (data instanceof ICommand) { + possibleCommands.add((ICommand) data); } monitor.worked(1); } @@ -1044,13 +1055,13 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta performCancel(); } } - + if (configsToBeDeleted != null) { deleteConfigurations(); } monitor.done(); } - + private void checkBuilderFolder() { try { IFolder builderFolder= BuilderUtils.getBuilderFolder(getInputProject(), false); @@ -1072,12 +1083,12 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta try { ICommand newCommand = project.getDescription().newCommand(); String builderName= config.getAttribute(IExternalToolConstants.ATTR_DISABLED_BUILDER, (String)null); - Map args= config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, new HashMap(0)); - + Map<String, String> args = config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, new HashMap<String, String>(0)); + newCommand.setBuilderName(builderName); newCommand.setArguments(args); if (configsToBeDeleted == null) { - configsToBeDeleted= new ArrayList(); + configsToBeDeleted = new ArrayList<ILaunchConfiguration>(); } configsToBeDeleted.add(config); return newCommand; @@ -1089,21 +1100,22 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta return null; } } - + /** - * Disables a builder by wrappering the builder command as a disabled external tool builder. - * The details of the command is persisted in the launch configuration. + * Disables a builder by wrapping the builder command as a disabled external + * tool builder. The details of the command is persisted in the launch + * configuration. */ private ILaunchConfiguration disableCommand(ICommand command) { - Map/*<String, String>*/ arguments= command.getArguments(); + Map<String, String> arguments = command.getArguments(); if (arguments != null) { arguments.remove(COMMAND_ENABLED); } - List externalToolTypes= getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY); + List<ILaunchConfigurationType> externalToolTypes = getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY); if (externalToolTypes.size() == 0) { return null; } - ILaunchConfigurationType type= (ILaunchConfigurationType)externalToolTypes.get(0); + ILaunchConfigurationType type= externalToolTypes.get(0); if (type == null) { return null; } @@ -1112,8 +1124,8 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta ILaunchConfigurationWorkingCopy workingCopy = null; String builderName = command.getBuilderName(); String name= DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(builderName); - workingCopy = type.newInstance(BuilderUtils.getBuilderFolder(getInputProject(), true), name); - + workingCopy = type.newInstance(BuilderUtils.getBuilderFolder(getInputProject(), true), name); + workingCopy.setAttribute(IExternalToolConstants.ATTR_DISABLED_BUILDER, builderName); if (arguments != null) { workingCopy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); @@ -1134,18 +1146,14 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } return null; } - + private void deleteConfigurations() { boolean wasAutobuilding= ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding(); try { setAutobuild(false); - - Iterator itr= configsToBeDeleted.iterator(); - while (itr.hasNext()) { - ILaunchConfiguration element = (ILaunchConfiguration) itr.next(); - element.delete(); + for (ILaunchConfiguration config : configsToBeDeleted) { + config.delete(); } - checkBuilderFolder(); } catch (CoreException e) { handleException(e); @@ -1157,7 +1165,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } } } - + /** * Returns whether any of the commands have changed. */ @@ -1176,12 +1184,12 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if (oldName == null && newName != null) { return true; } - + if(oldName != null && !oldName.equals(newName)) { return true; } - Map/*<String, String>*/ oldArgs= oldCommand.getArguments(); - Map/*<String, String>*/ newArgs= newCommand.getArguments(); + Map<String, String> oldArgs = oldCommand.getArguments(); + Map<String, String> newArgs = newCommand.getArguments(); if (oldArgs == null) { if(newArgs != null) { return true; @@ -1191,20 +1199,11 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta if(oldArgs.size() != newArgs.size()) { return true; } - Iterator keySet= oldArgs.keySet().iterator(); - while (keySet.hasNext()) { - Object key = keySet.next(); - Object oldArg= oldArgs.get(key); - Object newArg= newArgs.get(key); - if (oldArg instanceof String && newArg instanceof String) { - if (comparator.compare(oldArg, newArg) != 0) { - return true; - } - } else if (!oldArg.equals(newArg)){ + for (String key : oldArgs.keySet()) { + if (comparator.compare(oldArgs.get(key), newArgs.get(key)) != 0) { return true; } } - if (oldCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD) || oldCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD) || oldCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD) != newCommand.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD) @@ -1215,24 +1214,23 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta } catch (CoreException ce) { return true; } - return false; + return false; } /* (non-Javadoc) * @see org.eclipse.jface.preference.IPreferencePage#performCancel() */ + @Override public boolean performCancel() { - Iterator iter= newConfigList.iterator(); - while (iter.hasNext()) { + for (ILaunchConfiguration config : newConfigList) { try { - ((ILaunchConfiguration) iter.next()).delete(); + config.delete(); } catch (CoreException e) { handleException(e); } } - checkBuilderFolder(); - + //remove the local marking of the enabled state of the commands Table builderTable= viewer.getTable(); int numCommands = builderTable.getItemCount(); @@ -1240,15 +1238,16 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta Object data = builderTable.getItem(i).getData(); if (data instanceof ICommand) { ICommand command= (ICommand)data; - Map/*<String, String>*/ args= command.getArguments(); + Map<String, String> args = command.getArguments(); args.remove(COMMAND_ENABLED); command.setArguments(args); } } return super.performCancel(); } - - public Shell getShell() { + + @Override + public Shell getShell() { if (getControl().isDisposed()) { return null; } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java index 4a2befedc..320d15bb6 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/EditCommandDialog.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,25 +29,26 @@ public class EditCommandDialog extends Dialog { private Button fIncrementalButton; private Button fAutoButton; private Button fCleanButton; - + private ICommand fCommand; - + public EditCommandDialog(Shell parentShell, ICommand command) { super(parentShell); fCommand= command; } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createDialogArea(Composite parent) { - + getShell().setText(ExternalToolsUIMessages.EditCommandDialog_0); Composite composite = (Composite)super.createDialogArea(parent); - + Label label= new Label(composite, SWT.NONE); label.setText(ExternalToolsUIMessages.EditCommandDialog_1); - + fFullButton = new Button(composite, SWT.CHECK); fFullButton.setText(ExternalToolsUIMessages.EditCommandDialog_2); fFullButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); @@ -57,23 +58,24 @@ public class EditCommandDialog extends Dialog { fAutoButton = new Button(composite, SWT.CHECK); fAutoButton.setText(ExternalToolsUIMessages.EditCommandDialog_4); fAutoButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.AUTO_BUILD)); - + fCleanButton = new Button(composite, SWT.CHECK); fCleanButton.setText(ExternalToolsUIMessages.EditCommandDialog_5); fCleanButton.setSelection(fCommand.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD)); applyDialogFont(composite); return composite; } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ + @Override protected void okPressed() { fCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, fFullButton.getSelection()); fCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, fIncrementalButton.getSelection()); fCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, fAutoButton.getSelection()); fCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, fCleanButton.getSelection()); - + super.okPressed(); } } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java index 6c804b821..7b9fc3d42 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Frederic Gurr - Fixed restore default behavior (bug 346082) @@ -33,7 +33,7 @@ public class ExternalToolsPreferencePage extends PreferencePage implements IWork private Button promptForToolMigrationButton; private Button promptForProjectMigrationButton; - + public ExternalToolsPreferencePage() { setPreferenceStore(ExternalToolsPlugin.getDefault().getPreferenceStore()); setDescription(ExternalToolsUIMessages.ExternalToolsPreferencePage_External_tool_project_builders_migration_2); @@ -42,6 +42,7 @@ public class ExternalToolsPreferencePage extends PreferencePage implements IWork /** * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createContents(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IExternalToolsHelpContextIds.EXTERNAL_TOOLS_PREFERENCE_PAGE); //The main composite @@ -51,15 +52,15 @@ public class ExternalToolsPreferencePage extends PreferencePage implements IWork layout.marginWidth=0; composite.setLayout(layout); composite.setFont(parent.getFont()); - + promptForToolMigrationButton= createCheckButton(composite, ExternalToolsUIMessages.ExternalToolsPreferencePage_Prompt_before_migrating_3, IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION); promptForProjectMigrationButton= createCheckButton(composite, ExternalToolsUIMessages.ExternalToolsPreferencePage_1, IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION); - + applyDialogFont(composite); - + return composite; } - + /** * Returns a new check button with the given label for the given preference. */ @@ -71,16 +72,18 @@ public class ExternalToolsPreferencePage extends PreferencePage implements IWork button.setSelection(getPreferenceStore().getBoolean(preferenceKey)); return button; } - + /** * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ + @Override public void init(IWorkbench workbench) { } /** * @see org.eclipse.jface.preference.PreferencePage#performOk() */ + @Override public boolean performOk() { getPreferenceStore().setValue(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION, promptForToolMigrationButton.getSelection()); getPreferenceStore().setValue(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, promptForProjectMigrationButton.getSelection()); @@ -90,6 +93,7 @@ public class ExternalToolsPreferencePage extends PreferencePage implements IWork /** * @see org.eclipse.jface.preference.PreferencePage#performDefaults() */ + @Override protected void performDefaults() { promptForToolMigrationButton.setSelection(getPreferenceStore().getDefaultBoolean(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION)); promptForProjectMigrationButton.setSelection(getPreferenceStore().getDefaultBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION)); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java index db5a4b10d..db51b499e 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -13,6 +13,7 @@ package org.eclipse.ui.externaltools.internal.ui; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; + import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -60,7 +61,7 @@ public class FileSelectionDialog extends MessageDialog { private Pattern fPattern; /** * Creates a resource selection dialog rooted at the given element. - * + * * @param parentShell * the parent shell * @param rootElement @@ -74,12 +75,12 @@ public class FileSelectionDialog extends MessageDialog { root = rootElement; setShellStyle(getShellStyle() | SWT.RESIZE); } - + /** * Limits the files displayed in this dialog to files matching the given * pattern. The string can be a filename or a regular expression containing * '*' for any series of characters or '?' for any single character. - * + * * @param pattern * a pattern used to filter the displayed files or <code>null</code> * to display all files. If a pattern is supplied, only files @@ -100,23 +101,26 @@ public class FileSelectionDialog extends MessageDialog { fPattern = null; } } - + /* * (non-Javadoc) Method declared in Window. */ + @Override protected void configureShell(Shell shell) { super.configureShell(shell); PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IExternalToolsHelpContextIds.FILE_SELECTION_DIALOG); } + @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); initializeDialog(); } - + /* * (non-Javadoc) Method declared on Dialog. */ + @Override protected Control createDialogArea(Composite parent) { // page group Composite composite = (Composite) super.createDialogArea(parent); @@ -138,10 +142,12 @@ public class FileSelectionDialog extends MessageDialog { // size, otherwise it will open too small SIZING_SELECTION_WIDGET_WIDTH, SIZING_SELECTION_WIDGET_HEIGHT, allowMultiselection); - + composite.addControlListener(new ControlListener() { + @Override public void controlMoved(ControlEvent e) { } + @Override public void controlResized(ControlEvent e) { //Also try and reset the size of the columns as appropriate TableColumn[] columns = @@ -160,28 +166,27 @@ public class FileSelectionDialog extends MessageDialog { */ private ITreeContentProvider getResourceProvider(final int resourceType) { return new WorkbenchContentProvider() { + @Override public Object[] getChildren(Object o) { if (o instanceof IContainer) { IResource[] members = null; try { members = ((IContainer) o).members(); - List accessibleMembers = new ArrayList(members.length); + List<IResource> accessibleMembers = new ArrayList<IResource>(members.length); for (int i = 0; i < members.length; i++) { IResource resource = members[i]; if (resource.isAccessible()) { accessibleMembers.add(resource); } } - members = - (IResource[]) accessibleMembers.toArray( - new IResource[accessibleMembers.size()]); + members = accessibleMembers.toArray(new IResource[accessibleMembers.size()]); } catch (CoreException e) { //just return an empty set of children return new Object[0]; } //filter out the desired resource types - ArrayList results = new ArrayList(); + ArrayList<IResource> results = new ArrayList<IResource>(); for (int i = 0; i < members.length; i++) { //And the test bits with the resource types to see if // they are what we want @@ -196,7 +201,7 @@ public class FileSelectionDialog extends MessageDialog { } return results.toArray(); } - + return new Object[0]; } }; @@ -207,12 +212,14 @@ public class FileSelectionDialog extends MessageDialog { private void initializeDialog() { selectionGroup .addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { getButton(IDialogConstants.OK_ID).setEnabled( !selectionGroup.getListTableSelection().isEmpty()); } }); selectionGroup.addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(DoubleClickEvent event) { buttonPressed(IDialogConstants.OK_ID); } @@ -228,6 +235,7 @@ public class FileSelectionDialog extends MessageDialog { return result; } + @Override protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { result= selectionGroup.getListTableSelection(); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java index 0c3f2cf17..4b50ef916 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -12,7 +12,6 @@ package org.eclipse.ui.externaltools.internal.ui; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -43,8 +42,8 @@ import org.eclipse.ui.views.navigator.ResourceComparator; public class TreeAndListGroup implements ISelectionChangedListener { private Object root; private Object currentTreeSelection; - private List selectionChangedListeners = new ArrayList(); - private List doubleClickListeners= new ArrayList(); + private List<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); + private List<IDoubleClickListener> doubleClickListeners = new ArrayList<IDoubleClickListener>(); private ITreeContentProvider treeContentProvider; private IStructuredContentProvider listContentProvider; @@ -101,11 +100,11 @@ public class TreeAndListGroup implements ISelectionChangedListener { public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } - + /** * Add the given listener to the collection of clients that listen to * double-click events in the list viewer - * + * * @param listener IDoubleClickListener */ public void addDoubleClickListener(IDoubleClickListener listener) { @@ -117,20 +116,18 @@ public class TreeAndListGroup implements ISelectionChangedListener { * viewer */ protected void notifySelectionListeners(SelectionChangedEvent event) { - Iterator iter = selectionChangedListeners.iterator(); - while (iter.hasNext()) { - ((ISelectionChangedListener) iter.next()).selectionChanged(event); + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(event); } } - + /** * Notify all double click listeners that a double click event has occurred * in the list viewer */ protected void notifyDoubleClickListeners(DoubleClickEvent event) { - Iterator iter= doubleClickListeners.iterator(); - while (iter.hasNext()) { - ((IDoubleClickListener) iter.next()).doubleClick(event); + for (IDoubleClickListener listener : doubleClickListeners) { + listener.doubleClick(event); } } @@ -178,11 +175,13 @@ public class TreeAndListGroup implements ISelectionChangedListener { listViewer.setLabelProvider(listLabelProvider); listViewer.setComparator(new ResourceComparator(ResourceComparator.NAME)); listViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { notifySelectionListeners(event); } }); listViewer.addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(DoubleClickEvent event) { if (!event.getSelection().isEmpty()) { notifyDoubleClickListeners(event); @@ -207,30 +206,30 @@ public class TreeAndListGroup implements ISelectionChangedListener { treeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME)); treeViewer.addSelectionChangedListener(this); } - + public Table getListTable() { return listViewer.getTable(); } - + public IStructuredSelection getListTableSelection() { ISelection selection= this.listViewer.getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection)selection; - } + } return StructuredSelection.EMPTY; } - + protected void initialListItem(Object element) { Object parent = treeContentProvider.getParent(element); selectAndRevealFolder(parent); } - + public void selectAndRevealFolder(Object treeElement) { treeViewer.reveal(treeElement); IStructuredSelection selection = new StructuredSelection(treeElement); treeViewer.setSelection(selection); } - + public void selectAndRevealFile(Object treeElement) { listViewer.reveal(treeElement); IStructuredSelection selection = new StructuredSelection(treeElement); @@ -247,6 +246,7 @@ public class TreeAndListGroup implements ISelectionChangedListener { /* (non-Javadoc) * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ + @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); Object selectedElement = selection.getFirstElement(); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java index 88960d6b3..53e189243 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Matthew Conway and others. + * Copyright (c) 2007, 2013 Matthew Conway 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 @@ -7,6 +7,7 @@ * * Contributors: * Matthew Conway - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.ui.externaltools.internal.variables; @@ -33,16 +34,17 @@ public class BuildFilesResolver implements IDynamicVariableResolver // list of files to a unix command private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$ - public String resolveValue(IDynamicVariable variable, String argument) throws CoreException + @Override + public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { String result = null; - + IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta(); if (buildDelta != null) { final StringBuffer fileList = new StringBuffer(); - final Set changedResources = new LinkedHashSet(); - + final Set<String> changedResources = new LinkedHashSet<String>(); + // Use the argument to determine which deltas to visit - if none, // then defaults to all int deltas = 0; @@ -52,17 +54,17 @@ public class BuildFilesResolver implements IDynamicVariableResolver // Check delta kinds if (argument.indexOf(ARG_ADDED) > -1) { - deltas |= IResourceDelta.ADDED; + deltas |= IResourceDelta.ADDED; } if (argument.indexOf(ARG_CHANGED) > -1) { - deltas |= IResourceDelta.CHANGED; + deltas |= IResourceDelta.CHANGED; } if (argument.indexOf(ARG_REMOVED) > -1) { - deltas |= IResourceDelta.REMOVED; + deltas |= IResourceDelta.REMOVED; } - + // Check wether to include files and/or directories if (argument.indexOf(ARG_DIRS) > -1) { @@ -86,14 +88,15 @@ public class BuildFilesResolver implements IDynamicVariableResolver final int trackDeltas = deltas; final boolean trackDirs = dirs; final boolean trackFiles = files; - - + + buildDelta.accept(new IResourceDeltaVisitor() { - public boolean visit(IResourceDelta delta) throws CoreException + @Override + public boolean visit(IResourceDelta delta) throws CoreException { IResource resource = delta.getResource(); - + // Only track files with the right kind of delta boolean isTracked = (delta.getKind() & trackDeltas) > 0; if (isTracked) @@ -103,7 +106,7 @@ public class BuildFilesResolver implements IDynamicVariableResolver // Only track files if desired isTracked |= trackFiles && resource.getType() == IResource.FILE; } - + // If tracking a change, then add it to the change set for inclusion in the variable's output if (isTracked) { @@ -114,7 +117,7 @@ public class BuildFilesResolver implements IDynamicVariableResolver { fileList.append(FILE_LIST_SEPARATOR); } - + // Since space is our separator, we need to add quotes // around each file to handle filenames with embedded // spaces. We also need to escape out embedded quotes in @@ -130,7 +133,7 @@ public class BuildFilesResolver implements IDynamicVariableResolver }, deltas); result = fileList.toString(); } - + return result; } }
\ No newline at end of file diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java index e44873975..53009f683 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildProjectResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -29,6 +29,7 @@ public class BuildProjectResolver implements IDynamicVariableResolver { /* (non-Javadoc) * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String) */ + @Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { IResource resource= ExternalToolBuilder.getBuildProject(); if (argument != null && resource != null) { @@ -40,22 +41,22 @@ public class BuildProjectResolver implements IDynamicVariableResolver { abort(NLS.bind(VariableMessages.BuildProjectResolver_3, new String[]{getReferenceExpression(variable, argument)}), null); return null; } - + /** * Throws an exception with the given message and underlying exception. - * + * * @param message exception message - * @param exception underlying exception or <code>null</code> + * @param exception underlying exception or <code>null</code> * @throws CoreException */ protected void abort(String message, Throwable exception) throws CoreException { throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, message, exception)); } - + /** * Returns an expression used to reference the given variable and optional argument. * For example, <code>${var_name:arg}</code>. - * + * * @param variable referenced variable * @param argument referenced argument or <code>null</code> * @return vraiable reference expression diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java index 64f8d47a1..0cebaa27e 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildTypeResolver.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -20,6 +20,7 @@ public class BuildTypeResolver implements IDynamicVariableResolver { /* (non-Javadoc) * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String) */ + @Override public String resolveValue(IDynamicVariable variable, String argument) { return ExternalToolBuilder.getBuildType(); } diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java index dbcfce370..e35286bef 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Wieant (wieant@tasking.com) - Bug 138007 @@ -25,22 +25,23 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin; public class SystemPathResolver implements IDynamicVariableResolver { - + /* (non-Javadoc) * @see org.eclipse.core.variables.IDynamicVariableResolver#resolveValue(org.eclipse.core.variables.IDynamicVariable, java.lang.String) */ + @Override public String resolveValue(IDynamicVariable variable, String argument) throws CoreException { if (argument == null) { throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null)); } - Map map= DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); - String path= (String) map.get("PATH"); //$NON-NLS-1$ + Map<String, String> map = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); + String path= map.get("PATH"); //$NON-NLS-1$ if (path == null) { return argument; } // On MS Windows the PATHEXT environment variable defines which file extensions // mark files that are executable (e.g. .EXE, .COM, .BAT) - String pathext = (String) map.get("PATHEXT"); //$NON-NLS-1$ + String pathext = map.get("PATHEXT"); //$NON-NLS-1$ StringTokenizer tokenizer= new StringTokenizer(path, File.pathSeparator); while (tokenizer.hasMoreTokens()) { String pathElement= tokenizer.nextToken(); @@ -63,5 +64,5 @@ public class SystemPathResolver implements IDynamicVariableResolver { } } return argument; - } + } } diff --git a/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF b/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF index 4a37b5cf4..305020967 100644 --- a/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF @@ -14,11 +14,11 @@ Export-Package: org.eclipse.ui.externaltools.internal.launchConfigurations;x-fri org.eclipse.ui.externaltools.internal.variables;x-internal:=true Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)";resolution:=optional, org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", - org.eclipse.core.variables;bundle-version="[3.1.0,4.0.0)", + org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)", org.eclipse.ui;bundle-version="[3.2.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)", - org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", + org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)", + org.eclipse.debug.ui;bundle-version="[3.10.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)", - org.eclipse.core.externaltools;bundle-version="[1.0.0,2.0.0)" + org.eclipse.core.externaltools;bundle-version="[1.0.300,2.0.0)" Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java index 67394415e..522ef24af 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -24,6 +24,7 @@ public class ProgramBuilderTabGroup extends AbstractLaunchConfigurationTabGroup /** * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String) */ + @Override public void createTabs(ILaunchConfigurationDialog dialog, String mode) { RefreshTab refresh = new RefreshTab(); refresh.setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_REFRESH_TAB); diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java index 6969274f6..daf5d4269 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramMainTab.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class ProgramMainTab extends ExternalToolsMainTab { * location as a String containing the workspace_loc variable or * <code>null</code> if no location was obtained from the user. */ + @Override protected void handleWorkspaceLocationButtonSelected() { FileSelectionDialog dialog; dialog = new FileSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), ExternalToolsProgramMessages.ProgramMainTab_Select); @@ -44,11 +45,12 @@ public class ProgramMainTab extends ExternalToolsMainTab { locationField.setText(expression.toString()); } } - - + + /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { super.createControl(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_PROGRAM_MAIN_TAB); diff --git a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java index eddfb76b9..444a70bf2 100644 --- a/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java +++ b/org.eclipse.ui.externaltools/Program Tools Support/org/eclipse/ui/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * dakshinamurthy.karra@gmail.com - bug 165371 @@ -25,6 +25,7 @@ public class ProgramTabGroup extends AbstractLaunchConfigurationTabGroup { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String) */ + @Override public void createTabs(ILaunchConfigurationDialog dialog, String mode) { RefreshTab refresh = new RefreshTab(); refresh.setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_REFRESH_TAB); diff --git a/org.eclipse.ui.externaltools/buildfiles/exportplugin.xml b/org.eclipse.ui.externaltools/buildfiles/exportplugin.xml deleted file mode 100644 index 6444f3f83..000000000 --- a/org.eclipse.ui.externaltools/buildfiles/exportplugin.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- Export a jar of .class files for the org.eclipse.ui.externaltools Eclipse plug-in - along with other important plugin files to the "plugin-export" subdirectory - of the target Eclipse installation - - --> -<project name="Export externaltools" default="export" basedir=".."> - - <!-- Set the timestamp and important properties --> - <target name="init"> - <tstamp/> - <property name="destdir" value="../../plugin-export" /> - <property name="dest" value="${destdir}/org.eclipse.ui.externaltools_3.0.0" /> - </target> - - <!-- Create the jar of .class files, and copy other important files to export dir --> - <target name="export" depends="init"> - <mkdir dir="${destdir}" /> - <delete dir="${dest}" /> - <mkdir dir="${dest}" /> - <jar destfile="${dest}/externaltools.jar"> - <fileset dir="bin"> - </fileset> - </jar> - <!-- Create the source zip --> - <zip destfile="${dest}/externaltoolssrc.zip"> - <fileset dir="External Tools Base"/> - <fileset dir="Program Tools Support"/> - </zip> - <copy file="plugin.xml" todir="${dest}"/> - <copy file="plugin.properties" todir="${dest}"/> - <copy file=".classpath" todir="${dest}"/> - <copy file=".options" todir="${dest}"/> - <copy todir="${dest}/icons"> - <fileset dir="icons" /> - </copy> - </target> - -</project> |