Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2013-07-31 12:44:16 -0400
committerMike Rennie2013-07-31 12:44:16 -0400
commitd975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch)
treec7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.debug.core
parent4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff)
downloadeclipse.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.debug.core')
-rw-r--r--org.eclipse.debug.core/.classpath4
-rw-r--r--org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs40
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java99
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java508
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java189
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java117
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java108
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java42
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java169
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java253
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java104
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java98
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java96
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java62
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java21
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFilteredStep.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java149
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java11
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java111
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java285
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java42
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java46
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java53
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java30
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java68
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java35
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java58
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java118
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java13
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java40
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java34
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java23
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java46
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java404
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java21
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java5
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java25
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java192
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java42
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java301
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java33
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java369
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java188
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java239
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java87
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java1097
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java28
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchablePropertyTester.java3
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java78
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java44
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java120
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java34
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java46
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java12
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RefreshScopeComparator.java13
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java25
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java24
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SystemPropertyResolver.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/SystemVariableResolver.java12
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java57
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java44
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/CommandAdapterFactory.java14
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DisconnectCommand.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DropToFrameCommand.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ForEachCommand.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/Request.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ResumeCommand.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java20
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepIntoCommand.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepOverCommand.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepReturnCommand.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/SuspendCommand.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/TerminateCommand.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceContainerType.java27
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java30
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java42
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourcePathComputer.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ArchiveSourceContainerType.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DefaultSourceContainerType.java18
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/DirectorySourceContainerType.java18
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ExternalArchiveSourceContainerType.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/FolderSourceContainerType.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/ProjectSourceContainerType.java16
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/containers/WorkspaceSourceContainerType.java14
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ContainerResolver.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/DateTimeResolver.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ProjectResolver.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ResourceResolver.java35
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/WorkspaceResolver.java18
-rw-r--r--org.eclipse.debug.core/pom.xml2
95 files changed, 3799 insertions, 3297 deletions
diff --git a/org.eclipse.debug.core/.classpath b/org.eclipse.debug.core/.classpath
index 3138d4b81..220a8bfaf 100644
--- a/org.eclipse.debug.core/.classpath
+++ b/org.eclipse.debug.core/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="core"/>
- <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.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="core"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs
index 5d7a22fe3..74c3aeb02 100644
--- a/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.core/.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.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 35399581e..dc97a26a0 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.8.100.qualifier
+Bundle-Version: 3.9.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
@@ -18,10 +18,10 @@ Export-Package: org.eclipse.debug.core,
org.eclipse.debug.internal.core.sourcelookup.containers;x-friends:="org.eclipse.debug.ui",
org.eclipse.debug.internal.core.variables;x-friends:="org.eclipse.debug.ui,org.eclipse.jdt.debug.ui"
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)";visibility:=reexport,
- org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Import-Package: com.ibm.icu.text
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
index 1c867f7c8..4bf262163 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -28,7 +28,7 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
* down order - that is, parents are created before children.
* Termination events are guaranteed to occur in a bottom up order -
* that is, children before parents. However, termination events are not guaranteed
- * for all elements that are created. That is, terminate events can be coalesced - a
+ * for all elements that are created. That is, terminate events can be coalesced - a
* terminate event for a parent signals that all children have been terminated.
* </p>
* <p>
@@ -135,15 +135,15 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
* <li><code>IValue</code> - no events are specified for values.
* </li>
* </ul>
- *
+ *
*/
public final class DebugEvent extends EventObject {
-
+
/**
* All objects that can be serialized should have a stable serialVersionUID
*/
private static final long serialVersionUID = 1L;
-
+
/**
* Resume event kind.
*/
@@ -163,19 +163,19 @@ public final class DebugEvent extends EventObject {
* Terminate event kind.
*/
public static final int TERMINATE= 0x0008;
-
+
/**
* Change event kind.
*/
public static final int CHANGE= 0x0010;
-
+
/**
* Model specific event kind. The detail codes
* for a model specific event are client defined.
- *
+ *
* @since 2.1.2
*/
- public static final int MODEL_SPECIFIC= 0x0020;
+ public static final int MODEL_SPECIFIC= 0x0020;
/**
* Step start detail. Indicates a thread was resumed by a step
@@ -183,47 +183,47 @@ public final class DebugEvent extends EventObject {
* @since 2.0
*/
public static final int STEP_INTO= 0x0001;
-
+
/**
* Step start detail. Indicates a thread was resumed by a step
* over action.
* @since 2.0
*/
public static final int STEP_OVER= 0x0002;
-
+
/**
* Step start detail. Indicates a thread was resumed by a step
* return action.
* @since 2.0
*/
- public static final int STEP_RETURN= 0x0004;
+ public static final int STEP_RETURN= 0x0004;
/**
* Step end detail. Indicates a thread was suspended due
* to the completion of a step action.
*/
public static final int STEP_END= 0x0008;
-
+
/**
* Breakpoint detail. Indicates a thread was suspended by
* a breakpoint.
*/
public static final int BREAKPOINT= 0x0010;
-
+
/**
* Client request detail. Indicates a thread was suspended due
* to a client request.
*/
public static final int CLIENT_REQUEST= 0x0020;
-
+
/**
* Evaluation detail. Indicates that a thread was resumed or
* suspended to perform an expression evaluation.
- *
+ *
* @since 2.0
*/
public static final int EVALUATION = 0x0040;
-
+
/**
* Evaluation detail. Indicates that a thread was resumed or
* suspended to perform an implicit expression evaluation.
@@ -231,35 +231,35 @@ public final class DebugEvent extends EventObject {
* as an indirect result of a user action.
* Clients may use this detail event to decide whether or not
* to alert the user that an evaluation is taking place..
- *
+ *
* @since 2.0
*/
public static final int EVALUATION_IMPLICIT = 0x0080;
/**
- * State change detail. Indicates the state of a single
+ * State change detail. Indicates the state of a single
* debug element has changed. Only valid for <code>CHANGE</code>
* events.
- *
+ *
* @since 2.0
*/
public static final int STATE = 0x0100;
-
+
/**
* Content change detail. Indicates the content of a debug element
* (and potentially its children) has changed. Only valid for
* <code>CHANGE</code> events.
- *
+ *
* @since 2.0
*/
- public static final int CONTENT = 0x0200;
-
+ public static final int CONTENT = 0x0200;
+
/**
* Constant indicating that the kind or detail of a debug
* event is unspecified.
*/
public static final int UNSPECIFIED = 0;
-
+
/**
* The kind of event - one of the kind constants defined by
* this class.
@@ -271,14 +271,14 @@ public final class DebugEvent extends EventObject {
* this class.
*/
private int fDetail= UNSPECIFIED;
-
+
/**
* Client defined data field.
- *
+ *
* @since 2.1.2
*/
private Object fData = null;
-
+
/**
* Constructs a new debug event of the given kind with a detail code of
* <code>UNSPECIFIED</code>.
@@ -302,10 +302,12 @@ public final class DebugEvent extends EventObject {
*/
public DebugEvent(Object eventSource, int kind, int detail) {
super(eventSource);
- if ((kind & (RESUME | SUSPEND | CREATE | TERMINATE | CHANGE | MODEL_SPECIFIC)) == 0)
- throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_kind);
- if (kind != MODEL_SPECIFIC && detail != UNSPECIFIED && (detail & (STEP_END | STEP_INTO | STEP_OVER | STEP_RETURN | BREAKPOINT | CLIENT_REQUEST |EVALUATION | EVALUATION_IMPLICIT | STATE | CONTENT)) == 0)
- throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_detail);
+ if ((kind & (RESUME | SUSPEND | CREATE | TERMINATE | CHANGE | MODEL_SPECIFIC)) == 0) {
+ throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_kind);
+ }
+ if (kind != MODEL_SPECIFIC && detail != UNSPECIFIED && (detail & (STEP_END | STEP_INTO | STEP_OVER | STEP_RETURN | BREAKPOINT | CLIENT_REQUEST |EVALUATION | EVALUATION_IMPLICIT | STATE | CONTENT)) == 0) {
+ throw new IllegalArgumentException(DebugCoreMessages.DebugEvent_illegal_detail);
+ }
fKind= kind;
fDetail= detail;
}
@@ -323,19 +325,19 @@ public final class DebugEvent extends EventObject {
/**
* Returns this event's kind - one of the kind constants defined by this class.
- *
+ *
* @return the kind code
*/
public int getKind() {
return fKind;
}
-
+
/**
* Returns whether this event's detail indicates the
* beginning of a step event. This event's detail is one
* of <code>STEP_INTO</code>, <code>STEP_OVER</code>, or
* <code>STEP_RETURN</code>.
- *
+ *
* @return whether this event's detail indicates the beginning
* of a step event.
* @since 2.0
@@ -343,42 +345,43 @@ public final class DebugEvent extends EventObject {
public boolean isStepStart() {
return (getDetail() & (STEP_INTO | STEP_OVER | STEP_RETURN)) > 0;
}
-
+
/**
* Returns whether this event's detail indicates an
* evaluation. This event's detail is one
* of <code>EVALUATION</code>, or <code>EVALUATION_IMPLICIT</code>.
- *
+ *
* @return whether this event's detail indicates an evaluation.
* @since 2.0
*/
public boolean isEvaluation() {
return (getDetail() & (EVALUATION | EVALUATION_IMPLICIT)) > 0;
- }
-
+ }
+
/**
* Sets this event's application defined data.
- *
+ *
* @param data application defined data
* @since 2.1.2
*/
public void setData(Object data) {
fData = data;
}
-
+
/**
* Returns this event's application defined data, or <code>null</code> if none
- *
+ *
* @return application defined data, or <code>null</code> if none
* @since 2.1.2
*/
public Object getData() {
return fData;
}
-
+
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer("DebugEvent["); //$NON-NLS-1$
if (getSource() != null) {
@@ -399,7 +402,7 @@ public final class DebugEvent extends EventObject {
break;
case SUSPEND:
buf.append("SUSPEND"); //$NON-NLS-1$
- break;
+ break;
case CHANGE:
buf.append("CHANGE"); //$NON-NLS-1$
break;
@@ -409,6 +412,8 @@ public final class DebugEvent extends EventObject {
case MODEL_SPECIFIC:
buf.append("MODEL_SPECIFIC"); //$NON-NLS-1$
break;
+ default:
+ break;
}
buf.append(", "); //$NON-NLS-1$
switch (getDetail()) {
@@ -435,13 +440,13 @@ public final class DebugEvent extends EventObject {
break;
case EVALUATION_IMPLICIT:
buf.append("EVALUATION_IMPLICIT"); //$NON-NLS-1$
- break;
+ break;
case STATE:
buf.append("STATE"); //$NON-NLS-1$
- break;
+ break;
case CONTENT:
buf.append("CONTENT"); //$NON-NLS-1$
- break;
+ break;
case UNSPECIFIED:
buf.append("UNSPECIFIED"); //$NON-NLS-1$
break;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 5e814fea9..44b3e4adc 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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
@@ -92,7 +92,7 @@ import com.ibm.icu.text.MessageFormat;
* @noextend This class is not intended to be sub-classed by clients.
*/
public class DebugPlugin extends Plugin {
-
+
/**
* Unique identifier constant (value <code>"org.eclipse.debug.core"</code>)
* for the Debug Core plug-in.
@@ -102,63 +102,63 @@ public class DebugPlugin extends Plugin {
/**
* Simple identifier constant (value <code>"launchConfigurationTypes"</code>)
* for the launch configuration types extension point.
- *
+ *
* @since 2.0
*/
- public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES= "launchConfigurationTypes"; //$NON-NLS-1$
-
+ public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES= "launchConfigurationTypes"; //$NON-NLS-1$
+
/**
* Simple identifier constant (value <code>"launchConfigurationComparators"</code>)
* for the launch configuration comparators extension point.
- *
+ *
* @since 2.0
*/
- public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS= "launchConfigurationComparators"; //$NON-NLS-1$
-
+ public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS= "launchConfigurationComparators"; //$NON-NLS-1$
+
/**
* Simple identifier constant (value <code>"breakpoints"</code>) for the
* breakpoints extension point.
- *
+ *
* @since 2.0
*/
public static final String EXTENSION_POINT_BREAKPOINTS= "breakpoints"; //$NON-NLS-1$
-
+
/**
* Simple identifier constant (value <code>"statusHandlers"</code>) for the
* status handlers extension point.
- *
+ *
* @since 2.0
*/
- public static final String EXTENSION_POINT_STATUS_HANDLERS= "statusHandlers"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_STATUS_HANDLERS= "statusHandlers"; //$NON-NLS-1$
/**
* Simple identifier constant (value <code>"sourceLocators"</code>) for the
* source locators extension point.
- *
+ *
* @since 2.0
*/
- public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocators"; //$NON-NLS-1$
-
+ public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocators"; //$NON-NLS-1$
+
/**
* Simple identifier constant (value <code>"launchModes"</code>) for the
* source modes extension point.
- *
+ *
* @since 3.0
*/
- public static final String EXTENSION_POINT_LAUNCH_MODES= "launchModes"; //$NON-NLS-1$
-
+ public static final String EXTENSION_POINT_LAUNCH_MODES= "launchModes"; //$NON-NLS-1$
+
/**
* Simple identifier constant (value <code>"launchDelegates"</code>) for the
* launch delegates extension point.
- *
+ *
* @since 3.0
*/
public static final String EXTENSION_POINT_LAUNCH_DELEGATES= "launchDelegates"; //$NON-NLS-1$
-
+
/**
* Simple identifier constant (value <code>"processFactories"</code>) for the
* process factories extension point.
- *
+ *
* @since 3.0
*/
public static final String EXTENSION_POINT_PROCESS_FACTORIES = "processFactories"; //$NON-NLS-1$
@@ -166,62 +166,62 @@ public class DebugPlugin extends Plugin {
/**
* Simple identifier constant (value <code>"logicalStructureTypes"</code>) for the
* logical structure types extension point.
- *
+ *
* @since 3.0
*/
public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES = "logicalStructureTypes"; //$NON-NLS-1$
-
+
/**
* Simple identifier constant (value <code>"logicalStructureProviders"</code>) for the
* logical structure types extension point.
- *
+ *
* @since 3.1
*/
public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS = "logicalStructureProviders"; //$NON-NLS-1$
-
+
/**
* Simple identifier constant (value <code>"sourceContainerTypes"</code>) for the
* source container types extension point.
- *
+ *
* @since 3.0
- */
+ */
public static final String EXTENSION_POINT_SOURCE_CONTAINER_TYPES = "sourceContainerTypes"; //$NON-NLS-1$
/**
* Simple identifier constant (value <code>"sourcePathComputers"</code>) for the
* source path computers extension point.
- *
+ *
* @since 3.0
- */
+ */
public static final String EXTENSION_POINT_SOURCE_PATH_COMPUTERS = "sourcePathComputers"; //$NON-NLS-1$
-
+
/**
* Simple identifier constant for the launch options extension point
- *
+ *
* @since 3.3
*/
public static final String EXTENSION_POINT_LAUNCH_OPTIONS = "launchOptions"; //$NON-NLS-1$
-
+
/**
* Simple identifier constant for the breakpoint import participant extension point
- *
+ *
* @since 3.5
*/
public static final String EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS = "breakpointImportParticipants"; //$NON-NLS-1$
-
+
/**
* Status code indicating an unexpected error.
- *
+ *
* @since 3.4
*/
- public static final int ERROR = 125;
-
+ public static final int ERROR = 125;
+
/**
- * Status code indicating an unexpected internal error. Internal errors
+ * Status code indicating an unexpected internal error. Internal errors
* should never be displayed to the user in dialogs or status text.
* Internal error messages are not translated.
*/
- public static final int INTERNAL_ERROR = 120;
+ public static final int INTERNAL_ERROR = 120;
/**
* Status code indicating that the Eclipse runtime does not support
@@ -234,7 +234,7 @@ public class DebugPlugin extends Plugin {
* </p>
*/
public static final int ERR_WORKING_DIRECTORY_NOT_SUPPORTED = 115;
-
+
/**
* The launch configuration attribute that designates the process factory ID
* for the process factory to be used when creating a new process as a result of launching
@@ -242,46 +242,46 @@ public class DebugPlugin extends Plugin {
* @since 3.0
*/
public static final String ATTR_PROCESS_FACTORY_ID = "process_factory_id"; //$NON-NLS-1$
-
+
/**
* The launch attribute that designates whether or not it's associated
* launch should capture output. Value is a string representing a boolean -
* <code>true</code> or <code>false</code>. When unspecified, the default
* value is considered <code>true</code>.
- *
+ *
* @since 3.1
*/
public static final String ATTR_CAPTURE_OUTPUT = PI_DEBUG_CORE + ".capture_output"; //$NON-NLS-1$
-
+
/**
* The launch attribute that stores the time stamp of when a launch configuration was
* launched. Value is {@link Long#toString(long)} of {@link System#currentTimeMillis()}.
- *
+ *
* @since 3.6
*/
public static final String ATTR_LAUNCH_TIMESTAMP = PI_DEBUG_CORE + ".launch.timestamp"; //$NON-NLS-1$
-
+
/**
* This launch attribute designates the encoding to be used by the console
* associated with the launch.
* <p>
- * For release 3.3, the system encoding is used when unspecified. Since 3.4,
+ * For release 3.3, the system encoding is used when unspecified. Since 3.4,
* the inherited encoding is used when unspecified. See {@link ILaunchManager} for a
* description in <code>getEncoding(ILaunchConfiguration)</code>.
* </p>
* <p>
- * Value of this constant is the same as the value of the old
+ * Value of this constant is the same as the value of the old
* <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code> constant for backward
* compatibility.
* </p>
* @since 3.3
*/
public static final String ATTR_CONSOLE_ENCODING = "org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING"; //$NON-NLS-1$
-
+
/**
* Boolean preference key (value <code>org.eclipse.debug.core.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE</code>) that controls
* whether to delete associated configurations when a project is deleted. Default value is <code>false</code>.
- *
+ *
* @since 3.7
*/
public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = PI_DEBUG_CORE + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$
@@ -290,7 +290,7 @@ public class DebugPlugin extends Plugin {
* Deleted breakpoint marker attribute (value
* <code>"org.eclipse.debug.core.breakpointIsDeleted"</code>). The attribute is a
* <code>boolean</code> corresponding to the deleted state of a breakpoint.
- *
+ *
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
* @since 3.7
*/
@@ -305,7 +305,7 @@ public class DebugPlugin extends Plugin {
/**
* Attribute key for the path of the working directory for an {@link IProcess}
- *
+ *
* @see IProcess
* @since 3.8
*/
@@ -313,7 +313,7 @@ public class DebugPlugin extends Plugin {
/**
* Attribute key for path of the executable that launched an {@link IProcess}
- *
+ *
* @see IProcess
* @since 3.8
*/
@@ -328,11 +328,11 @@ public class DebugPlugin extends Plugin {
* The singleton breakpoint manager.
*/
private BreakpointManager fBreakpointManager;
-
+
/**
* The singleton expression manager.
*/
- private ExpressionManager fExpressionManager;
+ private ExpressionManager fExpressionManager;
/**
* The singleton launch manager.
@@ -344,12 +344,12 @@ public class DebugPlugin extends Plugin {
* @since 3.1
*/
private MemoryBlockManager fMemoryBlockManager;
-
+
/**
* The collection of debug event listeners.
*/
private ListenerList fEventListeners = new ListenerList();
-
+
/**
* Event filters, or <code>null</code> if none.
*/
@@ -360,20 +360,20 @@ public class DebugPlugin extends Plugin {
* down.
*/
private boolean fShuttingDown= false;
-
+
/**
* Table of status handlers. Keys are {plug-in identifier, status code}
* pairs, and values are associated <code>IConfigurationElement</code>s.
*/
- private HashMap fStatusHandlers = null;
-
+ private HashMap<StatusHandlerKey, IConfigurationElement> fStatusHandlers = null;
+
/**
* Map of process factories. Keys are process factory IDs
* and values are associated <code>IConfigurationElement</code>s.
* @since 3.0
*/
- private HashMap fProcessFactories = null;
-
+ private HashMap<String, IConfigurationElement> fProcessFactories = null;
+
/**
* Mode constants for the event notifier
*/
@@ -383,11 +383,11 @@ public class DebugPlugin extends Plugin {
/**
* Queue of debug events to fire to listeners and asynchronous runnables to execute
* in the order received.
- *
+ *
* @since 3.1
*/
- private List fEventQueue = new ArrayList();
-
+ private List<Object> fEventQueue = new ArrayList<Object>();
+
/**
* Job to fire events to listeners.
* @since 3.1
@@ -396,11 +396,11 @@ public class DebugPlugin extends Plugin {
/**
* Event dispatch job. Processes event queue of debug events and runnables.
- *
+ *
* @since 3.1
*/
class EventDispatchJob extends Job {
-
+
EventNotifier fNotifier = new EventNotifier();
AsynchRunner fRunner = new AsynchRunner();
@@ -408,15 +408,16 @@ public class DebugPlugin extends Plugin {
* Creates a new event dispatch job.
*/
public EventDispatchJob() {
- super(DebugCoreMessages.DebugPlugin_1);
+ super(DebugCoreMessages.DebugPlugin_1);
setPriority(Job.INTERACTIVE);
setSystem(true);
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
- protected IStatus run(IProgressMonitor monitor) {
-
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
while (!fEventQueue.isEmpty()) {
Object next = null;
synchronized (fEventQueue) {
@@ -432,44 +433,46 @@ public class DebugPlugin extends Plugin {
}
return Status.OK_STATUS;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#shouldRun()
*/
- public boolean shouldRun() {
+ @Override
+ public boolean shouldRun() {
return shouldSchedule();
}
/* (non-Javadoc)
* @see org.eclipse.core.internal.jobs.InternalJob#shouldSchedule()
*/
- public boolean shouldSchedule() {
+ @Override
+ public boolean shouldSchedule() {
return !(isShuttingDown() || fEventListeners.isEmpty());
}
-
+
}
/**
* Returns the singleton instance of the debug plug-in.
- *
+ *
* @return the debug plug-in
*/
public static DebugPlugin getDefault() {
return fgDebugPlugin;
}
-
+
/**
* Sets the singleton instance of the debug plug-in.
- *
+ *
* @param plugin the debug plug-in, or <code>null</code>
* when shutting down
*/
private static void setDefault(DebugPlugin plugin) {
fgDebugPlugin = plugin;
}
-
+
/**
* Convenience method which returns the unique identifier of this plug-in.
- *
+ *
* @return debug plug-in identifier
*/
public static String getUniqueIdentifier() {
@@ -479,7 +482,7 @@ public class DebugPlugin extends Plugin {
/**
* Constructs the debug plug-in.
* <p>
- * An instance of this plug-in runtime class is automatically created
+ * An instance of this plug-in runtime class is automatically created
* when the facilities provided by this plug-in are required.
* <b>Clients must never explicitly instantiate a plug-in runtime class.</b>
* </p>
@@ -488,7 +491,7 @@ public class DebugPlugin extends Plugin {
super();
setDefault(this);
}
-
+
/**
* Adds the given listener to the collection of registered debug
* event listeners. Has no effect if an identical listener is already
@@ -499,33 +502,34 @@ public class DebugPlugin extends Plugin {
*/
public void addDebugEventListener(IDebugEventSetListener listener) {
fEventListeners.add(listener);
- }
-
+ }
+
/**
* Notifies all registered debug event set listeners of the given
* debug events. Events which are filtered by a registered debug event
* filter are not fired.
- *
+ *
* @param events array of debug events to fire
* @see IDebugEventFilter
* @see IDebugEventSetListener
* @since 2.0
*/
public void fireDebugEventSet(DebugEvent[] events) {
- if (isShuttingDown() || events == null || fEventListeners.isEmpty())
+ if (isShuttingDown() || events == null || fEventListeners.isEmpty()) {
return;
+ }
synchronized (fEventQueue) {
fEventQueue.add(events);
}
fEventDispatchJob.schedule();
}
-
+
/**
* Asynchronously executes the given runnable in a separate
* thread, after debug event dispatch has completed. If debug
* events are not currently being dispatched, the runnable is
* scheduled to run in a separate thread immediately.
- *
+ *
* @param r runnable to execute asynchronously
* @since 2.1
*/
@@ -535,7 +539,7 @@ public class DebugPlugin extends Plugin {
}
fEventDispatchJob.schedule();
}
-
+
/**
* Returns the breakpoint manager.
*
@@ -548,7 +552,7 @@ public class DebugPlugin extends Plugin {
}
return fBreakpointManager;
}
-
+
/**
* Returns the launch manager.
*
@@ -561,7 +565,7 @@ public class DebugPlugin extends Plugin {
}
return fLaunchManager;
}
-
+
/**
* Returns the memory block manager.
* @return the memory block manager.
@@ -574,7 +578,7 @@ public class DebugPlugin extends Plugin {
}
return fMemoryBlockManager;
}
-
+
/**
* Returns the status handler registered for the given
* status, or <code>null</code> if none.
@@ -593,21 +597,21 @@ public class DebugPlugin extends Plugin {
if (fStatusHandlers == null) {
initializeStatusHandlers();
}
- IConfigurationElement config = (IConfigurationElement)fStatusHandlers.get(key);
+ IConfigurationElement config = fStatusHandlers.get(key);
if (config != null) {
try {
Object handler = config.createExecutableExtension(IConfigurationElementConstants.CLASS);
if (handler instanceof IStatusHandler) {
return (IStatusHandler)handler;
}
- invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", new String[] {config.getDeclaringExtension().getUniqueIdentifier()})); //$NON-NLS-1$
+ invalidStatusHandler(null, MessageFormat.format("Registered status handler {0} does not implement required interface IStatusHandler.", new Object[] { config.getDeclaringExtension().getUniqueIdentifier() })); //$NON-NLS-1$
} catch (CoreException e) {
log(e);
}
}
return null;
- }
-
+ }
+
/**
* Returns the expression manager.
*
@@ -620,8 +624,8 @@ public class DebugPlugin extends Plugin {
fExpressionManager = new ExpressionManager();
}
return fExpressionManager;
- }
-
+ }
+
/**
* Removes the given listener from the collection of registered debug
* event listeners. Has no effect if an identical listener is not already
@@ -632,15 +636,16 @@ public class DebugPlugin extends Plugin {
*/
public void removeDebugEventListener(IDebugEventSetListener listener) {
fEventListeners.remove(listener);
- }
+ }
/* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
try {
setShuttingDown(true);
-
+
if (fLaunchManager != null) {
fLaunchManager.shutdown();
}
@@ -650,10 +655,10 @@ public class DebugPlugin extends Plugin {
if (fMemoryBlockManager != null) {
fMemoryBlockManager.shutdown();
}
-
+
fEventListeners.clear();
fEventFilters.clear();
-
+
SourceLookupUtils.shutdown();
Preferences.savePreferences(DebugPlugin.getUniqueIdentifier());
ResourcesPlugin.getWorkspace().removeSaveParticipant(getUniqueIdentifier());
@@ -662,23 +667,28 @@ public class DebugPlugin extends Plugin {
setDefault(null);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
new DebugOptions(context);
ResourcesPlugin.getWorkspace().addSaveParticipant(getUniqueIdentifier(),
new ISaveParticipant() {
+ @Override
public void saving(ISaveContext saveContext) throws CoreException {
if (fExpressionManager != null) {
fExpressionManager.storeWatchExpressions();
}
Preferences.savePreferences(DebugPlugin.getUniqueIdentifier());
- }
+ }
+ @Override
public void rollback(ISaveContext saveContext) {}
+ @Override
public void prepareToSave(ISaveContext saveContext) throws CoreException {}
+ @Override
public void doneSaving(ISaveContext saveContext) {}
});
//command adapters
@@ -692,7 +702,7 @@ public class DebugPlugin extends Plugin {
manager.registerAdapters(actionFactory, ITerminate.class);
manager.registerAdapters(actionFactory, ILaunch.class);
manager.registerAdapters(actionFactory, IProcess.class);
- manager.registerAdapters(actionFactory, IDebugElement.class);
+ manager.registerAdapters(actionFactory, IDebugElement.class);
}
/**
@@ -715,7 +725,7 @@ public class DebugPlugin extends Plugin {
public static IProcess newProcess(ILaunch launch, Process process, String label) {
return newProcess(launch, process, label, null);
}
-
+
/**
* Creates and returns a new process representing the given
* <code>java.lang.Process</code>. A streams proxy is created
@@ -737,7 +747,7 @@ public class DebugPlugin extends Plugin {
* @see IProcessFactory
* @since 2.1
*/
- public static IProcess newProcess(ILaunch launch, Process process, String label, Map attributes) {
+ public static IProcess newProcess(ILaunch launch, Process process, String label, Map<String, String> attributes) {
ILaunchConfiguration config= launch.getLaunchConfiguration();
String processFactoryID= null;
if (config != null) {
@@ -751,7 +761,7 @@ public class DebugPlugin extends Plugin {
if (plugin.fProcessFactories == null) {
plugin.initializeProcessFactories();
}
- IConfigurationElement element= (IConfigurationElement) plugin.fProcessFactories.get(processFactoryID);
+ IConfigurationElement element= plugin.fProcessFactories.get(processFactoryID);
if (element == null) {
return null;
}
@@ -763,56 +773,56 @@ public class DebugPlugin extends Plugin {
return null;
}
return processFactory.newProcess(launch, process, label, attributes);
- }
+ }
return new RuntimeProcess(launch, process, label, attributes);
- }
-
+ }
+
/**
* Returns any logical structure types that have been contributed for the given
* value.
- *
+ *
* @param value the value for which logical structure types have been requested
* @return logical structure types that have been contributed for the given
* value, possibly an empty collection
- *
+ *
* @since 3.0
*/
public static ILogicalStructureType[] getLogicalStructureTypes(IValue value) {
return LogicalStructureManager.getDefault().getLogicalStructureTypes(value);
}
-
+
/**
* Returns the default logical structure type among the given combination of
* logical structure types, or <code>null</code> if none. When the given combination
* of logical structure type is applicable for a value, the default logical structure
* type is used to display a value.
- *
+ *
* @param types a combination of structures applicable to a value
* @return the default structure that should be used to display the value
* or <code>null</code> if none
- *
+ *
* @since 3.1
*/
public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types) {
return LogicalStructureManager.getDefault().getSelectedStructureType(types);
}
-
+
/**
* Sets the default logical structure type among the given combination of logical structure
* types. The logical structure types provided should all be applicable to a single
* value. Specifying <code>null</code> indicates there is no default logical structure
* for the given combination of types.
- *
+ *
* @param types a combination of logical structure types applicable to a value
* @param def the default logical structure among the given combination of types
* or <code>null</code> if none
- *
+ *
* @since 3.1
*/
public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def) {
LogicalStructureManager.getDefault().setEnabledType(types, def);
}
-
+
/**
* Convenience method that performs a runtime exec on the given command line
* in the context of the specified working directory, and returns the
@@ -820,14 +830,14 @@ public class DebugPlugin extends Plugin {
* specification of a working directory, the status handler for error code
* <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if the
* exec should be re-executed without specifying a working directory.
- *
+ *
* @param cmdLine the command line
* @param workingDirectory the working directory, or <code>null</code>
* @return the resulting process or <code>null</code> if the exec is
* canceled
* @exception CoreException if the exec fails
* @see Runtime
- *
+ *
* @since 2.1
*/
public static Process exec(String[] cmdLine, File workingDirectory) throws CoreException {
@@ -841,7 +851,7 @@ public class DebugPlugin extends Plugin {
* specification of a working directory, the status handler for error code
* <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if the
* exec should be re-executed without specifying a working directory.
- *
+ *
* @param cmdLine the command line
* @param workingDirectory the working directory, or <code>null</code>
* @param envp the environment variables set in the process, or <code>null</code>
@@ -849,7 +859,7 @@ public class DebugPlugin extends Plugin {
* canceled
* @exception CoreException if the exec fails
* @see Runtime
- *
+ *
* @since 3.0
*/
public static Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
@@ -861,13 +871,13 @@ public class DebugPlugin extends Plugin {
p= Runtime.getRuntime().exec(cmdLine, envp, workingDirectory);
}
} catch (IOException e) {
- Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e);
+ Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e);
throw new CoreException(status);
} catch (NoSuchMethodError e) {
- //attempting launches on 1.2.* - no ability to set working directory
- IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERR_WORKING_DIRECTORY_NOT_SUPPORTED, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e);
+ //attempting launches on 1.2.* - no ability to set working directory
+ IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERR_WORKING_DIRECTORY_NOT_SUPPORTED, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e);
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status);
-
+
if (handler != null) {
Object result = handler.handleStatus(status, null);
if (result instanceof Boolean && ((Boolean)result).booleanValue()) {
@@ -877,67 +887,67 @@ public class DebugPlugin extends Plugin {
}
return p;
}
-
+
/**
- * Returns whether this plug-in is in the process of
+ * Returns whether this plug-in is in the process of
* being shutdown.
- *
- * @return whether this plug-in is in the process of
+ *
+ * @return whether this plug-in is in the process of
* being shutdown
*/
private boolean isShuttingDown() {
return fShuttingDown;
}
-
+
/**
- * Sets whether this plug-in is in the process of
+ * Sets whether this plug-in is in the process of
* being shutdown.
- *
- * @param value whether this plug-in is in the process of
+ *
+ * @param value whether this plug-in is in the process of
* being shutdown
*/
private void setShuttingDown(boolean value) {
fShuttingDown = value;
}
-
+
/**
* Returns the collection of debug event listeners registered
* with this plug-in.
- *
+ *
* @return list of registered debug event listeners, instances
* of <code>IDebugEventSetListeners</code>
*/
private Object[] getEventListeners() {
return fEventListeners.getListeners();
}
-
+
/**
* Adds the given debug event filter to the registered
* event filters. Has no effect if an identical filter
* is already registered.
- *
+ *
* @param filter debug event filter
* @since 2.0
*/
public void addDebugEventFilter(IDebugEventFilter filter) {
fEventFilters.add(filter);
}
-
+
/**
* Removes the given debug event filter from the registered
* event filters. Has no effect if an identical filter
* is not already registered.
- *
+ *
* @param filter debug event filter
* @since 2.0
*/
public void removeDebugEventFilter(IDebugEventFilter filter) {
fEventFilters.remove(filter);
- }
-
+ }
+
/**
* Logs the given message if in debug mode.
- *
+ *
* @param message the message to log
* @since 2.0
*/
@@ -945,10 +955,10 @@ public class DebugPlugin extends Plugin {
if (getDefault().isDebugging()) {
// this message is intentionally not externalized, as an exception may
// be due to the resource bundle itself
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, new String[] {message}), null));
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_2, new Object[] { message }), null));
}
}
-
+
/**
* Logs the given message with this plug-in's log and the given
* throwable or <code>null</code> if none.
@@ -958,41 +968,41 @@ public class DebugPlugin extends Plugin {
public static void logMessage(String message, Throwable throwable) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, message, throwable));
}
-
+
/**
* Logs the specified status with this plug-in's log.
- *
+ *
* @param status status to log
* @since 2.0
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
-
+
/**
* Logs the specified throwable with this plug-in's log.
- *
- * @param t throwable to log
+ *
+ * @param t throwable to log
* @since 2.0
*/
public static void log(Throwable t) {
IStatus status= new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_3, t);
log(status);
}
-
+
/**
* Register status handlers.
- *
+ *
*/
private void initializeStatusHandlers() {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.PI_DEBUG_CORE, EXTENSION_POINT_STATUS_HANDLERS);
IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fStatusHandlers = new HashMap(infos.length);
+ fStatusHandlers = new HashMap<StatusHandlerKey, IConfigurationElement>(infos.length);
for (int i= 0; i < infos.length; i++) {
IConfigurationElement configurationElement = infos[i];
String id = configurationElement.getAttribute("plugin"); //$NON-NLS-1$
String code = configurationElement.getAttribute("code"); //$NON-NLS-1$
-
+
if (id != null && code != null) {
try {
StatusHandlerKey key = new StatusHandlerKey(id, Integer.parseInt(code));
@@ -1005,17 +1015,17 @@ public class DebugPlugin extends Plugin {
// invalid status handler
invalidStatusHandler(null, configurationElement.getAttribute("id")); //$NON-NLS-1$
}
- }
+ }
}
-
+
/**
* Register process factories.
- *
+ *
*/
private void initializeProcessFactories() {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.PI_DEBUG_CORE, EXTENSION_POINT_PROCESS_FACTORIES);
IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fProcessFactories = new HashMap(infos.length);
+ fProcessFactories = new HashMap<String, IConfigurationElement>(infos.length);
for (int i= 0; i < infos.length; i++) {
IConfigurationElement configurationElement = infos[i];
String id = configurationElement.getAttribute("id"); //$NON-NLS-1$
@@ -1025,32 +1035,35 @@ public class DebugPlugin extends Plugin {
} else {
// invalid process factory
String badDefiner= infos[i].getContributor().getName();
- log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new String[] {badDefiner, id}), null));
+ log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new Object[] {
+ badDefiner, id }), null));
}
- }
+ }
}
-
+
private void invalidStatusHandler(Exception e, String id) {
- log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, new String[] {id}), e));
+ log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_5, new Object[] { id }), e));
}
-
+
/**
* Key for status handler extensions - a plug-in identifier/code pair
*/
class StatusHandlerKey {
-
+
String fPluginId;
int fCode;
-
+
StatusHandlerKey(String pluginId, int code) {
fPluginId = pluginId;
fCode = code;
}
-
+
+ @Override
public int hashCode() {
return fPluginId.hashCode() + fCode;
}
-
+
+ @Override
public boolean equals(Object obj) {
if (obj instanceof StatusHandlerKey) {
StatusHandlerKey s = (StatusHandlerKey)obj;
@@ -1062,67 +1075,73 @@ public class DebugPlugin extends Plugin {
/**
* Executes runnables after event dispatch is complete.
- *
+ *
* @since 3.0
*/
class AsynchRunner implements ISafeRunnable {
-
+
private Runnable fRunnable = null;
-
+
void async(Runnable runnable) {
fRunnable = runnable;
SafeRunner.run(this);
fRunnable = null;
-
+
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
- IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_6, exception);
+ IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_6, exception);
log(status);
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
fRunnable.run();
}
}
-
+
/**
* Filters and dispatches events in a safe runnable to handle any
* exceptions.
*/
class EventNotifier implements ISafeRunnable {
-
+
private DebugEvent[] fEvents;
private IDebugEventSetListener fListener;
private IDebugEventFilter fFilter;
private int fMode;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
switch (fMode) {
case NOTIFY_FILTERS:
- IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_7, exception);
+ IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_7, exception);
log(status);
break;
- case NOTIFY_EVENTS:
- status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_8, exception);
+ case NOTIFY_EVENTS:
+ status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_8, exception);
log(status);
break;
+ default:
+ break;
}
}
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fMode) {
case NOTIFY_FILTERS:
@@ -1131,13 +1150,15 @@ public class DebugPlugin extends Plugin {
case NOTIFY_EVENTS:
fListener.handleDebugEvents(fEvents);
break;
+ default:
+ break;
}
}
-
+
/**
* Filter and dispatch the given events. If an exception occurs in one
* listener, events are still fired to subsequent listeners.
- *
+ *
* @param events debug events
*/
void dispatch(DebugEvent[] events) {
@@ -1151,9 +1172,9 @@ public class DebugPlugin extends Plugin {
if (fEvents == null || fEvents.length == 0) {
return;
}
- }
- }
-
+ }
+ }
+
fMode = NOTIFY_EVENTS;
Object[] listeners= getEventListeners();
if (DebugOptions.DEBUG_EVENTS) {
@@ -1162,19 +1183,19 @@ public class DebugPlugin extends Plugin {
}
}
for (int i= 0; i < listeners.length; i++) {
- fListener = (IDebugEventSetListener)listeners[i];
+ fListener = (IDebugEventSetListener)listeners[i];
SafeRunner.run(this);
}
fEvents = null;
fFilter = null;
- fListener = null;
+ fListener = null;
}
}
/**
* Creates and returns a new XML document.
- *
+ *
* @return a new XML document
* @throws CoreException if unable to create a new document
* @since 3.0
@@ -1184,13 +1205,13 @@ public class DebugPlugin extends Plugin {
return LaunchManager.getDocument();
} catch (ParserConfigurationException e) {
abort("Unable to create new XML document.", e); //$NON-NLS-1$
- }
+ }
return null;
- }
-
+ }
+
/**
* Serializes the given XML document into a string.
- *
+ *
* @param document XML document to serialize
* @return a string representing the given document
* @throws CoreException if unable to serialize the document
@@ -1210,7 +1231,7 @@ public class DebugPlugin extends Plugin {
/**
* Parses the given string representing an XML document, returning its
* root element.
- *
+ *
* @param document XML document as a string
* @return the document's root element
* @throws CoreException if unable to parse the document
@@ -1219,7 +1240,7 @@ public class DebugPlugin extends Plugin {
public static Element parseDocument(String document) throws CoreException {
Element root = null;
InputStream stream = null;
- try{
+ try{
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
stream = new ByteArrayInputStream(document.getBytes("UTF8")); //$NON-NLS-1$
@@ -1232,7 +1253,7 @@ public class DebugPlugin extends Plugin {
abort("Unable to parse XML document.", e); //$NON-NLS-1$
} catch (IOException e) {
abort("Unable to parse XML document.", e); //$NON-NLS-1$
- } finally {
+ } finally {
try{
if (stream != null) {
stream.close();
@@ -1240,13 +1261,13 @@ public class DebugPlugin extends Plugin {
} catch(IOException e) {
abort("Unable to parse XML document.", e); //$NON-NLS-1$
}
- }
+ }
return root;
- }
-
+ }
+
/**
* Throws an exception with the given message and underlying exception.
- *
+ *
* @param message error message
* @param exception underlying exception, or <code>null</code>
* @throws CoreException if a problem is encountered
@@ -1255,10 +1276,10 @@ public class DebugPlugin extends Plugin {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, message, exception);
throw new CoreException(status);
}
-
+
private static String[] parseArgumentsWindows(String args) {
// see http://msdn.microsoft.com/en-us/library/a1y7w461.aspx
- List result= new ArrayList();
+ List<String> result = new ArrayList<String>();
final int DEFAULT= 0;
final int ARG= 1;
@@ -1279,16 +1300,18 @@ public class DebugPlugin extends Plugin {
buf.append('\\');
}
if (backslashes == 1) {
- if (state == DEFAULT)
+ if (state == DEFAULT) {
state= ARG;
+ }
buf.append('"');
backslashes= 0;
continue;
} // else fall through to switch
} else {
// false alarm, treat passed backslashes literally...
- if (state == DEFAULT)
+ if (state == DEFAULT) {
state= ARG;
+ }
for (; backslashes > 0; backslashes--) {
buf.append('\\');
}
@@ -1316,7 +1339,7 @@ public class DebugPlugin extends Plugin {
buf.append(ch);
}
break;
-
+
case IN_DOUBLE_QUOTE:
if (ch == '"') {
if (i + 1 < len && args.charAt(i + 1) == '"') {
@@ -1342,21 +1365,22 @@ public class DebugPlugin extends Plugin {
throw new IllegalStateException();
}
}
- if (buf.length() > 0 || state != DEFAULT)
+ if (buf.length() > 0 || state != DEFAULT) {
result.add(buf.toString());
+ }
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
-
+
private static String[] parseArgumentsImpl(String args) {
// man sh, see topic QUOTING
- List result= new ArrayList();
-
+ List<String> result = new ArrayList<String>();
+
final int DEFAULT= 0;
final int ARG= 1;
final int IN_DOUBLE_QUOTE= 2;
final int IN_SINGLE_QUOTE= 3;
-
+
int state= DEFAULT;
StringBuffer buf= new StringBuffer();
int len= args.length();
@@ -1389,7 +1413,7 @@ public class DebugPlugin extends Plugin {
buf.append(ch);
}
break;
-
+
case IN_DOUBLE_QUOTE:
if (ch == '"') {
state= ARG;
@@ -1401,7 +1425,7 @@ public class DebugPlugin extends Plugin {
buf.append(ch);
}
break;
-
+
case IN_SINGLE_QUOTE:
if (ch == '\'') {
state= ARG;
@@ -1409,36 +1433,39 @@ public class DebugPlugin extends Plugin {
buf.append(ch);
}
break;
-
+
default:
throw new IllegalStateException();
}
}
- if (buf.length() > 0 || state != DEFAULT)
+ if (buf.length() > 0 || state != DEFAULT) {
result.add(buf.toString());
-
- return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ return result.toArray(new String[result.size()]);
}
-
+
/**
* Parses the given command line into separate arguments that can be passed to
* <code>DebugPlugin.exec(String[], File)</code>. Embedded quotes and slashes
* are escaped.
- *
+ *
* @param args command line arguments as a single string
* @return individual arguments
* @since 3.1
*/
public static String[] parseArguments(String args) {
- if (args == null)
+ if (args == null) {
return new String[0];
-
- if (Constants.OS_WIN32.equals(Platform.getOS()))
+ }
+
+ if (Constants.OS_WIN32.equals(Platform.getOS())) {
return parseArgumentsWindows(args);
-
+ }
+
return parseArgumentsImpl(args);
- }
-
+ }
+
/**
* Renders the given array of strings into a single command line.
* <p>
@@ -1446,7 +1473,7 @@ public class DebugPlugin extends Plugin {
* with the offsets of the start positions of arguments 1 to
* <code>arguments.length - 1</code>, as rendered in the resulting string.
* </p>
- *
+ *
* @param arguments
* the command line arguments
* @param segments
@@ -1460,9 +1487,10 @@ public class DebugPlugin extends Plugin {
StringBuffer buf = new StringBuffer();
int count = arguments.length;
for (int i = 0; i < count; i++) {
- if (i > 0)
+ if (i > 0) {
buf.append(' ');
-
+ }
+
boolean containsSpace = false;
char[] characters = arguments[i].toCharArray();
for (int j = 0; j < characters.length; j++) {
@@ -1473,7 +1501,7 @@ public class DebugPlugin extends Plugin {
break;
}
}
-
+
int backslashes = 0;
for (int j = 0; j < characters.length; j++) {
char ch = characters[j];
@@ -1506,7 +1534,7 @@ public class DebugPlugin extends Plugin {
} else if (characters.length == 0) {
buf.append("\"\""); //$NON-NLS-1$
}
-
+
if (segments != null && i < count - 1) {
segments[i] = buf.length() + 1;
}
@@ -1516,8 +1544,8 @@ public class DebugPlugin extends Plugin {
/**
* Sets whether step filters should be applied to step commands. This
- * setting is a global option applied to all registered debug targets.
- *
+ * setting is a global option applied to all registered debug targets.
+ *
* @param useStepFilters whether step filters should be applied to step
* commands
* @since 3.3
@@ -1526,10 +1554,10 @@ public class DebugPlugin extends Plugin {
public static void setUseStepFilters(boolean useStepFilters) {
getStepFilterManager().setUseStepFilters(useStepFilters);
}
-
+
/**
* Returns whether step filters are applied to step commands.
- *
+ *
* @return whether step filters are applied to step commands
* @since 3.3
* @see org.eclipse.debug.core.model.IStepFilters
@@ -1537,30 +1565,30 @@ public class DebugPlugin extends Plugin {
*/
public static boolean isUseStepFilters() {
return getStepFilterManager().isUseStepFilters();
- }
-
+ }
+
/**
* Returns the step filter manager.
- *
+ *
* @return step filter manager
*/
private static StepFilterManager getStepFilterManager() {
return ((LaunchManager)getDefault().getLaunchManager()).getStepFilterManager();
}
-
+
/**
* Returns an adapter of the specified type for the given object or <code>null</code>
* if none. The object itself is returned if it is an instance of the specified type.
* If the object is adaptable and does not subclass <code>PlatformObject</code>, and
* does not provide the specified adapter directly, the platform's adapter manager
* is consulted for an adapter.
- *
+ *
* @param element element to retrieve adapter for
* @param type adapter type
* @return adapter or <code>null</code>
* @since 3.4
*/
- public static Object getAdapter(Object element, Class type) {
+ public static Object getAdapter(Object element, Class<?> type) {
Object adapter = null;
if (element != null) {
if (type.isInstance(element)) {
@@ -1579,9 +1607,9 @@ public class DebugPlugin extends Plugin {
}
}
}
- return adapter;
- }
-
+ return adapter;
+ }
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
index a5cb36658..020ca26cf 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.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
@@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* A launch configuration describes how to launch an application.
* Each launch configuration is an instance of a type of launch
- * configuration as described by a launch configuration type
+ * configuration as described by a launch configuration type
* extension. Each launch configuration has a launch configuration
* delegate which performs the actual launching of a
* configuration.
@@ -61,45 +61,45 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @noextend This interface is not intended to be extended by clients.
*/
public interface ILaunchConfiguration extends IAdaptable {
-
+
/**
* The file extension for launch configuration files
* (value <code>"launch"</code>).
*/
public static final String LAUNCH_CONFIGURATION_FILE_EXTENSION = "launch"; //$NON-NLS-1$
-
+
/**
* Launch configuration attribute storing an identifier of
* a persistable source locator extension. When this attribute is
* specified, a new source locator will be created automatically and
* associated with the launch for this configuration.
- *
+ *
* @see org.eclipse.debug.core.model.IPersistableSourceLocator
*/
public static final String ATTR_SOURCE_LOCATOR_ID = DebugPlugin.getUniqueIdentifier() + ".source_locator_id"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute storing a memento of a
+ * Launch configuration attribute storing a memento of a
* source locator. When this attribute is specified in
* conjunction with a source locator id, the source locator
* created for a launch will be initialized with this memento.
* When not specified, but a source locator id is specified,
* the source locator will be initialized to default values.
- *
+ *
* @see org.eclipse.debug.core.model.IPersistableSourceLocator
*/
public static final String ATTR_SOURCE_LOCATOR_MEMENTO = DebugPlugin.getUniqueIdentifier() + ".source_locator_memento"; //$NON-NLS-1$
-
+
/**
- * Returns whether the contents of this launch configuration are
+ * Returns whether the contents of this launch configuration are
* equal to the contents of the given launch configuration.
- *
+ *
* @param configuration launch configuration
* @return whether the contents of this launch configuration are equal to the contents
* of the specified launch configuration.
*/
public boolean contentsEqual(ILaunchConfiguration configuration);
-
+
/**
* Returns a copy of this launch configuration, as a
* working copy, with the specified name. The new
@@ -108,7 +108,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* will return <code>null</code> for <code>getOriginal()</code>).
* When the working copy is saved it will not affect this
* launch configuration.
- *
+ *
* @param name the name of the copy
* @return a copy of this launch configuration
* @exception CoreException if this method fails. Reasons include:
@@ -119,12 +119,12 @@ public interface ILaunchConfiguration extends IAdaptable {
* @see ILaunchConfigurationWorkingCopy#getOriginal()
*/
public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException;
-
+
/**
* Deletes this launch configuration. This configuration's underlying
* storage is deleted. Has no effect if this configuration
* does not exist.
- *
+ *
* @exception CoreException if this method fails. Reasons include:
* <ul>
* <li>An exception occurs while deleting this configuration's
@@ -132,18 +132,18 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
*/
public void delete() throws CoreException;
-
+
/**
* Returns whether this launch configuration's underlying
* storage exists. This is a handle-only method.
- *
+ *
* @return whether this launch configuration's underlying
* storage exists
*/
public boolean exists();
-
+
/**
- * Returns the boolean-valued attribute with the given name.
+ * Returns the boolean-valued attribute with the given name.
* Returns the given default value if the attribute is undefined.
*
* @param attributeName the name of the attribute
@@ -158,9 +158,9 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
*/
public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException;
-
+
/**
- * Returns the integer-valued attribute with the given name.
+ * Returns the integer-valued attribute with the given name.
* Returns the given default value if the attribute is undefined.
*
* @param attributeName the name of the attribute
@@ -175,9 +175,9 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
*/
public int getAttribute(String attributeName, int defaultValue) throws CoreException;
-
+
/**
- * Returns the <code>java.util.List</code>-valued attribute with the given name.
+ * Returns the <code>java.util.List</code>-valued attribute with the given name.
* Returns the given default value if the attribute is undefined.
*
* @param attributeName the name of the attribute
@@ -191,10 +191,10 @@ public interface ILaunchConfiguration extends IAdaptable {
* have a List value</li>
* </ul>
*/
- public List getAttribute(String attributeName, List defaultValue) throws CoreException;
-
+ public List<String> getAttribute(String attributeName, List<String> defaultValue) throws CoreException;
+
/**
- * Returns the <code>java.util.Set</code>-valued attribute with the given name.
+ * Returns the <code>java.util.Set</code>-valued attribute with the given name.
* Returns the given default value if the attribute is undefined.
*
* @param attributeName the name of the attribute
@@ -207,13 +207,13 @@ public interface ILaunchConfiguration extends IAdaptable {
* <li>An attribute with the given name exists, but does not
* have a List value</li>
* </ul>
- *
+ *
* @since 3.3
*/
- public Set getAttribute(String attributeName, Set defaultValue) throws CoreException;
-
+ public Set<String> getAttribute(String attributeName, Set<String> defaultValue) throws CoreException;
+
/**
- * Returns the <code>java.util.Map</code>-valued attribute with the given name.
+ * Returns the <code>java.util.Map</code>-valued attribute with the given name.
* Returns the given default value if the attribute is undefined.
*
* @param attributeName the name of the attribute
@@ -227,10 +227,10 @@ public interface ILaunchConfiguration extends IAdaptable {
* have a Map value</li>
* </ul>
*/
- public Map getAttribute(String attributeName, Map defaultValue) throws CoreException;
-
+ public Map<String, String> getAttribute(String attributeName, Map<String, String> defaultValue) throws CoreException;
+
/**
- * Returns the string-valued attribute with the given name.
+ * Returns the string-valued attribute with the given name.
* Returns the given default value if the attribute is undefined.
*
* @param attributeName the name of the attribute
@@ -245,7 +245,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
*/
public String getAttribute(String attributeName, String defaultValue) throws CoreException;
-
+
/**
* Returns a map containing the attributes in this launch configuration.
* Returns an empty map if this configuration has no attributes.
@@ -259,12 +259,12 @@ public interface ILaunchConfiguration extends IAdaptable {
* @exception CoreException unable to generate/retrieve an attribute map
* @since 2.1
*/
- public Map getAttributes() throws CoreException;
-
+ public Map<String, Object> getAttributes() throws CoreException;
+
/**
* Returns this launch configuration's type's category, or <code>null</code>
* if unspecified. This is a handle-only method.
- *
+ *
* @return this launch configuration's type's category, or <code>null</code>
* @exception CoreException if this method fails. Reasons include:
* <ul>
@@ -273,18 +273,18 @@ public interface ILaunchConfiguration extends IAdaptable {
* @since 2.1
*/
public String getCategory() throws CoreException;
-
+
/**
* Returns the file this launch configuration is stored
* in, or <code>null</code> if this configuration is stored
* locally with the workspace. This is a handle-only method.
- *
+ *
* @return the file this launch configuration is stored
* in, or <code>null</code> if this configuration is stored
* locally with the workspace
*/
public IFile getFile();
-
+
/**
* Returns the location of this launch configuration as a
* path in the local file system or <code>null</code> if it cannot
@@ -294,7 +294,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* launch configuration is stored in the workspace as an {@link IFile} in
* an external file system ({@link EFS}).
* </p>
- *
+ *
* @return the location of this launch configuration as a
* path file system or <code>null</code> if it cannot be mapped
* to a location in the local file system. Since 3.5, this method
@@ -302,44 +302,45 @@ public interface ILaunchConfiguration extends IAdaptable {
* @deprecated Since a launch configuration does not need to be stored in the local
* file system, this attribute should no longer be used to identify a launch configuration.
*/
+ @Deprecated
public IPath getLocation();
-
+
/**
* Returns the resources this launch configuration is associated with or <code>null</code>
* if none. Clients contributing launch configuration types are responsible for maintaining
* resource mappings as appropriate.
- *
+ *
* @return the resources this launch configuration is associated with or <code>null</code>
* @throws CoreException unable to get the mapped resource
* @since 3.2
*/
public IResource[] getMappedResources() throws CoreException;
-
+
/**
* Returns a memento for this launch configuration, or <code>null</code>
* if unable to generate a memento for this configuration. A memento
* can be used to re-create a launch configuration, via the
* launch manager.
- *
+ *
* @return a memento for this configuration
* @see ILaunchManager#getLaunchConfiguration(String)
* @exception CoreException if an exception occurs generating this
- * launch configuration's memento
+ * launch configuration's memento
*/
public String getMemento() throws CoreException;
-
+
/**
* Returns the name of this launch configuration. This is
* a handle-only method.
- *
+ *
* @return the name of this launch configuration
*/
- public String getName();
-
+ public String getName();
+
/**
* Returns the launch modes that have been set on this configuration.
* An empty set is returned if no specific launch modes have been set
- * on a launch configuration.
+ * on a launch configuration.
* <p>
* Setting launch modes on a configuration allows a launch to be
* performed in mixed mode - for example, debug and profile at the
@@ -349,24 +350,24 @@ public interface ILaunchConfiguration extends IAdaptable {
* @exception CoreException if an exception occurs retrieving modes
* @since 3.3
*/
- public Set getModes() throws CoreException;
-
+ public Set<String> getModes() throws CoreException;
+
/**
* Returns the preferred launch delegate that has been set on this
* configuration or <code>null</code> if one is not specified.
- *
+ *
* @param modes mode set for which a preferred delegate has been requested
- * @return this configuration's preferred launch delegate for the specified mode set, or
+ * @return this configuration's preferred launch delegate for the specified mode set, or
* <code>null</code> if one is not specified
* @exception CoreException if an exception occurs retrieving preferred delegate
* @since 3.3
*/
- public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException;
-
+ public ILaunchDelegate getPreferredDelegate(Set<String> modes) throws CoreException;
+
/**
* Returns the type of this launch configuration. This is a
* handle-only method.
- *
+ *
* @return the type of this launch configuration
* @exception CoreException if this method fails. Reasons include:
* <ul>
@@ -374,22 +375,22 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
* @see ILaunchConfigurationType
*/
- public ILaunchConfigurationType getType() throws CoreException;
-
+ public ILaunchConfigurationType getType() throws CoreException;
+
/**
* Returns a working copy of this launch configuration.
- * Since 3.3, if this method is called on a working copy, a nested working
+ * Since 3.3, if this method is called on a working copy, a nested working
* copy is created (a working copy of a working copy).
* Changes to the working copy will be applied to this
- * launch configuration when saved, or to the parent working copy.
+ * launch configuration when saved, or to the parent working copy.
* The working copy will refer to this launch configuration as its original
* launch configuration, or the working copy it was created from.
* <p>
* When a working copy (B) is created from a working copy (A), the newly
* created working copy (B) is initialized with the attributes from
* the first working copy (A). Whenever a working copy is saved, it is written
- * back to the working copy from which it was created: in this example working
- * copy B will write back to working copy A, and A will write back to the
+ * back to the working copy from which it was created: in this example working
+ * copy B will write back to working copy A, and A will write back to the
* original launch configuration.
* </p>
* @return a working copy of this launch configuration, or a nested working copy if called
@@ -402,49 +403,49 @@ public interface ILaunchConfiguration extends IAdaptable {
* @see ILaunchConfigurationWorkingCopy#getOriginal()
*/
public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException;
-
+
/**
* Returns whether this configuration contains an attribute with the given name.
- *
+ *
* @param attributeName the name of the attribute
* @return true if this configuration has the specified attribute false otherwise
* @throws CoreException if unable to retrieve attributes
- *
+ *
* @since 3.4
*/
public boolean hasAttribute(String attributeName) throws CoreException;
-
+
/**
* Returns whether this launch configuration is stored
* locally within the workspace. This is a handle-only method.
- *
+ *
* @return whether this launch configuration is stored
* locally with the workspace
*/
public boolean isLocal();
-
+
/**
* Returns whether this launch configuration is a candidate for migration.
- *
+ *
* @return whether this launch configuration is a candidate for migration
* @throws CoreException if a problem is encountered
* @see ILaunchConfigurationMigrationDelegate
* @since 3.2
*/
public boolean isMigrationCandidate() throws CoreException ;
-
+
/**
* Returns whether this launch configuration is a working
* copy. Launch configurations which return <code>true</code>
- * to this method can be safely cast to
+ * to this method can be safely cast to
* <code>org.eclipse.debug.core.ILaunchConfigurationWorkingCopy</code>.
* This is a handle-only method.
- *
+ *
* @return whether this launch configuration is a working
* copy
*/
public boolean isWorkingCopy();
-
+
/**
* Launches this configuration in the specified mode by delegating to
* this configuration's launch configuration delegate, and returns the
@@ -457,9 +458,9 @@ public interface ILaunchConfiguration extends IAdaptable {
* defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
* @param monitor progress monitor, or <code>null</code>. A cancelable progress monitor is provided by the Job
* framework. It should be noted that the setCanceled(boolean) method should never be called on the provided
- * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
- * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
- * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.
+ * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
+ * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
+ * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.
* @return the resulting launch
* @exception CoreException if this method fails. Reasons include:<ul>
* <li>unable to instantiate the underlying launch configuration delegate</li>
@@ -467,7 +468,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
*/
public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException;
-
+
/**
* Launches this configuration in the specified mode by delegating to
* this configuration's launch configuration delegate, and returns the
@@ -502,16 +503,16 @@ public interface ILaunchConfiguration extends IAdaptable {
* defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
* @param monitor progress monitor, or <code>null</code>. A cancelable progress monitor is provided by the Job
* framework. It should be noted that the setCanceled(boolean) method should never be called on the provided
- * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
- * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
- * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.
+ * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
+ * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
+ * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.
* @param build whether the workspace should be built before the launch
* @return resulting launch
* @throws CoreException if an exception occurs during the launch sequence
* @since 3.0
*/
- public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException;
-
+ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException;
+
/**
* Launches this configuration in the specified mode by delegating to
* this configuration's launch configuration delegate, and returns the
@@ -550,9 +551,9 @@ public interface ILaunchConfiguration extends IAdaptable {
* defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
* @param monitor progress monitor, or <code>null</code>. A cancelable progress monitor is provided by the Job
* framework. It should be noted that the setCanceled(boolean) method should never be called on the provided
- * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
- * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
- * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.
+ * monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
+ * framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
+ * is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.
* @param build whether the workspace should be built before the launch
* @param register whether to register the resulting launch with the launch manager
* @return resulting launch
@@ -560,7 +561,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* @since 3.1
*/
public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException;
-
+
/**
* Migrates this launch configuration to be compatible with current tooling.
* Has no effect if this configuration is not a candidate for migration.
@@ -570,11 +571,11 @@ public interface ILaunchConfiguration extends IAdaptable {
* @see ILaunchConfigurationMigrationDelegate
*/
public void migrate() throws CoreException;
-
+
/**
* Returns whether this launch configuration supports the
* specified mode. This is a handle-only method.
- *
+ *
* @param mode a mode in which a configuration can be launched, one of
* the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or
* <code>DEBUG_MODE</code>.
@@ -586,14 +587,14 @@ public interface ILaunchConfiguration extends IAdaptable {
* </ul>
*/
public boolean supportsMode(String mode) throws CoreException;
-
+
/**
* Returns whether this launch configuration is read-only.
* A read-only configuration cannot be modified.
- *
+ *
* @return whether this configuration is read-only
- *
+ *
* @since 3.3
*/
- public boolean isReadOnly();
+ public boolean isReadOnly();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
index 375dc34ca..cd78a8ca4 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.core;
-
+
import java.util.Set;
import org.eclipse.core.resources.IContainer;
@@ -29,7 +29,7 @@ import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
* type extension.
* <pre>
* &lt;extension point="org.eclipse.debug.core.launchConfigurationTypes"&gt;
- * &lt;launchConfigurationType
+ * &lt;launchConfigurationType
* id="com.example.ExampleIdentifier"
* delegate="com.example.ExampleLaunchConfigurationDelegate"
* modes="run, debug"
@@ -81,47 +81,48 @@ import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
* @noextend This interface is not intended to be extended by clients.
*/
public interface ILaunchConfigurationType extends IAdaptable {
-
+
/**
* Returns the attribute with the given name, as specified by this launch
* configuration type's extension definition, or <code>null</code> if
* unspecified.
- *
+ *
* @param attributeName attribute name
* @return the specified extension attribute, or <code>null</code>
* @since 2.1
*/
public String getAttribute(String attributeName);
-
+
/**
* Returns this launch configuration type's category, or <code>null</code>
* if unspecified. This corresponds to the category attribute specified in
* the extension definition.
- *
+ *
* @return this launch configuration type's category, or <code>null</code>
* @since 2.1
*/
public String getCategory();
-
+
/**
* Returns the launch configuration delegate for launch
* configurations of this type, for <code>run</code> mode.
* The first time this method is called, the delegate is instantiated.
- *
+ *
* @return launch configuration delegate
* @exception CoreException if unable to instantiate the
* delegate
* @deprecated use <code>getDelegate(String)</code> to specify mode
- */
+ */
+ @Deprecated
public ILaunchConfigurationDelegate getDelegate() throws CoreException;
-
+
/**
* Returns the launch configuration delegate for launch
* configurations of this type, for the specified mode. The first time
* this method is called for a mode, the delegate is instantiated.
* Launch delegates may be contributed to a launch configuration type
* via the extension point <code>org.eclipse.debug.core.launchDelegates</code>
- *
+ *
* @param mode launch mode
* @return launch configuration delegate
* @exception CoreException if unable to instantiate the
@@ -129,84 +130,85 @@ public interface ILaunchConfigurationType extends IAdaptable {
* @since 3.0
* @deprecated since 3.3, the method <code>getDelegates(Set)</code> should be used
* instead, as there can be more than one capable delegate per mode or combination
- * of modes
- */
+ * of modes
+ */
+ @Deprecated
public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException;
-
+
/**
* Returns the delegates capable of launching in the specified modes, possibly
* an empty set.
- *
+ *
* @param modes set of launch modes
* @return the <code>ILaunchDelegate</code>s capable of launching
* in the specified modes or an empty collection if none
* @throws CoreException if a problem is encountered
* @since 3.3
*/
- public ILaunchDelegate[] getDelegates(Set modes) throws CoreException;
-
+ public ILaunchDelegate[] getDelegates(Set<String> modes) throws CoreException;
+
/**
* Returns the preferred launch delegate for this type in the specified mode combination
* or <code>null</code> if there is no preferred delegate.
- *
+ *
* @param modes the set of modes to support
* @return the preferred delegate or <code>null</code> if none
* @throws CoreException if a problem is encountered
- *
+ *
* @since 3.3
*/
- public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException;
-
+ public ILaunchDelegate getPreferredDelegate(Set<String> modes) throws CoreException;
+
/**
* Sets the preferred launch delegate for this type in the specified mode combination.
* Specify <code>null</code> as a preferred delegate to remove any preferred delegate
* setting for this launch configuration type.
- *
+ *
* @param modes launch mode combination
* @param delegate preferred launch delegate or <code>null</code>
* @throws CoreException if a problem is encountered
- *
+ *
* @since 3.3
*/
- public void setPreferredDelegate(Set modes, ILaunchDelegate delegate) throws CoreException;
-
+ public void setPreferredDelegate(Set<String> modes, ILaunchDelegate delegate) throws CoreException;
+
/**
* Returns whether this launch configuration supports the specified launch
* mode combination.
- *
+ *
* @param modes launch mode combination
* @return whether the launch mode combination is supported
* @since 3.3
*/
- public boolean supportsModeCombination(Set modes);
-
+ public boolean supportsModeCombination(Set<String> modes);
+
/**
* Returns the unique identifier for this type of launch configuration
- *
+ *
* @return the unique identifier for this type of launch configuration
*/
public String getIdentifier();
-
+
/**
* Returns the name of this type of launch configuration.
- *
+ *
* @return the name of this type of launch configuration
*/
public String getName();
-
+
/**
* Returns the identifier of the plug-in that contributes this launch configuration type.
- *
+ *
* @return the identifier of the plug-in that contributes this launch configuration type
* @since 3.0
*/
public String getPluginIdentifier();
-
+
/**
* Returns the identifier of the persistable source locator registered with
* this launch configurations type, or <code>null</code> if unspecified.
* A source locator can be specified by a launch configuration type or
- * launch delegate extension's <code>sourceLocatorId</code> attribute.
+ * launch delegate extension's <code>sourceLocatorId</code> attribute.
* <p>
* Only one source locator should be provided per launch configuration type
* and its launch delegates.
@@ -216,7 +218,7 @@ public interface ILaunchConfigurationType extends IAdaptable {
* @since 3.0
*/
public String getSourceLocatorId();
-
+
/**
* Returns the source path computer registered with this launch configuration
* type or <code>null</code> if unspecified. A source path computer can be
@@ -224,52 +226,53 @@ public interface ILaunchConfigurationType extends IAdaptable {
* <code>sourcePathComputerId</code> attribute.
* <p>
* Only one source path computer should be provided per launch configuration type
- * and its launch delegates.
+ * and its launch delegates.
* </p>
* @return the source path computer registered with this launch configuration
* type or <code>null</code> if unspecified
* @since 3.0
*/
- public ISourcePathComputer getSourcePathComputer();
-
+ public ISourcePathComputer getSourcePathComputer();
+
/**
* Returns all of the registered supported modes for this launch configuration type.
* This method does not return null.
- *
+ *
* <p>
* The returned set does not convey any mode combination capability nor does it describe how or what the type can launch, all this method does is return
- * a set of strings of all the modes in some way associated with this type
+ * a set of strings of all the modes in some way associated with this type
* </p>
- *
+ *
* @return the set of all supported modes
* @since 3.2
- *
+ *
* @deprecated Since 3.3 all modes are provided as sets and not individual strings. The method <code>getSupportedModeCombinations</code>
* should be used instead to retrieve the complete listing of supported modes and their allowable combinations.
*/
- public Set getSupportedModes();
-
+ @Deprecated
+ public Set<String> getSupportedModes();
+
/**
* Returns a <code>java.util.Set</code> of <code>java.util.Set</code>s containing all of the
* supported launch mode combinations for this type.
- *
+ *
* @return a set of sets of all the supported mode combinations supported by this type
- *
+ *
* @since 3.3
*/
- public Set getSupportedModeCombinations();
-
+ public Set<Set<String>> getSupportedModeCombinations();
+
/**
* Returns whether this launch configuration type is public. Public configuration
* types are available for use by the user, for example, the user can create new
* configurations based on public types through the UI. Private types are not
- * accessible in this way, but are still available through the methods on
+ * accessible in this way, but are still available through the methods on
* <code>ILaunchManager</code>.
- *
+ *
* @return whether this launch configuration type is public.
*/
public boolean isPublic();
-
+
/**
* Returns a new launch configuration working copy of this type,
* that resides in the specified container, with the given name.
@@ -291,11 +294,11 @@ public interface ILaunchConfigurationType extends IAdaptable {
* reason
*/
public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) throws CoreException;
-
+
/**
* Returns whether this type of launch configuration supports
* the specified mode.
- *
+ *
* @param mode a mode in which a configuration can be launched, one of
* the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or
* <code>DEBUG_MODE</code>.
@@ -303,10 +306,10 @@ public interface ILaunchConfigurationType extends IAdaptable {
* specified mode
*/
public boolean supportsMode(String mode);
-
+
/**
* Returns the name of the plug-in that contributed this launch configuration type.
- *
+ *
* @return name of contributing plug-in
* @since 3.3
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
index a7ffcb85a..b46e3747b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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
@@ -44,16 +44,16 @@ import org.eclipse.core.runtime.IAdaptable;
* @noextend This interface is not intended to be extended by clients.
*/
public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, IAdaptable {
-
+
/**
* Returns whether this configuration has been modified
* since it was last saved or created.
- *
+ *
* @return whether this configuration has been modified
* since it was last saved or created
*/
public boolean isDirty();
-
+
/**
* Saves this working copy to its underlying file and returns
* a handle to the resulting launch configuration.
@@ -65,19 +65,19 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* effecting the original launch configuration.
* </p>
* @return handle to saved launch configuration
- * @exception CoreException if an exception occurs while
+ * @exception CoreException if an exception occurs while
* writing this configuration to its underlying file.
*/
public ILaunchConfiguration doSave() throws CoreException;
-
+
/**
- * Sets the integer-valued attribute with the given name.
+ * Sets the integer-valued attribute with the given name.
*
* @param attributeName the name of the attribute, cannot be <code>null</code>
* @param value the value
*/
public void setAttribute(String attributeName, int value);
-
+
/**
* Sets the String-valued attribute with the given name.
* If the value is <code>null</code>, the attribute is removed from
@@ -87,7 +87,7 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* @param value the value, or <code>null</code> if the attribute is to be undefined
*/
public void setAttribute(String attributeName, String value);
-
+
/**
* Sets the <code>java.util.List</code>-valued attribute with the given name.
* The specified List <em>must</em> contain only String-valued entries.
@@ -97,8 +97,8 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* @param attributeName the name of the attribute, cannot be <code>null</code>
* @param value the value, or <code>null</code> if the attribute is to be undefined
*/
- public void setAttribute(String attributeName, List value);
-
+ public void setAttribute(String attributeName, List<String> value);
+
/**
* Sets the <code>java.util.Map</code>-valued attribute with the given name.
* The specified Map <em>must</em> contain only String keys and String values.
@@ -108,8 +108,8 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* @param attributeName the name of the attribute, cannot be <code>null</code>
* @param value the value, or <code>null</code> if the attribute is to be undefined
*/
- public void setAttribute(String attributeName, Map value);
-
+ public void setAttribute(String attributeName, Map<String, String> value);
+
/**
* Sets the <code>java.util.Set</code>-valued attribute with the given name.
* The specified Set <em>must</em> contain only String values.
@@ -120,25 +120,25 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* @param value the value, or <code>null</code> if the attribute is to be undefined
* @since 3.6
*/
- public void setAttribute(String attributeName, Set value);
-
+ public void setAttribute(String attributeName, Set<String> value);
+
/**
- * Sets the boolean-valued attribute with the given name.
+ * Sets the boolean-valued attribute with the given name.
*
* @param attributeName the name of the attribute, cannot be <code>null</code>
* @param value the value
*/
- public void setAttribute(String attributeName, boolean value);
-
+ public void setAttribute(String attributeName, boolean value);
+
/**
* Returns the original launch configuration this working copy
* was created from or <code>null</code> if this is a new
* working copy created from a launch configuration type.
- *
+ *
* @return the original launch configuration, or <code>null</code>
*/
public ILaunchConfiguration getOriginal();
-
+
/**
* Renames this launch configuration to the specified name.
* The new name cannot be <code>null</code>. Has no effect if the name
@@ -146,11 +146,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* on an existing launch configuration, this will cause
* the underlying launch configuration file to be renamed when
* this working copy is saved.
- *
- * @param name the new name for this configuration
+ *
+ * @param name the new name for this configuration
*/
- public void rename(String name);
-
+ public void rename(String name);
+
/**
* Sets the container this launch configuration will be stored
* in when saved. When set to <code>null</code>, this configuration
@@ -168,13 +168,13 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* The original file associated with this configuration in
* the workspace will be deleted.
* </p>
- *
+ *
* @param container the container in which to store this
* launch configuration, or <code>null</code> if this
* configuration is to be stored locally
*/
- public void setContainer(IContainer container);
-
+ public void setContainer(IContainer container);
+
/**
* Sets the attributes of this launch configuration to be the ones contained
* in the given map. The values must be an instance of one of the following
@@ -188,44 +188,46 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* Attribute names are not allowed to be <code>null</code>
* @since 2.1
*/
- public void setAttributes(Map attributes);
-
+ public void setAttributes(Map<String, ? extends Object> attributes);
+
/**
* Sets the resources associated with this launch configuration, possibly <code>null</code>.
* Clients contributing launch configuration types are responsible for maintaining
* resource mappings.
- *
+ *
* @param resources the resource to map to this launch configuration or <code>null</code>
* @since 3.2
*/
public void setMappedResources(IResource[] resources);
-
+
/**
- * Set the launch modes for this configuration.
- * Over-writes existing launch modes.
+ * Set the launch modes for this configuration. Over-writes existing launch
+ * modes.
* <p>
- * Setting launch modes on a configuration allows the configuration to
- * be launched in a mixed mode - for example, debug and profile.
+ * Setting launch modes on a configuration allows the configuration to be
+ * launched in a mixed mode - for example, <code>debug</code> and
+ * <code>profile</code>.
* </p>
- * @param modes launch mode identifiers to set on this configuration
- * or <code>null</code> to clear mode settings
- *
+ *
+ * @param modes launch mode identifiers to set on this configuration or
+ * <code>null</code> to clear mode settings
+ *
* @since 3.3
*/
- public void setModes(Set modes);
-
+ public void setModes(Set<String> modes);
+
/**
* Set the preferred launch delegates' id for the given mode set. Passing in <code>null</code> as a delegate
* id will cause the mapping for the specified mode set (if any) to be removed.
- *
+ *
* @param modes the set of modes to set this delegate id for
* @param delegateId the id of the delegate to associate as preferred for the specified mode set
* or <code>null</code> to clear the setting
- *
+ *
* @since 3.3
*/
- public void setPreferredLaunchDelegate(Set modes, String delegateId);
-
+ public void setPreferredLaunchDelegate(Set<String> modes, String delegateId);
+
/**
* Adds the specified launch modes to this configuration's settings.
* <p>
@@ -234,11 +236,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* </p>
* @param modes launch mode identifiers to append to the current set of
* launch modes set on this configuration
- *
+ *
* @since 3.3
*/
- public void addModes(Set modes);
-
+ public void addModes(Set<String> modes);
+
/**
* Removes the specified launch modes from this configuration's settings.
* <p>
@@ -247,11 +249,11 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* </p>
* @param modes launch mode identifiers to remove from the current set of
* launch modes set on this configuration
- *
+ *
* @since 3.3
*/
- public void removeModes(Set modes);
-
+ public void removeModes(Set<String> modes);
+
/**
* Removes the specified attribute from the this configuration and returns
* the previous value associated with the specified attribute name, or <tt>null</tt>
@@ -262,15 +264,15 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* </p>
* @param attributeName the name of the attribute to remove
* @return previous value of the attribute or <code>null</code>
- *
+ *
* @since 3.4
*/
public Object removeAttribute(String attributeName);
-
+
/**
* Returns the parent of this working copy or <code>null</code> if this working
* copy is not a nested copy of another working copy.
- *
+ *
* @return parent or <code>null</code>
* @since 3.3
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java
index b9af5cd34..8fda4c5aa 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -19,7 +19,7 @@ import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
/**
* A proxy to an {@link ILaunchConfigurationDelegate}. Represents a
* launch delegate contributed to the <code>org.eclipse.debug.core.launchDelegates</code>
- * extension point.
+ * extension point.
* @since 3.3
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
@@ -28,65 +28,65 @@ public interface ILaunchDelegate {
/**
* Returns this delegate's unique identifier.
- *
+ *
* @return launch delegate identifier
*/
public String getId();
-
+
/**
* Returns a human readable name for this launch delegate
* or <code>null</code> if none.
- *
+ *
* @return name or <code>null</code>
*/
public String getName();
-
+
/**
- * Returns a description of this launch delegate, or
+ * Returns a description of this launch delegate, or
* <code>null</code> if none.
- *
+ *
* @return description or <code>null</code>
*/
public String getDescription();
-
+
/**
* Returns the name of the plug-in that contributed this delegate.
- *
+ *
* @return contributor name
*/
public String getContributorName();
-
+
/**
* Returns the underlying launch configuration.
* Causes the delegate to be instantiated.
- *
+ *
* @return launch configuration delegate
* @exception CoreException if unable to instantiate the delegate
*/
public ILaunchConfigurationDelegate getDelegate() throws CoreException;
-
+
/**
* Returns the complete set of launch modes supported by this delegate as a list of sets.
* Each set contains one of more launch mode identifiers. When a set contains more than
* one launch mode, it indicates that a mixed launch mode is supported.
* If no modes are available an empty list is returned.
- *
+ *
* @return the complete set of launch modes this delegate supports
*/
- public List getModes();
-
+ public List<Set<String>> getModes();
+
/**
* Returns the id of the plug-in that contributed this launch delegate.
- *
+ *
* @return the id of the plug-in that contributed this launch delegate
*/
public String getPluginIdentifier();
-
+
/**
- * Returns the specified perspective id for the given mode set, or null if one is not provided
+ * Returns the specified perspective id for the given mode set, or null if one is not provided
* @param modes the set of modes to get the perspective id
* @return the perspective id associated with the given mode set, or <code>null</code> if none provided
*/
- public String getPerspectiveId(Set modes);
-
+ public String getPerspectiveId(Set<String> modes);
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
index 4796bec88..534abe840 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.core;
-
+
import java.util.Map;
import org.eclipse.core.resources.IFile;
@@ -43,43 +43,43 @@ public interface ILaunchManager {
* A launch in a special profile mode (value <code>"profile"</code>).
* @since 3.0
*/
- public static final String PROFILE_MODE= "profile"; //$NON-NLS-1$
+ public static final String PROFILE_MODE= "profile"; //$NON-NLS-1$
/**
* Launch configuration attribute - a boolean value that indicates if the
* launch configuration is 'private'. A private configuration is one that
* does not appear in the user interface (launch history or the launch
* configuration dialog).
- *
+ *
* @since 3.6
*/
public static final String ATTR_PRIVATE = "org.eclipse.debug.ui.private"; //$NON-NLS-1$
-
+
/**
* Launch configuration attribute name. The value is a map of environment
* variables passed into Runtime.exec(...) when a launch configuration is launched.
* Default value is <code>null</code> which indicates the default environment
- * should be used.
- *
+ * should be used.
+ *
* @since 3.0
*/
public static final String ATTR_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".environmentVariables"; //$NON-NLS-1$
-
+
/**
* Launch configuration attribute name. The value is a boolean value specifying
* whether the environment variables in a launch configuration
* should be appended to the native environment (i.e. when <code>true</code>),
* or if they should replace the environment (i.e. <code>false</code>). The
* default value is <code>true</code>.
- *
- * @since 3.0
+ *
+ * @since 3.0
*/
- public static final String ATTR_APPEND_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".appendEnvironmentVariables"; //$NON-NLS-1$
-
+ public static final String ATTR_APPEND_ENVIRONMENT_VARIABLES = DebugPlugin.getUniqueIdentifier() + ".appendEnvironmentVariables"; //$NON-NLS-1$
+
/**
* Adds the specified launch and notifies listeners. Has no
* effect if an identical launch is already registered.
- *
+ *
* @param launch the launch to add
* @since 2.0
*/
@@ -89,19 +89,19 @@ public interface ILaunchManager {
* of listeners notified when a launch configuration is
* added, removed, or changed. Has no effect if the given listener
* is already registered.
- *
+ *
* @param listener launch configuration listener
* @since 2.0
*/
- public void addLaunchConfigurationListener(ILaunchConfigurationListener listener);
+ public void addLaunchConfigurationListener(ILaunchConfigurationListener listener);
/**
* Adds the specified launch objects and notifies listeners. Has no
* effect on identical launch objects already registered.
- *
+ *
* @param launches the launch objects to add
* @since 2.1
*/
- public void addLaunches(ILaunch[] launches);
+ public void addLaunches(ILaunch[] launches);
/**
* Adds the given listener to the collection of registered launch listeners.
* Has no effect if an identical listener is already registered.
@@ -109,7 +109,7 @@ public interface ILaunchManager {
* @param listener the listener to register
* @since 2.1
*/
- public void addLaunchListener(ILaunchesListener listener);
+ public void addLaunchListener(ILaunchesListener listener);
/**
* Adds the given listener to the collection of registered launch listeners.
* Has no effect if an identical listener is already registered.
@@ -120,7 +120,7 @@ public interface ILaunchManager {
/**
* Return a String that can be used as the name of a launch configuration. The name
* is guaranteed to be unique (no existing launch configurations will have this name).
- * The name that is returned uses the <code>namePrefix</code> as a starting point. If
+ * The name that is returned uses the <code>namePrefix</code> as a starting point. If
* there is no existing launch configuration with this name, then <code>namePrefix</code>
* is returned. Otherwise, the value returned consists of the specified prefix plus
* some suffix that guarantees uniqueness.
@@ -129,20 +129,21 @@ public interface ILaunchManager {
* @return launch configuration name
* @since 2.0
* @deprecated since 3.6 clients should use the {@link #generateLaunchConfigurationName(String)} method which
- * will perform validation of the name and correct unsupported name parts.
+ * will perform validation of the name and correct unsupported name parts.
*/
+ @Deprecated
public String generateUniqueLaunchConfigurationNameFrom(String namePrefix);
-
+
/**
* Returns a string that can be used as the name of a launch configuration. The name
* is guaranteed to be unique (no existing launch configurations will have this name).
- * The name that is returned uses the <code>namePrefix</code> as a starting point. If
+ * The name that is returned uses the <code>namePrefix</code> as a starting point. If
* there is no existing launch configuration with this name, then <code>namePrefix</code>
* is returned. Otherwise, the value returned consists of the specified prefix plus
* some suffix that guarantees uniqueness.
* <p>
* If the name prefix does not pass name validation any illegal parts of the name will be removed
- * during the name generation. Illegal characters will be replaced with '_' and illegal names will be
+ * during the name generation. Illegal characters will be replaced with '_' and illegal names will be
* replaced with "_reserved_".
* </p>
* @param namePrefix the string that the returned name should begin with
@@ -150,11 +151,11 @@ public interface ILaunchManager {
* @since 3.6
*/
public String generateLaunchConfigurationName(String namePrefix);
-
+
/**
- * Returns if the given name is valid or not. If an invalid name part is located
+ * Returns if the given name is valid or not. If an invalid name part is located
* an {@link IllegalArgumentException} is thrown.
- *
+ *
* @param configname the name to check
* @return true if the given name is valid or throws an exception if not, where an invalid name
* is either a reserved system name (like 'aux' on Win 32) or the name contains invalid characters (like ':' or '/').
@@ -163,7 +164,7 @@ public interface ILaunchManager {
* @since 3.6
*/
public boolean isValidLaunchConfigurationName(String configname) throws IllegalArgumentException;
-
+
/**
* Returns the collection of debug targets currently registered with this
* launch manager.
@@ -171,11 +172,11 @@ public interface ILaunchManager {
* @return an array of debug targets
*/
public IDebugTarget[] getDebugTargets();
- /**
+ /**
* Returns an array of environment variables to be used when
* launching the given configuration or <code>null</code> if unspecified.
* Each entry is of the form "<code>var_name=value</code>".
- *
+ *
* @return an array of environment variables to use when launching the given
* configuration or <code>null</code> if unspecified
* @param configuration launch configuration
@@ -187,9 +188,9 @@ public interface ILaunchManager {
/**
* This method returns the character encoding to use when launching the specified <code>ILaunchConfiguration</code>.
* The returned encoding can be derived from one of three places in the following order:
- * <ol>
+ * <ol>
* <li>An attribute saved on the configuration itself (where no attribute means use the default encoding).</li>
- * <li>The mapped resources for the configuration, in the event one of them has a specific encoding that
+ * <li>The mapped resources for the configuration, in the event one of them has a specific encoding that
* is not the workspace default. If there are more than one mapped resource we optimistically ask only the first resource
* for its encoding.</li>
* <li>We ask the <code>ResourcesPlugin</code> for the workspace preference (which resolves back to the system
@@ -198,26 +199,26 @@ public interface ILaunchManager {
* @param configuration the <code>ILaunchConfiguration</code> to get the encoding for
* @return the encoding to use when launching the specified <code>ILaunchConfiguration</code>
* @throws CoreException if a problem is encountered
- *
+ *
* @since 3.4
*/
public String getEncoding(ILaunchConfiguration configuration) throws CoreException;
/**
* Returns a handle to the launch configuration contained
- * in the specified file. This method does not check if the specified <code>IFile</code> is
+ * in the specified file. This method does not check if the specified <code>IFile</code> is
* a launch configuration file or that it exists in the local or
* remote file system.
- *
+ *
* @param file launch configuration file
* @return a handle to the launch configuration contained
* in the specified file
* @since 2.0
*/
- public ILaunchConfiguration getLaunchConfiguration(IFile file);
+ public ILaunchConfiguration getLaunchConfiguration(IFile file);
/**
* Returns a handle to the launch configuration specified by
* the given memento. The configuration may not exist.
- *
+ *
* @param memento launch configuration memento
* @return a handle to the launch configuration specified by
* the given memento
@@ -229,15 +230,15 @@ public interface ILaunchManager {
public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException;
/**
* Returns all launch configurations defined in the workspace.
- *
+ *
* @return all launch configurations defined in the workspace
* @exception CoreException if an exception occurs retrieving configurations
* @since 2.0
*/
- public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException;
+ public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException;
/**
* Returns all launch configurations of the specified type defined in the workspace
- *
+ *
* @param type a launch configuration type
* @return all launch configurations of the specified type defined in the workspace
* @exception CoreException if an error occurs while retrieving
@@ -245,63 +246,63 @@ public interface ILaunchManager {
* @since 2.0
*/
public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException;
-
+
/**
* Returns the launch configuration type extension with the specified
* id, or <code>null</code> if it does not exist.
- *
+ *
* @param id unique identifier for a launch configuration type extension
* @return the launch configuration type extension with the specified
* id, or <code>null</code> if it does not exist
* @since 2.0
*/
public ILaunchConfigurationType getLaunchConfigurationType(String id);
-
+
/**
* Returns all defined launch configuration type extensions
- *
+ *
* @return all defined launch configuration type extensions
* @since 2.0
*/
public ILaunchConfigurationType[] getLaunchConfigurationTypes();
-
+
/**
* Returns the collection of launches currently registered
* with this launch manager.
- *
+ *
* @return an array of launches
*/
public ILaunch[] getLaunches();
-
+
/**
* Returns the launch mode registered with the given mode identifier,
* or <code>null</code> if none.
- *
+ *
* @param mode mode identifier
* @return launch mode or <code>null</code>
* @since 3.0
*/
public ILaunchMode getLaunchMode(String mode);
-
+
/**
* Returns all registered launch modes.
- *
+ *
* @return all registered launch modes
* @since 3.0
*/
public ILaunchMode[] getLaunchModes();
-
+
/**
* Returns a collection of launch configurations that required migration to be
* compatible with current tooling.
- *
+ *
* @return a collection of launch configurations that required migration
* @exception org.eclipse.core.runtime.CoreException if an exception occurs determining
* migration candidates
* @since 3.2
*/
public ILaunchConfiguration[] getMigrationCandidates() throws CoreException;
-
+
/**
* When a launch configuration is created or moved, registered launch
* configuration listeners (see <code>ILaunchConfigurationListener</code>)
@@ -316,7 +317,7 @@ public interface ILaunchManager {
* Renaming a configuration is considered the same as moving a
* configuration.
* </p>
- *
+ *
* @param addedConfiguration a launch configuration for which an add
* notification is being broadcast
* @return the launch configuration that the added launch configuration was
@@ -325,7 +326,7 @@ public interface ILaunchManager {
* @since 2.1
*/
public ILaunchConfiguration getMovedFrom(ILaunchConfiguration addedConfiguration);
-
+
/**
* When a launch configuration is deleted or moved, registered launch
* configuration listeners (see <code>ILaunchConfigurationListener</code>)
@@ -348,8 +349,8 @@ public interface ILaunchManager {
* result of a move
* @since 2.1
*/
- public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration);
-
+ public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration);
+
/**
* Returns the native system environment variables as a map of
* variable names and values (Strings).
@@ -357,19 +358,19 @@ public interface ILaunchManager {
* Note that WIN32 system environment preserves
* the case of variable names but is otherwise case insensitive.
* Depending on what you intend to do with the environment, the
- * lack of normalization may or may not be create problems. On
+ * lack of normalization may or may not be create problems. On
* WIN32, this method normalizes mixed-case keys variable names
* to upper case. Use {@link #getNativeEnvironmentCasePreserved()}
* instead to get a WIN32 system environment where the keys are
* the mixed-case variable names recorded by the OS.
* </p>
- *
+ *
* @return the native system environment variables; on WIN32, mixed-case
* variable names (keys) have been normalized to upper case
* (key type: <code>String</code>; value type: <code>String</code>)
* @since 3.0
- */
- public Map getNativeEnvironment();
+ */
+ public Map<String, String> getNativeEnvironment();
/**
* Returns the native system environment variables as a map of
@@ -379,18 +380,18 @@ public interface ILaunchManager {
* the case of variable names but is otherwise case insensitive.
* Depending on what you intend to do with the environment, the
* lack of normalization may or may not be create problems. This
- * method returns mixed-case keys using the variable names
+ * method returns mixed-case keys using the variable names
* recorded by the OS.
* Use {@link #getNativeEnvironment()} instead to get a WIN32 system
* environment where all keys have been normalized to upper case.
* </p>
- *
+ *
* @return the native system environment variables; on WIN32, mixed-case
* variable names (keys) are returned without normalization
* (key type: <code>String</code>; value type: <code>String</code>)
* @since 3.1
- */
- public Map getNativeEnvironmentCasePreserved();
+ */
+ public Map<String, String> getNativeEnvironmentCasePreserved();
/**
* Returns the collection of processes currently registered with this
@@ -399,21 +400,21 @@ public interface ILaunchManager {
* @return an array of processes
*/
public IProcess[] getProcesses();
-
+
/**
* Returns the source container type extension registered with the
* given unique identifier, or <code>null</code> if none.
- *
+ *
* @param id unique identifier of a source container type extension
* @return the source container type extension registered with the
* given unique identifier, or <code>null</code> if none
* @since 3.0
*/
public ISourceContainerType getSourceContainerType(String id);
-
+
/**
* Returns all registered source container type extensions.
- *
+ *
* @return all registered source container type extensions
* @since 3.0
*/
@@ -424,7 +425,7 @@ public interface ILaunchManager {
* the given launch configuration, or <code>null</code> if a source path
* computer has not been registered for the associated launch configuration
* type.
- *
+ *
* @param configuration a launch configuration
* @return a source path computer registered for the associated launch
* configurations type, or <code>null</code> if unspecified
@@ -433,43 +434,43 @@ public interface ILaunchManager {
* @since 3.0
*/
public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException;
-
+
/**
* Returns the source path computer extension registered with the given
* unique identifier, or <code>null</code> if none.
- *
+ *
* @param id source path computer identifier
* @return the source path computer extension registered with the given
* unique identifier, or <code>null</code> if none
* @since 3.0
*/
- public ISourcePathComputer getSourcePathComputer(String id);
-
+ public ISourcePathComputer getSourcePathComputer(String id);
+
/**
- * Return <code>true</code> if there is a launch configuration with the specified name,
+ * Return <code>true</code> if there is a launch configuration with the specified name,
* <code>false</code> otherwise.
- *
+ *
* @return whether a launch configuration already exists with the given name
* @param name the name of the launch configuration whose existence is being checked
* @exception CoreException if unable to retrieve existing launch configuration names
* @since 2.0
*/
public boolean isExistingLaunchConfigurationName(String name) throws CoreException;
-
+
/**
* Returns whether the given launch is currently registered.
- *
+ *
* @param launch a launch
* @return whether the launch is currently registered
* @since 3.1
*/
public boolean isRegistered(ILaunch launch);
-
+
/**
* Creates and returns a new source locator of the specified
* type.
- *
- * @param identifier the identifier associated with a
+ *
+ * @param identifier the identifier associated with a
* persistable source locator extension
* @return a source locator
* @exception CoreException if an exception occurs creating
@@ -493,7 +494,7 @@ public interface ILaunchManager {
* of listeners notified when a launch configuration is
* added, removed, or changed. Has no effect if the given listener
* is not already registered.
- *
+ *
* @param listener launch configuration listener
* @since 2.0
*/
@@ -508,7 +509,7 @@ public interface ILaunchManager {
* @since 2.1
*/
public void removeLaunches(ILaunch[] launches);
-
+
/**
* Removes the given listener from the collection of registered launch listeners.
* Has no effect if an identical listener is not already registered.
@@ -517,7 +518,7 @@ public interface ILaunchManager {
* @since 2.1
*/
public void removeLaunchListener(ILaunchesListener listener);
-
+
/**
* Removes the given listener from the collection of registered launch listeners.
* Has no effect if an identical listener is not already registered.
@@ -525,7 +526,7 @@ public interface ILaunchManager {
* @param listener the listener to unregister
*/
public void removeLaunchListener(ILaunchListener listener);
-
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java
index 802ffc917..d412ca9bb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.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
*******************************************************************************/
@@ -47,7 +47,7 @@ import org.eclipse.debug.core.model.IProcess;
*/
public interface IProcessFactory {
-
+
/**
* Creates and returns a new process representing the given
* <code>java.lang.Process</code>. A streams proxy is created
@@ -62,5 +62,5 @@ public interface IProcessFactory {
* @return the process
* @see IProcess
*/
- public IProcess newProcess(ILaunch launch, Process process, String label, Map attributes);
+ public IProcess newProcess(ILaunch launch, Process process, String label, Map<String, String> attributes);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
index 2ce48cca6..8f54e9cbb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -14,7 +14,6 @@ package org.eclipse.debug.core;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
@@ -38,16 +37,15 @@ import org.eclipse.debug.internal.core.LaunchManager;
* @see ILaunch
* @see ILaunchManager
*/
-
public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILaunchListener, ILaunchConfigurationListener, IDebugEventSetListener {
-
+
/**
* The debug targets associated with this
* launch (the primary target is the first one
* in this collection), or empty if
* there are no debug targets.
*/
- private List fTargets= new ArrayList();
+ private List<IDebugTarget> fTargets = new ArrayList<IDebugTarget>();
/**
* The configuration that was launched, or null.
@@ -58,7 +56,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
* The system processes associated with
* this launch, or empty if none.
*/
- private List fProcesses= new ArrayList();
+ private List<IProcess> fProcesses = new ArrayList<IProcess>();
/**
* The source locator to use in the debug session
@@ -70,19 +68,19 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
* The mode this launch was launched in.
*/
private String fMode;
-
+
/**
* Table of client defined attributes
*/
- private HashMap fAttributes;
-
+ private HashMap<String, String> fAttributes;
+
/**
* Flag indicating that change notification should
* be suppressed. <code>true</code> until this
* launch has been initialized.
*/
private boolean fSuppressChange = true;
-
+
/**
* Constructs a launch with the specified attributes.
*
@@ -92,7 +90,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
* @param locator the source locator to use for this debug session, or
* <code>null</code> if not supported
*/
- public Launch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
+ public Launch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
fConfiguration = launchConfiguration;
setSourceLocator(locator);
fMode = mode;
@@ -100,35 +98,32 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
getLaunchManager().addLaunchListener(this);
getLaunchManager().addLaunchConfigurationListener(this);
}
-
+
/**
* Registers debug event listener.
*/
private void addEventListener() {
DebugPlugin.getDefault().addDebugEventListener(this);
}
-
+
/**
* Removes debug event listener.
*/
private void removeEventListener() {
DebugPlugin.getDefault().removeDebugEventListener(this);
}
-
+
/**
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
+ @Override
public boolean canTerminate() {
- List processes = getProcesses0();
- for (int i = 0; i < processes.size(); i++) {
- IProcess process = (IProcess)processes.get(i);
+ for (IProcess process : getProcesses0()) {
if (process.canTerminate()) {
return true;
}
}
- List targets = getDebugTargets0();
- for (int i = 0; i < targets.size(); i++) {
- IDebugTarget target = (IDebugTarget)targets.get(i);
+ for (IDebugTarget target : getDebugTargets0()) {
if (target.canTerminate() || target.canDisconnect()) {
return true;
}
@@ -139,8 +134,9 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/**
* @see ILaunch#getChildren()
*/
+ @Override
public Object[] getChildren() {
- ArrayList children = new ArrayList(getDebugTargets0());
+ ArrayList<Object> children = new ArrayList<Object>(getDebugTargets0());
children.addAll(getProcesses0());
return children.toArray();
}
@@ -148,77 +144,76 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/**
* @see ILaunch#getDebugTarget()
*/
+ @Override
public IDebugTarget getDebugTarget() {
if (!getDebugTargets0().isEmpty()) {
- return (IDebugTarget)getDebugTargets0().get(0);
+ return getDebugTargets0().get(0);
}
return null;
}
-
+
/**
* @see ILaunch#getProcesses()
*/
+ @Override
public IProcess[] getProcesses() {
- return (IProcess[])getProcesses0().toArray(new IProcess[getProcesses0().size()]);
+ return getProcesses0().toArray(new IProcess[getProcesses0().size()]);
}
-
+
/**
* Returns the processes associated with this
* launch, in its internal form - a list.
- *
+ *
* @return list of processes
*/
- protected List getProcesses0() {
+ protected List<IProcess> getProcesses0() {
return fProcesses;
- }
-
+ }
+
/**
* @see ILaunch#getSourceLocator()
*/
+ @Override
public ISourceLocator getSourceLocator() {
return fLocator;
}
-
+
/**
* @see ILaunch#setSourceLocator(ISourceLocator)
*/
+ @Override
public void setSourceLocator(ISourceLocator sourceLocator) {
fLocator = sourceLocator;
- }
+ }
/**
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
+ @Override
public boolean isTerminated() {
if (getProcesses0().isEmpty() && getDebugTargets0().isEmpty()) {
return false;
}
-
- Iterator processes = getProcesses0().iterator();
- while (processes.hasNext()) {
- IProcess process = (IProcess)processes.next();
+ for (IProcess process : getProcesses0()) {
if (!process.isTerminated()) {
return false;
}
}
-
- Iterator targets = getDebugTargets0().iterator();
- while (targets.hasNext()) {
- IDebugTarget target = (IDebugTarget)targets.next();
+ for (IDebugTarget target : getDebugTargets0()) {
if (!(target.isTerminated() || target.isDisconnected())) {
return false;
}
}
-
return true;
}
/**
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
+ @Override
public void terminate() throws DebugException {
- MultiStatus status=
- new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.Launch_terminate_failed, null);
+ MultiStatus status=
+ new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.Launch_terminate_failed, null);
//stop targets first to free up and sockets, etc held by the target
// terminate or disconnect debug target if it is still alive
IDebugTarget[] targets = getDebugTargets();
@@ -261,20 +256,22 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
IStatus[] children= status.getChildren();
if (children.length == 1) {
throw new DebugException(children[0]);
- }
+ }
throw new DebugException(status);
}
/**
* @see ILaunch#getLaunchMode()
*/
+ @Override
public String getLaunchMode() {
return fMode;
}
-
+
/**
* @see ILaunch#getLaunchConfiguration()
*/
+ @Override
public ILaunchConfiguration getLaunchConfiguration() {
return fConfiguration;
}
@@ -282,43 +279,47 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/**
* @see ILaunch#setAttribute(String, String)
*/
+ @Override
public void setAttribute(String key, String value) {
if (fAttributes == null) {
- fAttributes = new HashMap(5);
+ fAttributes = new HashMap<String, String>(5);
}
- fAttributes.put(key, value);
+ fAttributes.put(key, value);
}
/**
* @see ILaunch#getAttribute(String)
*/
+ @Override
public String getAttribute(String key) {
if (fAttributes == null) {
return null;
}
- return (String)fAttributes.get(key);
+ return fAttributes.get(key);
}
/**
* @see ILaunch#getDebugTargets()
*/
+ @Override
public IDebugTarget[] getDebugTargets() {
- return (IDebugTarget[])fTargets.toArray(new IDebugTarget[fTargets.size()]);
+ return fTargets.toArray(new IDebugTarget[fTargets.size()]);
}
-
+
/**
* Returns the debug targets associated with this
* launch, in its internal form - a list
- *
+ *
* @return list of debug targets
*/
- protected List getDebugTargets0() {
+ protected List<IDebugTarget> getDebugTargets0() {
return fTargets;
- }
+ }
/**
* @see ILaunch#addDebugTarget(IDebugTarget)
*/
+ @Override
public void addDebugTarget(IDebugTarget target) {
if (target != null) {
if (!getDebugTargets0().contains(target)) {
@@ -328,21 +329,23 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
}
}
-
+
/**
* @see ILaunch#removeDebugTarget(IDebugTarget)
*/
+ @Override
public void removeDebugTarget(IDebugTarget target) {
if (target != null) {
if (getDebugTargets0().remove(target)) {
fireChanged();
}
}
- }
-
+ }
+
/**
* @see ILaunch#addProcess(IProcess)
*/
+ @Override
public void addProcess(IProcess process) {
if (process != null) {
if (!getProcesses0().contains(process)) {
@@ -352,21 +355,22 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
}
}
-
+
/**
* @see ILaunch#removeProcess(IProcess)
*/
+ @Override
public void removeProcess(IProcess process) {
if (process != null) {
if (getProcesses0().remove(process)) {
fireChanged();
}
}
- }
-
+ }
+
/**
* Adds the given processes to this launch.
- *
+ *
* @param processes processes to add
*/
protected void addProcesses(IProcess[] processes) {
@@ -377,7 +381,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
}
}
-
+
/**
* Notifies listeners that this launch has changed.
* Has no effect of this launch has not yet been
@@ -402,84 +406,79 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
removeEventListener();
}
-
+
/**
* @see ILaunch#hasChildren()
*/
+ @Override
public boolean hasChildren() {
return getProcesses0().size() > 0 || (getDebugTargets0().size() > 0);
}
-
+
/**
- * Returns whether any processes or targets can be disconnected.
+ * Returns whether any processes or targets can be disconnected.
* Ones that are already terminated or disconnected are ignored.
- *
+ *
* @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
*/
+ @Override
public boolean canDisconnect() {
- List processes = getProcesses0();
- for (int i = 0; i < processes.size(); i++) {
- if (processes.get(i) instanceof IDisconnect) {
- IDisconnect process = (IDisconnect)processes.get(i);
- if (process.canDisconnect()) {
- return true;
- }
- }
- }
- List targets = getDebugTargets0();
- for (int i = 0; i < targets.size(); i++) {
- if ( ((IDebugTarget)targets.get(i)).canDisconnect() ) {
- return true;
- }
- }
+ for (IProcess process : getProcesses0()) {
+ if (process instanceof IDisconnect) {
+ if (((IDisconnect) process).canDisconnect()) {
+ return true;
+ }
+ }
+ }
+ for (IDebugTarget target : getDebugTargets0()) {
+ if (target.canDisconnect()) {
+ return true;
+ }
+ }
return false;
}
/**
* @see org.eclipse.debug.core.model.IDisconnect#disconnect()
*/
+ @Override
public void disconnect() throws DebugException {
- List processes = getProcesses0();
- for (int i = 0; i < processes.size(); i++) {
- if (processes.get(i) instanceof IDisconnect) {
- IDisconnect disconnect = (IDisconnect)processes.get(i);
- if (disconnect.canDisconnect()) {
- disconnect.disconnect();
- }
- }
- }
- List targets = getDebugTargets0();
- for (int i = 0; i < targets.size(); i++) {
- IDebugTarget debugTarget = (IDebugTarget)targets.get(i);
- if (debugTarget.canDisconnect()) {
- debugTarget.disconnect();
- }
- }
- }
-
- /**
- * Returns whether all of the contained targets and processes are
- * disconnected. Processes that don't support disconnecting are not
+ for (IProcess process : getProcesses0()) {
+ if (process instanceof IDisconnect) {
+ IDisconnect dis = (IDisconnect) process;
+ if (dis.canDisconnect()) {
+ dis.disconnect();
+ }
+ }
+ }
+ for (IDebugTarget target : getDebugTargets0()) {
+ if (target.canDisconnect()) {
+ target.disconnect();
+ }
+ }
+ }
+
+ /**
+ * Returns whether all of the contained targets and processes are
+ * disconnected. Processes that don't support disconnecting are not
* counted.
- *
+ *
* @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
*/
+ @Override
public boolean isDisconnected() {
- List processes = getProcesses0();
- for (int i = 0; i < processes.size(); i++) {
- if (processes.get(i) instanceof IDisconnect) {
- IDisconnect process = (IDisconnect)processes.get(i);
- if (!process.isDisconnected()) {
- return false;
- }
- }
- }
- List targets = getDebugTargets0();
- for (int i = 0; i < targets.size(); i++) {
- if ( !((IDebugTarget)targets.get(i)).isDisconnected() ) {
- return false;
- }
- }
+ for (IProcess process : getProcesses0()) {
+ if (process instanceof IDisconnect) {
+ if (!((IDisconnect) process).isDisconnected()) {
+ return false;
+ }
+ }
+ }
+ for (IDebugTarget target : getDebugTargets0()) {
+ if (!target.isDisconnected()) {
+ return false;
+ }
+ }
// only return true if there are processes or targets that are disconnected
return hasChildren();
}
@@ -487,6 +486,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchRemoved(org.eclipse.debug.core.ILaunch)
*/
+ @Override
public void launchRemoved(ILaunch launch) {
if (this.equals(launch)) {
removeEventListener();
@@ -497,7 +497,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/**
* Returns the launch manager.
- *
+ *
* @return the launch manager.
*/
protected ILaunchManager getLaunchManager() {
@@ -507,22 +507,25 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch)
*/
+ @Override
public void launchAdded(ILaunch launch) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch)
*/
+ @Override
public void launchChanged(ILaunch launch) {
}
/* (non-Javadoc)
- *
+ *
* If the launch configuration this launch is associated with is
* moved, update the underlying handle to the new location.
- *
+ *
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
ILaunchConfiguration from = getLaunchManager().getMovedFrom(configuration);
if (from != null && from.equals(getLaunchConfiguration())) {
@@ -534,15 +537,17 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void launchConfigurationChanged(ILaunchConfiguration configuration) {}
/* (non-Javadoc)
- *
+ *
* Update the launch configuration associated with this launch if the
* underlying configuration is deleted.
- *
+ *
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
if (configuration.equals(getLaunchConfiguration())) {
if (getLaunchManager().getMovedTo(configuration) == null) {
@@ -555,6 +560,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/* (non-Javadoc)
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
*/
+ @Override
public void handleDebugEvents(DebugEvent[] events) {
for (int i = 0; i < events.length; i++) {
DebugEvent event = events[i];
@@ -578,6 +584,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
/* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/
+ @Override
public Object getAdapter(Class adapter) {
if (adapter.equals(ILaunch.class)) {
return this;
@@ -588,7 +595,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
return super.getAdapter(adapter);
}
-
-
+
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java
index 0a2a2bc44..06913be28 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 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
@@ -19,12 +19,13 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.internal.core.DebugCoreMessages;
@@ -37,7 +38,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* Utilities for launch configurations that persist, restore, and refresh
* collections of resources.
- *
+ *
* @since 3.6
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
@@ -60,82 +61,84 @@ public class RefreshUtil {
* of one.
*/
public static final String ATTR_REFRESH_RECURSIVE = DebugPlugin.getUniqueIdentifier() + ".ATTR_REFRESH_RECURSIVE"; //$NON-NLS-1$
-
+
/**
* Resource memento referring to the selected resource's project.
* Only works when the debug user interface is running.
- *
+ *
* @see #toResources(String)
*/
public static final String MEMENTO_SELECTED_PROJECT = "${project}"; //$NON-NLS-1$
-
+
/**
* Resource memento referring to the selected resource's container.
* Only works when the debug user interface is running.
- *
+ *
* @see #toResources(String)
- */
+ */
public static final String MEMENTO_SELECTED_CONTAINER = "${container}"; //$NON-NLS-1$
-
+
/**
* Resource memento referring to the selected resource.
* Only works when the debug user interface is running.
- *
+ *
* @see #toResources(String)
- */
+ */
public static final String MEMENTO_SELECTED_RESOURCE = "${resource}"; //$NON-NLS-1$
-
+
/**
* Resource memento referring to the workspace root.
- *
+ *
* @see #toResources(String)
- */
+ */
public static final String MEMENTO_WORKSPACE = "${workspace}"; //$NON-NLS-1$
-
+
/**
* Indicates no working set has been selected (for backwards compatibility).
* The new format uses an empty working set
*/
-
+
private static final String NO_WORKING_SET = "NONE"; //$NON-NLS-1$
/**
* Refreshes the resources as specified by the given launch configuration.
- *
+ *
* @param resources
* resources to refresh
* @param depth one of {@link IResource#DEPTH_INFINITE}, {@link IResource#DEPTH_ONE},
- * or {@link IResource#DEPTH_ZERO}
+ * or {@link IResource#DEPTH_ZERO}
* @param monitor
* progress monitor which may be <code>null</code>
* @throws CoreException
* if an exception occurs while refreshing resources
*/
public static void refreshResources(IResource[] resources, int depth, IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
if (resources == null || resources.length == 0) {
return;
}
- if (monitor.isCanceled()) {
+ SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.RefreshingResources, resources.length);
+ if (lmonitor.isCanceled()) {
return;
}
- monitor.beginTask(DebugCoreMessages.RefreshingResources, resources.length);
MultiStatus status = new MultiStatus(DebugPlugin.getUniqueIdentifier(), 0, DebugCoreMessages.RefreshingResourcesError, null);
- for (int i = 0; i < resources.length; i++) {
- if (monitor.isCanceled())
- break;
- if (resources[i] != null && resources[i].isAccessible()) {
- try {
- resources[i].refreshLocal(depth, null);
- } catch (CoreException e) {
- status.merge(e.getStatus());
+ try {
+ for (int i = 0; i < resources.length; i++) {
+ if (lmonitor.isCanceled()) {
+ break;
+ }
+ if (resources[i] != null && resources[i].isAccessible()) {
+ try {
+ resources[i].refreshLocal(depth, null);
+ } catch (CoreException e) {
+ status.merge(e.getStatus());
+ }
}
+ lmonitor.worked(1);
}
- monitor.worked(1);
}
- monitor.done();
+ finally {
+ lmonitor.done();
+ }
if (!status.isOK()) {
throw new CoreException(status);
}
@@ -144,7 +147,7 @@ public class RefreshUtil {
/**
* Returns a collection of resources referred to by the specified
* memento generated via {@link #toMemento(IResource[])}.
- *
+ *
* @param memento
* resource memento generated by this manager
* @return collection of resources referred to by the memento
@@ -160,7 +163,7 @@ public class RefreshUtil {
if (resource == null) {
throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
IStatus.ERROR, MessageFormat.format(DebugCoreMessages.RefreshUtil_1,
- new String[] { pathString }), null));
+ new Object[] { pathString }), null));
}
return new IResource[] { resource };
} else if (memento.startsWith("${working_set:")) { //$NON-NLS-1$
@@ -191,13 +194,13 @@ public class RefreshUtil {
}
}
}
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), MessageFormat.format(DebugCoreMessages.RefreshUtil_0, new String[]{memento})));
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), MessageFormat.format(DebugCoreMessages.RefreshUtil_0, new Object[] { memento })));
}
-
+
/**
* Returns a memento for a collection of resources that can be restored
* via {@link #toResources(String)}.
- *
+ *
* @param resources resources to create a memento for
* @return memento for the given resources
*/
@@ -219,11 +222,11 @@ public class RefreshUtil {
buf.append("}"); //$NON-NLS-1$
return buf.toString();
}
-
+
/**
* Restores a collection of resources from a working set memento, for backwards
* compatibility.
- *
+ *
* @param wsMemento working set memento
* @return resource collection, possibly empty
*/
@@ -233,7 +236,7 @@ public class RefreshUtil {
return null;
}
- List resourcesList = new ArrayList();
+ List<IAdaptable> resourcesList = new ArrayList<IAdaptable>();
StringReader reader = new StringReader(wsMemento);
XMLMemento memento = null;
@@ -244,20 +247,19 @@ public class RefreshUtil {
return null;
}
- XMLMemento[] mementos = memento
- .getChildren(IMementoConstants.MEMENTO_ITEM);
+ XMLMemento[] mementos = memento.getChildren(IMementoConstants.MEMENTO_ITEM);
for (int i = 0; i < mementos.length; i++) {
resourcesList.add(ResourceFactory.createElement(mementos[i]));
}
- return (IResource[]) resourcesList.toArray(new IResource[resourcesList.size()]);
+ return resourcesList.toArray(new IResource[resourcesList.size()]);
+
+ }
- }
-
/**
* Returns whether the refresh scope specified by the given launch
* configuration is recursive.
- *
+ *
* @param configuration the {@link ILaunchConfiguration}
* @return whether the refresh scope is recursive
* @throws CoreException
@@ -265,12 +267,12 @@ public class RefreshUtil {
*/
public static boolean isRefreshRecursive(ILaunchConfiguration configuration) throws CoreException {
return configuration.getAttribute(ATTR_REFRESH_RECURSIVE, true);
- }
-
+ }
+
/**
* Refreshes the resources as specified by the given launch configuration via its
* {@link RefreshUtil#ATTR_REFRESH_SCOPE} and {@link #ATTR_REFRESH_RECURSIVE} attributes.
- *
+ *
* @param configuration launch configuration
* @param monitor progress monitor which may be <code>null</code>
* @throws CoreException
@@ -289,5 +291,5 @@ public class RefreshUtil {
refreshResources(resources, depth, monitor);
}
}
- }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
index 2d2128b7d..4674482f5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -33,25 +33,25 @@ import org.eclipse.debug.internal.core.DebugOptions;
* @since 3.6
*/
public abstract class AbstractDebugCommand implements IDebugCommandHandler {
-
+
/**
* Job to update enabled state of action.
*/
private class UpdateJob extends Job implements IJobChangeListener {
-
+
/**
* The request to update
*/
private IEnabledStateRequest request;
-
+
/**
* Whether this job has been run
*/
private boolean run = false;
-
+
/**
* Creates a new job to update the specified request
- *
+ *
* @param stateRequest the {@link IEnabledStateRequest}
*/
UpdateJob(IEnabledStateRequest stateRequest) {
@@ -61,10 +61,11 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
setRule(getEnabledStateSchedulingRule(request));
getJobManager().addJobChangeListener(this);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected IStatus run(IProgressMonitor monitor) {
run = true;
if (DebugOptions.DEBUG_COMMANDS) {
@@ -116,10 +117,11 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
monitor.done();
return Status.OK_STATUS;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
*/
+ @Override
public boolean belongsTo(Object family) {
Object myFamily = getEnabledStateJobFamily(request);
if (myFamily != null) {
@@ -128,12 +130,15 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
return false;
}
+ @Override
public void aboutToRun(IJobChangeEvent event) {
}
+ @Override
public void awake(IJobChangeEvent event) {
}
+ @Override
public void done(IJobChangeEvent event) {
if (event.getJob() == this) {
if (!run) {
@@ -147,17 +152,20 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
}
}
+ @Override
public void running(IJobChangeEvent event) {
}
+ @Override
public void scheduled(IJobChangeEvent event) {
}
+ @Override
public void sleeping(IJobChangeEvent event) {
}
-
+
}
-
+
/**
* Scheduling rule to serialize commands on an object
*/
@@ -171,18 +179,20 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
*/
+ @Override
public boolean contains(ISchedulingRule rule) {
return rule == this;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule)
*/
+ @Override
public boolean isConflicting(ISchedulingRule rule) {
if (rule instanceof SerialPerObjectRule) {
SerialPerObjectRule vup = (SerialPerObjectRule) rule;
@@ -192,12 +202,14 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.commands.IDebugCommandHandler#execute(org.eclipse.debug.core.commands.IDebugCommandRequest)
*/
+ @Override
public boolean execute(final IDebugCommandRequest request) {
Job job = new Job(getExecuteTaskName()) {
+ @Override
protected IStatus run(IProgressMonitor monitor) {
if (DebugOptions.DEBUG_COMMANDS) {
DebugOptions.trace("execute: " + AbstractDebugCommand.this); //$NON-NLS-1$
@@ -222,6 +234,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
monitor.done();
return Status.OK_STATUS;
}
+ @Override
public boolean belongsTo(Object family) {
Object jobFamily = getExecuteJobFamily(request);
if (jobFamily != null) {
@@ -234,53 +247,54 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
job.setRule(getExecuteSchedulingRule(request));
job.schedule();
return isRemainEnabled(request);
- }
-
+ }
+
/**
* Returns whether this command should remain enabled after starting execution of the specified request.
- *
+ *
* @param request the request being executed
* @return whether to remain enabled while executing the request
*/
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.commands.IDebugCommandHandler#canExecute(org.eclipse.debug.core.commands.IEnabledStateRequest)
*/
+ @Override
public void canExecute(final IEnabledStateRequest request) {
Job job = new UpdateJob(request);
job.schedule();
}
-
+
/**
* Returns the name to use for a job and progress monitor task names when performing
* an {@link IEnabledStateRequest}.
- *
+ *
* @return task name
*/
protected String getEnabledStateTaskName() {
// this is a system job name and does not need to be NLS'd
return "Check Debug Command"; //$NON-NLS-1$
}
-
+
/**
* Returns the name to use for jobs and progress monitor task names when executing
* an {@link IDebugCommandRequest}.
- *
+ *
* @return task name
*/
protected String getExecuteTaskName() {
// this is a system job name and does not need to be NLS'd
return "Execute Debug Command"; //$NON-NLS-1$
- }
+ }
/**
* Executes this command synchronously on the specified targets, reporting progress. This method
* is called by a job. If an exception is thrown, the calling job will set the associated status
* on the request object. The calling job also calls #done() on the request object after this method
- * is called, and sets a cancel status on the progress monitor if the request is canceled.
+ * is called, and sets a cancel status on the progress monitor if the request is canceled.
* <p>
* Handlers must override this method.
* </p>
@@ -296,7 +310,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
* is called by a job. If an exception is thrown, the calling job will set the associated status
* on the request object and report that this command is not enabled. The calling job also calls #done()
* on the request object after this method is called, and sets a cancel status on the progress monitor if
- * the request is canceled. Enabled state is set to <code>false</code> if the request is canceled.
+ * the request is canceled. Enabled state is set to <code>false</code> if the request is canceled.
* <p>
* Handlers must override this method.
* </p>
@@ -307,7 +321,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
* @throws CoreException if a problem is encountered
*/
protected abstract boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request) throws CoreException;
-
+
/**
* Returns the appropriate target for this command handler for the given object.
* This method is called to map each element in a command request to the target
@@ -317,23 +331,23 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
* <p>
* Clients must override this method.
* </p>
- * @param element element from a {@link IDebugCommandRequest}
+ * @param element element from a {@link IDebugCommandRequest}
* @return associated target object for execution or enabled state update. Cannot return <code>null</code>.
*/
- protected abstract Object getTarget(Object element);
-
+ protected abstract Object getTarget(Object element);
+
/**
* Convenience method to return an adapter of the specified type for the given object or <code>null</code>
* if none.
- *
+ *
* @param element element to retrieve adapter for
* @param type adapter type
* @return adapter or <code>null</code>
*/
- protected Object getAdapter(Object element, Class type) {
- return DebugPlugin.getAdapter(element, type);
- }
-
+ protected Object getAdapter(Object element, Class<?> type) {
+ return DebugPlugin.getAdapter(element, type);
+ }
+
/**
* Returns a scheduling rule for this command's {@link IEnabledStateRequest} update job
* or <code>null</code> if none. By default a rule is created to serialize
@@ -347,7 +361,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
protected ISchedulingRule getEnabledStateSchedulingRule(IDebugCommandRequest request) {
return new SerialPerObjectRule(request.getElements()[0]);
}
-
+
/**
* Returns a scheduling rule for this command's {@link IDebugCommandRequest} execute job
* or <code>null</code> if none. By default, execution jobs have no scheduling rule.
@@ -360,7 +374,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
protected ISchedulingRule getExecuteSchedulingRule(IDebugCommandRequest request) {
return null;
}
-
+
/**
* Returns the job family for the this command's {@link IEnabledStateRequest} update job
* or <code>null</code> if none. The default implementation returns <code>null</code>.
@@ -372,8 +386,8 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
*/
protected Object getEnabledStateJobFamily(IDebugCommandRequest request) {
return null;
- }
-
+ }
+
/**
* Returns the job family for the this command's {@link IDebugCommandRequest} execute job
* or <code>null</code> if none. The default implementation returns <code>null</code>.
@@ -385,11 +399,11 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
*/
protected Object getExecuteJobFamily(IDebugCommandRequest request) {
return null;
- }
-
+ }
+
/**
* Returns an array of objects with duplicates removed, if any.
- *
+ *
* @param objects array of objects
* @return array of object in same order with duplicates removed, if any.
*/
@@ -397,12 +411,12 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
if (objects.length == 1) {
return objects;
} else {
- LinkedHashSet set = new LinkedHashSet(objects.length);
+ LinkedHashSet<Object> set = new LinkedHashSet<Object>(objects.length);
for (int i = 0; i < objects.length; i++) {
set.add(objects[i]);
}
return set.toArray();
}
}
-
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
index 442a331cb..6a6aab9f8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
@@ -1,16 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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
*******************************************************************************/
package org.eclipse.debug.core.model;
-
+
import java.util.Map;
import org.eclipse.core.resources.IMarker;
@@ -35,7 +35,7 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
* Abstract implementation of a breakpoint. This class is
* intended to be sub-classed by implementations
* of breakpoints.
- *
+ *
* @see IBreakpoint
* @since 2.0
*/
@@ -44,7 +44,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
* Creates a breakpoint.
- *
+ *
* @since 3.8
*/
public Breakpoint() {
@@ -60,55 +60,62 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
* @see IBreakpoint#setMarker(IMarker)
*/
+ @Override
public void setMarker(IMarker marker) throws CoreException {
fMarker= marker;
}
-
+
/**
* @see Object#equals(Object)
*/
+ @Override
public boolean equals(Object item) {
if (item instanceof IBreakpoint) {
return getMarker().equals(((IBreakpoint)item).getMarker());
}
return false;
}
-
+
/**
* @see Object#hashCode()
*/
+ @Override
public int hashCode() {
return getMarker().hashCode();
}
-
+
/**
* @see IBreakpoint#setEnabled(boolean)
*/
+ @Override
public void setEnabled(boolean enabled) throws CoreException {
if (enabled != isEnabled()) {
setAttribute(ENABLED, enabled);
}
}
-
+
/**
* @see IBreakpoint#isEnabled()
*/
+ @Override
public boolean isEnabled() throws CoreException {
return getMarker().getAttribute(ENABLED, false);
}
-
+
/**
* @see IBreakpoint#isRegistered()
*/
+ @Override
public boolean isRegistered() throws CoreException {
IMarker marker= getMarker();
return marker.exists() && marker.getAttribute(REGISTERED, true);
- }
-
+ }
+
/**
* @see IBreakpoint#setRegistered(boolean)
*/
+ @Override
public void setRegistered(boolean registered) throws CoreException {
if (isRegistered() != registered) {
setAttribute(REGISTERED, registered);
@@ -119,11 +126,12 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
mgr.removeBreakpoint(this, false);
}
}
- }
+ }
/**
* @see IBreakpoint#delete()
*/
+ @Override
public void delete() throws CoreException {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(this, false);
getMarker().delete();
@@ -132,6 +140,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
* @see IBreakpoint#getMarker()
*/
+ @Override
public IMarker getMarker() {
return fMarker;
}
@@ -139,6 +148,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
* @see IBreakpoint#isPersisted()
*/
+ @Override
public boolean isPersisted() throws CoreException {
return getMarker().getAttribute(PERSISTED, true);
}
@@ -146,18 +156,19 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
* @see IBreakpoint#setPersisted(boolean)
*/
+ @Override
public void setPersisted(boolean persisted) throws CoreException {
if (isPersisted() != persisted) {
setAttributes(new String[] {PERSISTED, IMarker.TRANSIENT}, new Object[] {Boolean.valueOf(persisted), Boolean.valueOf(!persisted)});
}
}
-
+
/**
* Convenience method to set the given boolean attribute of
* this breakpoint's underlying marker in a workspace
* runnable. Setting marker attributes in a workspace runnable
* prevents deadlock.
- *
+ *
* @param attributeName attribute name
* @param value attribute value
* @exception CoreException is setting the attribute fails
@@ -166,20 +177,21 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
protected void setAttribute(final String attributeName, final boolean value) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ensureMarker().setAttribute(attributeName, value);
}
};
-
+
workspace.run(runnable, getMarkerRule(), 0, null);
}
-
+
/**
* Convenience method to set the given integer attribute of
* this breakpoint's underlying marker in a workspace
* runnable. Setting marker attributes in a workspace runnable
* prevents deadlock.
- *
+ *
* @param attributeName attribute name
* @param value attribute value
* @exception CoreException is setting the attribute fails
@@ -188,11 +200,12 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
protected void setAttribute(final String attributeName, final int value) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ensureMarker().setAttribute(attributeName, value);
}
};
-
+
workspace.run(runnable, getMarkerRule(), 0, null);
}
@@ -201,7 +214,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
* this breakpoint's underlying marker in a workspace
* runnable. Setting marker attributes in a workspace runnable
* prevents deadlock.
- *
+ *
* @param attributeName attribute name
* @param value attribute value
* @exception CoreException is setting the attribute fails
@@ -210,11 +223,12 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
protected void setAttribute(final String attributeName, final Object value) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ensureMarker().setAttribute(attributeName, value);
}
};
-
+
workspace.run(runnable, getMarkerRule(), 0, null);
}
@@ -223,7 +237,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
* this breakpoint's underlying marker in a workspace
* runnable. Setting marker attributes in a workspace runnable
* prevents deadlock.
- *
+ *
* @param attributeNames attribute names
* @param values attribute values
* @exception CoreException is setting the attributes fails
@@ -232,11 +246,12 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
protected void setAttributes(final String[] attributeNames, final Object[] values) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ensureMarker().setAttributes(attributeNames, values);
}
};
-
+
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
@@ -245,41 +260,42 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
* this breakpoint's underlying marker in a workspace
* runnable. Setting marker attributes in a workspace runnable
* prevents deadlock.
- *
+ *
* @param attributes attribute map
* @exception CoreException is setting the attributes fails
* @see IMarker#setAttributes(java.util.Map)
*/
- protected void setAttributes(final Map attributes) throws CoreException{
+ protected void setAttributes(final Map<String, ? extends Object> attributes) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
ensureMarker().setAttributes(attributes);
}
};
-
+
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
/**
* Returns the marker associated with this breakpoint.
- *
+ *
* @return breakpoint marker
- * @exception DebugException if no marker is associated with
+ * @exception DebugException if no marker is associated with
* this breakpoint or the associated marker does not exist
*/
protected IMarker ensureMarker() throws DebugException {
IMarker m = getMarker();
if (m == null || !m.exists()) {
throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED,
- DebugCoreMessages.Breakpoint_no_associated_marker, null));
+ DebugCoreMessages.Breakpoint_no_associated_marker, null));
}
return m;
}
-
+
/**
* Returns whether this breakpoint has an associated marker that exists.
- *
+ *
* @return returns whether this breakpoint has an associated marker that exists
* @since 2.1
*/
@@ -291,7 +307,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
/**
* Returns a scheduling rule to use when modifying markers on the given resource,
* possibly <code>null</code>.
- *
+ *
* @param resource a resource on which a marker will be created, modified, or deleted
* @return a scheduling rule to use when modifying markers on the given resource
* possibly <code>null</code>
@@ -305,13 +321,13 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
}
return rule;
}
-
+
/**
- * Returns a scheduling rule to use when modifying or deleting this breakpoint's marker,
+ * Returns a scheduling rule to use when modifying or deleting this breakpoint's marker,
* possibly <code>null</code>. This method is only valid when this breakpoint's
* marker has already been created. When creating a marker on a specific resource,
* use <code>getMarkerRule(IResource)</code> instead.
- *
+ *
* @return a scheduling rule to use when modifying or deleting this breakpoint's marker
* @since 3.1
*/
@@ -327,10 +343,10 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
}
return rule;
}
-
+
/**
* Execute the given workspace runnable with the scheduling rule to use when running the operation.
- *
+ *
* @param rule the rule to use when running the operation
* @param wr the runnable operation
* @throws DebugException If a core exception occurs performing the operation
@@ -341,7 +357,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
ResourcesPlugin.getWorkspace().run(wr, rule, 0, null);
} catch (CoreException e) {
throw new DebugException(e.getStatus());
- }
- }
-
+ }
+ }
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java
index bf5a31865..71e606570 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 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
@@ -27,13 +27,13 @@ import org.eclipse.debug.core.ILaunchConfiguration;
* @since 3.1
*/
public abstract class DebugElement extends PlatformObject implements IDebugElement {
-
+
private IDebugTarget fTarget;
/**
* Constructs a debug element referring to an artifact in the given
* debug target.
- *
+ *
* @param target debug target containing this element
*/
public DebugElement(IDebugTarget target) {
@@ -41,34 +41,38 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme
}
/* (non-Javadoc)
- *
+ *
* Debug target implementation should override this method.
- *
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
*/
- public IDebugTarget getDebugTarget() {
+ @Override
+ public IDebugTarget getDebugTarget() {
return fTarget;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
*/
- public ILaunch getLaunch() {
+ @Override
+ public ILaunch getLaunch() {
return getDebugTarget().getLaunch();
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
- public Object getAdapter(Class adapter) {
+ @Override
+ public Object getAdapter(Class adapter) {
if (adapter == IDebugElement.class) {
return this;
}
-
+
// a debug target may not implement IStepFilters
if (adapter == IStepFilters.class) {
- if (getDebugTarget() instanceof IStepFilters)
+ if (getDebugTarget() instanceof IStepFilters) {
return getDebugTarget();
+ }
}
if (adapter == IDebugTarget.class) {
return getDebugTarget();
@@ -88,81 +92,81 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme
/**
* Fires a debug event.
- *
+ *
* @param event debug event to fire
*/
public void fireEvent(DebugEvent event) {
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
- }
+ }
/**
* Fires a change event for this debug element
* with the specified detail code.
- *
+ *
* @param detail detail code for the change event,
* such as <code>DebugEvent.STATE</code> or <code>DebugEvent.CONTENT</code>
*/
public void fireChangeEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.CHANGE, detail));
}
-
+
/**
* Fires a creation event for this debug element.
*/
public void fireCreationEvent() {
fireEvent(new DebugEvent(this, DebugEvent.CREATE));
- }
-
+ }
+
/**
* Fires a resume for this debug element with
* the specified detail code.
- *
- * @param detail detail code for the resume event, such
+ *
+ * @param detail detail code for the resume event, such
* as <code>DebugEvent.STEP_OVER</code>
*/
public void fireResumeEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
}
-
+
/**
* Fires a suspend event for this debug element with
* the specified detail code.
- *
+ *
* @param detail detail code for the suspend event, such
* as <code>DebugEvent.BREAKPOINT</code>
*/
public void fireSuspendEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
- }
-
+ }
+
/**
* Fires a terminate event for this debug element.
*/
public void fireTerminateEvent() {
fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
- }
-
+ }
+
/**
* Throws a debug exception with a status code of <code>TARGET_REQUEST_FAILED</code>.
- *
+ *
* @param message exception message
* @param e underlying exception or <code>null</code>
* @throws DebugException if a problem is encountered
*/
protected void requestFailed(String message, Throwable e) throws DebugException {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
DebugException.TARGET_REQUEST_FAILED, message, e));
}
-
+
/**
* Throws a debug exception with a status code of <code>NOT_SUPPORTED</code>.
- *
+ *
* @param message exception message
* @param e underlying exception or <code>null</code>
* @throws DebugException if a problem is encountered
*/
protected void notSupported(String message, Throwable e) throws DebugException {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
DebugException.NOT_SUPPORTED, message, e));
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java
index cbafd8933..302d19001 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 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
@@ -40,28 +40,28 @@ import org.eclipse.debug.core.IBreakpointManager;
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @see IBreakpointManager
* @since 3.5
*/
public interface IBreakpointImportParticipant {
-
+
/**
* Determines if the given attributes match the given breakpoint.
- *
+ *
* @param attributes the map of raw breakpoint attributes read from the import memento
* @param breakpoint the current breakpoint context in the import operation
* @return true if the breakpoint matches the given attributes, false otherwise
* @throws CoreException if an exception occurs
*/
- public boolean matches(Map attributes, IBreakpoint breakpoint) throws CoreException;
-
+ public boolean matches(Map<String, Object> attributes, IBreakpoint breakpoint) throws CoreException;
+
/**
* Verifies the state of the breakpoint once it has been imported. This method can be used to correct
* attributes of the imported breakpoint once it has been imported.
- *
+ *
* For example: updating line number information or character ranges to ensure the marker appears correctly
- *
+ *
* @param breakpoint the breakpoint to be verified
* @throws CoreException if an exception occurs
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java
index 31c4f25d7..5509a78a9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java
@@ -1,16 +1,16 @@
/*******************************************************************************
- * 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
*******************************************************************************/
package org.eclipse.debug.core.model;
-
+
/**
* An expression is a snippet of code that can be evaluated
* to produce a value. When and how an expression is evaluated
@@ -23,17 +23,17 @@ package org.eclipse.debug.core.model;
* evaluate an expression once to produce a value that can
* be inspected iteratively, or they may wish to evaluate an
* expression iteratively producing new values each time
- * (i.e. as in a watch list).
+ * (i.e. as in a watch list).
* <p>
* Clients are intended to implement this interface.
* </p>
* @since 2.0
*/
public interface IExpression extends IDebugElement {
-
+
/**
* Returns this expression's snippet of code.
- *
+ *
* @return the expression
*/
public abstract String getExpressionText();
@@ -42,21 +42,22 @@ public interface IExpression extends IDebugElement {
* Returns the current value of this expression or
* <code>null</code> if this expression does not
* currently have a value.
- *
+ *
* @return value or <code>null</code>
*/
public abstract IValue getValue();
-
+
/**
* Returns the debug target this expression is associated
* with, or <code>null</code> if this expression is not
* associated with a debug target.
- *
+ *
* @return debug target or <code>null</code>
* @see IDebugElement#getDebugTarget()
*/
+ @Override
public abstract IDebugTarget getDebugTarget();
-
+
/**
* Notifies this expression that it has been removed
* from the expression manager. Any required clean up
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFilteredStep.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFilteredStep.java
index 24e375c12..a0854de9b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFilteredStep.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFilteredStep.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
*******************************************************************************/
@@ -23,6 +23,7 @@ import org.eclipse.debug.core.DebugException;
* @since 2.1
* @deprecated clients should implement <code>IStepFilters</code> instead
*/
+@Deprecated
public interface IFilteredStep extends IStep {
/**
* Returns whether this element can currently perform a filtered step into.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
index cf91b20cc..d44785dd7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 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
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.debug.core.model;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -26,6 +25,7 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
@@ -41,12 +41,14 @@ import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
+import com.ibm.icu.text.MessageFormat;
+
/**
* Default implementation of a launch configuration delegate. Provides
* convenience methods for computing the build order of projects,
* building projects, and searching for errors in the workspace. The
* default pre-launch check prompts the user to launch in debug mode
- * if breakpoints are present in the workspace.
+ * if breakpoints are present in the workspace.
* <p>
* Clients implementing launch configuration delegates should subclass
* this class.
@@ -54,66 +56,68 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
* @since 3.0
*/
public abstract class LaunchConfigurationDelegate implements ILaunchConfigurationDelegate2 {
-
+
/**
* Constant to define debug.core for the status codes
- *
+ *
* @since 3.2
*/
private static final String DEBUG_CORE = "org.eclipse.debug.core"; //$NON-NLS-1$
-
+
/**
* Constant to define debug.ui for the status codes
- *
+ *
* @since 3.2
*/
private static final String DEBUG_UI = "org.eclipse.debug.ui"; //$NON-NLS-1$
-
+
/**
* Status code for which a UI prompter is registered.
*/
protected static final IStatus promptStatus = new Status(IStatus.INFO, DEBUG_UI, 200, IInternalDebugCoreConstants.EMPTY_STRING, null);
-
+
/**
* Status code for which a prompter is registered to ask the user if they
* want to launch in debug mode when breakpoints are present.
*/
protected static final IStatus switchToDebugPromptStatus = new Status(IStatus.INFO, DEBUG_CORE, 201, IInternalDebugCoreConstants.EMPTY_STRING, null);
-
+
/**
* Status code for which a prompter is registered to ask the user if the
* want to continue launch despite existing compile errors
*/
protected static final IStatus complileErrorPromptStatus = new Status(IStatus.INFO, DEBUG_CORE, 202, IInternalDebugCoreConstants.EMPTY_STRING, null);
-
+
/**
* Status code for which a prompter will ask the user to save any/all of the dirty editors which have only to do
* with this launch (scoping them to the current launch/build)
- *
+ *
* @since 3.2
*/
protected static final IStatus saveScopedDirtyEditors = new Status(IStatus.INFO, DEBUG_CORE, 222, IInternalDebugCoreConstants.EMPTY_STRING, null);
-
+
/**
* Status code for which a prompter is registered to ask the user if the
* want to continue launch despite existing compile errors in specific
* projects. This enhances the 'compileErrorPromptStatus' by specifying
* which projects the errors exist in.
- *
+ *
* @since 3.1
*/
protected static final IStatus complileErrorProjectPromptStatus = new Status(IStatus.INFO, DEBUG_CORE, 203, IInternalDebugCoreConstants.EMPTY_STRING, null);
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
*/
+ @Override
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
if (monitor != null) {
monitor.beginTask("", 1); //$NON-NLS-1$
@@ -122,7 +126,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
IProject[] projects = getBuildOrder(configuration, mode);
if (projects == null) {
return true;
- }
+ }
buildProjects(projects, new SubProgressMonitor(monitor, 1));
return false;
} finally {
@@ -131,12 +135,12 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
}
}
}
-
+
/**
* Returns the projects to build before launching the given launch configuration
* or <code>null</code> if the entire workspace should be built incrementally.
* Subclasses should override as required.
- *
+ *
* @param configuration the configuration being launched
* @param mode launch mode
* @return projects to build, in build order, or <code>null</code>
@@ -145,11 +149,11 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
return null;
}
-
+
/**
- * Returns the set of projects to use when searching for errors or <code>null</code>
- * if no search is to be done.
- *
+ * Returns the set of projects to use when searching for errors or <code>null</code>
+ * if no search is to be done.
+ *
* @param configuration the configuration being launched
* @param mode launch mode
* @return a list of projects or <code>null</code>
@@ -158,10 +162,11 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException {
return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#finalLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
monitor.beginTask("", 1); //$NON-NLS-1$
try {
@@ -170,15 +175,15 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
return true; //continue launch
}
boolean continueLaunch = true;
-
- monitor.subTask(DebugCoreMessages.LaunchConfigurationDelegate_6);
- List errors = new ArrayList();
+
+ monitor.subTask(DebugCoreMessages.LaunchConfigurationDelegate_6);
+ List<IAdaptable> errors = new ArrayList<IAdaptable>();
for (int i = 0; i < projects.length; i++) {
- monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new String[]{projects[i].getName()}));
+ monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new Object[] { projects[i].getName() }));
if (existsProblems(projects[i])) {
errors.add(projects[i]);
- }
- }
+ }
+ }
if (!errors.isEmpty()) {
errors.add(0, configuration);
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
@@ -186,24 +191,25 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
continueLaunch = ((Boolean) prompter.handleStatus(complileErrorProjectPromptStatus, errors)).booleanValue();
}
}
-
+
return continueLaunch;
} finally {
monitor.done();
}
}
-
+
/* (non-Javadoc)
- *
+ *
* If launching in run mode, and the configuration supports debug mode, check
* if there are any breakpoints in the workspace, and ask the user if they'd
* rather launch in debug mode.
* <p>
* Since 3.2, this check also performs saving of resources before launching.
* </p>
- *
+ *
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
if (!saveBeforeLaunch(configuration, mode, monitor)) {
return false;
@@ -218,19 +224,19 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
if (prompter != null) {
boolean launchInDebugModeInstead = ((Boolean)prompter.handleStatus(switchToDebugPromptStatus, configuration)).booleanValue();
- if (launchInDebugModeInstead) {
+ if (launchInDebugModeInstead) {
return false; //kill this launch
- }
+ }
}
// if no user prompt, or user says to continue (no need to check other breakpoints)
return true;
}
}
- }
+ }
// no enabled breakpoints... continue launch
return true;
}
-
+
/**
* Performs the scoped saving of resources before launching and returns whether
* the launch should continue. By default, only resources contained within the projects
@@ -238,7 +244,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
* <p>
* Subclasses may override this method if required.
* </p>
- *
+ *
* @param configuration the configuration being launched
* @param mode the launch mode
* @param monitor progress monitor
@@ -256,7 +262,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
if(!((Boolean)prompter.handleStatus(saveScopedDirtyEditors, new Object[]{configuration, buildOrder})).booleanValue()) {
return false;
}
- }
+ }
return true;
} finally {
monitor.done();
@@ -266,11 +272,11 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
/**
* Returns the breakpoint collection that is relevant for this launch delegate.
* By default this is all the breakpoints registered with the Debug breakpoint manager.
- *
+ *
* @param configuration the configuration to get associated breakpoints for
* @since 3.1
* @return the breakpoints that are relevant for this launch delegate
- */
+ */
protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) {
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
if (!breakpointManager.isEnabled()) {
@@ -279,12 +285,12 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
}
return breakpointManager.getBreakpoints();
}
-
+
/**
* Returns an array of projects in their suggested build order
* containing all of the projects specified by <code>baseProjects</code>
* and all of their referenced projects.
- *
+ *
* @param baseProjects a collection of projects
* @return an array of projects in their suggested build order
* containing all of the projects specified by <code>baseProjects</code>
@@ -292,26 +298,26 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
* projects
*/
protected IProject[] computeReferencedBuildOrder(IProject[] baseProjects) throws CoreException {
- HashSet unorderedProjects = new HashSet();
+ HashSet<IProject> unorderedProjects = new HashSet<IProject>();
for(int i = 0; i< baseProjects.length; i++) {
unorderedProjects.add(baseProjects[i]);
addReferencedProjects(baseProjects[i], unorderedProjects);
}
- IProject[] projectSet = (IProject[]) unorderedProjects.toArray(new IProject[unorderedProjects.size()]);
+ IProject[] projectSet = unorderedProjects.toArray(new IProject[unorderedProjects.size()]);
return computeBuildOrder(projectSet);
}
-
-
+
+
/**
* Adds all projects referenced by <code>project</code> to the given
* set.
- *
+ *
* @param project project
* @param references set to which referenced projects are added
* @throws CoreException if an error occurs while computing referenced
* projects
*/
- protected void addReferencedProjects(IProject project, Set references) throws CoreException{
+ protected void addReferencedProjects(IProject project, Set<IProject> references) throws CoreException {
if (project.isOpen()) {
IProject[] projects = project.getReferencedProjects();
for (int i = 0; i < projects.length; i++) {
@@ -320,32 +326,32 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
references.add(refProject);
addReferencedProjects(refProject, references);
}
- }
+ }
}
}
-
- /**
+
+ /**
* Returns a list of projects in their suggested build order from the
* given unordered list of projects.
- *
+ *
* @param projects the list of projects to sort into build order
* @return a new array containing all projects from <code>projects</code> sorted
* according to their build order.
*/
- protected IProject[] computeBuildOrder(IProject[] projects) {
+ protected IProject[] computeBuildOrder(IProject[] projects) {
String[] orderedNames = ResourcesPlugin.getWorkspace().getDescription().getBuildOrder();
if (orderedNames != null) {
- List orderedProjects = new ArrayList(projects.length);
+ List<IProject> orderedProjects = new ArrayList<IProject>(projects.length);
//Projects may not be in the build order but should be built if selected
- List unorderedProjects = new ArrayList(projects.length);
+ List<IProject> unorderedProjects = new ArrayList<IProject>(projects.length);
for(int i = 0; i < projects.length; ++i) {
unorderedProjects.add(projects[i]);
}
-
+
for (int i = 0; i < orderedNames.length; i++) {
String projectName = orderedNames[i];
- for (Iterator iterator = unorderedProjects.iterator(); iterator.hasNext(); ) {
- IProject project = (IProject)iterator.next();
+ for (Iterator<IProject> iterator = unorderedProjects.iterator(); iterator.hasNext();) {
+ IProject project = iterator.next();
if (project.getName().equals(projectName)) {
orderedProjects.add(project);
iterator.remove();
@@ -355,18 +361,18 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
}
//Add anything not specified before we return
orderedProjects.addAll(unorderedProjects);
- return (IProject[]) orderedProjects.toArray(new IProject[orderedProjects.size()]);
+ return orderedProjects.toArray(new IProject[orderedProjects.size()]);
}
-
+
// Computing build order returned null, try the project prerequisite order
IWorkspace.ProjectOrder po = ResourcesPlugin.getWorkspace().computeProjectOrder(projects);
return po.projects;
- }
-
+ }
+
/**
* Returns whether the given project contains any problem markers of the
* specified severity.
- *
+ *
* @param proj the project to search
* @return whether the given project contains any problems that should
* stop it from launching
@@ -384,13 +390,13 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
}
return false;
}
-
+
/**
* Returns whether the given problem should potentially abort the launch.
* By default if the problem has an error severity, the problem is considered
* a potential launch problem. Subclasses may override to specialize error
* detection.
- *
+ *
* @param problemMarker candidate problem
* @return whether the given problem should potentially abort the launch
* @throws CoreException if any exceptions occur while accessing marker attributes
@@ -399,20 +405,21 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
Integer severity = (Integer)problemMarker.getAttribute(IMarker.SEVERITY);
if (severity != null) {
return severity.intValue() >= IMarker.SEVERITY_ERROR;
- }
-
+ }
+
return false;
}
-
+
/**
* Performs an incremental build on each of the given projects.
- *
+ *
* @param projects projects to build
* @param monitor progress monitor
* @throws CoreException if an exception occurs while building
*/
protected void buildProjects(final IProject[] projects, IProgressMonitor monitor) throws CoreException {
IWorkspaceRunnable build = new IWorkspaceRunnable(){
+ @Override
public void run(IProgressMonitor pm) throws CoreException {
SubMonitor localmonitor = SubMonitor.convert(pm, DebugCoreMessages.LaunchConfigurationDelegate_scoped_incremental_build, projects.length);
try {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
index 94f04baa8..48c278691 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.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,16 +19,17 @@ import org.eclipse.core.runtime.CoreException;
* Abstract implementation of a line breakpoint. This class is
* intended to be subclassed by debug model specific implementations
* of line breakpoints.
- *
+ *
* @see ILineBreakpoint
*/
public abstract class LineBreakpoint extends Breakpoint implements ILineBreakpoint {
-
+
/**
* @see ILineBreakpoint#getLineNumber()
*/
+ @Override
public int getLineNumber() throws CoreException {
IMarker m = getMarker();
if (m != null) {
@@ -40,6 +41,7 @@ public abstract class LineBreakpoint extends Breakpoint implements ILineBreakpoi
/**
* @see ILineBreakpoint#getCharStart()
*/
+ @Override
public int getCharStart() throws CoreException {
IMarker m = getMarker();
if (m != null) {
@@ -51,6 +53,7 @@ public abstract class LineBreakpoint extends Breakpoint implements ILineBreakpoi
/**
* @see ILineBreakpoint#getCharEnd()
*/
+ @Override
public int getCharEnd() throws CoreException {
IMarker m = getMarker();
if (m != null) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
index 1a8b8fe25..1a27397d2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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,8 +12,8 @@ package org.eclipse.debug.core.model;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
@@ -35,7 +35,7 @@ import org.eclipse.debug.internal.core.StreamsProxy;
* Clients may subclass this class. Clients that need to replace the implementation
* of a streams proxy associated with an <code>IProcess</code> should subclass this
* class. Generally clients should not instantiate this class directly, but should
- * instead call <code>DebugPlugin.newProcess(...)</code>, which can delegate to an
+ * instead call <code>DebugPlugin.newProcess(...)</code>, which can delegate to an
* <code>IProcessFactory</code> if one is referenced by the associated launch configuration.
* </p>
* @see org.eclipse.debug.core.model.IProcess
@@ -46,28 +46,28 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
private static final int MAX_WAIT_FOR_DEATH_ATTEMPTS = 10;
private static final int TIME_TO_WAIT_FOR_THREAD_DEATH = 500; // ms
-
+
/**
* The launch this process is contained in
*/
private ILaunch fLaunch;
-
+
/**
* The system process represented by this <code>IProcess</code>
*/
private Process fProcess;
-
+
/**
* This process's exit value
*/
private int fExitValue;
-
+
/**
* The monitor which listens for this runtime process' system process
* to terminate.
*/
private ProcessMonitorThread fMonitor;
-
+
/**
* The streams proxy for this process
*/
@@ -82,12 +82,12 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* Whether this process has been terminated
*/
private boolean fTerminated;
-
+
/**
* Table of client defined attributes
*/
- private Map fAttributes;
-
+ private Map<String, String> fAttributes;
+
/**
* Whether output from the process should be captured or swallowed
*/
@@ -97,14 +97,14 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* Constructs a RuntimeProcess on the given system process
* with the given name, adding this process to the given
* launch.
- *
+ *
* @param launch the parent launch of this process
* @param process underlying system process
* @param name the label used for this process
* @param attributes map of attributes used to initialize the attributes
* of this process, or <code>null</code> if none
*/
- public RuntimeProcess(ILaunch launch, Process process, String name, Map attributes) {
+ public RuntimeProcess(ILaunch launch, Process process, String name, Map<String, String> attributes) {
setLaunch(launch);
initializeAttributes(attributes);
fProcess= process;
@@ -115,7 +115,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
} catch (IllegalThreadStateException e) {
fTerminated= false;
}
-
+
String captureOutput = launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT);
fCaptureOutput = !("false".equals(captureOutput)); //$NON-NLS-1$
@@ -128,22 +128,21 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Initialize the attributes of this process to those in the given map.
- *
+ *
* @param attributes attribute map or <code>null</code> if none
*/
- private void initializeAttributes(Map attributes) {
+ private void initializeAttributes(Map<String, String> attributes) {
if (attributes != null) {
- Iterator keys = attributes.keySet().iterator();
- while (keys.hasNext()) {
- String key = (String)keys.next();
- setAttribute(key, (String)attributes.get(key));
- }
+ for (Entry<String, String> entry : attributes.entrySet()) {
+ setAttribute(entry.getKey(), entry.getValue());
+ }
}
}
/**
* @see ITerminate#canTerminate()
*/
+ @Override
public synchronized boolean canTerminate() {
return !fTerminated;
}
@@ -151,13 +150,14 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see IProcess#getLabel()
*/
+ @Override
public String getLabel() {
return fName;
}
-
+
/**
* Sets the launch this process is contained in
- *
+ *
* @param launch the launch this process is contained in
*/
protected void setLaunch(ILaunch launch) {
@@ -167,13 +167,14 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see IProcess#getLaunch()
*/
+ @Override
public ILaunch getLaunch() {
return fLaunch;
}
/**
* Returns the underlying system process associated with this process.
- *
+ *
* @return system process
*/
protected Process getSystemProcess() {
@@ -183,6 +184,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see ITerminate#isTerminated()
*/
+ @Override
public synchronized boolean isTerminated() {
return fTerminated;
}
@@ -190,8 +192,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see ITerminate#terminate()
*/
+ @Override
public void terminate() throws DebugException {
- if (!isTerminated()) {
+ if (!isTerminated()) {
if (fStreamsProxy instanceof StreamsProxy) {
((StreamsProxy)fStreamsProxy).kill();
}
@@ -220,7 +223,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
fMonitor.killThread();
fMonitor = null;
}
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.RuntimeProcess_terminate_failed, null);
+ IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.RuntimeProcess_terminate_failed, null);
throw new DebugException(status);
}
}
@@ -234,7 +237,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
((StreamsProxy)fStreamsProxy).close();
}
-
+
// Avoid calling IProcess.exitValue() inside a sync section (Bug 311813).
int exitValue = -1;
boolean running = false;
@@ -243,7 +246,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
} catch (IllegalThreadStateException ie) {
running = true;
}
-
+
synchronized (this) {
fTerminated= true;
if (!running) {
@@ -253,30 +256,31 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
}
fireTerminateEvent();
}
-
+
/**
* @see IProcess#getStreamsProxy()
*/
+ @Override
public IStreamsProxy getStreamsProxy() {
if (!fCaptureOutput) {
return null;
}
return fStreamsProxy;
}
-
+
/**
* Creates and returns the streams proxy associated with this process.
- *
+ *
* @return streams proxy
*/
protected IStreamsProxy createStreamsProxy() {
if (!fCaptureOutput) {
return new NullStreamsProxy(getSystemProcess());
}
- String encoding = getLaunch().getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING);
+ String encoding = getLaunch().getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING);
return new StreamsProxy(getSystemProcess(), encoding);
- }
-
+ }
+
/**
* Fires a creation event.
*/
@@ -286,7 +290,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Fires the given debug event.
- *
+ *
* @param event debug event to fire
*/
protected void fireEvent(DebugEvent event) {
@@ -305,7 +309,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Fires a change event.
- */
+ */
protected void fireChangeEvent() {
fireEvent(new DebugEvent(this, DebugEvent.CHANGE));
}
@@ -313,32 +317,35 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see IProcess#setAttribute(String, String)
*/
+ @Override
public void setAttribute(String key, String value) {
if (fAttributes == null) {
- fAttributes = new HashMap(5);
+ fAttributes = new HashMap<String, String>(5);
}
Object origVal = fAttributes.get(key);
if (origVal != null && origVal.equals(value)) {
return; //nothing changed.
}
-
+
fAttributes.put(key, value);
fireChangeEvent();
}
-
+
/**
* @see IProcess#getAttribute(String)
*/
+ @Override
public String getAttribute(String key) {
if (fAttributes == null) {
return null;
}
- return (String)fAttributes.get(key);
+ return fAttributes.get(key);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @Override
public Object getAdapter(Class adapter) {
if (adapter.equals(IProcess.class)) {
return this;
@@ -365,19 +372,20 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see IProcess#getExitValue()
*/
+ @Override
public synchronized int getExitValue() throws DebugException {
if (isTerminated()) {
return fExitValue;
- }
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.RuntimeProcess_Exit_value_not_available_until_process_terminates__1, null));
+ }
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.RuntimeProcess_Exit_value_not_available_until_process_terminates__1, null));
}
-
+
/**
* Monitors a system process, waiting for it to terminate, and
* then notifies the associated runtime process.
*/
class ProcessMonitorThread extends Thread {
-
+
/**
* Whether the thread has been told to exit.
*/
@@ -385,7 +393,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* The underlying <code>java.lang.Process</code> being monitored.
*/
- protected Process fOSProcess;
+ protected Process fOSProcess;
/**
* The <code>IProcess</code> which will be informed when this
* monitor detects that the underlying process has terminated.
@@ -396,7 +404,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* The <code>Thread</code> which is monitoring the underlying process.
*/
protected Thread fThread;
-
+
/**
* A lock protecting access to <code>fThread</code>.
*/
@@ -405,6 +413,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* @see Thread#run()
*/
+ @Override
public void run() {
synchronized (fThreadLock) {
if (fExit) {
@@ -429,11 +438,11 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Creates a new process monitor and starts monitoring the process for
* termination.
- *
+ *
* @param process process to monitor for termination
*/
public ProcessMonitorThread(RuntimeProcess process) {
- super(DebugCoreMessages.ProcessMonitorJob_0);
+ super(DebugCoreMessages.ProcessMonitorJob_0);
setDaemon(true);
fRuntimeProcess= process;
fOSProcess= process.getSystemProcess();
@@ -441,7 +450,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
/**
* Kills the monitoring thread.
- *
+ *
* This method is to be useful for dealing with the error
* case of an underlying process which has not informed this
* monitor of its termination.
@@ -455,5 +464,5 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
}
}
}
- }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
index f6918d659..f87794c33 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 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
* QNX Software Systems - Mikhail Khodjaiants - Bug 88232
@@ -14,7 +14,6 @@ package org.eclipse.debug.core.sourcelookup;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -68,15 +67,15 @@ import com.ibm.icu.text.MessageFormat;
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant
*/
public abstract class AbstractSourceLookupDirector implements ISourceLookupDirector, ILaunchConfigurationListener, ILaunchListener {
-
+
// source locator type identifier
protected String fId;
//ISourceLocatorParticipants that are listening for container changes
- protected ArrayList fParticipants = new ArrayList();
+ protected ArrayList<ISourceLookupParticipant> fParticipants = new ArrayList<ISourceLookupParticipant>();
//list of current source containers
protected ISourceContainer[] fSourceContainers = null;
//the launch config associated with this director
- protected ILaunchConfiguration fConfig;
+ protected ILaunchConfiguration fConfig;
//whether duplicates should be searched for or not
protected boolean fDuplicates = false;
// source path computer, or null if default
@@ -85,13 +84,13 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
* Cache of resolved source elements when duplicates exist.
* Keys are the duplicates, values are the source element to use.
*/
- protected Map fResolvedElements = null;
+ protected Map<Object, Object> fResolvedElements = null;
// current participant performing lookup or <code>null</code>
private ISourceLookupParticipant fCurrentParticipant;
-
+
protected static final IStatus fPromptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$
protected static final IStatus fResolveDuplicatesStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 205, "", null); //$NON-NLS-1$//$NON-NLS-2$
-
+
// XML nodes & attributes for persistence
protected static final String DIRECTOR_ROOT_NODE = "sourceLookupDirector"; //$NON-NLS-1$
protected static final String CONTAINERS_NODE = "sourceContainers"; //$NON-NLS-1$
@@ -99,13 +98,13 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
protected static final String CONTAINER_NODE = "container"; //$NON-NLS-1$
protected static final String CONTAINER_TYPE_ATTR = "typeId"; //$NON-NLS-1$
protected static final String CONTAINER_MEMENTO_ATTR = "memento"; //$NON-NLS-1$
-
+
class SourceLookupQuery implements ISafeRunnable {
-
- private List fSourceElements = new ArrayList();
+
+ private List<Object> fSourceElements = new ArrayList<Object>();
private Object fElement = null;
private Throwable fException = null;
-
+
SourceLookupQuery(Object element) {
fElement = element;
}
@@ -113,13 +112,14 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
fException = exception;
}
-
+
/**
* Returns any exception that occurred during source lookup.
- *
+ *
* @return the (any) exception that occured during source lookup
*/
public Throwable getException() {
@@ -129,6 +129,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
MultiStatus multiStatus = null;
CoreException single = null;
@@ -141,9 +142,11 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
sourceArray = participants[i].findSourceElements(fElement);
if (sourceArray !=null && sourceArray.length > 0) {
if (isFindDuplicates()) {
- for(int j=0; j<sourceArray.length; j++)
- if(!checkDuplicate(sourceArray[j], fSourceElements))
+ for(int j=0; j<sourceArray.length; j++) {
+ if(!checkDuplicate(sourceArray[j], fSourceElements)) {
fSourceElements.add(sourceArray[j]);
+ }
+ }
} else {
fSourceElements.add(sourceArray[0]);
return;
@@ -153,7 +156,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
if (single == null) {
single = e;
} else if (multiStatus == null) {
- multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.Source_Lookup_Error, null);
+ multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.Source_Lookup_Error, null);
multiStatus.add(e.getStatus());
} else {
multiStatus.add(e.getStatus());
@@ -172,8 +175,8 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
}
}
-
- public List getSourceElements() {
+
+ public List<Object> getSourceElements() {
return fSourceElements;
}
@@ -182,38 +185,38 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
fSourceElements = null;
fException = null;
}
-
+
}
-
+
/**
* Constructs source lookup director
*/
public AbstractSourceLookupDirector() {
}
-
+
/**
* Sets the type identifier for this source locator's type
- *
+ *
* @param id corresponds to source locator type identifier for a
- * persistable source locator
+ * persistable source locator
*/
public void setId(String id) {
fId = id;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2#dispose()
*/
+ @Override
public synchronized void dispose() {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.removeLaunchConfigurationListener(this);
launchManager.removeLaunchListener(this);
- Iterator iterator = fParticipants.iterator();
- while (iterator.hasNext()) {
- ISourceLookupParticipant participant = (ISourceLookupParticipant) iterator.next();
+ for (ISourceLookupParticipant participant : fParticipants) {
//director may also be a participant
- if(participant != this)
+ if(participant != this) {
participant.dispose();
+ }
}
fParticipants.clear();
if (fSourceContainers != null) {
@@ -224,10 +227,10 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
fSourceContainers = null;
fResolvedElements = null;
}
-
+
/**
* Throws an exception with the given message and underlying exception.
- *
+ *
* @param message error message
* @param exception underlying exception, or <code>null</code>
* @throws CoreException if a problem is encountered
@@ -236,57 +239,59 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, message, exception);
throw new CoreException(status);
}
-
+
/**
* Constructs source containers from a list of container mementos.
- *
+ *
* @param list the list of nodes to be parsed
* @exception CoreException if parsing encounters an error
* @return a list of source containers
*/
- private List parseSourceContainers(NodeList list) throws CoreException {
- List containers = new ArrayList();
+ private List<ISourceContainer> parseSourceContainers(NodeList list) throws CoreException {
+ List<ISourceContainer> containers = new ArrayList<ISourceContainer>();
for (int i=0; i < list.getLength(); i++) {
- if(!(list.item(i).getNodeType() == Node.ELEMENT_NODE))
- continue;
+ if(!(list.item(i).getNodeType() == Node.ELEMENT_NODE)) {
+ continue;
+ }
Element element = (Element)list.item(i);
String typeId = element.getAttribute(CONTAINER_TYPE_ATTR);
if (typeId == null || typeId.equals("")) { //$NON-NLS-1$
- abort(SourceLookupMessages.AbstractSourceLookupDirector_11, null);
+ abort(SourceLookupMessages.AbstractSourceLookupDirector_11, null);
}
ISourceContainerType type = DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(typeId);
- if(type != null) {
+ if(type != null) {
String memento = element.getAttribute(CONTAINER_MEMENTO_ATTR);
if (memento == null || memento.equals("")) { //$NON-NLS-1$
- abort(SourceLookupMessages.AbstractSourceLookupDirector_13, null);
+ abort(SourceLookupMessages.AbstractSourceLookupDirector_13, null);
}
ISourceContainer container = type.createSourceContainer(memento);
containers.add(container);
}
else {
- abort(MessageFormat.format(SourceLookupMessages.AbstractSourceLookupDirector_12, new String[]{typeId}), null);
- }
- }
+ abort(MessageFormat.format(SourceLookupMessages.AbstractSourceLookupDirector_12, new Object[] { typeId }), null);
+ }
+ }
return containers;
}
-
+
/**
* Registers the given source lookup participant. Has no effect if an identical
* participant is already registered. Participants receive notification
- * when the source containers associated with this source director change.
- *
+ * when the source containers associated with this source director change.
+ *
* @param participant the participant to register
*/
private synchronized void addSourceLookupParticipant(ISourceLookupParticipant participant) {
if (!fParticipants.contains(participant)) {
fParticipants.add(participant);
participant.init(this);
- }
+ }
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#getSourceContainers()
*/
+ @Override
public synchronized ISourceContainer[] getSourceContainers() {
if (fSourceContainers == null) {
return new ISourceContainer[0];
@@ -295,50 +300,54 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
System.arraycopy(fSourceContainers, 0, copy, 0, fSourceContainers.length);
return copy;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#isFindDuplicates()
*/
- public boolean isFindDuplicates() {
- return fDuplicates;
+ @Override
+ public boolean isFindDuplicates() {
+ return fDuplicates;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#setFindDuplicates(boolean)
*/
- public void setFindDuplicates(boolean duplicates) {
- fDuplicates = duplicates;
- }
-
+ @Override
+ public void setFindDuplicates(boolean duplicates) {
+ fDuplicates = duplicates;
+ }
+
/**
* Removes the given participant from the list of registered participants.
* Has no effect if an identical participant is not already registered.
- *
+ *
* @param participant the participant to remove
*/
private synchronized void removeSourceLookupParticipant(ISourceLookupParticipant participant) {
if (fParticipants.remove(participant)) {
participant.dispose();
}
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
ILaunchConfiguration from = DebugPlugin.getDefault().getLaunchManager().getMovedFrom(configuration);
if (from != null && from.equals(getLaunchConfiguration())) {
fConfig = configuration;
}
}
-
+
/* (non-Javadoc)
- *
+ *
* Updates source containers in response to changes in underlying launch
* configuration. Only responds to changes in non-working copies.
- *
+ *
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
if (fConfig == null || configuration.isWorkingCopy()) {
return;
@@ -355,11 +364,12 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
}
}
-
-
+
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
if (configuration.equals(getLaunchConfiguration())) {
if (DebugPlugin.getDefault().getLaunchManager().getMovedTo(configuration) == null) {
@@ -367,16 +377,17 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
*/
+ @Override
public synchronized String getMemento() throws CoreException {
Document doc = DebugPlugin.newDocument();
Element rootNode = doc.createElement(DIRECTOR_ROOT_NODE);
doc.appendChild(rootNode);
-
- Element pathNode = doc.createElement(CONTAINERS_NODE);
+
+ Element pathNode = doc.createElement(CONTAINERS_NODE);
if(fDuplicates) {
pathNode.setAttribute(DUPLICATES_ATTR, "true"); //$NON-NLS-1$
} else {
@@ -395,18 +406,19 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
return DebugPlugin.serializeDocument(doc);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeFromMemento(java.lang.String)
*/
+ @Override
public void initializeFromMemento(String memento) throws CoreException {
doInitializeFromMemento(memento, true);
}
-
+
/**
* Initializes this source lookup director from the given memento.
* Disposes itself before initialization if specified.
- *
+ *
* @param memento source locator memento
* @param dispose whether to dispose any current source containers and participants
* before initializing
@@ -417,9 +429,9 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
if (dispose) {
dispose();
}
- Element rootElement = DebugPlugin.parseDocument(memento);
- if (!rootElement.getNodeName().equalsIgnoreCase(DIRECTOR_ROOT_NODE)) {
- abort(SourceLookupMessages.AbstractSourceLookupDirector_14, null);
+ Element rootElement = DebugPlugin.parseDocument(memento);
+ if (!rootElement.getNodeName().equalsIgnoreCase(DIRECTOR_ROOT_NODE)) {
+ abort(SourceLookupMessages.AbstractSourceLookupDirector_14, null);
}
NodeList list = rootElement.getChildNodes();
int length = list.getLength();
@@ -431,28 +443,30 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
if(entry.getNodeName().equalsIgnoreCase(CONTAINERS_NODE)){
setFindDuplicates("true".equals(entry.getAttribute(DUPLICATES_ATTR))); //$NON-NLS-1$
NodeList children = entry.getChildNodes();
- List containers = parseSourceContainers(children);
- setSourceContainers((ISourceContainer[]) containers.toArray(new ISourceContainer[containers.size()]));
+ List<ISourceContainer> containers = parseSourceContainers(children);
+ setSourceContainers(containers.toArray(new ISourceContainer[containers.size()]));
}
}
}
initializeParticipants();
- }
-
+ }
+
/**
* Sets the source containers used by this source lookup
* director.
- *
+ *
* @param containers source containers to search
*/
+ @Override
public void setSourceContainers(ISourceContainer[] containers) {
synchronized (this) {
- List list = Arrays.asList( containers );
+ List<ISourceContainer> list = Arrays.asList(containers);
ISourceContainer[] old = getSourceContainers();
for (int i = 0; i < old.length; i++) {
// skip overlapping containers
- if (!list.contains(old[i]))
+ if (!list.contains(old[i])) {
old[i].dispose();
+ }
}
fSourceContainers = containers;
for (int i = 0; i < containers.length; i++) {
@@ -469,26 +483,27 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
participant.sourceContainersChanged(this);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISourceLocator#getSourceElement(org.eclipse.debug.core.model.IStackFrame)
* Would be better to accept Object so this can be used for breakpoints and other objects.
*/
+ @Override
public Object getSourceElement(IStackFrame stackFrame) {
return getSourceElement((Object)stackFrame);
}
-
+
/**
* Performs a source lookup query for the given element
* returning the source elements associated with the element.
- *
+ *
* @param element stack frame
* @return list of associated source elements
*/
- protected List doSourceLookup(Object element) {
+ protected List<Object> doSourceLookup(Object element) {
SourceLookupQuery query = new SourceLookupQuery(element);
SafeRunner.run(query);
- List sources = query.getSourceElements();
+ List<Object> sources = query.getSourceElements();
Throwable exception = query.getException();
if (exception != null) {
if (exception instanceof CoreException) {
@@ -503,7 +518,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
query.dispose();
return sources;
}
-
+
/**
* Returns the source element to associate with the given element.
* This method is called when more than one source element has been found
@@ -517,11 +532,9 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
* @param sources the source elements found for the given element
* @return a single source element for the given element
*/
- public Object resolveSourceElement(Object element, List sources) {
+ public Object resolveSourceElement(Object element, List<Object> sources) {
// check the duplicates cache first
- Iterator duplicates = sources.iterator();
- while (duplicates.hasNext()) {
- Object dup = duplicates.next();
+ for (Object dup : sources) {
Object resolved = getCachedElement(dup);
if (resolved != null) {
return resolved;
@@ -544,23 +557,26 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/**
* Checks if the object being added to the list of sources is a duplicate of what's already in the list
- * @param sourceToAdd the new source file to be added
+ * @param sourceToAdd the new source file to be added
* @param sources the list that the source will be compared against
* @return true if it is already in the list, false if it is a new object
*/
- private boolean checkDuplicate(Object sourceToAdd, List sources){
- if(sources.size() == 0)
+ private boolean checkDuplicate(Object sourceToAdd, List<Object> sources) {
+ if(sources.size() == 0) {
return false;
- Iterator iterator = sources.iterator();
- while(iterator.hasNext())
- if(iterator.next().equals(sourceToAdd))
+ }
+ for (Object obj : sources) {
+ if (obj.equals(sourceToAdd)) {
return true;
+ }
+ }
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2#initializeFromMemento(java.lang.String, org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void initializeFromMemento(String memento, ILaunchConfiguration configuration) throws CoreException {
dispose();
setLaunchConfiguration(configuration);
@@ -570,27 +586,29 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeDefaults(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public void initializeDefaults(ILaunchConfiguration configuration) throws CoreException {
dispose();
setLaunchConfiguration(configuration);
setSourceContainers(new ISourceContainer[]{new DefaultSourceContainer()});
initializeParticipants();
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#getLaunchConfiguration()
*/
+ @Override
public ILaunchConfiguration getLaunchConfiguration() {
return fConfig;
}
-
+
/**
* Sets the launch configuration associated with this source lookup
* director. If the given configuration is a working copy, this director
* will respond to changes the working copy. If the given configuration
* is a persisted launch configuration, this director will respond to changes
* in the persisted launch configuration.
- *
+ *
* @param configuration launch configuration to associate with this
* source lookup director, or <code>null</code> if none
*/
@@ -598,22 +616,25 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
fConfig = configuration;
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.addLaunchConfigurationListener(this);
- launchManager.addLaunchListener(this);
+ launchManager.addLaunchListener(this);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch)
*/
+ @Override
public void launchAdded(ILaunch launch) {
}
/* (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) {
if (this.equals(launch.getSourceLocator())) {
dispose();
@@ -622,40 +643,39 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#getParticipants()
*/
+ @Override
public synchronized ISourceLookupParticipant[] getParticipants() {
- return (ISourceLookupParticipant[]) fParticipants.toArray(new ISourceLookupParticipant[fParticipants.size()]);
+ return fParticipants.toArray(new ISourceLookupParticipant[fParticipants.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#supportsSourceContainerType(org.eclipse.debug.core.sourcelookup.ISourceContainerType)
*/
+ @Override
public boolean supportsSourceContainerType(ISourceContainerType type) {
return true;
}
-
+
/**
* Caches the resolved source element to use when one of the following
* duplicates is found.
- *
+ *
* @param duplicates duplicates source elements
* @param sourceElement chosen source element to use in place of the
* duplicates
*/
- protected void cacheResolvedElement(List duplicates, Object sourceElement) {
+ protected void cacheResolvedElement(List<Object> duplicates, Object sourceElement) {
if (fResolvedElements == null) {
- fResolvedElements = new HashMap(10);
+ fResolvedElements = new HashMap<Object, Object>(10);
}
- Iterator iterator = duplicates.iterator();
- while (iterator.hasNext()) {
- Object dup = iterator.next();
+ for (Object dup : duplicates) {
fResolvedElements.put(dup, sourceElement);
}
-
}
-
+
/**
* Returns the cached source element to use when the given duplicate
* is encountered.
- *
+ *
* @param duplicate duplicates source element
* @return element to use in the duplicate's place
*/
@@ -665,11 +685,11 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
return null;
}
-
+
/**
* Clears any cached source element associated with the given duplicate
* is source element.
- *
+ *
* @param duplicate duplicate source element to cache resolved results
* for
*/
@@ -677,23 +697,24 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
if (fResolvedElements != null) {
fResolvedElements.remove(duplicate);
}
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#clearSourceElements(java.lang.Object)
*/
+ @Override
public void clearSourceElements(Object element) {
- List list = doSourceLookup(element);
+ List<Object> list = doSourceLookup(element);
if (list.size() > 0) {
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- clearCachedElement(iterator.next());
+ for (Object obj : list) {
+ clearCachedElement(obj);
}
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#addParticipants(org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant[])
*/
+ @Override
public void addParticipants(ISourceLookupParticipant[] participants) {
for (int i = 0; i < participants.length; i++) {
ISourceLookupParticipant participant = participants[i];
@@ -704,6 +725,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#removeParticipants(org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant[])
*/
+ @Override
public void removeParticipants(ISourceLookupParticipant[] participants) {
for (int i = 0; i < participants.length; i++) {
removeSourceLookupParticipant(participants[i]);
@@ -713,12 +735,14 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#getId()
*/
+ @Override
public String getId() {
return fId;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#getSourcePathComputer()
*/
+ @Override
public ISourcePathComputer getSourcePathComputer() {
if (fComputer == null && getLaunchConfiguration() != null) {
try {
@@ -731,16 +755,18 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#setSourcePathComputer(org.eclipse.debug.core.sourcelookup.ISourcePathComputer)
*/
+ @Override
public void setSourcePathComputer(ISourcePathComputer computer) {
fComputer = computer;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#findSourceElements(java.lang.Object)
*/
+ @Override
public Object[] findSourceElements(Object object) throws CoreException {
SourceLookupQuery query = new SourceLookupQuery(object);
SafeRunner.run(query);
- List sources = query.getSourceElements();
+ List<Object> sources = query.getSourceElements();
Throwable exception = query.getException();
query.dispose();
if (exception != null && sources.isEmpty()) {
@@ -754,30 +780,31 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#getSourceElement(java.lang.Object)
*/
+ @Override
public Object getSourceElement(Object element) {
- List sources = doSourceLookup(element);
+ List<Object> sources = doSourceLookup(element);
if(sources.size() == 1) {
return sources.get(0);
} else if(sources.size() > 1) {
return resolveSourceElement(element, sources);
- } else {
+ } else {
return null;
}
}
-
+
/**
* Sets the current participant or <code>null</code> if none.
- *
+ *
* @param participant active participant or <code>null</code>
*/
private void setCurrentParticipant(ISourceLookupParticipant participant) {
fCurrentParticipant = participant;
}
-
+
/**
* Returns the participant currently looking up source or <code>null</code>
* if none.
- *
+ *
* @return the participant currently looking up source or <code>null</code>
* if none
* @since 3.5
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
index 3640d76e2..be9876582 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.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
*******************************************************************************/
@@ -28,14 +28,15 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* @since 3.0
*/
public abstract class AbstractSourceLookupParticipant implements ISourceLookupParticipant {
-
+
private ISourceLookupDirector fDirector;
-
- protected static final Object[] EMPTY = new Object[0];
-
+
+ protected static final Object[] EMPTY = new Object[0];
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#init(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
*/
+ @Override
public void init(ISourceLookupDirector director) {
fDirector = director;
}
@@ -43,19 +44,21 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#dispose()
*/
+ @Override
public void dispose() {
fDirector = null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#findSourceElements(java.lang.Object)
*/
+ @Override
public Object[] findSourceElements(Object object) throws CoreException {
- List results = null;
+ List<Object> results = null;
CoreException single = null;
MultiStatus multiStatus = null;
if (isFindDuplicates()) {
- results = new ArrayList();
+ results = new ArrayList<Object>();
}
String name = getSourceName(object);
if (name != null) {
@@ -75,7 +78,7 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
} else {
if (objects.length == 1) {
return objects;
- }
+ }
return new Object[]{objects[0]};
}
}
@@ -101,14 +104,14 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
return EMPTY;
}
return results.toArray();
- }
-
+ }
+
/**
* Returns the source container to search in place of the given source
* container, or <code>null</code> if the given source container is not
* to be searched. The default implementation does not translate source
* containers. Subclasses should override if required.
- *
+ *
* @param container the source container about to be searched (proxy)
* @return the source container to be searched (delegate), or <code>null</code>
* if the source container should not be searched
@@ -116,22 +119,22 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
protected ISourceContainer getDelegateContainer(ISourceContainer container) {
return container;
}
-
+
/**
* Returns the source lookup director this participant is registered with
* or <code>null</code> if none.
- *
+ *
* @return the source lookup director this participant is registered with
* or <code>null</code> if none
*/
protected ISourceLookupDirector getDirector() {
return fDirector;
}
-
+
/**
* Returns whether this participant's source lookup director is configured
* to search for duplicate source elements.
- *
+ *
* @return whether this participant's source lookup director is configured
* to search for duplicate source elements
* @since 3.5
@@ -147,7 +150,7 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
/**
* Returns the source containers currently registered with this participant's
* source lookup director.
- *
+ *
* @return the source containers currently registered with this participant's
* source lookup director
*/
@@ -158,10 +161,11 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
}
return new ISourceContainer[0];
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#sourceContainersChanged(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
*/
+ @Override
public void sourceContainersChanged(ISourceLookupDirector director) {
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java
index 613d62ca9..924ee5075 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.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
*******************************************************************************/
@@ -30,14 +30,14 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
* @since 3.0
*/
public abstract class AbstractSourceContainer extends PlatformObject implements ISourceContainer {
-
+
public static final Object[] EMPTY = new Object[0];
-
+
private ISourceLookupDirector fDirector;
-
+
/**
* Throws an error exception with the given message and underlying exception.
- *
+ *
* @param message error message
* @param exception underlying exception, or <code>null</code>
* @throws CoreException if a problem is encountered
@@ -46,33 +46,35 @@ public abstract class AbstractSourceContainer extends PlatformObject implements
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, message, exception);
throw new CoreException(status);
}
-
+
/**
* Throws a warning exception with the given message and underlying exception.
- *
+ *
* @param message error message
* @param exception underlying exception, or <code>null</code>
* @throws CoreException if a problem is encountered
* @since 3.3
- */
+ */
protected void warn(String message, Throwable exception) throws CoreException {
IStatus status = new Status(IStatus.WARNING, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, message, exception);
throw new CoreException(status);
}
-
+
/* (non-Javadoc)
- *
+ *
* By default, do nothing. Subclasses should override as required.
- *
+ *
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#dispose()
*/
+ @Override
public void dispose() {
fDirector = null;
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getSourceContainers()
*/
+ @Override
public ISourceContainer[] getSourceContainers() throws CoreException {
return new ISourceContainer[0];
}
@@ -80,34 +82,36 @@ public abstract class AbstractSourceContainer extends PlatformObject implements
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
*/
+ @Override
public boolean isComposite() {
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#init(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
*/
+ @Override
public void init(ISourceLookupDirector director) {
fDirector = director;
}
-
+
/**
* Returns the source lookup director this source container registered
* in, or <code>null</code> if none.
- *
+ *
* @return the source lookup director this source container registered
* in, or <code>null</code> if none
*/
protected ISourceLookupDirector getDirector() {
return fDirector;
}
-
+
/**
* Returns whether this container's source should search for duplicate source
* elements. Since 3.5, the current participant is consulted to determine if
* duplicates should be found. Fall back to querying the source lookup director
* if the participant is not an {@link AbstractSourceLookupParticipant}.
- *
+ *
* @return whether to search for duplicate source elements
*/
protected boolean isFindDuplicates() {
@@ -125,11 +129,11 @@ public abstract class AbstractSourceContainer extends PlatformObject implements
}
return false;
}
-
+
/**
* Returns the source container type identified by the given id,
* or <code>null</code> if none.
- *
+ *
* @param id source container type identifier
* @return source container type or <code>null</code>
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java
index 3120a01d5..402e06f61 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -20,26 +20,26 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
* Archive source container for an archive in the workspace. Returns instances
* of <code>ZipEntryStorage</code> as source elements.
* <p>
- * Clients may instantiate this class.
+ * Clients may instantiate this class.
* </p>
* @since 3.0
* @noextend This class is not intended to be subclassed by clients.
*/
public class ArchiveSourceContainer extends AbstractSourceContainer {
-
+
private IFile fFile;
- private boolean fDetectRoot;
+ private boolean fDetectRoot;
private ExternalArchiveSourceContainer fDelegateContainer;
-
+
/**
* Unique identifier for the archive source container type
* (value <code>org.eclipse.debug.core.containerType.archive</code>).
*/
public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.archive"; //$NON-NLS-1$
-
+
/**
- * Creates an archive source container on the given file.
- *
+ * Creates an archive source container on the given file.
+ *
* @param archive archive in the workspace
* @param detectRootPath whether a root path should be detected. When
* <code>true</code>, searching is performed relative to a root path
@@ -50,7 +50,7 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
* <code>r/a/b/c.d</code> exists, the root path is set to <code>r</code>.
* From that point on, searching is performed relative to <code>r</code>.
* When <code>false</code>, searching is performed by
- * matching file names as suffixes to the entries in the archive.
+ * matching file names as suffixes to the entries in the archive.
*/
public ArchiveSourceContainer(IFile archive, boolean detectRootPath) {
fFile = archive;
@@ -59,41 +59,45 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
fDelegateContainer = new ExternalArchiveSourceContainer(archive.getLocation().toOSString(), detectRootPath);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName()
*/
+ @Override
public String getName() {
return fFile.getName();
}
-
+
/**
* Returns the associated file in the workspace.
- *
+ *
* @return associated file in the workspace
*/
public IFile getFile() {
return fFile;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
return obj instanceof ArchiveSourceContainer &&
((ArchiveSourceContainer)obj).getName().equals(getName());
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getName().hashCode();
}
@@ -101,17 +105,18 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
*/
- public Object[] findSourceElements(String name) throws CoreException {
+ @Override
+ public Object[] findSourceElements(String name) throws CoreException {
ExternalArchiveSourceContainer container = getDelegateContainer();
if (container != null) {
return container.findSourceElements(name);
}
return EMPTY;
}
-
+
/**
* Returns the underlying external archive source container.
- *
+ *
* @return underlying external archive source container
* @since 3.0.1.1
*/
@@ -121,7 +126,8 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#init(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
*/
- public void init(ISourceLookupDirector director) {
+ @Override
+ public void init(ISourceLookupDirector director) {
super.init(director);
if (fDelegateContainer != null) {
fDelegateContainer.init(director);
@@ -130,22 +136,23 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#dispose()
*/
- public void dispose() {
+ @Override
+ public void dispose() {
super.dispose();
if (fDelegateContainer != null) {
fDelegateContainer.dispose();
}
}
-
+
/**
* Returns whether root paths are automatically detected in this
* archive source container.
- *
+ *
* @return whether root paths are automatically detected in this
* archive source container
* @since 3.0.1.1
*/
public boolean isDetectRoot() {
return fDetectRoot;
- }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
index ed442127b..4b79ce6bc 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 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,23 +29,25 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* @since 3.0
*/
public abstract class CompositeSourceContainer extends AbstractSourceContainer {
-
+
private ISourceContainer[] fContainers;
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
*/
+ @Override
public boolean isComposite() {
return true;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
*/
+ @Override
public Object[] findSourceElements(String name) throws CoreException {
return findSourceElements(name, getSourceContainers());
}
-
+
/**
* Returns a collection of source elements in the given containers corresponding to
* the given name. Returns an empty collection if no source elements are found.
@@ -65,13 +67,13 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
* @param containers the containers to search
* @return a collection of source elements corresponding to the given name
* @exception CoreException if an exception occurs while searching for source elements
- */
+ */
protected Object[] findSourceElements(String name, ISourceContainer[] containers) throws CoreException {
- List results = null;
+ List<Object> results = null;
CoreException single = null;
MultiStatus multiStatus = null;
if (isFindDuplicates()) {
- results = new ArrayList();
+ results = new ArrayList<Object>();
}
for (int i = 0; i < containers.length; i++) {
ISourceContainer container = containers[i];
@@ -95,7 +97,7 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
if (single == null) {
single = e;
} else if (multiStatus == null) {
- multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.Source_Lookup_Error, null);
+ multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.Source_Lookup_Error, null);
multiStatus.add(e.getStatus());
} else {
multiStatus.add(e.getStatus());
@@ -111,27 +113,28 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
return EMPTY;
}
return results.toArray();
- }
-
+ }
+
/**
* Creates the source containers in this composite container.
* Subclasses should override this methods.
* @return the array of {@link ISourceContainer}s
- *
+ *
* @throws CoreException if unable to create the containers
*/
protected abstract ISourceContainer[] createSourceContainers() throws CoreException;
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getSourceContainers()
*/
+ @Override
public synchronized ISourceContainer[] getSourceContainers() throws CoreException {
if (fContainers == null) {
fContainers = createSourceContainers();
for (int i = 0; i < fContainers.length; i++) {
ISourceContainer container = fContainers[i];
container.init(getDirector());
- }
+ }
}
return fContainers;
}
@@ -139,6 +142,7 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#dispose()
*/
+ @Override
public void dispose() {
super.dispose();
if (fContainers != null) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
index 00c5ff7f4..97a073951 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 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
@@ -44,14 +44,14 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
private IContainer fContainer = null;
private boolean fSubfolders = false;
-
+
private URI fRootURI = null;
private IFileStore fRootFile = null;
private IWorkspaceRoot fRoot = null;
/**
- * Constructs a source container on the given workspace container.
- *
+ * Constructs a source container on the given workspace container.
+ *
* @param container the container to search for source in
* @param subfolders whether nested folders should be searched
* for source elements
@@ -68,29 +68,30 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
fRoot = ResourcesPlugin.getWorkspace().getRoot();
}
}
-
+
/**
* Returns the workspace container this source container is
* rooted at.
- *
+ *
* @return the workspace container this source container is
* rooted at
*/
public IContainer getContainer() {
return fContainer;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
*/
+ @Override
public Object[] findSourceElements(String name) throws CoreException {
- ArrayList sources = new ArrayList();
+ ArrayList<Object> sources = new ArrayList<Object>();
- // An IllegalArgumentException is thrown from the "getFile" method
- // if the path created by appending the file name to the container
+ // An IllegalArgumentException is thrown from the "getFile" method
+ // if the path created by appending the file name to the container
// path doesn't conform with Eclipse resource restrictions.
- // To prevent the interruption of the search procedure we check
- // if the path is valid before passing it to "getFile".
+ // To prevent the interruption of the search procedure we check
+ // if the path is valid before passing it to "getFile".
if ( validateFile(name) ) {
IFile file = fContainer.getFile(new Path(name));
if (file.exists()) {
@@ -114,13 +115,13 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
}
} else if (files.length > 0) {
sources.add(files[0]);
- }
+ }
}
}
}
}
- //check sub-folders
+ //check sub-folders
if ((isFindDuplicates() && fSubfolders) || (sources.isEmpty() && fSubfolders)) {
ISourceContainer[] containers = getSourceContainers();
for (int i=0; i < containers.length; i++) {
@@ -129,41 +130,46 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
continue;
}
if (isFindDuplicates()) {
- for(int j=0; j < objects.length; j++)
+ for(int j=0; j < objects.length; j++) {
sources.add(objects[j]);
+ }
} else {
sources.add(objects[0]);
break;
}
}
- }
-
- if(sources.isEmpty())
+ }
+
+ if(sources.isEmpty()) {
return EMPTY;
+ }
return sources.toArray();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName()
*/
- public String getName() {
- return getContainer().getName();
+ @Override
+ public String getName() {
+ return getContainer().getName();
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof ContainerSourceContainer) {
ContainerSourceContainer loc = (ContainerSourceContainer) obj;
return loc.getContainer().equals(getContainer());
- }
+ }
return false;
- }
-
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getContainer().hashCode();
}
@@ -171,36 +177,38 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#isComposite()
*/
- public boolean isComposite() {
+ @Override
+ public boolean isComposite() {
return fSubfolders;
}
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
*/
+ @Override
protected ISourceContainer[] createSourceContainers() throws CoreException {
if(fSubfolders) {
IResource[] resources = getContainer().members();
- List list = new ArrayList(resources.length);
+ List<ISourceContainer> list = new ArrayList<ISourceContainer>(resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource.getType() == IResource.FOLDER) {
list.add(new FolderSourceContainer((IFolder)resource, fSubfolders));
}
}
- ISourceContainer[] containers = (ISourceContainer[]) list.toArray(new ISourceContainer[list.size()]);
+ ISourceContainer[] containers = list.toArray(new ISourceContainer[list.size()]);
for (int i = 0; i < containers.length; i++) {
ISourceContainer container = containers[i];
container.init(getDirector());
- }
+ }
return containers;
}
return new ISourceContainer[0];
}
/**
- * Validates the given string as a path for a file in this container.
- *
+ * Validates the given string as a path for a file in this container.
+ *
* @param name path name
* @return <code>true</code> if the path is valid <code>false</code> otherwise
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java
index 957655ad0..d97c6afd9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 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
@@ -24,13 +24,13 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* for a launch configuration on each launch using a launch configuration's
* associated source path computer.
* <p>
- * Clients may instantiate this class.
+ * Clients may instantiate this class.
* </p>
* @since 3.0
* @noextend This class is not intended to be subclassed by clients.
*/
-public class DefaultSourceContainer extends CompositeSourceContainer {
-
+public class DefaultSourceContainer extends CompositeSourceContainer {
+
/**
* Unique identifier for the default source container type
* (value <code>org.eclipse.debug.core.containerType.default</code>).
@@ -38,29 +38,31 @@ public class DefaultSourceContainer extends CompositeSourceContainer {
public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.default"; //$NON-NLS-1$
/**
- * Constructs a default source container.
+ * Constructs a default source container.
*/
public DefaultSourceContainer() {
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
return obj instanceof DefaultSourceContainer;
- }
+ }
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getClass().hashCode();
- }
-
+ }
+
/**
* Returns the launch configuration for which a default source lookup
* path will be computed, or <code>null</code> if none.
- *
+ *
* @return the launch configuration for which a default source lookup
* path will be computed, or <code>null</code>
*/
@@ -71,18 +73,19 @@ public class DefaultSourceContainer extends CompositeSourceContainer {
}
return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
-
+
/**
* Returns the source path computer to use, or <code>null</code>
* if none.
- *
+ *
* @return the source path computer to use, or <code>null</code>
* if none
*/
@@ -97,13 +100,15 @@ public class DefaultSourceContainer extends CompositeSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName()
*/
+ @Override
public String getName() {
- return SourceLookupMessages.DefaultSourceContainer_0;
+ return SourceLookupMessages.DefaultSourceContainer_0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
*/
+ @Override
protected ISourceContainer[] createSourceContainers() throws CoreException {
ISourcePathComputer sourcePathComputer = getSourcePathComputer();
if (sourcePathComputer != null) {
@@ -112,7 +117,7 @@ public class DefaultSourceContainer extends CompositeSourceContainer {
return sourcePathComputer.computeSourceContainers(config, null);
}
}
-
+
return new ISourceContainer[0];
}
} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
index 311dba478..3a7689df2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 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
@@ -13,6 +13,7 @@ package org.eclipse.debug.core.sourcelookup.containers;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.DebugPlugin;
@@ -24,14 +25,14 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
* from <code>findSourceElements(...)</code> are instances
* of <code>LocalFileStorage</code>.
* <p>
- * Clients may instantiate this class.
+ * Clients may instantiate this class.
* </p>
* @since 3.0
* @noextend This class is not intended to be subclassed by clients.
*/
public class DirectorySourceContainer extends CompositeSourceContainer {
-
+
// root directory
private File fDirectory;
// whether to search sub-folders
@@ -41,11 +42,11 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
* (value <code>org.eclipse.debug.core.containerType.directory</code>).
*/
public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.directory"; //$NON-NLS-1$
-
+
/**
* Constructs an external folder container for the
* directory identified by the given path.
- *
+ *
* @param dirPath path to a directory in the local file system
* @param subfolders whether folders within the root directory
* should be searched for source elements
@@ -53,11 +54,11 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
public DirectorySourceContainer(IPath dirPath, boolean subfolders) {
this(dirPath.toFile(), subfolders);
}
-
+
/**
* Constructs an external folder container for the
* directory identified by the given file.
- *
+ *
* @param dir a directory in the local file system
* @param subfolders whether folders within the root directory
* should be searched for source elements
@@ -65,29 +66,31 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
public DirectorySourceContainer(File dir, boolean subfolders) {
fDirectory = dir;
fSubfolders = subfolders;
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName()
*/
+ @Override
public String getName() {
return fDirectory.getName();
- }
-
+ }
+
/**
* Returns the root directory in the local file system associated
* with this source container.
- *
+ *
* @return the root directory in the local file system associated
* with this source container
*/
public File getDirectory() {
return fDirectory;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
@@ -95,15 +98,16 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
*/
+ @Override
public Object[] findSourceElements(String name) throws CoreException {
- ArrayList sources = new ArrayList();
+ ArrayList<Object> sources = new ArrayList<Object>();
File directory = getDirectory();
File file = new File(directory, name);
if (file.exists() && file.isFile()) {
sources.add(new LocalFileStorage(file));
}
-
- //check sub-folders
+
+ //check sub-folders
if ((isFindDuplicates() && fSubfolders) || (sources.isEmpty() && fSubfolders)) {
ISourceContainer[] containers = getSourceContainers();
for (int i=0; i < containers.length; i++) {
@@ -112,23 +116,26 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
continue;
}
if (isFindDuplicates()) {
- for(int j=0; j < objects.length; j++)
+ for(int j=0; j < objects.length; j++) {
sources.add(objects[j]);
+ }
} else {
sources.add(objects[0]);
break;
}
}
- }
-
- if(sources.isEmpty())
+ }
+
+ if(sources.isEmpty()) {
return EMPTY;
+ }
return sources.toArray();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
*/
+ @Override
public boolean isComposite() {
return fSubfolders;
}
@@ -136,6 +143,7 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
if (obj instanceof DirectorySourceContainer) {
DirectorySourceContainer container = (DirectorySourceContainer) obj;
@@ -146,18 +154,20 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getDirectory().hashCode();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
*/
+ @Override
protected ISourceContainer[] createSourceContainers() throws CoreException {
if (isComposite()) {
String[] files = fDirectory.list();
if (files != null) {
- List dirs = new ArrayList();
+ List<ISourceContainer> dirs = new ArrayList<ISourceContainer>();
for (int i = 0; i < files.length; i++) {
String name = files[i];
File file = new File(getDirectory(), name);
@@ -165,11 +175,11 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
dirs.add(new DirectorySourceContainer(file, true));
}
}
- ISourceContainer[] containers = (ISourceContainer[]) dirs.toArray(new ISourceContainer[dirs.size()]);
+ ISourceContainer[] containers = dirs.toArray(new ISourceContainer[dirs.size()]);
for (int i = 0; i < containers.length; i++) {
ISourceContainer container = containers[i];
container.init(getDirector());
- }
+ }
return containers;
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java
index 70241e758..1ff284a11 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.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
@@ -12,7 +12,6 @@ package org.eclipse.debug.core.sourcelookup.containers;
import java.io.File;
import java.io.IOException;
-import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
@@ -30,31 +29,33 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils;
+import com.ibm.icu.text.MessageFormat;
+
/**
* An archive in the local file system. Returns instances
* of <code>ZipEntryStorage</code> as source elements.
* <p>
- * Clients may instantiate this class.
+ * Clients may instantiate this class.
* </p>
* @since 3.0
* @noextend This class is not intended to be subclassed by clients.
*/
public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
-
+
private boolean fDetectRoots = false;
- private Set fPotentialRoots = null;
- private List fRoots = new ArrayList();
+ private Set<String> fPotentialRoots = null;
+ private List<String> fRoots = new ArrayList<String>();
private String fArchivePath = null;
/**
* Unique identifier for the external archive source container type
* (value <code>org.eclipse.debug.core.containerType.externalArchive</code>).
*/
public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.externalArchive"; //$NON-NLS-1$
-
+
/**
- * Creates an archive source container on the archive at the
- * specified location in the local file system.
- *
+ * Creates an archive source container on the archive at the
+ * specified location in the local file system.
+ *
* @param archivePath path to the archive in the local file system
* @param detectRootPaths whether root container paths should be detected. When
* <code>true</code>, searching is performed relative to a root path
@@ -66,24 +67,25 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
* When searching for an unqualified file name, root containers are not
* considered.
* When <code>false</code>, searching is performed by
- * matching file names as suffixes to the entries in the archive.
+ * matching file names as suffixes to the entries in the archive.
*/
public ExternalArchiveSourceContainer(String archivePath, boolean detectRootPaths) {
fArchivePath = archivePath;
fDetectRoots = detectRootPaths;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
*/
+ @Override
public Object[] findSourceElements(String name) throws CoreException {
- name = name.replace('\\', '/');
+ String newname = name.replace('\\', '/');
ZipFile file = getArchive();
// NOTE: archive can be closed between get (above) and synchronized block (below)
synchronized (file) {
- boolean isQualfied = name.indexOf('/') > 0;
+ boolean isQualfied = newname.indexOf('/') > 0;
if (fDetectRoots && isQualfied) {
- ZipEntry entry = searchRoots(file, name);
+ ZipEntry entry = searchRoots(file, newname);
if (entry != null) {
return new Object[]{new ZipEntryStorage(file, entry)};
}
@@ -91,10 +93,10 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
// try exact match
ZipEntry entry = null;
try {
- entry = file.getEntry(name);
+ entry = file.getEntry(newname);
} catch (IllegalStateException e) {
// archive was closed between retrieving and locking
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
e.getMessage(), e));
}
if (entry != null) {
@@ -102,16 +104,16 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
return new Object[]{new ZipEntryStorage(file, entry)};
}
// search
- Enumeration entries = file.entries();
- List matches = null;
+ Enumeration<? extends ZipEntry> entries = file.entries();
+ List<ZipEntryStorage> matches = null;
while (entries.hasMoreElements()) {
- entry = (ZipEntry)entries.nextElement();
+ entry = entries.nextElement();
String entryName = entry.getName();
- if (entryName.endsWith(name)) {
- if (isQualfied || entryName.length() == name.length() || entryName.charAt(entryName.length() - name.length() - 1) == '/') {
+ if (entryName.endsWith(newname)) {
+ if (isQualfied || entryName.length() == newname.length() || entryName.charAt(entryName.length() - newname.length() - 1) == '/') {
if (isFindDuplicates()) {
if (matches == null) {
- matches = new ArrayList();
+ matches = new ArrayList<ZipEntryStorage>();
}
matches.add(new ZipEntryStorage(file, entry));
} else {
@@ -127,12 +129,12 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
}
return EMPTY;
}
-
+
/**
* Returns the root path in this archive for the given file name, based
* on its type, or <code>null</code> if none. Detects a root if a root has
* not yet been detected for the given file type.
- *
+ *
* @param file zip file to search in
* @param name file name
* @return the {@link ZipEntry} with the given name or <code>null</code>
@@ -140,13 +142,13 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
*/
private ZipEntry searchRoots(ZipFile file, String name) throws CoreException {
if (fPotentialRoots == null) {
- fPotentialRoots = new HashSet();
+ fPotentialRoots = new HashSet<String>();
fPotentialRoots.add(""); //$NON-NLS-1$
// all potential roots are the directories
try {
- Enumeration entries = file.entries();
+ Enumeration<? extends ZipEntry> entries = file.entries();
while (entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) entries.nextElement();
+ ZipEntry entry = entries.nextElement();
if (entry.isDirectory()) {
fPotentialRoots.add(entry.getName());
} else {
@@ -164,13 +166,13 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
}
} catch (IllegalStateException e) {
// archive was closed between retrieving and locking
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
e.getMessage(), e));
}
}
int i = 0;
while (i < fRoots.size()) {
- String root = (String) fRoots.get(i);
+ String root = fRoots.get(i);
ZipEntry entry = file.getEntry(root+name);
if (entry != null) {
return entry;
@@ -178,30 +180,25 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
i++;
}
if (!fPotentialRoots.isEmpty()) {
- Iterator roots = fPotentialRoots.iterator();
- String root = null;
- ZipEntry entry = null;
- while (roots.hasNext()) {
- root = (String) roots.next();
- entry = file.getEntry(root+name);
+ for (String root : fPotentialRoots) {
+ ZipEntry entry = file.getEntry(root + name);
if (entry != null) {
- break;
- }
- }
- if (entry != null) {
- if (root != null) {
- fRoots.add(root);
- fPotentialRoots.remove(root);
- // remove any roots that begin with the new root, as roots cannot be nested
- Iterator rs = fPotentialRoots.iterator();
- while (rs.hasNext()) {
- String r = (String) rs.next();
- if (r.startsWith(root)) {
- rs.remove();
+ if (root != null) {
+ fRoots.add(root);
+ fPotentialRoots.remove(root);
+ // remove any roots that begin with the new root, as
+ // roots
+ // cannot be nested
+ Iterator<String> rs = fPotentialRoots.iterator();
+ while (rs.hasNext()) {
+ String r = rs.next();
+ if (r.startsWith(root)) {
+ rs.remove();
+ }
}
}
- }
- return entry;
+ return entry;
+ }
}
}
return null;
@@ -210,7 +207,7 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
/**
* Returns the archive to search in.
* @return the {@link ZipFile} to search in
- *
+ *
* @throws CoreException if unable to access the archive
*/
private ZipFile getArchive() throws CoreException {
@@ -219,9 +216,9 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
} catch (IOException e) {
File file = new File(fArchivePath);
if (file.exists()) {
- abort(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_2, new String[]{fArchivePath}), e);
+ abort(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_2, new Object[] { fArchivePath }), e);
} else {
- warn(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_1, new String[]{fArchivePath}), e);
+ warn(MessageFormat.format(SourceLookupMessages.ExternalArchiveSourceContainer_1, new Object[] { fArchivePath }), e);
}
}
return null;
@@ -230,20 +227,22 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName()
*/
+ @Override
public String getName() {
return fArchivePath;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
-
+
/**
* Returns whether root paths are automatically detected in this
* archive source container.
- *
+ *
* @return whether root paths are automatically detected in this
* archive source container
*/
@@ -253,6 +252,7 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
return obj instanceof ExternalArchiveSourceContainer &&
((ExternalArchiveSourceContainer)obj).getName().equals(getName());
@@ -260,19 +260,21 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getName().hashCode();
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#dispose()
*/
+ @Override
public void dispose() {
super.dispose();
if (fPotentialRoots != null) {
fPotentialRoots.clear();
}
fRoots.clear();
- }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java
index d43b9e289..90f9ea736 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 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
@@ -17,7 +17,7 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
/**
* A folder in the workspace.
* <p>
- * Clients may instantiate this class.
+ * Clients may instantiate this class.
* </p>
* @since 3.0
* @noextend This class is not intended to be subclassed by clients.
@@ -32,20 +32,21 @@ public class FolderSourceContainer extends ContainerSourceContainer {
/**
- * Constructs a source container on the given folder.
- *
+ * Constructs a source container on the given folder.
+ *
* @param folder the folder to search for source in
* @param subfolders whether to search nested folders
*/
public FolderSourceContainer(IContainer folder, boolean subfolders) {
super(folder, subfolders);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
-
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java
index 454c06a54..261d3bd57 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -36,35 +36,37 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* @noextend This class is not intended to be subclassed by clients.
*/
public class LocalFileStorage extends PlatformObject implements IStorage {
-
+
/**
* The file this storage refers to.
- */
+ */
private File fFile;
-
+
/**
* Constructs and returns storage for the given file.
- *
+ *
* @param file a local file
*/
public LocalFileStorage(File file){
setFile(file);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getContents()
*/
+ @Override
public InputStream getContents() throws CoreException {
try {
return new FileInputStream(getFile());
} catch (IOException e){
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, SourceLookupMessages.LocalFileStorage_0, e));
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, SourceLookupMessages.LocalFileStorage_0, e));
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getFullPath()
*/
+ @Override
public IPath getFullPath() {
try {
return new Path(getFile().getCanonicalPath());
@@ -77,6 +79,7 @@ public class LocalFileStorage extends PlatformObject implements IStorage {
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getName()
*/
+ @Override
public String getName() {
return getFile().getName();
}
@@ -84,40 +87,43 @@ public class LocalFileStorage extends PlatformObject implements IStorage {
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#isReadOnly()
*/
+ @Override
public boolean isReadOnly() {
return true;
}
-
+
/**
* Sets the file associated with this storage
- *
+ *
* @param file a local file
*/
private void setFile(File file) {
- fFile = file;
+ fFile = file;
}
-
+
/**
* Returns the file associated with this storage
- *
+ *
* @return file
*/
public File getFile() {
return fFile;
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
- public boolean equals(Object object) {
+ @Override
+ public boolean equals(Object object) {
return object instanceof LocalFileStorage &&
getFile().equals(((LocalFileStorage)object).getFile());
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getFile().hashCode();
- }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
index be8f9ddb3..5682d216c 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 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
@@ -7,7 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Mikhail Khodjaiants, QNX - Bug 110227: Possible infinite loop in ProjectSourceContainer
+ * Mikhail Khodjaiants, QNX - Bug 110227: Possible infinite loop in ProjectSourceContainer
*******************************************************************************/
package org.eclipse.debug.core.sourcelookup.containers;
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
@@ -37,12 +38,12 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
/**
* Unique identifier for the project source container type
* (value <code>org.eclipse.debug.core.containerType.project</code>).
- */
+ */
public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.project"; //$NON-NLS-1$
-
+
/**
* Constructs a project source container.
- *
+ *
* @param project the project to search for source in
* @param referenced whether referenced projects should be considered
*/
@@ -50,19 +51,19 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
super(project, true);
fReferencedProjects = referenced;
}
-
+
/**
* Returns whether referenced projects are considered.
- *
+ *
* @return whether referenced projects are considered
*/
public boolean isSearchReferencedProjects() {
return fReferencedProjects;
}
-
+
/**
* Returns the project this source container references.
- *
+ *
* @return the project this source container references
*/
public IProject getProject() {
@@ -72,6 +73,7 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
@@ -79,6 +81,7 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
*/
+ @Override
public boolean isComposite() {
return true;
}
@@ -86,13 +89,14 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
*/
+ @Override
protected ISourceContainer[] createSourceContainers() throws CoreException {
if (getProject().isOpen()) {
if (isSearchReferencedProjects()) {
IProject project = getProject();
IProject[] projects = getAllReferencedProjects(project);
ISourceContainer[] folders = super.createSourceContainers();
- List all = new ArrayList(folders.length + projects.length);
+ List<ISourceContainer> all = new ArrayList<ISourceContainer>(folders.length + projects.length);
for (int i = 0; i < folders.length; i++) {
all.add(folders[i]);
}
@@ -103,20 +107,20 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
all.add(container);
}
}
- return (ISourceContainer[]) all.toArray(new ISourceContainer[all.size()]);
- }
+ return all.toArray(new ISourceContainer[all.size()]);
+ }
return super.createSourceContainers();
}
return new ISourceContainer[0];
}
private IProject[] getAllReferencedProjects(IProject project) throws CoreException {
- Set all = new HashSet();
+ Set<IProject> all = new HashSet<IProject>();
getAllReferencedProjects(all, project);
- return (IProject[]) all.toArray(new IProject[all.size()]);
+ return all.toArray(new IProject[all.size()]);
}
- private void getAllReferencedProjects(Set all, IProject project) throws CoreException {
+ private void getAllReferencedProjects(Set<IProject> all, IProject project) throws CoreException {
IProject[] refs = project.getReferencedProjects();
for (int i = 0; i < refs.length; i++) {
if (!all.contains(refs[i]) && refs[i].exists() && refs[i].isOpen()) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java
index 9bed84fb7..50c801043 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 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
@@ -27,7 +27,7 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* @noextend This class is not intended to be subclassed by clients.
*/
public class WorkspaceSourceContainer extends CompositeSourceContainer {
-
+
/**
* Unique identifier for the workspace source container type
* (value <code>org.eclipse.debug.core.containerType.workspace</code>).
@@ -35,39 +35,44 @@ public class WorkspaceSourceContainer extends CompositeSourceContainer {
public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.workspace"; //$NON-NLS-1$
public WorkspaceSourceContainer() {
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName()
*/
+ @Override
public String getName() {
- return SourceLookupMessages.WorkspaceSourceContainer_0;
+ return SourceLookupMessages.WorkspaceSourceContainer_0;
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
return obj instanceof WorkspaceSourceContainer;
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
- */
+ */
+ @Override
public int hashCode() {
return ResourcesPlugin.getWorkspace().hashCode();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
+ @Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
*/
+ @Override
protected ISourceContainer[] createSourceContainers() throws CoreException {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
ISourceContainer[] containers = new ISourceContainer[projects.length];
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java
index 205d91566..a133cfe72 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
-
+
/**
* Storage implementation for zip entries.
* <p>
@@ -36,21 +36,21 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* @noextend This class is not intended to be subclassed by clients.
*/
public class ZipEntryStorage extends PlatformObject implements IStorage {
-
+
/**
* Zip file associated with zip entry
*/
private ZipFile fArchive;
-
+
/**
* Zip entry
*/
private ZipEntry fZipEntry;
-
+
/**
* Constructs a new storage implementation for the
* given zip entry in the specified zip file
- *
+ *
* @param archive zip file
* @param entry zip entry
*/
@@ -62,17 +62,19 @@ public class ZipEntryStorage extends PlatformObject implements IStorage {
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getContents()
*/
+ @Override
public InputStream getContents() throws CoreException {
try {
return getArchive().getInputStream(getZipEntry());
} catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, SourceLookupMessages.ZipEntryStorage_0, e));
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, SourceLookupMessages.ZipEntryStorage_0, e));
}
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getFullPath()
*/
+ @Override
public IPath getFullPath() {
return new Path(getArchive().getName()).append(getZipEntry().getName());
}
@@ -80,6 +82,7 @@ public class ZipEntryStorage extends PlatformObject implements IStorage {
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getName()
*/
+ @Override
public String getName() {
int index = getZipEntry().getName().lastIndexOf('\\');
if (index == -1) {
@@ -87,65 +90,68 @@ public class ZipEntryStorage extends PlatformObject implements IStorage {
}
if (index == -1) {
return getZipEntry().getName();
- }
+ }
return getZipEntry().getName().substring(index + 1);
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#isReadOnly()
*/
+ @Override
public boolean isReadOnly() {
return true;
}
-
+
/**
* Sets the archive containing the zip entry.
- *
+ *
* @param archive a zip file
*/
private void setArchive(ZipFile archive) {
fArchive = archive;
}
-
+
/**
* Returns the archive containing the zip entry.
- *
+ *
* @return zip file
*/
public ZipFile getArchive() {
return fArchive;
- }
-
+ }
+
/**
* Sets the entry that contains the source.
- *
+ *
* @param entry the entry that contains the source
*/
private void setZipEntry(ZipEntry entry) {
fZipEntry = entry;
}
-
+
/**
* Returns the entry that contains the source
- *
+ *
* @return zip entry
*/
public ZipEntry getZipEntry() {
return fZipEntry;
- }
+ }
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
- public boolean equals(Object object) {
+ @Override
+ public boolean equals(Object object) {
return object instanceof ZipEntryStorage &&
getArchive().equals(((ZipEntryStorage)object).getArchive()) &&
getZipEntry().getName().equals(((ZipEntryStorage)object).getZipEntry().getName());
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return getZipEntry().getName().hashCode();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index 18a65651c..73b263535 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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,10 +12,8 @@ package org.eclipse.debug.internal.core;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -62,11 +60,11 @@ import com.ibm.icu.text.MessageFormat;
* will not automatically be initialized. Client code that expects markers and breakpoints to be
* initialized must call {@link #ensureInitialized()}.
* </p>
- *
+ *
* @see IBreakpointManager
*/
public class BreakpointManager implements IBreakpointManager, IResourceChangeListener {
-
+
/**
* Constants for breakpoint add/remove/change updates
*/
@@ -77,75 +75,75 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* A collection of breakpoints registered with this manager.
*/
- private Vector fBreakpoints= null;
-
+ private Vector<IBreakpoint> fBreakpoints = null;
+
/**
* Map of breakpoint import participants.
* Map has the form:
* <pre>Map(String - marker_id, List of {@link IBreakpointImportParticipant})</pre>
*/
- private HashMap fImportParticipants = null;
-
+ private HashMap<String, ArrayList<BreakpointImportParticipantDelegate>> fImportParticipants = null;
+
/**
* A system default import participant that performs legacy comparison support
* when no participants are provided for a given type.
- *
+ *
* @since 3.5
*/
private IBreakpointImportParticipant fDefaultParticipant = null;
-
+
/**
* A collection of breakpoint markers that have received a POST_CHANGE notification
* that they have changed before a POST_BUILD notification of add. This allows us
* to tell if a marker has been created & changed since the breakpoint has been
* registered (see bug 138473).
*/
- private Set fPostChangMarkersChanged = new HashSet();
-
+ private Set<IMarker> fPostChangMarkersChanged = new HashSet<IMarker>();
+
/**
* A collection of breakpoint markers that have received a POST_BUILD notification
* of being added.
*/
- private Set fPostBuildMarkersAdded = new HashSet();
-
+ private Set<IMarker> fPostBuildMarkersAdded = new HashSet<IMarker>();
+
/**
- * Collection of breakpoints being added currently. Used to
+ * Collection of breakpoints being added currently. Used to
* suppress change notification of "REGISTERED" attribute when
* being added.
*/
- private List fSuppressChange = new ArrayList();
-
+ private List<IBreakpoint> fSuppressChange = new ArrayList<IBreakpoint>();
+
/**
* A table of breakpoint extension points, keyed by
* marker type
* key: a marker type
* value: the breakpoint extension which corresponds to that marker type
*/
- private HashMap fBreakpointExtensions;
-
+ private HashMap<String, IConfigurationElement> fBreakpointExtensions;
+
/**
* Collection of markers that associates markers to breakpoints
* key: a marker
* value: the breakpoint which contains that marker
- */
- private HashMap fMarkersToBreakpoints;
+ */
+ private HashMap<IMarker, IBreakpoint> fMarkersToBreakpoints;
/**
* Collection of breakpoint listeners.
*/
private ListenerList fBreakpointListeners= new ListenerList();
-
+
/**
* Collection of (plural) breakpoint listeners.
*/
- private ListenerList fBreakpointsListeners= new ListenerList();
-
+ private ListenerList fBreakpointsListeners= new ListenerList();
+
/**
* Singleton resource delta visitor which handles marker
* additions, changes, and removals.
*/
private static BreakpointManagerVisitor fgVisitor;
-
+
/**
* Collection of breakpoint manager listeners which are
* notified when this manager's state changes.
@@ -158,12 +156,13 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* sent.
*/
class PostChangeListener implements IResourceChangeListener {
-
+
private PostChangeVisitor fVisitor = new PostChangeVisitor();
/* (non-Javadoc)
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
*/
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta= event.getDelta();
if (delta != null) {
@@ -174,17 +173,18 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
}
-
+
}
-
+
/**
* Default implementation of a breakpoint import participant
- *
+ *
* @since 3.5
*/
class DefaultImportParticipant implements IBreakpointImportParticipant {
- public boolean matches(Map attributes, IBreakpoint breakpoint) throws CoreException {
+ @Override
+ public boolean matches(Map<String, Object> attributes, IBreakpoint breakpoint) throws CoreException {
//perform legacy comparison
IMarker marker = breakpoint.getMarker();
String type = (String) attributes.get("type"); //$NON-NLS-1$
@@ -201,19 +201,21 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
return false;
}
+ @Override
public void verify(IBreakpoint breakpoint) throws CoreException {}
}
-
+
/**
* The listener
*/
private PostChangeListener fPostChangeListener = new PostChangeListener();
-
+
class PostChangeVisitor implements IResourceDeltaVisitor {
/* (non-Javadoc)
* @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
*/
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (delta == null) {
return false;
@@ -235,25 +237,27 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
break;
+ default:
+ break;
}
}
}
return true;
}
-
+
}
-
+
/**
* Constructs a new breakpoint manager.
*/
public BreakpointManager() {
- fMarkersToBreakpoints= new HashMap(10);
- fBreakpointExtensions= new HashMap(15);
+ fMarkersToBreakpoints = new HashMap<IMarker, IBreakpoint>(10);
+ fBreakpointExtensions = new HashMap<String, IConfigurationElement>(15);
}
-
+
/**
* Loads all the breakpoints on the given resource.
- *
+ *
* @param resource the resource which contains the breakpoints
* @param notify whether to notify of the breakpoint additions
* @throws CoreException if a problem is encountered
@@ -261,7 +265,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
private void loadBreakpoints(IResource resource, boolean notify) throws CoreException {
initBreakpointExtensions();
IMarker[] markers= getPersistedMarkers(resource);
- List added = new ArrayList();
+ List<IBreakpoint> added = new ArrayList<IBreakpoint>();
for (int i = 0; i < markers.length; i++) {
IMarker marker= markers[i];
try {
@@ -276,16 +280,16 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
DebugPlugin.log(e);
}
}
- addBreakpoints((IBreakpoint[])added.toArray(new IBreakpoint[added.size()]), notify);
+ addBreakpoints(added.toArray(new IBreakpoint[added.size()]), notify);
}
-
+
/**
* Returns the persisted markers associated with the given resource.
- *
+ *
* Delete any invalid breakpoint markers. This is done at startup rather
* than shutdown, since the changes made at shutdown are not persisted as
* the workspace state has already been saved. See bug 7683.
- *
+ *
* Since the <code>TRANSIENT</code> marker attribute/feature has been added,
* we no longer have to manually delete non-persisted markers - the platform
* does this for us (at shutdown, transient markers are not saved). However,
@@ -297,8 +301,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
protected IMarker[] getPersistedMarkers(IResource resource) throws CoreException {
IMarker[] markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
- final List delete = new ArrayList();
- List persisted= new ArrayList();
+ final List<IMarker> delete = new ArrayList<IMarker>();
+ List<IMarker> persisted = new ArrayList<IMarker>();
for (int i = 0; i < markers.length; i++) {
IMarker marker= markers[i];
// ensure the marker has a valid model identifier attribute
@@ -317,8 +321,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
// delete any markers that are not to be restored
if (!delete.isEmpty()) {
- final IMarker[] delMarkers = (IMarker[])delete.toArray(new IMarker[delete.size()]);
+ final IMarker[] delMarkers = delete.toArray(new IMarker[delete.size()]);
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor pm) throws CoreException {
for (int i = 0; i < delMarkers.length; i++) {
IMarker marker = delMarkers[i];
@@ -328,9 +333,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
};
new BreakpointManagerJob(wr).schedule();
}
- return (IMarker[])persisted.toArray(new IMarker[persisted.size()]);
+ return persisted.toArray(new IMarker[persisted.size()]);
}
-
+
/**
* Removes this manager as a resource change listener
* and removes all breakpoint listeners.
@@ -366,7 +371,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
String markerType = elements[i].getAttribute(IConfigurationElementConstants.MARKER_TYPE);
String className = elements[i].getAttribute(IConfigurationElementConstants.CLASS);
if (markerType == null) {
- DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + elements[i].getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: markerType", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + elements[i].getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: markerType", null)); //$NON-NLS-1$ //$NON-NLS-2$
} else if (className == null){
DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + elements[i].getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: class", null)); //$NON-NLS-1$ //$NON-NLS-2$
} else {
@@ -386,18 +391,20 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see IBreakpointManager#getBreakpoint(IMarker)
*/
+ @Override
public IBreakpoint getBreakpoint(IMarker marker) {
// ensure that breakpoints are initialized
getBreakpoints0();
- return (IBreakpoint)fMarkersToBreakpoints.get(marker);
+ return fMarkersToBreakpoints.get(marker);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#getBreakpoints()
*/
+ @Override
public IBreakpoint[] getBreakpoints() {
IBreakpoint[] temp = new IBreakpoint[0];
- Vector breakpoints = getBreakpoints0();
+ Vector<IBreakpoint> breakpoints = getBreakpoints0();
synchronized (breakpoints) {
temp = new IBreakpoint[breakpoints.size()];
breakpoints.copyInto(temp);
@@ -412,7 +419,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* be initialized. Client code that expects markers and breakpoints to be initialized must call
* this method.
* </p>
- *
+ *
* @since 3.8
*/
public void ensureInitialized() {
@@ -421,33 +428,32 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* The BreakpointManager waits to load the breakpoints
- * of the workspace until a request is made to retrieve the
+ * of the workspace until a request is made to retrieve the
* breakpoints.
* @return the underlying {@link Vector} of breakpoints
*/
- private synchronized Vector getBreakpoints0() {
+ private synchronized Vector<IBreakpoint> getBreakpoints0() {
if (fBreakpoints == null) {
initializeBreakpoints();
}
return fBreakpoints;
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#getBreakpoints(java.lang.String)
*/
+ @Override
public IBreakpoint[] getBreakpoints(String modelIdentifier) {
- Vector allBreakpoints= getBreakpoints0();
+ Vector<IBreakpoint> allBreakpoints = getBreakpoints0();
synchronized (allBreakpoints) {
- ArrayList temp = new ArrayList(allBreakpoints.size());
- Iterator breakpoints= allBreakpoints.iterator();
- while (breakpoints.hasNext()) {
- IBreakpoint breakpoint= (IBreakpoint) breakpoints.next();
+ ArrayList<IBreakpoint> temp = new ArrayList<IBreakpoint>(allBreakpoints.size());
+ for (IBreakpoint breakpoint : allBreakpoints) {
String id= breakpoint.getModelIdentifier();
if (id != null && id.equals(modelIdentifier)) {
temp.add(breakpoint);
}
}
- return (IBreakpoint[]) temp.toArray(new IBreakpoint[temp.size()]);
+ return temp.toArray(new IBreakpoint[temp.size()]);
}
}
@@ -456,56 +462,57 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* workspace. Start listening to resource deltas.
*/
private void initializeBreakpoints() {
- setBreakpoints(new Vector(10));
+ setBreakpoints(new Vector<IBreakpoint>(10));
try {
loadBreakpoints(getWorkspace().getRoot(), false);
getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
getWorkspace().addResourceChangeListener(fPostChangeListener, IResourceChangeEvent.POST_CHANGE);
} catch (CoreException ce) {
DebugPlugin.log(ce);
- setBreakpoints(new Vector(0));
- }
+ setBreakpoints(new Vector<IBreakpoint>(0));
+ }
}
-
+
/**
* @see IBreakpointManager#isRegistered(IBreakpoint)
*/
+ @Override
public boolean isRegistered(IBreakpoint breakpoint) {
return getBreakpoints0().contains(breakpoint);
}
-
+
/**
* @see IBreakpointManager#removeBreakpoint(IBreakpoint, boolean)
*/
+ @Override
public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException {
removeBreakpoints(new IBreakpoint[]{breakpoint}, delete);
}
-
+
/**
* @see IBreakpointManager#removeBreakpoints(IBreakpoint[], boolean)
*/
+ @Override
public void removeBreakpoints(IBreakpoint[] breakpoints, final boolean delete) throws CoreException {
- final List remove = new ArrayList(breakpoints.length);
+ final List<IBreakpoint> remove = new ArrayList<IBreakpoint>(breakpoints.length);
+ List<IBreakpoint> bps = getBreakpoints0();
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
- if (getBreakpoints0().contains(breakpoint)) {
+ if (bps.contains(breakpoint)) {
remove.add(breakpoint);
}
}
if (!remove.isEmpty()) {
- Iterator iter = remove.iterator();
- while (iter.hasNext()) {
- IBreakpoint breakpoint = (IBreakpoint)iter.next();
- getBreakpoints0().remove(breakpoint);
+ for (IBreakpoint breakpoint : remove) {
+ bps.remove(breakpoint);
fMarkersToBreakpoints.remove(breakpoint.getMarker());
}
fireUpdate(remove, null, REMOVED);
IWorkspaceRunnable r = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor montitor) throws CoreException {
- Iterator innerIter = remove.iterator();
- while (innerIter.hasNext()) {
- IBreakpoint breakpoint = (IBreakpoint)innerIter.next();
+ for (IBreakpoint breakpoint : remove) {
if (delete) {
breakpoint.delete();
} else {
@@ -521,21 +528,21 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
}
- }
+ }
}
};
getWorkspace().run(r, null, 0, null);
}
- }
-
+ }
+
/**
* Create a breakpoint for the given marker. The created breakpoint
* is of the type specified in the breakpoint extension associated
* with the given marker type.
- *
+ *
* @param marker marker to create a breakpoint for
* @return a breakpoint on this marker
- * @exception DebugException if breakpoint creation fails. Reasons for
+ * @exception DebugException if breakpoint creation fails. Reasons for
* failure include:
* <ol>
* <li>The breakpoint manager cannot determine what kind of breakpoint
@@ -544,53 +551,55 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* </ol>
*/
public IBreakpoint createBreakpoint(IMarker marker) throws DebugException {
- IBreakpoint breakpoint= (IBreakpoint) fMarkersToBreakpoints.get(marker);
+ IBreakpoint breakpoint= fMarkersToBreakpoints.get(marker);
if (breakpoint != null) {
return breakpoint;
}
try {
- IConfigurationElement config = (IConfigurationElement)fBreakpointExtensions.get(marker.getType());
+ IConfigurationElement config = fBreakpointExtensions.get(marker.getType());
if (config == null) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.BreakpointManager_Missing_breakpoint_definition, new String[] {marker.getType()}), null));
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.BreakpointManager_Missing_breakpoint_definition, new Object[] { marker.getType() }), null));
}
Object object = config.createExecutableExtension(IConfigurationElementConstants.CLASS);
if (object instanceof IBreakpoint) {
breakpoint = (IBreakpoint)object;
breakpoint.setMarker(marker);
} else {
- DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + config.getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: class", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + config.getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: class", null)); //$NON-NLS-1$ //$NON-NLS-2$
}
- return breakpoint;
+ return breakpoint;
} catch (CoreException e) {
throw new DebugException(e.getStatus());
}
- }
+ }
/**
* @see IBreakpointManager#addBreakpoint(IBreakpoint)
*/
+ @Override
public void addBreakpoint(IBreakpoint breakpoint) throws CoreException {
addBreakpoints(new IBreakpoint[]{breakpoint});
}
-
+
/**
* @see IBreakpointManager#addBreakpoints(IBreakpoint[])
*/
+ @Override
public void addBreakpoints(IBreakpoint[] breakpoints) throws CoreException {
addBreakpoints(breakpoints, true);
- }
-
+ }
+
/**
* Registers the given breakpoints and notifies listeners if specified.
- *
+ *
* @param breakpoints the breakpoints to register
* @param notify whether to notify listeners of the add
* @throws CoreException if a problem is encountered
*/
private void addBreakpoints(IBreakpoint[] breakpoints, boolean notify) throws CoreException {
- List added = new ArrayList(breakpoints.length);
- final List update = new ArrayList();
+ List<IBreakpoint> added = new ArrayList<IBreakpoint>(breakpoints.length);
+ final List<IBreakpoint> update = new ArrayList<IBreakpoint>();
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
if (!getBreakpoints0().contains(breakpoint)) {
@@ -604,51 +613,52 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
// need to update the 'registered' and/or 'group' attributes
update.add(breakpoint);
}
- }
+ }
}
if (notify) {
fireUpdate(added, null, ADDED);
}
if (!update.isEmpty()) {
IWorkspaceRunnable r = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- Iterator iter = update.iterator();
- while (iter.hasNext()) {
- IBreakpoint breakpoint = (IBreakpoint)iter.next();
- getBreakpoints0().add(breakpoint);
+ List<IBreakpoint> bps = getBreakpoints0();
+ for (IBreakpoint breakpoint : update) {
+ bps.add(breakpoint);
breakpoint.setRegistered(true);
- fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
+ fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
}
}
};
// Need to suppress change notification, since this is really
- // an add notification
+ // an add notification
fSuppressChange.addAll(update);
getWorkspace().run(r, null, 0, null);
fSuppressChange.removeAll(update);
if (notify) {
fireUpdate(update, null, ADDED);
}
- }
- }
-
+ }
+ }
+
/**
* Returns whether change notification is to be suppressed for the given breakpoint.
* Used when adding breakpoints and changing the "REGISTERED" attribute.
- *
+ *
* @param breakpoint the breakpoint
* @return boolean whether change notification is suppressed
*/
protected boolean isChangeSuppressed(IBreakpoint breakpoint) {
return fSuppressChange.contains(breakpoint);
}
-
+
/**
* @see IBreakpointManager#fireBreakpointChanged(IBreakpoint)
*/
+ @Override
public void fireBreakpointChanged(IBreakpoint breakpoint) {
if (getBreakpoints0().contains(breakpoint)) {
- List changed = new ArrayList();
+ List<IBreakpoint> changed = new ArrayList<IBreakpoint>();
changed.add(breakpoint);
fireUpdate(changed, null, CHANGED);
}
@@ -664,8 +674,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
try {
String id= breakpoint.getModelIdentifier();
if (id == null) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.CONFIGURATION_INVALID, DebugCoreMessages.BreakpointManager_Missing_model_identifier, null));
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.CONFIGURATION_INVALID, DebugCoreMessages.BreakpointManager_Missing_model_identifier, null));
}
} catch (CoreException e) {
throw new DebugException(e.getStatus());
@@ -674,9 +684,10 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* A resource has changed. Traverses the delta for breakpoint changes.
- *
+ *
* @param event resource change event
*/
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta= event.getDelta();
if (delta != null) {
@@ -699,24 +710,24 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* Moved markers
*/
- private List fMoved = new ArrayList();
+ private List<IMarker> fMoved = new ArrayList<IMarker>();
/**
* Removed breakpoints
*/
- private List fRemoved = new ArrayList();
-
+ private List<IBreakpoint> fRemoved = new ArrayList<IBreakpoint>();
+
/**
* Added breakpoints.
* @since 3.7
*/
- private List fAdded= new ArrayList();
+ private List<IBreakpoint> fAdded = new ArrayList<IBreakpoint>();
/**
* Changed breakpoints and associated marker deltas
*/
- private List fChanged = new ArrayList();
- private List fChangedDeltas = new ArrayList();
-
+ private List<IBreakpoint> fChanged = new ArrayList<IBreakpoint>();
+ private List<IMarkerDelta> fChangedDeltas = new ArrayList<IMarkerDelta>();
+
/**
* Resets the visitor for a delta traversal - empties
* collections of removed/changed breakpoints.
@@ -728,7 +739,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fChanged.clear();
fChangedDeltas.clear();
}
-
+
/**
* Performs updates on accumulated changes, and fires change notification after
* a traversal. Accumulated updates are reset.
@@ -737,8 +748,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
if (!fMoved.isEmpty()) {
// delete moved markers
IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- IMarker[] markers = (IMarker[])fMoved.toArray(new IMarker[fMoved.size()]);
+ IMarker[] markers = fMoved.toArray(new IMarker[fMoved.size()]);
for (int i = 0; i < markers.length; i++) {
markers[i].delete();
}
@@ -751,7 +763,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
if (!fRemoved.isEmpty()) {
try {
- removeBreakpoints((IBreakpoint[])fRemoved.toArray(new IBreakpoint[fRemoved.size()]), false);
+ removeBreakpoints(fRemoved.toArray(new IBreakpoint[fRemoved.size()]), false);
} catch (CoreException e) {
DebugPlugin.log(e);
}
@@ -759,17 +771,16 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
if (!fAdded.isEmpty()) {
try {
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- Iterator iter= fAdded.iterator();
- while (iter.hasNext()) {
- IBreakpoint breakpoint= (IBreakpoint)iter.next();
+ for (IBreakpoint breakpoint : fAdded) {
breakpoint.getMarker().setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, false);
breakpoint.setRegistered(true);
}
}
};
getWorkspace().run(runnable, null, 0, null);
- addBreakpoints((IBreakpoint[])fAdded.toArray(new IBreakpoint[fAdded.size()]), false);
+ addBreakpoints(fAdded.toArray(new IBreakpoint[fAdded.size()]), false);
} catch (CoreException e) {
DebugPlugin.log(e);
}
@@ -778,11 +789,12 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fireUpdate(fChanged, fChangedDeltas, CHANGED);
}
reset();
- }
-
+ }
+
/**
* @see IResourceDeltaVisitor#visit(IResourceDelta)
*/
+ @Override
public boolean visit(IResourceDelta delta) {
if (delta == null) {
return false;
@@ -805,12 +817,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
case IResourceDelta.CHANGED :
handleChangeBreakpoint(markerDelta.getMarker(), markerDelta);
break;
+ default:
+ break;
}
}
}
return true;
- }
+ }
/**
* Wrapper for handling adds
@@ -827,7 +841,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fMoved.add(marker);
}
} else {
- // check if the an add & change have be combined into one add notification
+ // check if the an add & change have be combined into one add notification
synchronized (fPostChangMarkersChanged) {
if (fPostChangMarkersChanged.contains(marker)) {
handleChangeBreakpoint(marker, mDelta);
@@ -843,7 +857,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
}
-
+
/**
* Wrapper for handling removes
* @param marker the {@link IMarker}
@@ -871,36 +885,36 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fChangedDeltas.add(delta);
}
}
-
+
/**
* A project has been opened or closed. Updates the breakpoints for
* that project
* @param project the {@link IProject} that was changed
*/
+ @SuppressWarnings("unchecked")
private void handleProjectResourceOpenStateChange(final IResource project) {
if (!project.isAccessible()) {
//closed
- Enumeration breakpoints= ((Vector)getBreakpoints0().clone()).elements();
- while (breakpoints.hasMoreElements()) {
- IBreakpoint breakpoint= (IBreakpoint) breakpoints.nextElement();
+ for (IBreakpoint breakpoint : (Vector<IBreakpoint>) getBreakpoints0().clone()) {
IResource markerResource= breakpoint.getMarker().getResource();
if (project.getFullPath().isPrefixOf(markerResource.getFullPath())) {
fRemoved.add(breakpoint);
}
}
return;
- }
+ }
try {
loadBreakpoints(project, true);
} catch (CoreException e) {
DebugPlugin.log(e);
}
- }
+ }
}
/**
* @see IBreakpointManager#addBreakpointListener(IBreakpointListener)
*/
+ @Override
public void addBreakpointListener(IBreakpointListener listener) {
fBreakpointListeners.add(listener);
}
@@ -908,47 +922,50 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see IBreakpointManager#removeBreakpointListener(IBreakpointListener)
*/
+ @Override
public void removeBreakpointListener(IBreakpointListener listener) {
fBreakpointListeners.remove(listener);
}
-
+
/**
* Notifies listeners of the adds/removes/changes
- *
+ *
* @param breakpoints associated breakpoints
* @param deltas or <code>null</code>
* @param update type of change
*/
- private void fireUpdate(List breakpoints, List deltas, int update) {
+ private void fireUpdate(List<IBreakpoint> breakpoints, List<IMarkerDelta> deltas, int update) {
if (breakpoints.isEmpty()) {
- return;
+ return;
}
- IBreakpoint[] bpArray = (IBreakpoint[])breakpoints.toArray(new IBreakpoint[breakpoints.size()]);
+ IBreakpoint[] bpArray = breakpoints.toArray(new IBreakpoint[breakpoints.size()]);
IMarkerDelta[] deltaArray = new IMarkerDelta[bpArray.length];
if (deltas != null) {
- deltaArray = (IMarkerDelta[])deltas.toArray(deltaArray);
+ deltaArray = deltas.toArray(deltaArray);
}
// single listeners
getBreakpointNotifier().notify(bpArray, deltaArray, update);
-
+
// plural listeners
getBreakpointsNotifier().notify(bpArray, deltaArray, update);
- }
+ }
- protected void setBreakpoints(Vector breakpoints) {
+ protected void setBreakpoints(Vector<IBreakpoint> breakpoints) {
fBreakpoints = breakpoints;
}
-
+
/**
* @see IBreakpointManager#hasBreakpoints()
*/
+ @Override
public boolean hasBreakpoints() {
return !getBreakpoints0().isEmpty();
}
-
+
/**
* @see org.eclipse.debug.core.IBreakpointManager#addBreakpointListener(org.eclipse.debug.core.IBreakpointsListener)
*/
+ @Override
public void addBreakpointListener(IBreakpointsListener listener) {
fBreakpointsListeners.add(listener);
}
@@ -956,6 +973,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see org.eclipse.debug.core.IBreakpointManager#removeBreakpointListener(org.eclipse.debug.core.IBreakpointsListener)
*/
+ @Override
public void removeBreakpointListener(IBreakpointsListener listener) {
fBreakpointsListeners.remove(listener);
}
@@ -963,21 +981,22 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
private BreakpointNotifier getBreakpointNotifier() {
return new BreakpointNotifier();
}
-
+
/**
* Notifies breakpoint listener (single breakpoint) in a safe runnable to
* handle exceptions.
*/
class BreakpointNotifier implements ISafeRunnable {
-
+
private IBreakpointListener fListener;
private int fType;
private IMarkerDelta fDelta;
private IBreakpoint fBreakpoint;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during breakpoint change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -986,6 +1005,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case ADDED:
@@ -995,14 +1015,16 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fListener.breakpointRemoved(fBreakpoint, fDelta);
break;
case CHANGED:
- fListener.breakpointChanged(fBreakpoint, fDelta);
+ fListener.breakpointChanged(fBreakpoint, fDelta);
+ break;
+ default:
break;
- }
+ }
}
/**
* Notifies the listeners of the add/change/remove
- *
+ *
* @param breakpoints the breakpoints that changed
* @param deltas the deltas associated with the change
* @param update the type of change
@@ -1015,33 +1037,34 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
for (int j = 0; j < breakpoints.length; j++) {
fBreakpoint = breakpoints[j];
fDelta = deltas[j];
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
}
fListener = null;
fDelta = null;
- fBreakpoint = null;
+ fBreakpoint = null;
}
}
-
+
private BreakpointsNotifier getBreakpointsNotifier() {
return new BreakpointsNotifier();
}
-
+
/**
* Notifies breakpoint listener (multiple breakpoints) in a safe runnable to
* handle exceptions.
*/
class BreakpointsNotifier implements ISafeRunnable {
-
+
private IBreakpointsListener fListener;
private int fType;
private IMarkerDelta[] fDeltas;
private IBreakpoint[] fNotifierBreakpoints;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during breakpoint change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -1050,6 +1073,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case ADDED:
@@ -1059,14 +1083,16 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fListener.breakpointsRemoved(fNotifierBreakpoints, fDeltas);
break;
case CHANGED:
- fListener.breakpointsChanged(fNotifierBreakpoints, fDeltas);
+ fListener.breakpointsChanged(fNotifierBreakpoints, fDeltas);
break;
- }
+ default:
+ break;
+ }
}
/**
* Notifies the listeners of the adds/changes/removes
- *
+ *
* @param breakpoints the breakpoints that changed
* @param deltas the deltas associated with the changed breakpoints
* @param update the type of change
@@ -1089,6 +1115,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#isEnabled()
*/
+ @Override
public boolean isEnabled() {
return Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, true, null);
}
@@ -1096,16 +1123,18 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#setEnabled(boolean)
*/
+ @Override
public void setEnabled(final boolean enabled) {
if (isEnabled() != enabled) {
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, enabled, null);
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
IBreakpoint[] breakpoints = getBreakpoints();
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
// Touch the marker (but don't actually change anything) so that the icon in
- // the editor ruler will be updated (editors listen to marker changes).
+ // the editor ruler will be updated (editors listen to marker changes).
breakpoint.getMarker().setAttribute(IBreakpoint.ENABLED, breakpoint.isEnabled());
}
}
@@ -1122,6 +1151,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#addBreakpointManagerListener(org.eclipse.debug.core.IBreakpointManagerListener)
*/
+ @Override
public void addBreakpointManagerListener(IBreakpointManagerListener listener) {
fBreakpointManagerListeners.add(listener);
}
@@ -1129,22 +1159,24 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#removeBreakpointManagerListener(org.eclipse.debug.core.IBreakpointManagerListener)
*/
+ @Override
public void removeBreakpointManagerListener(IBreakpointManagerListener listener) {
fBreakpointManagerListeners.remove(listener);
- }
-
+ }
+
/**
* Notifies breakpoint manager listeners in a safe runnable to
* handle exceptions.
*/
class BreakpointManagerNotifier implements ISafeRunnable {
-
+
private IBreakpointManagerListener fListener;
private boolean fManagerEnabled;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during breakpoint change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -1153,13 +1185,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
fListener.breakpointManagerEnablementChanged(fManagerEnabled);
}
/**
* Notifies the listeners of the enabled state change
- *
+ *
* @param enabled whether the manager is enabled
*/
public void notify(boolean enabled) {
@@ -1172,9 +1205,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fListener = null;
}
}
-
+
class BreakpointManagerJob extends Job {
-
+
private final IWorkspaceRunnable fRunnable;
public BreakpointManagerJob (IWorkspaceRunnable wRunnable) {
@@ -1186,6 +1219,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected IStatus run(IProgressMonitor monitor) {
try {
getWorkspace().run(fRunnable, null, 0, null);
@@ -1199,16 +1233,17 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#getTypeName(org.eclipse.debug.core.model.IBreakpoint)
*/
- public String getTypeName(IBreakpoint breakpoint) {
+ @Override
+ public String getTypeName(IBreakpoint breakpoint) {
String typeName= null;
IMarker marker = breakpoint.getMarker();
if (marker != null) {
try {
- IConfigurationElement element = (IConfigurationElement) fBreakpointExtensions.get(marker.getType());
+ IConfigurationElement element = fBreakpointExtensions.get(marker.getType());
if (element != null) {
typeName= element.getAttribute(IConfigurationElementConstants.NAME);
}
- }
+ }
catch (CoreException e) {}
}
return typeName;
@@ -1217,42 +1252,43 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/* (non-Javadoc)
* @see org.eclipse.debug.core.IBreakpointManager#getImportParticipants(java.lang.String)
*/
+ @Override
public IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException {
initializeImportParticipants();
- ArrayList list = (ArrayList) fImportParticipants.get(markertype);
+ ArrayList<BreakpointImportParticipantDelegate> list = fImportParticipants.get(markertype);
if(list == null) {
return new IBreakpointImportParticipant[] {fDefaultParticipant};
}
IBreakpointImportParticipant[] participants = new IBreakpointImportParticipant[list.size()];
BreakpointImportParticipantDelegate delegate = null;
for(int i = 0; i < list.size(); i++) {
- delegate = (BreakpointImportParticipantDelegate) list.get(i);
+ delegate = list.get(i);
participants[i] = delegate.getDelegate();
}
if(participants.length == 0) {
return new IBreakpointImportParticipant[] {fDefaultParticipant};
}
- return participants;
+ return participants;
}
-
+
/**
- * Initializes the cache of breakpoint import participants. Does no work if the cache
+ * Initializes the cache of breakpoint import participants. Does no work if the cache
* has already been initialized
*/
private synchronized void initializeImportParticipants() {
if(fImportParticipants == null) {
- fImportParticipants = new HashMap();
+ fImportParticipants = new HashMap<String, ArrayList<BreakpointImportParticipantDelegate>>();
fDefaultParticipant = new DefaultImportParticipant();
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS);
IConfigurationElement[] elements = ep.getConfigurationElements();
String type = null;
- ArrayList list = null;
+ ArrayList<BreakpointImportParticipantDelegate> list = null;
for(int i = 0; i < elements.length; i++) {
type = elements[i].getAttribute(IConfigurationElementConstants.TYPE);
if(type != null) {
- list = (ArrayList) fImportParticipants.get(type);
+ list = fImportParticipants.get(type);
if(list == null) {
- list = new ArrayList();
+ list = new ArrayList<BreakpointImportParticipantDelegate>();
fImportParticipants.put(type, list);
}
list.add(new BreakpointImportParticipantDelegate(elements[i]));
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
index f92e8b263..e02b4099c 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -19,11 +19,11 @@ import org.osgi.framework.BundleContext;
/**
* Access to debug options.
- *
+ *
* @since 3.3
*/
public class DebugOptions implements DebugOptionsListener {
-
+
// debug option flags
public static boolean DEBUG = false;
public static boolean DEBUG_COMMANDS = false;
@@ -32,33 +32,34 @@ public class DebugOptions implements DebugOptionsListener {
static final String DEBUG_FLAG = "org.eclipse.debug.core/debug"; //$NON-NLS-1$
static final String DEBUG_FLAG_COMMANDS = "org.eclipse.debug.core/debug/commands"; //$NON-NLS-1$
static final String DEBUG_FLAG_EVENTS = "org.eclipse.debug.core/debug/events"; //$NON-NLS-1$
-
+
/**
* The {@link DebugTrace} object to print to OSGi tracing
* @since 3.8
*/
private static DebugTrace fgDebugTrace;
-
+
/**
* Constructor
* @param context the bundle context
*/
public DebugOptions(BundleContext context) {
- Hashtable props = new Hashtable(2);
+ Hashtable<String, String> props = new Hashtable<String, String>(2);
props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, DebugPlugin.getUniqueIdentifier());
context.registerService(DebugOptionsListener.class.getName(), this, props);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.osgi.service.debug.DebugOptionsListener#optionsChanged(org.eclipse.osgi.service.debug.DebugOptions)
*/
+ @Override
public void optionsChanged(org.eclipse.osgi.service.debug.DebugOptions options) {
fgDebugTrace = options.newDebugTrace(DebugPlugin.getUniqueIdentifier());
DEBUG = options.getBooleanOption(DEBUG_FLAG, false);
DEBUG_COMMANDS = DEBUG & options.getBooleanOption(DEBUG_FLAG_COMMANDS, false);
DEBUG_EVENTS = DEBUG & options.getBooleanOption(DEBUG_FLAG_EVENTS, false);
}
-
+
/**
* Prints the given message to System.out and to the OSGi tracing (if started)
* @param option the option or <code>null</code>
@@ -72,10 +73,10 @@ public class DebugOptions implements DebugOptionsListener {
fgDebugTrace.trace(option, message, throwable);
}
}
-
+
/**
* Prints the given message to System.out and to the OSGi tracing (if enabled)
- *
+ *
* @param message the message or <code>null</code>
* @since 3.8
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java
index c2b7479c5..7f4a0f814 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -15,7 +15,7 @@ import org.eclipse.debug.core.DebugPlugin;
/**
* Initializes preferences for debug.core
- *
+ *
* @since 3.3
*/
public class DebugPreferenceInitializer extends AbstractPreferenceInitializer {
@@ -23,6 +23,7 @@ public class DebugPreferenceInitializer extends AbstractPreferenceInitializer {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
+ @Override
public void initializeDefaultPreferences() {
// Step filter preferences
Preferences.setDefaultBoolean(DebugPlugin.getUniqueIdentifier(), StepFilterManager.PREF_USE_STEP_FILTERS, false);
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
index b3f1f6c8a..d024f0cd3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
@@ -1,18 +1,18 @@
/*******************************************************************************
- * 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
*******************************************************************************/
package org.eclipse.debug.internal.core;
-import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -24,30 +24,29 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.osgi.service.environment.Constants;
/**
- * Resolves the value of environment variables.
+ * Resolves the value of environment variables.
*/
public class EnvironmentVariableResolver 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, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, DebugCoreMessages.EnvironmentVariableResolver_0, null));
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), IStatus.ERROR, DebugCoreMessages.EnvironmentVariableResolver_0, null));
}
- Map map= DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
- String value= (String) map.get(argument);
+ Map<String, String> map = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
+ String value = map.get(argument);
if (value == null && Platform.getOS().equals(Constants.OS_WIN32)) {
// On Win32, env variables are case insensitive, so we search the map
// for matches manually.
- Iterator iter = map.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry= ((Map.Entry) iter.next());
- String key= (String) entry.getKey();
+ for (Entry<String, String> entry : map.entrySet()) {
+ String key = entry.getKey();
if (key.equalsIgnoreCase(argument)) {
- return (String) entry.getValue();
+ return entry.getValue();
}
- }
+ }
}
return value;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
index 0fc30b27a..8df5726ba 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.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
@@ -13,7 +13,6 @@ package org.eclipse.debug.internal.core;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
@@ -53,28 +52,28 @@ import com.ibm.icu.text.MessageFormat;
* @see IExpressionManager
*/
public class ExpressionManager extends PlatformObject implements IExpressionManager {
-
+
/**
* Ordered collection of registered expressions.
*/
- private Vector fExpressions = null;
-
+ private Vector<IExpression> fExpressions = null;
+
/**
* List of expression listeners
*/
private ListenerList fListeners = null;
-
+
/**
* List of expressions listeners (plural)
*/
private ListenerList fExpressionsListeners = null;
-
+
/**
* Mapping of debug model identifiers (String) to
* expression delegate extensions (IConfigurationElement)
*/
- private Map fWatchExpressionDelegates= new HashMap();
-
+ private Map<String, IConfigurationElement> fWatchExpressionDelegates = new HashMap<String, IConfigurationElement>();
+
// Constants for add/remove/change/insert/move notification
private static final int ADDED = 1;
private static final int CHANGED = 2;
@@ -92,12 +91,12 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
// XML values
private static final String TRUE_VALUE= "true"; //$NON-NLS-1$
private static final String FALSE_VALUE= "false"; //$NON-NLS-1$
-
+
public ExpressionManager() {
loadPersistedExpressions();
loadWatchExpressionDelegates();
}
-
+
/**
* Loads the mapping of debug models to watch expression delegates
* from the org.eclipse.debug.core.watchExpressionDelegates
@@ -117,16 +116,17 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#newWatchExpressionDelegate(java.lang.String)
*/
+ @Override
public IWatchExpressionDelegate newWatchExpressionDelegate(String debugModel) {
try {
- IConfigurationElement element= (IConfigurationElement) fWatchExpressionDelegates.get(debugModel);
+ IConfigurationElement element= fWatchExpressionDelegates.get(debugModel);
if (element != null) {
return (IWatchExpressionDelegate) element.createExecutableExtension(IConfigurationElementConstants.DELEGATE_CLASS);
- }
+ }
return null;
} catch (CoreException e) {
DebugPlugin.log(e);
@@ -137,11 +137,12 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#hasWatchExpressionDelegate(java.lang.String)
*/
- public boolean hasWatchExpressionDelegate(String id) {
- IConfigurationElement element= (IConfigurationElement) fWatchExpressionDelegates.get(id);
+ @Override
+ public boolean hasWatchExpressionDelegate(String id) {
+ IConfigurationElement element= fWatchExpressionDelegates.get(id);
return element != null;
}
-
+
/**
* Loads any persisted watch expressions from the preferences.
* NOTE: It's important that no setter methods are called on
@@ -170,7 +171,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element= (Element) node;
if (!element.getNodeName().equals(EXPRESSION_TAG)) {
- DebugPlugin.logMessage(MessageFormat.format("Invalid XML element encountered while loading watch expressions: {0}", new String[] {node.getNodeName()}), null); //$NON-NLS-1$
+ DebugPlugin.logMessage(MessageFormat.format("Invalid XML element encountered while loading watch expressions: {0}", new Object[] { node.getNodeName() }), null); //$NON-NLS-1$
continue;
}
String expressionText= element.getAttribute(TEXT_TAG);
@@ -178,7 +179,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
boolean enabled= TRUE_VALUE.equals(element.getAttribute(ENABLED_TAG));
IWatchExpression expression= newWatchExpression(expressionText, enabled);
if (fExpressions == null) {
- fExpressions= new Vector(list.getLength());
+ fExpressions = new Vector<IExpression>(list.getLength());
}
fExpressions.add(expression);
} else {
@@ -187,11 +188,11 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
}
}
}
-
+
/**
* Creates a new watch expression with the given expression
* and the given enablement;
- *
+ *
* @param expressionText the text of the expression to be evaluated
* @param enabled whether or not the new expression should be enabled
* @return the new watch expression
@@ -203,13 +204,14 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#newWatchExpression(java.lang.String)
*/
+ @Override
public IWatchExpression newWatchExpression(String expressionText) {
return new WatchExpression(expressionText);
}
-
+
/**
* Persists this manager's watch expressions as XML in the
- * preference store.
+ * preference store.
*/
public void storeWatchExpressions() {
String expressionString = IInternalDebugCoreConstants.EMPTY_STRING;
@@ -243,7 +245,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
for (int i = 0; i < expressions.length; i++) {
IExpression expression= expressions[i];
if (expression instanceof IWatchExpression) {
- Element element= document.createElement(EXPRESSION_TAG);
+ Element element= document.createElement(EXPRESSION_TAG);
element.setAttribute(TEXT_TAG, expression.getExpressionText());
element.setAttribute(ENABLED_TAG, ((IWatchExpression) expression).isEnabled() ? TRUE_VALUE : FALSE_VALUE);
rootElement.appendChild(element);
@@ -255,40 +257,42 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#addExpression(org.eclipse.debug.core.model.IExpression)
*/
+ @Override
public void addExpression(IExpression expression) {
addExpressions(new IExpression[]{expression});
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#addExpressions(org.eclipse.debug.core.model.IExpression[])
*/
+ @Override
public void addExpressions(IExpression[] expressions) {
- List added = doAdd(expressions);
+ List<IExpression> added = doAdd(expressions);
if (!added.isEmpty()) {
- fireUpdate((IExpression[])added.toArray(new IExpression[added.size()]), ADDED);
+ fireUpdate(added.toArray(new IExpression[added.size()]), ADDED);
}
}
-
+
/**
* Adds the given expressions to the list of managed expressions, and returns a list
* of expressions that were actually added. Expressions that already exist in the
* managed list are not added.
- *
+ *
* @param expressions expressions to add
* @return list of expressions that were actually added.
*/
- private List doAdd(IExpression[] expressions) {
- List added = new ArrayList(expressions.length);
+ private List<IExpression> doAdd(IExpression[] expressions) {
+ List<IExpression> added = new ArrayList<IExpression>(expressions.length);
synchronized (this) {
if (fExpressions == null) {
- fExpressions = new Vector(expressions.length);
+ fExpressions = new Vector<IExpression>(expressions.length);
}
for (int i = 0; i < expressions.length; i++) {
IExpression expression = expressions[i];
if (fExpressions.indexOf(expression) == -1) {
added.add(expression);
fExpressions.add(expression);
- }
+ }
}
}
return added;
@@ -297,6 +301,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#getExpressions()
*/
+ @Override
public synchronized IExpression[] getExpressions() {
if (fExpressions == null) {
return new IExpression[0];
@@ -309,22 +314,21 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#getExpressions(java.lang.String)
*/
+ @Override
public synchronized IExpression[] getExpressions(String modelIdentifier) {
if (fExpressions == null) {
return new IExpression[0];
}
- ArrayList temp= new ArrayList(fExpressions.size());
- Iterator iter= fExpressions.iterator();
- while (iter.hasNext()) {
- IExpression expression= (IExpression) iter.next();
- String id= expression.getModelIdentifier();
+ ArrayList<IExpression> temp = new ArrayList<IExpression>(fExpressions.size());
+ for (IExpression expression : fExpressions) {
+ String id = expression.getModelIdentifier();
if (id != null && id.equals(modelIdentifier)) {
temp.add(expression);
}
}
- return (IExpression[]) temp.toArray(new IExpression[temp.size()]);
+ return temp.toArray(new IExpression[temp.size()]);
}
-
+
/**
* Adds the given expressions to the collection of registered expressions
* in the workspace and notifies all registered listeners. The expressions
@@ -339,8 +343,8 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
* @since 3.4
*/
public void insertExpressions(IExpression[] expressions, IExpression insertionLocation, boolean insertBefore){
- List added = null;
- List inserted = null;
+ List<IExpression> added = null;
+ List<IExpression> inserted = null;
int insertionIndex = -1;
synchronized (this) {
if (fExpressions == null || ((insertionIndex = fExpressions.indexOf(insertionLocation)) < 0)) {
@@ -349,44 +353,44 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
if (!insertBefore){
insertionIndex++;
}
- inserted = new ArrayList(expressions.length);
+ inserted = new ArrayList<IExpression>(expressions.length);
for (int i = 0; i < expressions.length; i++) {
IExpression expression = expressions[i];
if (fExpressions.indexOf(expression) == -1) {
//Insert in the same order as the array is passed
fExpressions.add(insertionIndex+inserted.size(), expression);
inserted.add(expression);
- }
+ }
}
}
}
if (added != null) {
if (!added.isEmpty()) {
- fireUpdate((IExpression[])added.toArray(new IExpression[added.size()]), ADDED);
+ fireUpdate(added.toArray(new IExpression[added.size()]), ADDED);
}
return;
}
if (inserted != null) {
if (!inserted.isEmpty()) {
- fireUpdate((IExpression[])inserted.toArray(new IExpression[inserted.size()]), INSERTED, insertionIndex);
+ fireUpdate(inserted.toArray(new IExpression[inserted.size()]), INSERTED, insertionIndex);
}
}
}
-
+
/**
* Moves the given expressions from their location in the collection
* of registered expressions in the workspace to the specified insertion
* location. Notifies all registered listeners. This method has no effect
- * if an expression does not exist in the collection or if no valid insertion
+ * if an expression does not exist in the collection or if no valid insertion
* location could be determined.
- *
+ *
* @param expressions expressions to move
* @param insertionLocation the expression at the location to insert the moved expressions
* @param insertBefore whether to insert the moved expressions before or after the given insertion location
* @since 3.4
*/
public void moveExpressions(IExpression[] expressions, IExpression insertionLocation, boolean insertBefore){
- List movedExpressions = new ArrayList(expressions.length);
+ List<IExpression> movedExpressions = new ArrayList<IExpression>(expressions.length);
int insertionIndex = -1;
IExpression[] movedExpressionsArray = null;
synchronized (this) {
@@ -400,7 +404,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
if (!insertBefore){
insertionIndex++;
}
-
+
for (int i = 0; i < expressions.length; i++) {
int removeIndex = fExpressions.indexOf(expressions[i]);
if (removeIndex >= 0){
@@ -411,21 +415,22 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fExpressions.remove(removeIndex);
}
}
- movedExpressionsArray = (IExpression[])movedExpressions.toArray(new IExpression[movedExpressions.size()]);
+ movedExpressionsArray = movedExpressions.toArray(new IExpression[movedExpressions.size()]);
for (int i = 0; i < movedExpressionsArray.length; i++) {
// Insert the expressions in the same order as the passed array
fExpressions.add(insertionIndex+i,movedExpressionsArray[i]);
}
}
-
+
if (!movedExpressions.isEmpty()) {
fireUpdate(movedExpressionsArray, MOVED, insertionIndex);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#removeExpression(org.eclipse.debug.core.model.IExpression)
*/
+ @Override
public void removeExpression(IExpression expression) {
removeExpressions(new IExpression[] {expression});
}
@@ -433,8 +438,9 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#removeExpressions(org.eclipse.debug.core.model.IExpression[])
*/
+ @Override
public void removeExpressions(IExpression[] expressions) {
- List removed = new ArrayList(expressions.length);
+ List<IExpression> removed = new ArrayList<IExpression>(expressions.length);
synchronized (this) {
if (fExpressions == null) {
return;
@@ -443,22 +449,22 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
IExpression expression = expressions[i];
if (fExpressions.remove(expression)) {
removed.add(expression);
- }
- }
+ }
+ }
}
// dispose outside of the synchronized block
- Iterator iterator = removed.iterator();
- while (iterator.hasNext()) {
- ((IExpression) iterator.next()).dispose();
- }
if (!removed.isEmpty()) {
- fireUpdate((IExpression[])removed.toArray(new IExpression[removed.size()]), REMOVED);
+ for (IExpression expression : removed) {
+ expression.dispose();
+ }
+ fireUpdate(removed.toArray(new IExpression[removed.size()]), REMOVED);
}
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#addExpressionListener(org.eclipse.debug.core.IExpressionListener)
*/
+ @Override
public void addExpressionListener(IExpressionListener listener) {
if (fListeners == null) {
fListeners = new ListenerList();
@@ -469,17 +475,18 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#removeExpressionListener(org.eclipse.debug.core.IExpressionListener)
*/
+ @Override
public void removeExpressionListener(IExpressionListener listener) {
if (fListeners == null) {
return;
}
fListeners.remove(listener);
}
-
+
/**
* The given watch expression has changed. Update the persisted
* expressions to store this change as indicated
- *
+ *
* @param expression the changed expression
*/
protected void watchExpressionChanged(IWatchExpression expression) {
@@ -496,17 +503,17 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/**
* Notifies listeners of the adds/removes/changes
- *
+ *
* @param expressions expressions that were modified
* @param update update flags
*/
private void fireUpdate(IExpression[] expressions, int update){
fireUpdate(expressions, update, -1);
}
-
+
/**
* Notifies listeners of the adds/removes/changes/insertions/moves
- *
+ *
* @param expressions expressions that were modified
* @param update update flags
* @param index index where expressions were inserted/moved to or <code>-1</code>
@@ -514,14 +521,15 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
private void fireUpdate(IExpression[] expressions, int update, int index){
// single listeners
getExpressionNotifier().notify(expressions, update);
-
+
// multi listeners
getExpressionsNotifier().notify(expressions, update, index);
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#hasExpressions()
*/
+ @Override
public synchronized boolean hasExpressions() {
return fExpressions != null && !fExpressions.isEmpty();
}
@@ -529,6 +537,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#addExpressionListener(org.eclipse.debug.core.IExpressionsListener)
*/
+ @Override
public void addExpressionListener(IExpressionsListener listener) {
if (fExpressionsListeners == null) {
fExpressionsListeners = new ListenerList();
@@ -539,23 +548,24 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.debug.core.IExpressionManager#removeExpressionListener(org.eclipse.debug.core.IExpressionsListener)
*/
+ @Override
public void removeExpressionListener(IExpressionsListener listener) {
if (fExpressionsListeners == null) {
return;
}
fExpressionsListeners.remove(listener);
}
-
+
private ExpressionNotifier getExpressionNotifier() {
return new ExpressionNotifier();
}
-
+
/**
* Notifies an expression listener (single expression) in a safe runnable to
* handle exceptions.
*/
class ExpressionNotifier implements ISafeRunnable {
-
+
private IExpressionListener fListener;
private int fType;
private IExpression fExpression;
@@ -563,6 +573,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during expression change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -571,6 +582,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case ADDED:
@@ -581,14 +593,16 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fListener.expressionRemoved(fExpression);
break;
case CHANGED:
- fListener.expressionChanged(fExpression);
+ fListener.expressionChanged(fExpression);
+ break;
+ default:
break;
- }
+ }
}
/**
* Notifies listeners of the add/change/remove
- *
+ *
* @param expressions the expressions that have changed
* @param update the type of change
*/
@@ -602,13 +616,13 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fExpression = expressions[j];
SafeRunner.run(this);
}
- }
+ }
}
fListener = null;
fExpression = null;
}
}
-
+
/**
* Returns the expressions notifier
* @return the expressions notifier
@@ -616,21 +630,22 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
private ExpressionsNotifier getExpressionsNotifier() {
return new ExpressionsNotifier();
}
-
+
/**
* Notifies an expression listener (multiple expressions) in a safe runnable
* to handle exceptions.
*/
class ExpressionsNotifier implements ISafeRunnable {
-
+
private IExpressionsListener fListener;
private int fType;
private int fIndex;
private IExpression[] fNotifierExpressions;
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during expression change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -639,6 +654,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/* (non-Javadoc)
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case MOVED:
@@ -662,14 +678,16 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fListener.expressionsRemoved(fNotifierExpressions);
break;
case CHANGED:
- fListener.expressionsChanged(fNotifierExpressions);
+ fListener.expressionsChanged(fNotifierExpressions);
+ break;
+ default:
break;
- }
+ }
}
/**
* Notifies listeners of the adds/changes/removes
- *
+ *
* @param expressions the expressions that changed
* @param update the type of change
* @param index the index of the first change
@@ -684,9 +702,9 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fListener = (IExpressionsListener)copiedListeners[i];
SafeRunner.run(this);
}
- }
+ }
fNotifierExpressions = null;
- fListener = null;
+ fListener = null;
}
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
index 933dabf8d..3196df3ea 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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
@@ -20,12 +20,12 @@ import org.eclipse.debug.core.DebugPlugin;
/**
* Writes to the input stream of a system process,
* queueing output if the stream is blocked.
- *
+ *
* The input stream monitor writes to system in via
* an output stream.
*/
public class InputStreamMonitor {
-
+
/**
* The stream which is being written to (connected to system in).
*/
@@ -33,7 +33,7 @@ public class InputStreamMonitor {
/**
* The queue of output.
*/
- private Vector fQueue;
+ private Vector<String> fQueue;
/**
* The thread which writes to the stream.
*/
@@ -42,7 +42,7 @@ public class InputStreamMonitor {
* A lock for ensuring that writes to the queue are contiguous
*/
private Object fLock;
-
+
/**
* Whether the underlying output stream has been closed
*/
@@ -52,34 +52,34 @@ public class InputStreamMonitor {
* The encoding of the input stream.
*/
private String fEncoding;
-
+
/**
* Creates an input stream monitor which writes to system in via the given output stream.
- *
+ *
* @param stream output stream
*/
public InputStreamMonitor(OutputStream stream) {
this(stream, null);
- }
+ }
/**
* Creates an input stream monitor which writes to system in via the given output stream.
- *
+ *
* @param stream output stream
* @param encoding stream encoding or <code>null</code> for system default
*/
public InputStreamMonitor(OutputStream stream, String encoding) {
fStream= stream;
- fQueue= new Vector();
+ fQueue = new Vector<String>();
fLock= new Object();
fEncoding= encoding;
}
-
+
/**
* Appends the given text to the stream, or
* queues the text to be written at a later time
* if the stream is blocked.
- *
+ *
* @param text text to append
*/
public void write(String text) {
@@ -95,6 +95,7 @@ public class InputStreamMonitor {
public void startMonitoring() {
if (fThread == null) {
fThread= new Thread(new Runnable() {
+ @Override
public void run() {
write();
}
@@ -103,7 +104,7 @@ public class InputStreamMonitor {
fThread.start();
}
}
-
+
/**
* Close all communications between this
* monitor and the underlying stream.
@@ -115,7 +116,7 @@ public class InputStreamMonitor {
thread.interrupt();
}
}
-
+
/**
* Continuously writes to the stream.
*/
@@ -131,19 +132,20 @@ public class InputStreamMonitor {
}
}
}
-
+
/**
* Write the text in the queue to the stream.
*/
protected void writeNext() {
while (!fQueue.isEmpty() && !fClosed) {
- String text = (String)fQueue.firstElement();
+ String text = fQueue.firstElement();
fQueue.removeElementAt(0);
try {
- if (fEncoding != null)
+ if (fEncoding != null) {
fStream.write(text.getBytes(fEncoding));
- else
+ } else {
fStream.write(text.getBytes());
+ }
fStream.flush();
} catch (IOException e) {
DebugPlugin.log(e);
@@ -160,7 +162,7 @@ public class InputStreamMonitor {
/**
* Closes the output stream attached to the standard input stream of this
* monitor's process.
- *
+ *
* @exception IOException if an exception occurs closing the input stream
*/
public void closeInputStream() throws IOException {
@@ -170,7 +172,7 @@ public class InputStreamMonitor {
} else {
throw new IOException();
}
-
+
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
index ff886fa04..b021f6b85 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
@@ -4,14 +4,14 @@
* 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
* Sascha Radike - bug 56642
*******************************************************************************/
package org.eclipse.debug.internal.core;
-
+
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
@@ -39,10 +39,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
@@ -67,73 +67,73 @@ import com.ibm.icu.text.MessageFormat;
/**
* Launch configuration handle.
- *
+ *
* @see ILaunchConfiguration
*/
public class LaunchConfiguration extends PlatformObject implements ILaunchConfiguration {
-
+
/**
* Launch configuration attribute that specifies the resources paths mapped to it.
* Not all launch configurations will have a mapped resource unless migrated.
* Value is a list of resource paths stored as portable strings, or <code>null</code>
* if none.
- *
+ *
* @since 3.2
*/
public static final String ATTR_MAPPED_RESOURCE_PATHS = DebugPlugin.getUniqueIdentifier() + ".MAPPED_RESOURCE_PATHS"; //$NON-NLS-1$
-
+
/**
* Launch configuration attribute that specifies the resources types mapped to it.
* Not all launch configurations will have a mapped resource unless migrated.
* Value is a list of resource type integers, or <code>null</code> if none.
- *
+ *
* @since 3.2
- */
+ */
public static final String ATTR_MAPPED_RESOURCE_TYPES = DebugPlugin.getUniqueIdentifier() + ".MAPPED_RESOURCE_TYPES"; //$NON-NLS-1$
-
+
/**
* The launch modes set on this configuration.
- *
+ *
* @since 3.3
*/
public static final String ATTR_LAUNCH_MODES = DebugPlugin.getUniqueIdentifier() + ".LAUNCH_MODES"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute storing a list
+ * Launch configuration attribute storing a list
* of preferred launchers for associated mode sets.
* This attribute is a list of launchers stored by mode set
* and relating to the id of the preferred launcher, which happens to be an <code>ILaunchDelegate</code>
- *
+ *
* @since 3.3
*/
- public static final String ATTR_PREFERRED_LAUNCHERS = DebugPlugin.getUniqueIdentifier() + ".preferred_launchers"; //$NON-NLS-1$
-
+ public static final String ATTR_PREFERRED_LAUNCHERS = DebugPlugin.getUniqueIdentifier() + ".preferred_launchers"; //$NON-NLS-1$
+
/**
* Status handler to prompt in the UI thread
- *
+ *
* @since 3.3
*/
protected static final IStatus promptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$
-
+
/**
* Status handler to prompt the user to resolve the missing launch delegate issue
* @since 3.3
*/
protected static final IStatus delegateNotAvailable = new Status(IStatus.INFO, "org.eclipse.debug.core", 226, "", null); //$NON-NLS-1$ //$NON-NLS-2$
-
+
/**
* Status handle to prompt the user to resolve duplicate launch delegates being detected
- *
+ *
* @since 3.3
*/
protected static final IStatus duplicateDelegates = new Status(IStatus.INFO, "org.eclipse.debug.core", 227, "", null); //$NON-NLS-1$//$NON-NLS-2$
-
+
/**
* This configuration's name
* @since 3.5
*/
private String fName;
-
+
/**
* The container this configuration is stored in or <code>null</code> if stored locally
* with workspace metadata.
@@ -145,7 +145,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
* Constructs a launch configuration with the given name. The configuration
* is stored in the given container or locally with workspace metadata if
* the specified container is <code>null</code>.
- *
+ *
* @param name launch configuration name
* @param container parent container or <code>null</code>
* @since 3.5
@@ -160,22 +160,22 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
* Initialize any state variables - called first in the constructor.
* Subclasses must override as appropriate.
*/
- protected void initialize() {
+ protected void initialize() {
}
-
+
/**
* Constructs a launch configuration on the given workspace file.
- *
+ *
* @param file workspace .launch file
* @since 3.5
*/
protected LaunchConfiguration(IFile file) {
this(getSimpleName(file.getName()), file.getParent());
}
-
+
/**
* Given a name that ends with .launch, return the simple name of the configuration.
- *
+ *
* @param fileName the name to parse
* @return simple name
* @since 3.5
@@ -187,11 +187,11 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
return fileName;
}
-
+
/**
* Constructs a launch configuration from the given
* memento.
- *
+ *
* @param memento launch configuration memento
* @exception CoreException if the memento is invalid or
* an exception occurs reading the memento
@@ -205,21 +205,21 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
StringReader reader = new StringReader(memento);
InputSource source = new InputSource(reader);
root = parser.parse(source).getDocumentElement();
-
- String localString = root.getAttribute(IConfigurationElementConstants.LOCAL);
+
+ String localString = root.getAttribute(IConfigurationElementConstants.LOCAL);
String path = root.getAttribute(IConfigurationElementConstants.PATH);
- String message = null;
+ String message = null;
if (path == null || IInternalDebugCoreConstants.EMPTY_STRING.equals(path)) {
- message = DebugCoreMessages.LaunchConfiguration_18;
+ message = DebugCoreMessages.LaunchConfiguration_18;
} else if (localString == null || IInternalDebugCoreConstants.EMPTY_STRING.equals(localString)) {
- message = DebugCoreMessages.LaunchConfiguration_19;
+ message = DebugCoreMessages.LaunchConfiguration_19;
}
if (message != null) {
throw new CoreException(newStatus(message, DebugException.INTERNAL_ERROR, null));
}
-
-
+
+
boolean local = (Boolean.valueOf(localString)).booleanValue();
IPath iPath = new Path(path);
String name = getSimpleName(iPath.lastSegment());
@@ -231,19 +231,20 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
setContainer(container);
return;
} catch (ParserConfigurationException e) {
- ex = e;
+ ex = e;
} catch (SAXException e) {
ex = e;
} catch (IOException e) {
ex = e;
}
- IStatus s = newStatus(DebugCoreMessages.LaunchConfiguration_17, DebugException.INTERNAL_ERROR, ex);
+ IStatus s = newStatus(DebugCoreMessages.LaunchConfiguration_17, DebugException.INTERNAL_ERROR, ex);
throw new CoreException(s);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#contentsEqual(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public boolean contentsEqual(ILaunchConfiguration object) {
try {
if (object instanceof LaunchConfiguration) {
@@ -262,14 +263,16 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#copy(java.lang.String)
*/
+ @Override
public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException {
ILaunchConfigurationWorkingCopy copy = new LaunchConfigurationWorkingCopy(this, name);
return copy;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#delete()
*/
+ @Override
public void delete() throws CoreException {
if (exists()) {
IFile file = getFile();
@@ -280,7 +283,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
if ((store.fetchInfo().exists())) {
throw new DebugException(
new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfiguration_Failed_to_delete_launch_configuration__1, null)
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfiguration_Failed_to_delete_launch_configuration__1, null)
);
}
}
@@ -306,16 +309,17 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
* given configuration. Two configurations are equal if
* they are stored in the same location (and neither one
* is a working copy).
- *
+ *
* @return whether this configuration is equal to the
* given configuration
* @see Object#equals(Object)
*/
+ @Override
public boolean equals(Object object) {
if (object instanceof ILaunchConfiguration) {
if (isWorkingCopy()) {
return this == object;
- }
+ }
LaunchConfiguration config = (LaunchConfiguration) object;
if (!config.isWorkingCopy()) {
return getName().equals(config.getName()) &&
@@ -324,10 +328,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
return false;
}
-
+
/**
* Returns whether the given objects are equal or both <code>null</code>.
- *
+ *
* @param o1 the object
* @param o2 the object to be compared to o1
* @return whether the given objects are equal or both <code>null</code>
@@ -345,6 +349,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#exists()
*/
+ @Override
public boolean exists() {
IFile file = getFile();
if (file != null) {
@@ -363,6 +368,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, boolean)
*/
+ @Override
public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
return getInfo().getBooleanAttribute(attributeName, defaultValue);
}
@@ -370,6 +376,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, int)
*/
+ @Override
public int getAttribute(String attributeName, int defaultValue) throws CoreException {
return getInfo().getIntAttribute(attributeName, defaultValue);
}
@@ -377,27 +384,34 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.util.List)
*/
- public List getAttribute(String attributeName, List defaultValue) throws CoreException {
+ @Override
+ public List<String> getAttribute(String attributeName, List<String> defaultValue) throws CoreException {
return getInfo().getListAttribute(attributeName, defaultValue);
}
- /**
- * @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.util.Set)
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String
+ * , java.util.Set)
*/
- public Set getAttribute(String attributeName, Set defaultValue) throws CoreException {
+ @Override
+ public Set<String> getAttribute(String attributeName, Set<String> defaultValue) throws CoreException {
return getInfo().getSetAttribute(attributeName, defaultValue);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.util.Map)
*/
- public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
+ @Override
+ public Map<String, String> getAttribute(String attributeName, Map<String, String> defaultValue) throws CoreException {
return getInfo().getMapAttribute(attributeName, defaultValue);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.lang.String)
*/
+ @Override
public String getAttribute(String attributeName, String defaultValue) throws CoreException {
return getInfo().getStringAttribute(attributeName, defaultValue);
}
@@ -405,7 +419,8 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getAttributes()
*/
- public Map getAttributes() throws CoreException {
+ @Override
+ public Map<String, Object> getAttributes() throws CoreException {
LaunchConfigurationInfo info = getInfo();
return info.getAttributes();
}
@@ -413,6 +428,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getCategory()
*/
+ @Override
public String getCategory() throws CoreException {
return getType().getCategory();
}
@@ -420,6 +436,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getFile()
*/
+ @Override
public IFile getFile() {
IContainer container = getContainer();
if (container != null) {
@@ -427,10 +444,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
return null;
}
-
+
/**
* Returns the simple file name of this launch configuration.
- *
+ *
* @return the simple file name of this launch configuration - for example
* "Abc.launch"
*/
@@ -444,7 +461,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/**
* Returns the info object containing the attributes
* of this configuration
- *
+ *
* @return info for this handle
* @exception CoreException if unable to retrieve the
* info object
@@ -452,19 +469,20 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
protected LaunchConfigurationInfo getInfo() throws CoreException {
return getLaunchManager().getInfo(this);
}
-
+
/**
* Returns the launch manager
- *
+ *
* @return launch manager
*/
protected LaunchManager getLaunchManager() {
return (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getLocation()
*/
+ @Override
public IPath getLocation() {
try {
IFileStore store = getFileStore();
@@ -478,12 +496,12 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
return null;
}
-
+
/**
* Returns the file store this configuration is persisted in or <code>null</code> if
* a file store cannot be derived. The file may or may not exist. If this configuration
* is in a project that is closed or does not exist, <code>null</code> is returned.
- *
+ *
* @return file store this configuration is persisted in or <code>null</code>
* @throws CoreException if a problem is encountered
* @since 3.5
@@ -503,25 +521,26 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getResource()
*/
+ @Override
public IResource[] getMappedResources() throws CoreException {
- List paths = getAttribute(ATTR_MAPPED_RESOURCE_PATHS, (List)null);
+ List<String> paths = getAttribute(ATTR_MAPPED_RESOURCE_PATHS, (List<String>) null);
if (paths == null || paths.size() == 0) {
return null;
}
- List types = getAttribute(ATTR_MAPPED_RESOURCE_TYPES, (List)null);
+ List<String> types = getAttribute(ATTR_MAPPED_RESOURCE_TYPES, (List<String>) null);
if (types == null || types.size() != paths.size()) {
- throw new CoreException(newStatus(DebugCoreMessages.LaunchConfiguration_0, DebugPlugin.ERROR, null));
+ throw new CoreException(newStatus(DebugCoreMessages.LaunchConfiguration_0, DebugPlugin.ERROR, null));
}
- ArrayList list = new ArrayList();
+ ArrayList<IResource> list = new ArrayList<IResource>();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
for(int i = 0; i < paths.size(); i++) {
- String pathStr = (String) paths.get(i);
- String typeStr= (String) types.get(i);
+ String pathStr = paths.get(i);
+ String typeStr= types.get(i);
int type = -1;
try {
type = Integer.decode(typeStr).intValue();
} catch (NumberFormatException e) {
- throw new CoreException(newStatus(DebugCoreMessages.LaunchConfiguration_0, DebugPlugin.ERROR, e));
+ throw new CoreException(newStatus(DebugCoreMessages.LaunchConfiguration_0, DebugPlugin.ERROR, e));
}
IPath path = Path.fromPortableString(pathStr);
IResource res = null;
@@ -551,12 +570,13 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
if (list.isEmpty()) {
return null;
}
- return (IResource[])list.toArray(new IResource[list.size()]);
+ return list.toArray(new IResource[list.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getMemento()
*/
+ @Override
public String getMemento() throws CoreException {
IPath relativePath = null;
IFile file = getFile();
@@ -582,37 +602,40 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
} catch (TransformerException te) {
e= te;
}
- IStatus status = newStatus(DebugCoreMessages.LaunchConfiguration_16, DebugException.INTERNAL_ERROR, e);
+ IStatus status = newStatus(DebugCoreMessages.LaunchConfiguration_16, DebugException.INTERNAL_ERROR, e);
throw new CoreException(status);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getName()
*/
+ @Override
public String getName() {
return fName;
}
-
+
/**
* Returns the container this configuration is stored in, or <code>null</code>
* if this configuration is local.
- *
+ *
* @return the container this configuration is stored in, or <code>null</code>
* if this configuration is local
* @since 3.5
*/
protected IContainer getContainer() {
return fContainer;
- }
+ }
- public Set getModes() throws CoreException {
- Set options = getAttribute(ATTR_LAUNCH_MODES, (Set)null);
- return (options != null ? new HashSet(options) : new HashSet(0));
+ @Override
+ public Set<String> getModes() throws CoreException {
+ Set<String> options = getAttribute(ATTR_LAUNCH_MODES, (Set<String>) null);
+ return (options != null ? new HashSet<String>(options) : new HashSet<String>(0));
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getType()
*/
+ @Override
public ILaunchConfigurationType getType() throws CoreException {
return getInfo().getType();
}
@@ -620,6 +643,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#getWorkingCopy()
*/
+ @Override
public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
return new LaunchConfigurationWorkingCopy(this);
}
@@ -627,6 +651,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
IContainer container = getContainer();
if (container == null) {
@@ -635,18 +660,19 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
return getName().hashCode() + container.hashCode();
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#hasAttribute(java.lang.String)
*/
+ @Override
public boolean hasAttribute(String attributeName) throws CoreException {
return getInfo().hasAttribute(attributeName);
}
-
+
/**
- * Set the source locator to use with the launch, if specified
+ * Set the source locator to use with the launch, if specified
* by this configuration.
- *
+ *
* @param launch the launch on which to set the source locator
* @throws CoreException if a problem is encountered
*/
@@ -662,10 +688,11 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
if (memento == null) {
locator.initializeDefaults(this);
} else {
- if(locator instanceof IPersistableSourceLocator2)
+ if(locator instanceof IPersistableSourceLocator2) {
((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this);
- else
+ } else {
locator.initializeFromMemento(memento);
+ }
}
launch.setSourceLocator(locator);
}
@@ -675,13 +702,15 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#isLocal()
*/
+ @Override
public boolean isLocal() {
return getContainer() == null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#isMigrationCandidate()
*/
+ @Override
public boolean isMigrationCandidate() throws CoreException {
return ((LaunchConfigurationType)getType()).isMigrationCandidate(this);
}
@@ -689,6 +718,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#isWorkingCopy()
*/
+ @Override
public boolean isWorkingCopy() {
return false;
}
@@ -696,6 +726,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
return launch(mode, monitor, false);
}
@@ -703,6 +734,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean)
*/
+ @Override
public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException {
return launch(mode, monitor, build, true);
}
@@ -710,10 +742,8 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean, boolean)
*/
- public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
+ @Override
+ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
/* Setup progress monitor
* - Prepare delegate (0)
* - Pre-launch check (1)
@@ -722,16 +752,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
* - Final launch validation (1)
* - Initialize source locator (1)
* - Launch delegate (10) */
- if (build) {
- monitor.beginTask("", 23); //$NON-NLS-1$
- }
- else {
- monitor.beginTask("", 13); //$NON-NLS-1$
- }
- monitor.subTask(DebugCoreMessages.LaunchConfiguration_9);
+ SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchConfiguration_9, build ? 23 : 13);
try {
// bug 28245 - force the delegate to load in case it is interested in launch notifications
- Set modes = getModes();
+ Set<String> modes = getModes();
modes.add(mode);
ILaunchDelegate[] delegates = getType().getDelegates(modes);
ILaunchConfigurationDelegate delegate = null;
@@ -742,7 +766,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
if (handler != null) {
handler.handleStatus(delegateNotAvailable, new Object[] {this, mode});
}
- IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_11, null);
+ IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_11, null);
throw new CoreException(status);
} else {
ILaunchDelegate del = getPreferredDelegate(modes);
@@ -764,12 +788,12 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
delegate = del.getDelegate();
}
else {
- status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
+ status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
throw new CoreException(status);
}
}
else {
- status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
+ status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
throw new CoreException(status);
}
}
@@ -777,7 +801,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
delegate = del.getDelegate();
}
}
-
+
ILaunchConfigurationDelegate2 delegate2 = null;
if (delegate instanceof ILaunchConfigurationDelegate2) {
delegate2 = (ILaunchConfigurationDelegate2) delegate;
@@ -792,8 +816,9 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
} else {
// ensure the launch mode is valid
if (!mode.equals(launch.getLaunchMode())) {
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR,
- MessageFormat.format(DebugCoreMessages.LaunchConfiguration_14, new String[]{mode, launch.getLaunchMode()}), null);
+ IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR,
+ MessageFormat.format(DebugCoreMessages.LaunchConfiguration_14, new Object[] {
+ mode, launch.getLaunchMode() }), null);
throw new CoreException(status);
}
}
@@ -805,57 +830,58 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
}
launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, getLaunchManager().getEncoding(this));
-
+
// perform initial pre-launch sanity checks
- monitor.subTask(DebugCoreMessages.LaunchConfiguration_8);
-
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_8);
+
if (delegate2 != null) {
- if (!(delegate2.preLaunchCheck(this, mode, new SubProgressMonitor(monitor, 1)))) {
+ if (!(delegate2.preLaunchCheck(this, mode, new SubProgressMonitor(lmonitor, 1)))) {
return launch;
}
}
else {
- monitor.worked(1); /* No pre-launch-check */
+ lmonitor.worked(1); /* No pre-launch-check */
}
// perform pre-launch build
if (build) {
- IProgressMonitor buildMonitor = new SubProgressMonitor(monitor, 10, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
- buildMonitor.beginTask(DebugCoreMessages.LaunchConfiguration_7, 10);
+ IProgressMonitor buildMonitor = new SubProgressMonitor(lmonitor, 10, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ buildMonitor.beginTask(DebugCoreMessages.LaunchConfiguration_7, 10);
buildMonitor.subTask(DebugCoreMessages.LaunchConfiguration_6);
+ boolean tempbuild = build;
if (delegate2 != null) {
- build = delegate2.buildForLaunch(this, mode, new SubProgressMonitor(buildMonitor, 7));
+ tempbuild = delegate2.buildForLaunch(this, mode, new SubProgressMonitor(buildMonitor, 7));
}
- if (build) {
+ if (tempbuild) {
buildMonitor.subTask(DebugCoreMessages.LaunchConfiguration_5);
- ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(buildMonitor, 3));
+ ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(buildMonitor, 3));
}
else {
buildMonitor.worked(3); /* No incremental build required */
}
}
// final validation
- monitor.subTask(DebugCoreMessages.LaunchConfiguration_4);
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_4);
if (delegate2 != null) {
- if (!(delegate2.finalLaunchCheck(this, mode, new SubProgressMonitor(monitor, 1)))) {
+ if (!(delegate2.finalLaunchCheck(this, mode, new SubProgressMonitor(lmonitor, 1)))) {
return launch;
}
}
else {
- monitor.worked(1); /* No validation */
+ lmonitor.worked(1); /* No validation */
}
if (register) {
getLaunchManager().addLaunch(launch);
}
-
+
try {
//initialize the source locator
- monitor.subTask(DebugCoreMessages.LaunchConfiguration_3);
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_3);
initializeSourceLocator(launch);
- monitor.worked(1);
+ lmonitor.worked(1);
/* Launch the delegate */
- monitor.subTask(DebugCoreMessages.LaunchConfiguration_2);
- delegate.launch(this, mode, launch, new SubProgressMonitor(monitor, 10));
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_2);
+ delegate.launch(this, mode, launch, new SubProgressMonitor(lmonitor, 10));
} catch (CoreException e) {
// if there was an exception, and the launch is empty, remove it
if (!launch.hasChildren()) {
@@ -869,27 +895,28 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
throw e;
}
- if (monitor.isCanceled()) {
+ if (lmonitor.isCanceled()) {
getLaunchManager().removeLaunch(launch);
}
return launch;
}
finally {
- monitor.done();
+ lmonitor.done();
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#migrate()
*/
- public void migrate() throws CoreException {
+ @Override
+ public void migrate() throws CoreException {
((LaunchConfigurationType)getType()).migrate(this);
}
/**
- * Creates and returns a new error status based on
+ * Creates and returns a new error status based on
* the given message, code, and exception.
- *
+ *
* @param message error message
* @param code error code
* @param e exception or <code>null</code>
@@ -901,28 +928,29 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/**
* Sets the new name for this configuration.
- *
+ *
* @param name the new name for this configuration
* @since 3.5
*/
protected void setName(String name) {
fName = name;
}
-
+
/**
* Sets this configurations container or <code>null</code> if stored in the
* local metadata.
- *
+ *
* @param container or <code>null</code>
* @since 3.5
*/
protected void setContainer(IContainer container) {
fContainer = container;
- }
-
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#supportsMode(java.lang.String)
*/
+ @Override
public boolean supportsMode(String mode) throws CoreException {
return getType().supportsMode(mode);
}
@@ -930,6 +958,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfiguration#isReadOnly()
*/
+ @Override
public boolean isReadOnly() {
try {
IFileStore fileStore = getFileStore();
@@ -944,23 +973,25 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
/**
* @see org.eclipse.debug.core.ILaunchConfiguration#getPreferredDelegate(java.util.Set)
*/
- public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException {
- Map delegates = getAttribute(LaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, (Map)null);
+ @Override
+ public ILaunchDelegate getPreferredDelegate(Set<String> modes) throws CoreException {
+ Map<String, String> delegates = getAttribute(LaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, (Map<String, String>) null);
if(delegates != null) {
- String id = (String) delegates.get(modes.toString());
+ String id = delegates.get(modes.toString());
if(id != null) {
return getLaunchManager().getLaunchDelegate(id);
}
}
return null;
}
-
+
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
return getName();
}
-
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java
index 3b2751197..6e633e9b8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationComparator.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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
-
+
import java.util.Comparator;
import org.eclipse.core.runtime.CoreException;
@@ -19,44 +19,46 @@ import org.eclipse.debug.core.DebugPlugin;
/**
* Proxy to a runtime classpath entry resolver extension.
- *
+ *
* @see IConfigurationElementConstants
*/
-public class LaunchConfigurationComparator implements Comparator {
+public class LaunchConfigurationComparator implements Comparator<Object> {
private IConfigurationElement fConfigurationElement;
-
- private Comparator fDelegate;
-
+
+ private Comparator<Object> fDelegate;
+
/**
* Constructs a new resolver on the given configuration element
- *
+ *
* @param element configuration element
*/
public LaunchConfigurationComparator(IConfigurationElement element) {
fConfigurationElement = element;
}
-
+
/**
* Returns the {@link Comparator} delegate
- *
+ *
* @return the {@link Comparator}
*/
- protected Comparator getComparator() {
+ @SuppressWarnings("unchecked")
+ protected Comparator<Object> getComparator() {
if (fDelegate == null) {
try {
- fDelegate = (Comparator)fConfigurationElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
+ fDelegate = (Comparator<Object>) fConfigurationElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
} catch (CoreException e) {
DebugPlugin.log(e);
}
}
return fDelegate;
}
-
+
/**
* @see Comparator#compare(Object, Object)
*/
+ @Override
public int compare(Object o1, Object o2) {
return getComparator().compare(o1, o2);
}
@@ -64,8 +66,13 @@ public class LaunchConfigurationComparator implements Comparator {
/**
* @see Object#equals(Object)
*/
+ @Override
public boolean equals(Object obj) {
return getComparator().equals(obj);
}
+ @Override
+ public int hashCode() {
+ return getComparator().hashCode();
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
index e62171c5f..be5564629 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
-
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -38,12 +38,12 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.ibm.icu.text.MessageFormat;
-
+
/**
* The information associated with a launch configuration handle.
*/
public class LaunchConfigurationInfo {
-
+
/**
* Constants for XML element names and attributes
*/
@@ -60,24 +60,26 @@ public class LaunchConfigurationInfo {
private static final String INT_ATTRIBUTE = "intAttribute"; //$NON-NLS-1$
private static final String STRING_ATTRIBUTE = "stringAttribute"; //$NON-NLS-1$
private static final String TYPE = "type"; //$NON-NLS-1$
-
+
/**
* This configurations attribute table. Keys are <code>String</code>s and
- * values are one of <code>String</code>, <code>Integer</code>, or
- * <code>Boolean</code>.
+ * values are one of <code>String</code>, <code>Integer</code>,
+ * <code>Boolean</code>, <code>Set&lt;String&gt;</code>,
+ * <code>List&lt;String&gt;</code>, or
+ * <code>Map&lt;String, String&gt;</code>
*/
- private TreeMap fAttributes;
-
+ private TreeMap<String, Object> fAttributes;
+
/**
* This launch configuration's type
*/
private ILaunchConfigurationType fType;
-
+
/**
* Whether running on Sun 1.4 VM - see bug 110215
*/
private static boolean fgIsSun14x = false;
-
+
static {
String vendor = System.getProperty("java.vm.vendor"); //$NON-NLS-1$
if (vendor.startsWith("Sun Microsystems")) { //$NON-NLS-1$
@@ -87,52 +89,52 @@ public class LaunchConfigurationInfo {
}
}
}
-
+
/**
* Constructs a new empty info
*/
protected LaunchConfigurationInfo() {
- setAttributeTable(new TreeMap());
+ setAttributeTable(new TreeMap<String, Object>());
}
-
+
/**
* Returns this configuration's attribute table.
- *
+ *
* @return attribute table
*/
- private TreeMap getAttributeTable() {
+ private TreeMap<String, Object> getAttributeTable() {
return fAttributes;
}
/**
* Sets this configuration's attribute table.
- *
+ *
* @param table
* attribute table
- */
- private void setAttributeTable(TreeMap table) {
+ */
+ private void setAttributeTable(TreeMap<String, Object> table) {
fAttributes = table;
}
-
+
/**
* Sets the attributes in this info to those in the given map.
- *
+ *
* @param map the {@link Map} of attributes to set
*/
- protected void setAttributes(Map map) {
+ protected void setAttributes(Map<String, ?> map) {
if (map == null) {
- setAttributeTable(new TreeMap());
+ setAttributeTable(new TreeMap<String, Object>());
return;
}
- setAttributeTable(new TreeMap(map));
+ setAttributeTable(new TreeMap<String, Object>(map));
}
-
+
/**
* Returns the <code>String</code> attribute with the given key or the
* given default value if undefined.
* @param key the attribute name
* @param defaultValue the value to be returned if the given key does not exist in the attribute table
- *
+ *
* @return attribute specified by given key or the defaultValue if undefined
* @throws CoreException
* if the attribute with the given key exists but is not a
@@ -143,23 +145,23 @@ public class LaunchConfigurationInfo {
if (attr != null) {
if (attr instanceof String) {
return (String)attr;
- }
+ }
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_java_lang_String__1, new String[] {key}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_java_lang_String__1, new Object[] { key }), null
)
);
}
return defaultValue;
}
-
+
/**
* Returns the <code>int</code> attribute with the given key or the given
* default value if undefined.
* @param key the name of the attribute
* @param defaultValue the default value to return if the key does not appear in the attribute table
- *
+ *
* @return attribute specified by given key or the defaultValue if undefined
* @throws CoreException
* if the attribute with the given key exists but is not an
@@ -170,23 +172,23 @@ public class LaunchConfigurationInfo {
if (attr != null) {
if (attr instanceof Integer) {
return ((Integer)attr).intValue();
- }
+ }
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_int__2, new String[] {key}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_int__2, new Object[] { key }), null
)
);
}
return defaultValue;
}
-
+
/**
* Returns the <code>boolean</code> attribute with the given key or the
* given default value if undefined.
* @param key the name of the attribute
* @param defaultValue the default value to return if the key does not appear in the attribute table
- *
+ *
* @return attribute specified by given key or the defaultValue if undefined
* @throws CoreException
* if the attribute with the given key exists but is not a
@@ -197,123 +199,127 @@ public class LaunchConfigurationInfo {
if (attr != null) {
if (attr instanceof Boolean) {
return ((Boolean)attr).booleanValue();
- }
+ }
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_boolean__3, new String[] {key}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_boolean__3, new Object[] { key }), null
)
);
}
return defaultValue;
}
-
+
/**
* Returns the <code>java.util.List</code> attribute with the given key or
* the given default value if undefined.
* @param key the name of the attribute
* @param defaultValue the default value to return if the key does not appear in the attribute table
- *
+ *
* @return attribute specified by given key or the defaultValue if undefined
* @throws CoreException
* if the attribute with the given key exists but is not a
* <code>java.util.List</code>
*/
- protected List getListAttribute(String key, List defaultValue) throws CoreException {
+ @SuppressWarnings("unchecked")
+ protected List<String> getListAttribute(String key, List<String> defaultValue) throws CoreException {
Object attr = getAttributeTable().get(key);
if (attr != null) {
if (attr instanceof List) {
- return (List)attr;
- }
+ return (List<String>) attr;
+ }
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_java_util_List__1, new String[] {key}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_java_util_List__1, new Object[] { key }), null
)
);
}
return defaultValue;
}
-
+
/**
* Returns the <code>java.util.Set</code> attribute with the given key or
* the given default value if undefined.
+ *
* @param key the name of the attribute
- * @param defaultValue the default value to return if the key does not xist in the attribute table
- *
+ * @param defaultValue the default value to return if the key does not exist
+ * in the attribute table
+ *
* @return attribute specified by given key or the defaultValue if undefined
- * @throws CoreException
- * if the attribute with the given key exists but is not a
- * <code>java.util.Set</code>
- *
+ * @throws CoreException if the attribute with the given key exists but is
+ * not a <code>java.util.Set</code>
+ *
* @since 3.3
*/
- protected Set getSetAttribute(String key, Set defaultValue) throws CoreException {
+ @SuppressWarnings("unchecked")
+ protected Set<String> getSetAttribute(String key, Set<String> defaultValue) throws CoreException {
Object attr = getAttributeTable().get(key);
if (attr != null) {
if (attr instanceof Set) {
- return (Set)attr;
- }
+ return (Set<String>) attr;
+ }
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_35, new String[] {key}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_35, new Object[] { key }), null
)
);
}
return defaultValue;
}
-
+
/**
* Returns the <code>java.util.Map</code> attribute with the given key or
* the given default value if undefined.
* @param key the name of the attribute
* @param defaultValue the default value to return if the key does not exist in the attribute table
- *
+ *
* @return attribute specified by given key or the defaultValue if undefined
* @throws CoreException
* if the attribute with the given key exists but is not a
* <code>java.util.Map</code>
*/
- protected Map getMapAttribute(String key, Map defaultValue) throws CoreException {
+ @SuppressWarnings("unchecked")
+ protected Map<String, String> getMapAttribute(String key, Map<String, String> defaultValue) throws CoreException {
Object attr = getAttributeTable().get(key);
if (attr != null) {
if (attr instanceof Map) {
- return (Map)attr;
- }
+ return (Map<String, String>) attr;
+ }
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_java_util_Map__1, new String[] {key}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_Attribute__0__is_not_of_type_java_util_Map__1, new Object[] { key }), null
)
);
}
return defaultValue;
}
-
+
/**
* Sets this configuration's type.
- *
+ *
* @param type
* launch configuration type
*/
protected void setType(ILaunchConfigurationType type) {
fType = type;
}
-
+
/**
* Returns this configuration's type.
- *
+ *
* @return launch configuration type
*/
protected ILaunchConfigurationType getType() {
return fType;
- }
-
-
+ }
+
+
/**
* Returns a copy of this info object
- *
+ *
* @return copy of this info
*/
protected LaunchConfigurationInfo getCopy() {
@@ -322,20 +328,20 @@ public class LaunchConfigurationInfo {
copy.setAttributeTable(getAttributes());
return copy;
}
-
+
/**
* Returns a copy of this info's attribute map.
- *
+ *
* @return a copy of this info's attribute map
*/
- protected TreeMap getAttributes() {
- return (TreeMap)getAttributeTable().clone();
+ protected TreeMap<String, Object> getAttributes() {
+ return new TreeMap<String, Object>(getAttributeTable());
}
-
+
/**
* Sets the given attribute to the given value. Only working copy's should
* use this API.
- *
+ *
* @param key
* attribute key
* @param value
@@ -348,10 +354,10 @@ public class LaunchConfigurationInfo {
getAttributeTable().put(key, value);
}
}
-
+
/**
* Returns the content of this info as XML
- *
+ *
* @return the content of this info as XML
* @throws CoreException
* if a attribute has been set with a null key
@@ -362,22 +368,20 @@ public class LaunchConfigurationInfo {
* @throws TransformerException
* if an exception occurs creating the XML
*/
+ @SuppressWarnings("unchecked")
protected String getAsXML() throws CoreException, IOException, ParserConfigurationException, TransformerException {
-
Document doc = LaunchManager.getDocument();
- Element configRootElement = doc.createElement(LAUNCH_CONFIGURATION);
+ Element configRootElement = doc.createElement(LAUNCH_CONFIGURATION);
doc.appendChild(configRootElement);
-
- configRootElement.setAttribute(TYPE, getType().getIdentifier());
-
- Iterator keys = getAttributeTable().keySet().iterator();
- while (keys.hasNext()) {
- String key = (String)keys.next();
+
+ configRootElement.setAttribute(TYPE, getType().getIdentifier());
+
+ for (String key : getAttributeTable().keySet()) {
if (key == null) {
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationInfo_36, null
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationInfo_36, null
)
);
}
@@ -389,26 +393,25 @@ public class LaunchConfigurationInfo {
String valueString = null;
if (value instanceof String) {
valueString = (String)value;
- element = createKeyValueElement(doc, STRING_ATTRIBUTE, key, valueString);
+ element = createKeyValueElement(doc, STRING_ATTRIBUTE, key, valueString);
} else if (value instanceof Integer) {
valueString = ((Integer)value).toString();
- element = createKeyValueElement(doc, INT_ATTRIBUTE, key, valueString);
+ element = createKeyValueElement(doc, INT_ATTRIBUTE, key, valueString);
} else if (value instanceof Boolean) {
valueString = ((Boolean)value).toString();
- element = createKeyValueElement(doc, BOOLEAN_ATTRIBUTE, key, valueString);
- } else if (value instanceof List) {
- element = createListElement(doc, LIST_ATTRIBUTE, key, (List)value);
- } else if (value instanceof Map) {
- element = createMapElement(doc, MAP_ATTRIBUTE, key, (Map)value);
+ element = createKeyValueElement(doc, BOOLEAN_ATTRIBUTE, key, valueString);
+ } else if (value instanceof List) {
+ element = createListElement(doc, LIST_ATTRIBUTE, key, (List<String>) value);
+ } else if (value instanceof Map) {
+ element = createMapElement(doc, MAP_ATTRIBUTE, key, (Map<String, String>) value);
} else if(value instanceof Set) {
- element = createSetElement(doc, SET_ATTRIBUTE, key, (Set)value);
+ element = createSetElement(doc, SET_ATTRIBUTE, key, (Set<String>) value);
}
configRootElement.appendChild(element);
}
-
return LaunchManager.serializeDocument(doc);
}
-
+
/**
* Helper method that creates a 'key value' element of the specified type
* with the specified attribute values.
@@ -420,109 +423,105 @@ public class LaunchConfigurationInfo {
*/
protected Element createKeyValueElement(Document doc, String elementType, String key, String value) {
Element element = doc.createElement(elementType);
- element.setAttribute(KEY, key);
+ element.setAttribute(KEY, key);
element.setAttribute(VALUE, value);
return element;
}
-
+
/**
* Creates a new <code>Element</code> for the specified
* <code>java.util.List</code>
- *
+ *
* @param doc the doc to add the element to
* @param elementType the type of the element
* @param listKey the key for the element
* @param list the list to fill the new element with
* @return the new element
*/
- protected Element createListElement(Document doc, String elementType, String listKey, List list) {
+ protected Element createListElement(Document doc, String elementType, String listKey, List<String> list) {
Element listElement = doc.createElement(elementType);
- listElement.setAttribute(KEY, listKey);
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- String value = (String) iterator.next();
- Element element = doc.createElement(LIST_ENTRY);
+ listElement.setAttribute(KEY, listKey);
+ for (String value : list) {
+ Element element = doc.createElement(LIST_ENTRY);
element.setAttribute(VALUE, value);
listElement.appendChild(element);
- }
+ }
return listElement;
}
-
+
/**
* Creates a new <code>Element</code> for the specified
* <code>java.util.Set</code>
- *
+ *
* @param doc the doc to add the element to
* @param elementType the type of the element
* @param setKey the key for the element
* @param set the set to fill the new element with
* @return the new element
- *
+ *
* @since 3.3
*/
- protected Element createSetElement(Document doc, String elementType, String setKey, Set set) {
+ protected Element createSetElement(Document doc, String elementType, String setKey, Set<String> set) {
Element setElement = doc.createElement(elementType);
setElement.setAttribute(KEY, setKey);
// persist in sorted order
- List list = new ArrayList(set);
+ List<String> list = new ArrayList<String>(set);
Collections.sort(list);
Element element = null;
- for(Iterator iter = list.iterator(); iter.hasNext();) {
+ for (String str : list) {
element = doc.createElement(SET_ENTRY);
- element.setAttribute(VALUE, (String) iter.next());
+ element.setAttribute(VALUE, str);
setElement.appendChild(element);
}
return setElement;
}
-
+
/**
* Creates a new <code>Element</code> for the specified
* <code>java.util.Map</code>
- *
+ *
* @param doc the doc to add the element to
* @param elementType the type of the element
* @param mapKey the key for the element
* @param map the map to fill the new element with
* @return the new element
- *
+ *
*/
- protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) {
+ protected Element createMapElement(Document doc, String elementType, String mapKey, Map<String, String> map) {
Element mapElement = doc.createElement(elementType);
mapElement.setAttribute(KEY, mapKey);
// persist in sorted order based on keys
- List keys = new ArrayList(map.keySet());
+ List<String> keys = new ArrayList<String>(map.keySet());
Collections.sort(keys);
- Iterator iterator = keys.iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- String value = (String) map.get(key);
- Element element = doc.createElement(MAP_ENTRY);
- element.setAttribute(KEY, key);
- element.setAttribute(VALUE, value);
+ for (String key : keys) {
+ String value = map.get(key);
+ Element element = doc.createElement(MAP_ENTRY);
+ element.setAttribute(KEY, key);
+ element.setAttribute(VALUE, value);
mapElement.appendChild(element);
- }
- return mapElement;
+ }
+ return mapElement;
}
-
+
/**
* Initializes the mapping of attributes from the XML file
* @param root the root node from the XML document
* @throws CoreException if a problem is encountered
*/
protected void initializeFromXML(Element root) throws CoreException {
- if (!root.getNodeName().equalsIgnoreCase(LAUNCH_CONFIGURATION)) {
+ if (!root.getNodeName().equalsIgnoreCase(LAUNCH_CONFIGURATION)) {
throw getInvalidFormatDebugException();
}
-
+
// read type
- String id = root.getAttribute(TYPE);
+ String id = root.getAttribute(TYPE);
if (id == null) {
throw getInvalidFormatDebugException();
- }
-
+ }
+
ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(id);
if (type == null) {
- String message= MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_missing_type, new Object[]{id});
+ String message= MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_missing_type, new Object[]{id});
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
@@ -530,7 +529,7 @@ public class LaunchConfigurationInfo {
);
}
setType(type);
-
+
NodeList list = root.getChildNodes();
Node node = null;
Element element = null;
@@ -541,23 +540,23 @@ public class LaunchConfigurationInfo {
if (nodeType == Node.ELEMENT_NODE) {
element = (Element) node;
nodeName = element.getNodeName();
- if (nodeName.equalsIgnoreCase(STRING_ATTRIBUTE)) {
+ if (nodeName.equalsIgnoreCase(STRING_ATTRIBUTE)) {
setStringAttribute(element);
- } else if (nodeName.equalsIgnoreCase(INT_ATTRIBUTE)) {
+ } else if (nodeName.equalsIgnoreCase(INT_ATTRIBUTE)) {
setIntegerAttribute(element);
- } else if (nodeName.equalsIgnoreCase(BOOLEAN_ATTRIBUTE)) {
+ } else if (nodeName.equalsIgnoreCase(BOOLEAN_ATTRIBUTE)) {
setBooleanAttribute(element);
- } else if (nodeName.equalsIgnoreCase(LIST_ATTRIBUTE)) {
- setListAttribute(element);
- } else if (nodeName.equalsIgnoreCase(MAP_ATTRIBUTE)) {
- setMapAttribute(element);
- } else if(nodeName.equalsIgnoreCase(SET_ATTRIBUTE)) {
+ } else if (nodeName.equalsIgnoreCase(LIST_ATTRIBUTE)) {
+ setListAttribute(element);
+ } else if (nodeName.equalsIgnoreCase(MAP_ATTRIBUTE)) {
+ setMapAttribute(element);
+ } else if(nodeName.equalsIgnoreCase(SET_ATTRIBUTE)) {
setSetAttribute(element);
}
}
}
- }
-
+ }
+
/**
* Loads a <code>String</code> from the specified element into the local attribute mapping
* @param element the element to load from
@@ -566,7 +565,7 @@ public class LaunchConfigurationInfo {
protected void setStringAttribute(Element element) throws CoreException {
setAttribute(getKeyAttribute(element), getValueAttribute(element));
}
-
+
/**
* Loads an <code>Integer</code> from the specified element into the local attribute mapping
* @param element the element to load from
@@ -575,7 +574,7 @@ public class LaunchConfigurationInfo {
protected void setIntegerAttribute(Element element) throws CoreException {
setAttribute(getKeyAttribute(element), new Integer(getValueAttribute(element)));
}
-
+
/**
* Loads a <code>Boolean</code> from the specified element into the local attribute mapping
* @param element the element to load from
@@ -584,26 +583,26 @@ public class LaunchConfigurationInfo {
protected void setBooleanAttribute(Element element) throws CoreException {
setAttribute(getKeyAttribute(element), Boolean.valueOf(getValueAttribute(element)));
}
-
+
/**
* Reads a <code>List</code> attribute from the specified XML node and
* loads it into the mapping of attributes
- *
+ *
* @param element the element to read the list attribute from
* @throws CoreException if the element has an invalid format
*/
protected void setListAttribute(Element element) throws CoreException {
- String listKey = element.getAttribute(KEY);
+ String listKey = element.getAttribute(KEY);
NodeList nodeList = element.getChildNodes();
int entryCount = nodeList.getLength();
- List list = new ArrayList(entryCount);
+ List<String> list = new ArrayList<String>(entryCount);
Node node = null;
Element selement = null;
for (int i = 0; i < entryCount; i++) {
node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
- selement = (Element) node;
- if (!selement.getNodeName().equalsIgnoreCase(LIST_ENTRY)) {
+ selement = (Element) node;
+ if (!selement.getNodeName().equalsIgnoreCase(LIST_ENTRY)) {
throw getInvalidFormatDebugException();
}
list.add(getValueAttribute(selement));
@@ -611,28 +610,28 @@ public class LaunchConfigurationInfo {
}
setAttribute(listKey, list);
}
-
+
/**
* Reads a <code>Set</code> attribute from the specified XML node and
* loads it into the mapping of attributes
- *
+ *
* @param element the element to read the set attribute from
* @throws CoreException if the element has an invalid format
- *
+ *
* @since 3.3
*/
protected void setSetAttribute(Element element) throws CoreException {
String setKey = element.getAttribute(KEY);
NodeList nodeList = element.getChildNodes();
int entryCount = nodeList.getLength();
- Set set = new HashSet(entryCount);
+ Set<String> set = new HashSet<String>(entryCount);
Node node = null;
Element selement = null;
for(int i = 0; i < entryCount; i++) {
node = nodeList.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
selement = (Element)node;
- if(!selement.getNodeName().equalsIgnoreCase(SET_ENTRY)) {
+ if(!selement.getNodeName().equalsIgnoreCase(SET_ENTRY)) {
throw getInvalidFormatDebugException();
}
set.add(getValueAttribute(selement));
@@ -640,26 +639,26 @@ public class LaunchConfigurationInfo {
}
setAttribute(setKey, set);
}
-
+
/**
* Reads a <code>Map</code> attribute from the specified XML node and
* loads it into the mapping of attributes
- *
+ *
* @param element the element to read the map attribute from
* @throws CoreException if the element has an invalid format
*/
protected void setMapAttribute(Element element) throws CoreException {
- String mapKey = element.getAttribute(KEY);
+ String mapKey = element.getAttribute(KEY);
NodeList nodeList = element.getChildNodes();
int entryCount = nodeList.getLength();
- Map map = new HashMap(entryCount);
+ Map<String, String> map = new HashMap<String, String>(entryCount);
Node node = null;
Element selement = null;
for (int i = 0; i < entryCount; i++) {
node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
- selement = (Element) node;
- if (!selement.getNodeName().equalsIgnoreCase(MAP_ENTRY)) {
+ selement = (Element) node;
+ if (!selement.getNodeName().equalsIgnoreCase(MAP_ENTRY)) {
throw getInvalidFormatDebugException();
}
map.put(getKeyAttribute(selement), getValueAttribute(selement));
@@ -667,7 +666,7 @@ public class LaunchConfigurationInfo {
}
setAttribute(mapKey, map);
}
-
+
/**
* Returns the <code>String</code> representation of the 'key' attribute from the specified element
* @param element the element to read from
@@ -681,7 +680,7 @@ public class LaunchConfigurationInfo {
}
return key;
}
-
+
/**
* Returns the <code>String</code> representation of the 'value' attribute from the specified element
* @param element the element to read from
@@ -689,71 +688,72 @@ public class LaunchConfigurationInfo {
* @throws CoreException if a problem is encountered
*/
protected String getValueAttribute(Element element) throws CoreException {
- String value = element.getAttribute(VALUE);
+ String value = element.getAttribute(VALUE);
if (value == null) {
throw getInvalidFormatDebugException();
}
return value;
}
-
+
/**
* Returns an invalid format exception for reuse
* @return an invalid format exception
*/
protected DebugException getInvalidFormatDebugException() {
- return
+ return
new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationInfo_Invalid_launch_configuration_XML__10, null
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationInfo_Invalid_launch_configuration_XML__10, null
)
);
}
-
+
/**
* Two <code>LaunchConfigurationInfo</code> objects are equal if and only
* if they have the same type and they have the same set of attributes with
* the same values.
- *
+ *
* @see Object#equals(Object)
*/
+ @Override
public boolean equals(Object obj) {
-
+
// Make sure it's a LaunchConfigurationInfo object
if (!(obj instanceof LaunchConfigurationInfo)) {
return false;
}
-
+
// Make sure the types are the same
LaunchConfigurationInfo other = (LaunchConfigurationInfo) obj;
if (!fType.getIdentifier().equals(other.getType().getIdentifier())) {
return false;
}
-
+
// Make sure the attributes are the same
return compareAttributes(fAttributes, other.getAttributeTable());
}
-
+
/**
* Returns whether the two attribute maps are equal, consulting registered
* comparator extensions.
- *
+ *
* @param map1 attribute map
* @param map2 attribute map
* @return whether the two attribute maps are equal
*/
- protected boolean compareAttributes(TreeMap map1, TreeMap map2) {
+ protected boolean compareAttributes(TreeMap<String, Object> map1, TreeMap<String, Object> map2) {
LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
if (map1.size() == map2.size()) {
- Iterator attributes = map1.keySet().iterator();
+ Iterator<String> attributes = map1.keySet().iterator();
while (attributes.hasNext()) {
- String key = (String)attributes.next();
+ String key = attributes.next();
Object attr1 = map1.get(key);
Object attr2 = map2.get(key);
if (attr2 == null) {
return false;
}
- Comparator comp = manager.getComparator(key);
+ Comparator<Object> comp = manager.getComparator(key);
if (comp == null) {
if (fgIsSun14x) {
if(attr2 instanceof String & attr1 instanceof String) {
@@ -776,14 +776,15 @@ public class LaunchConfigurationInfo {
}
}
}
- return true;
+ return true;
}
return false;
}
-
+
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
return fType.hashCode() + fAttributes.size();
}
@@ -792,20 +793,20 @@ public class LaunchConfigurationInfo {
* Returns if the attribute map contains the specified key
* @param attributeName the name of the attribute to check for
* @return true if the attribute map contains the specified key, false otherwise
- *
+ *
* @since 3.4.0
*/
protected boolean hasAttribute(String attributeName) {
return fAttributes.containsKey(attributeName);
}
-
+
/**
* Removes the specified attribute from the mapping and returns
* its value, or <code>null</code> if none. Does nothing
* if the attribute name is <code>null</code>
* @param attributeName the name of the attribute to remove
* @return attribute value or <code>null</code>
- *
+ *
* @since 3.4.0
*/
protected Object removeAttribute(String attributeName) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
index 39890ae86..8848883ed 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.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
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
-
+
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -47,79 +46,80 @@ import com.ibm.icu.text.MessageFormat;
* extension.
*/
public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType {
-
+
/**
* The configuration element of the extension.
*/
private IConfigurationElement fElement;
-
+
/**
* a listing of modes contributed to this launch configuration type
- *
+ *
* @since 3.3
*/
- private Set fModes = null;
-
+ private Set<String> fModes = null;
+
/**
* A set of sets containing all of the supported mode combinations of this type
- *
+ *
* @since 3.3
*/
- private Set fModeCombinations = null;
-
+ private Set<Set<String>> fModeCombinations = null;
+
/**
* the default source path computer for this config type
- *
+ *
* @since 3.3
*/
private ISourcePathComputer fSourcePathComputer = null;
-
+
/**
* Cache for the migration delegate
- *
+ *
* @since 3.3
*/
private ILaunchConfigurationMigrationDelegate fMigrationDelegate = null;
-
+
/**
* The source locator id for this config type
*/
private String fSourceLocator = null;
-
+
/**
* The delegates for launch configurations of this type.
* Delegates are instantiated lazily as required. There may
* be different delegates for different modes (since 3.0).
* Map of modes (Set of modes) to list of delegates
*/
- private Map fDelegates = null;
-
+ private Map<Set<String>, Set<ILaunchDelegate>> fDelegates = null;
+
/**
* The source provider cache entry
*/
private LaunchDelegate fSourceProvider = null;
-
+
/**
* A map of preferred launch delegates for mode combinations
- *
+ *
* @since 3.3
*/
- private Map fPreferredDelegates = null;
-
+ private Map<Set<String>, ILaunchDelegate> fPreferredDelegates = null;
+
/**
* Constructs a new launch configuration type on the
* given configuration element.
- *
+ *
* @param element configuration element
*/
protected LaunchConfigurationType(IConfigurationElement element) {
fElement = element;
initializePreferredDelegates();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getAttribute(java.lang.String)
*/
+ @Override
public String getAttribute(String attributeName) {
return fElement.getAttribute(attributeName);
}
@@ -127,6 +127,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getCategory()
*/
+ @Override
public String getCategory() {
return fElement.getAttribute(IConfigurationElementConstants.CATEGORY);
}
@@ -134,6 +135,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate()
*/
+ @Override
public ILaunchConfigurationDelegate getDelegate() throws CoreException {
return getDelegate(ILaunchManager.RUN_MODE);
}
@@ -141,8 +143,9 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate(java.lang.String)
*/
+ @Override
public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
- Set modes = new HashSet();
+ Set<String> modes = new HashSet<String>();
modes.add(mode);
ILaunchDelegate[] delegates = getDelegates(modes);
if (delegates.length > 0) {
@@ -153,33 +156,35 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
if (launchMode == null) {
status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_7,
- new String[]{mode}));
+ new Object[] { mode }));
} else {
status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_7,
- new String[]{((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchModeName(mode)}));
+ new Object[] { ((LaunchManager) DebugPlugin.getDefault().getLaunchManager()).getLaunchModeName(mode) }));
}
throw new CoreException(status);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegates(java.util.Set)
*/
- public ILaunchDelegate[] getDelegates(Set modes) throws CoreException {
+ @Override
+ public ILaunchDelegate[] getDelegates(Set<String> modes) throws CoreException {
initializeDelegates();
- Set delegates = (Set) fDelegates.get(modes);
+ Set<ILaunchDelegate> delegates = fDelegates.get(modes);
if (delegates == null) {
delegates = Collections.EMPTY_SET;
}
- return (ILaunchDelegate[]) delegates.toArray(new ILaunchDelegate[delegates.size()]);
+ return delegates.toArray(new ILaunchDelegate[delegates.size()]);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#setPreferredDelegate(java.util.Set, org.eclipse.debug.core.ILaunchDelegate)
*/
- public void setPreferredDelegate(Set modes, ILaunchDelegate delegate) {
+ @Override
+ public void setPreferredDelegate(Set<String> modes, ILaunchDelegate delegate) {
if(fPreferredDelegates == null) {
- fPreferredDelegates = new HashMap();
+ fPreferredDelegates = new HashMap<Set<String>, ILaunchDelegate>();
}
if (delegate == null) {
fPreferredDelegates.remove(modes);
@@ -188,15 +193,16 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).persistPreferredLaunchDelegate(this);
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchConfigurationType#getPreferredDelegate(java.util.Set)
*/
- public ILaunchDelegate getPreferredDelegate(Set modes) {
+ @Override
+ public ILaunchDelegate getPreferredDelegate(Set<String> modes) {
initializePreferredDelegates();
- return (ILaunchDelegate) fPreferredDelegates.get(modes);
+ return fPreferredDelegates.get(modes);
}
-
+
/**
* Internal use method to allow access to the listing of preferred delegates. Delegates are stored in the map by their mode set combinations.
* <p>
@@ -206,33 +212,31 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
* </pre>
* </p>
* @return the <code>java.util.Map</code> of preferred delegates or an empty <code>java.util.Map</code> if no preferred delegates are specified, never <code>null</code>
- *
+ *
* @since 3.3
*/
- public Map getPreferredDelegates() {
+ public Map<Set<String>, ILaunchDelegate> getPreferredDelegates() {
initializePreferredDelegates();
return fPreferredDelegates;
}
-
+
/**
* This method is used to initialize the listing of preferred launch delegates for this type
- *
+ *
* <p>
- * Undecided if this code should live in the launch manager and have it load a listing of all preferred launch
- * delegates that each config type could then query as needed when looking for their preferred delegate.
+ * Undecided if this code should live in the launch manager and have it load a listing of all preferred launch
+ * delegates that each config type could then query as needed when looking for their preferred delegate.
* Seems like it would be alot less work...
* </p>
* @since 3.3
*/
private synchronized void initializePreferredDelegates() {
if(fPreferredDelegates == null) {
- fPreferredDelegates = new HashMap();
+ fPreferredDelegates = new HashMap<Set<String>, ILaunchDelegate>();
initializeDelegates();
LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
ILaunchDelegate delegate = null;
- Set modes = null;
- for(Iterator iter = fDelegates.keySet().iterator(); iter.hasNext();) {
- modes = (Set) iter.next();
+ for (Set<String> modes : fDelegates.keySet()) {
delegate = lm.getPreferredDelegate(getIdentifier(), modes);
if(delegate != null) {
fPreferredDelegates.put(modes, delegate);
@@ -240,27 +244,25 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
}
}
-
+
/**
* Initializes the listing of launch delegates for this type
*/
private synchronized void initializeDelegates() {
if (fDelegates == null) {
// initialize delegate
- fDelegates = new Hashtable();
+ fDelegates = new Hashtable<Set<String>, Set<ILaunchDelegate>>();
LaunchDelegate[] launchDelegates = getLaunchDelegateExtensions();
LaunchDelegate delegate = null;
- List modelist = null;
- Set modes = null, tmp = null;
+ List<Set<String>> modelist = null;
+ Set<ILaunchDelegate> tmp = null;
for (int i = 0; i < launchDelegates.length; i++) {
delegate = launchDelegates[i];
modelist = delegate.getModes();
- for(int j = 0; j < modelist.size(); j++) {
- //cache the delegate based on its set of modes and delegate
- modes = (Set) modelist.get(j);
- tmp = (Set) fDelegates.get(modes);
+ for (Set<String> modes : modelist) {
+ tmp = fDelegates.get(modes);
if (tmp == null) {
- tmp = new HashSet();
+ tmp = new HashSet<ILaunchDelegate>();
fDelegates.put(modes, tmp);
}
tmp.add(delegate);
@@ -268,10 +270,10 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
}
}
-
+
/**
* Returns all launch delegate extensions registered for this configuration type.
- *
+ *
* @return all launch delegate extensions
*/
private LaunchDelegate[] getLaunchDelegateExtensions() {
@@ -281,6 +283,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getIdentifier()
*/
+ @Override
public String getIdentifier() {
return fElement.getAttribute(IConfigurationElementConstants.ID);
}
@@ -288,6 +291,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getName()
*/
+ @Override
public String getName() {
return fElement.getAttribute(IConfigurationElementConstants.NAME);
}
@@ -295,13 +299,15 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getPluginId()
*/
+ @Override
public String getPluginIdentifier() {
return fElement.getContributor().getName();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId()
*/
+ @Override
public String getSourceLocatorId() {
if(fSourceLocator == null) {
fSourceLocator = getAttribute(IConfigurationElementConstants.SOURCE_LOCATOR);
@@ -324,11 +330,12 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
}
return fSourceLocator;
- }
+ }
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getSourcePathComputer()
*/
+ @Override
public ISourcePathComputer getSourcePathComputer() {
if(fSourcePathComputer == null) {
//get the id
@@ -340,7 +347,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
if(id != null) {
fSourcePathComputer = DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
}
- else {
+ else {
//if not provided check all the applicable delegates for one and record the delegate if found,
//so it can be reused to try and find the source path computer
LaunchDelegate[] delegates = getLaunchDelegateExtensions();
@@ -356,7 +363,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
fSourceProvider = null;
}
-
+
}
return fSourcePathComputer;
}
@@ -364,45 +371,41 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModes()
*/
- public Set getSupportedModes() {
+ @Override
+ public Set<String> getSupportedModes() {
if(fModes == null) {
- fModes = new HashSet();
+ fModes = new HashSet<String>();
LaunchDelegate[] delegates = getLaunchDelegateExtensions();
- List modesets = null;
+ List<Set<String>> modesets = null;
for(int i= 0; i < delegates.length; i++) {
modesets = delegates[i].getModes();
- for(Iterator iter = modesets.iterator(); iter.hasNext();) {
- fModes.addAll((Set) iter.next());
+ for (Set<String> modes : modesets) {
+ fModes.addAll(modes);
}
}
}
return fModes;
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModeCombinations()
*/
- public Set getSupportedModeCombinations() {
+ @Override
+ public Set<Set<String>> getSupportedModeCombinations() {
if(fModeCombinations == null) {
initializeDelegates();
- fModeCombinations = new HashSet();
fModeCombinations = fDelegates.keySet();
}
- //return a clone or bad things happen
- HashSet set = new HashSet();
- for(Iterator iter = fModeCombinations.iterator(); iter.hasNext();) {
- set.add(new HashSet((Set) iter.next()));
- }
- return set;
+ return Collections.unmodifiableSet(fModeCombinations);
}
-
+
/**
* determines if the specified candidate is suitable for migration by loading its delegate.
* if we initialize the delegate and it has not been provided, return false instead of failing
* @param candidate the candidate to inspect for migration suitability
* @return true if the specified launch configuration is suitable for migration, false otherwise
* @throws CoreException if a problem is encountered
- *
+ *
* @since 3.2
*/
public boolean isMigrationCandidate(ILaunchConfiguration candidate) throws CoreException {
@@ -412,7 +415,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
}
return false;
}
-
+
/**
* This method initializes the migration delegate
* @throws CoreException if a problem is encountered
@@ -422,17 +425,18 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
fMigrationDelegate = (ILaunchConfigurationMigrationDelegate) fElement.createExecutableExtension(IConfigurationElementConstants.MIGRATION_DELEGATE);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#isPublic()
*/
+ @Override
public boolean isPublic() {
String publicString = fElement.getAttribute(IConfigurationElementConstants.PUBLIC);
if (publicString != null) {
if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
return false;
}
- }
+ }
return true;
}
@@ -441,7 +445,7 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
* In the event the migration delegate has not been provided do nothing.
* @param candidate the candidate launch configuration to migrate
* @throws CoreException if a problem is encountered
- *
+ *
* @since 3.2
*/
public void migrate(ILaunchConfiguration candidate) throws CoreException {
@@ -450,13 +454,14 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
fMigrationDelegate.migrate(candidate);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String)
*/
+ @Override
public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) throws CoreException {
// validate the configuration name - see bug 275741
- IPath path = new Path(name);
+ IPath path = new Path(name);
if (container == null) {
// not allowed to nest in sub directory when local
if (path.segmentCount() > 1) {
@@ -475,23 +480,23 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/**
* @see org.eclipse.debug.core.ILaunchConfigurationType#supportsMode(java.lang.String)
*/
+ @Override
public boolean supportsMode(String mode) {
if(fModeCombinations == null) {
getSupportedModeCombinations();
}
- Set modes = null;
- for(Iterator iter = fModeCombinations.iterator(); iter.hasNext();) {
- modes = (Set) iter.next();
+ for (Set<String> modes : fModeCombinations) {
if(modes.size() == 1 && modes.contains(mode)) {
return true;
}
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#getContributorName()
*/
+ @Override
public String getContributorName() {
return fElement.getContributor().getName();
}
@@ -499,14 +504,15 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationType#supportsModeCombination(java.util.Set)
*/
- public boolean supportsModeCombination(Set modes) {
+ @Override
+ public boolean supportsModeCombination(Set<String> modes) {
if(fModeCombinations == null) {
getSupportedModeCombinations();
}
return fModeCombinations.contains(modes);
}
- /**
+ /**
* Called on preference import to reset preferred delegates.
*/
void resetPreferredDelegates() {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index da3db4b35..372f57c09 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
-
+
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -47,44 +47,44 @@ import com.ibm.icu.text.MessageFormat;
* A working copy launch configuration
*/
public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implements ILaunchConfigurationWorkingCopy {
-
+
/**
* Handle of original launch configuration this
* working copy is based on
*/
private LaunchConfiguration fOriginal;
-
+
/**
* Handle to a parent working copy
* @since 3.3
*/
private LaunchConfigurationWorkingCopy fParent = null;
-
+
/**
* Working copy of attributes.
*/
private LaunchConfigurationInfo fInfo;
-
+
/**
* Whether this working copy has been modified since
* it was created
*/
private boolean fDirty;
-
+
/**
* Indicates whether this working copy has been explicitly renamed.
*/
private boolean fRenamed;
-
+
/**
* Suppress change notification until created
*/
private boolean fSuppressChange ;
-
+
/**
- * Constructs a working copy of the specified launch
+ * Constructs a working copy of the specified launch
* configuration.
- *
+ *
* @param original launch configuration to make
* a working copy of
* @exception CoreException if unable to initialize this
@@ -96,20 +96,21 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
setOriginal(original);
fSuppressChange = false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.LaunchConfiguration#initialize()
*/
+ @Override
protected void initialize() {
fDirty = false;
fRenamed = false;
fSuppressChange = true;
super.initialize();
}
-
+
/**
* Constructs a working copy of the specified launch configuration as its parent.
- *
+ *
* @param parent launch configuration to make
* a working copy of
* @exception CoreException if unable to initialize this
@@ -121,12 +122,12 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
setOriginal((LaunchConfiguration) parent.getOriginal());
fParent = parent;
fSuppressChange = false;
- }
-
+ }
+
/**
- * Constructs a copy of the specified launch
+ * Constructs a copy of the specified launch
* configuration, with the given (new) name.
- *
+ *
* @param original launch configuration to make
* a working copy of
* @param name the new name for the copy of the launch
@@ -139,11 +140,11 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
copyFrom(original);
fSuppressChange = false;
}
-
+
/**
* Constructs a new working copy to be created in the specified
* location.
- *
+ *
* @param container the container that the configuration will be created in
* or <code>null</code> if to be local
* @param name the name of the new launch configuration
@@ -159,6 +160,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfigurationWorkingCopy#isDirty()
*/
+ @Override
public boolean isDirty() {
return fDirty;
}
@@ -166,17 +168,18 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfigurationWorkingCopy#doSave()
*/
+ @Override
public synchronized ILaunchConfiguration doSave() throws CoreException {
return doSave(new NullProgressMonitor());
}
/**
* Saves with progress.
- *
+ *
* @param monitor the {@link IProgressMonitor}
* @return the saved <code>ILaunchConfiguration</code>
* @throws CoreException if a problem is encountered
- *
+ *
* @since 3.3
*/
public synchronized ILaunchConfiguration doSave(IProgressMonitor monitor) throws CoreException {
@@ -206,6 +209,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
if (useRunnable) {
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor pm) throws CoreException {
doSave0(pm);
}
@@ -225,14 +229,14 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
return new LaunchConfiguration(getName(), getContainer());
}
-
+
/**
* Performs the actual saving of the launch configuration.
* @param monitor the {@link IProgressMonitor}
* @throws CoreException if a problem is encountered
*/
private void doSave0(IProgressMonitor monitor) throws CoreException {
- SubMonitor lmonitor = SubMonitor.convert(monitor, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_0, new String[] {getName()}), 2);
+ SubMonitor lmonitor = SubMonitor.convert(monitor, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_0, new Object[] { getName() }), 2);
try {
// set up from/to information if this is a move
boolean moved = (!isNew() && isMoved());
@@ -257,11 +261,11 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
}
}
-
+
/**
* Writes the new configuration information to a file.
* @param monitor the {@link IProgressMonitor}
- *
+ *
* @exception CoreException if writing the file fails
*/
protected void writeNewFile(IProgressMonitor monitor) throws CoreException {
@@ -272,9 +276,9 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new String[]{e.toString()}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new Object[] { e.toString() }), null
)
- );
+ );
}
SubMonitor lmonitor = SubMonitor.convert(monitor, IInternalDebugCoreConstants.EMPTY_STRING, 5);
try {
@@ -288,7 +292,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_4, null
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_4, null
)
);
}
@@ -315,9 +319,9 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new String[]{ie.toString()}), null
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1, new Object[] { ie.toString() }), null
)
- );
+ );
}
} else {
// use resource API to update configuration file
@@ -327,7 +331,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_5, null
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_5, null
));
}
IContainer dir = file.getParent();
@@ -336,9 +340,9 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_Specified_container_for_launch_configuration_does_not_exist_2, null
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_Specified_container_for_launch_configuration_does_not_exist_2, null
)
- );
+ );
}
ByteArrayInputStream stream = null;
try {
@@ -348,7 +352,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
throw new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_5, ue
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchConfigurationWorkingCopy_5, ue
));
}
SubMonitor smonitor = null;
@@ -356,7 +360,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
added = true;
//create file input stream: work one unit in a sub monitor
smonitor = lmonitor.newChild(1);
- smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_2, new String[] {getName()}));
+ smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_2, new Object[] { getName() }));
file.create(stream, false, smonitor);
} else {
// validate edit
@@ -366,14 +370,14 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
lmonitor.done();
throw new CoreException(status);
}
- }
+ }
//set the contents of the file: work 1 unit in a sub monitor
smonitor = lmonitor.newChild(1);
- smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_3, new String[] {getName()}));
+ smonitor.setTaskName(MessageFormat.format(DebugCoreMessages.LaunchConfigurationWorkingCopy_3, new Object[] { getName() }));
file.setContents(stream, true, false, smonitor);
}
}
- // notify of add/change for both local and shared configurations - see bug 288368
+ // notify of add/change for both local and shared configurations - see bug 288368
if (added) {
getLaunchManager().launchConfigurationAdded(new LaunchConfiguration(getName(), getContainer()));
} else {
@@ -402,10 +406,11 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
}
}
-
+
/**
* @see ILaunchConfigurationWorkingCopy#setAttribute(String, int)
*/
+ @Override
public void setAttribute(String attributeName, int value) {
getInfo().setAttribute(attributeName, new Integer(value));
setDirty();
@@ -414,6 +419,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfigurationWorkingCopy#setAttribute(String, String)
*/
+ @Override
public void setAttribute(String attributeName, String value) {
getInfo().setAttribute(attributeName, value);
setDirty();
@@ -422,15 +428,17 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfigurationWorkingCopy#setAttribute(String, boolean)
*/
+ @Override
public void setAttribute(String attributeName, boolean value) {
getInfo().setAttribute(attributeName, Boolean.valueOf(value));
- setDirty();
+ setDirty();
}
/**
* @see ILaunchConfigurationWorkingCopy#setAttribute(String, List)
*/
- public void setAttribute(String attributeName, List value) {
+ @Override
+ public void setAttribute(String attributeName, List<String> value) {
getInfo().setAttribute(attributeName, value);
setDirty();
}
@@ -438,15 +446,17 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfigurationWorkingCopy#setAttribute(String, Map)
*/
- public void setAttribute(String attributeName, Map value) {
+ @Override
+ public void setAttribute(String attributeName, Map<String, String> value) {
getInfo().setAttribute(attributeName, value);
setDirty();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttribute(java.lang.String, java.util.Set)
*/
- public void setAttribute(String attributeName, Set value) {
+ @Override
+ public void setAttribute(String attributeName, Set<String> value) {
getInfo().setAttribute(attributeName, value);
setDirty();
}
@@ -454,6 +464,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfigurationWorkingCopy#getOriginal()
*/
+ @Override
public ILaunchConfiguration getOriginal() {
ILaunchConfiguration config = fOriginal;
ILaunchConfigurationWorkingCopy parent = fParent;
@@ -463,20 +474,21 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
return config;
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent()
*/
+ @Override
public ILaunchConfigurationWorkingCopy getParent() {
return fParent;
}
-
+
/**
* Sets the launch configuration this working copy
* is based on. Initializes the attributes of this
* working copy to the current values of the given
* configuration.
- *
+ *
* @param original the launch configuration this working
* copy is based on.
* @exception CoreException if unable to initialize this
@@ -488,21 +500,21 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
setInfo(info.getCopy());
fDirty = false;
}
-
+
/**
* Sets the launch configuration this working copy
* is based on.
- *
- * @param original the launch configuration this working
+ *
+ * @param original the launch configuration this working
* copy is based on.
*/
private void setOriginal(LaunchConfiguration original) {
fOriginal = original;
- }
-
+ }
+
/**
* Sets the working copy info object for this working copy.
- *
+ *
* @param info a copy of attributes from this working copy's
* original launch configuration
*/
@@ -513,20 +525,22 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see ILaunchConfiguration#isWorkingCopy()
*/
+ @Override
public boolean isWorkingCopy() {
return true;
}
-
+
/**
* A working copy keeps a local info object that is not
* cached with the launch manager.
- *
+ *
* @see LaunchConfiguration#getInfo()
*/
+ @Override
protected LaunchConfigurationInfo getInfo() {
return fInfo;
}
-
+
/**
* Sets this working copy's state to dirty.
* Notifies listeners that this working copy has
@@ -536,13 +550,14 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
fDirty = true;
if (!suppressChangeNotification()) {
getLaunchManager().getConfigurationNotifier().notify(this, LaunchManager.CHANGED);
- }
+ }
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setModes(java.util.Set)
*/
- public void setModes(Set modes) {
+ @Override
+ public void setModes(Set<String> modes) {
getInfo().setAttribute(ATTR_LAUNCH_MODES, (modes.size() > 0 ? modes : null));
setDirty();
}
@@ -550,70 +565,74 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#addModes(java.util.Set)
*/
- public void addModes(Set modes) {
+ @Override
+ public void addModes(Set<String> modes) {
try {
- Set opts = getModes();
+ Set<String> opts = getModes();
if(opts.addAll(modes)) {
getInfo().setAttribute(ATTR_LAUNCH_MODES, opts);
setDirty();
}
- }
+ }
catch (CoreException e) {
DebugPlugin.log(e);
}
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#removeModes(java.util.Set)
*/
- public void removeModes(Set options) {
+ @Override
+ public void removeModes(Set<String> options) {
try {
- Set opts = getModes();
+ Set<String> opts = getModes();
if(opts.removeAll(options)) {
getInfo().setAttribute(ATTR_LAUNCH_MODES, (opts.size() < 1 ? null : opts));
setDirty();
}
- }
+ }
catch (CoreException e) {
DebugPlugin.log(e);
}
}
-
+
/**
* @see ILaunchConfigurationWorkingCopy#rename(String)
*/
+ @Override
public void rename(String name) {
if (!getName().equals(name)) {
setName(name);
fRenamed = isNew() || !(getOriginal().getName().equals(name));
}
}
-
+
/**
* Sets the new name for this configuration.
- *
+ *
* @param name the new name for this configuration
*/
+ @Override
protected void setName(String name) {
super.setName(name);
setDirty();
- }
-
+ }
+
/**
* Returns whether this working copy is new, or is a
* working copy of another launch configuration.
- *
+ *
* @return whether this working copy is new, or is a
* working copy of another launch configuration
*/
protected boolean isNew() {
return getOriginal() == null;
}
-
+
/**
* Returns whether this working copy is new or if its
* location has changed from that of its original.
- *
+ *
* @return whether this working copy is new or if its
* location has changed from that of its original
*/
@@ -628,19 +647,20 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
if (newContainer == null) {
return !originalContainer.equals(newContainer);
- }
+ }
return !newContainer.equals(originalContainer);
- }
-
+ }
+
/**
* A working copy cannot generate a memento.
- *
+ *
* @see ILaunchConfiguration#getMemento()
*/
+ @Override
public String getMemento() {
return null;
- }
-
+ }
+
/**
* Returns whether change notification should be
* suppressed
@@ -649,10 +669,11 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
protected boolean suppressChangeNotification() {
return fSuppressChange;
}
-
+
/**
* @see ILaunchConfigurationWorkingCopy#setContainer(IContainer)
*/
+ @Override
public void setContainer(IContainer container) {
if (equalOrNull(getContainer(), container)) {
return;
@@ -660,11 +681,15 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
super.setContainer(container);
setDirty();
}
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttributes(java.util.Map)
- */
- public void setAttributes(Map attributes) {
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttributes(
+ * java.util.Map)
+ */
+ @Override
+ public void setAttributes(Map<String, ? extends Object> attributes) {
getInfo().setAttributes(attributes);
setDirty();
}
@@ -672,12 +697,13 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setResource(org.eclipse.core.resources.IResource)
*/
+ @Override
public void setMappedResources(IResource[] resources) {
- ArrayList paths = null;
- ArrayList types = null;
+ ArrayList<String> paths = null;
+ ArrayList<String> types = null;
if(resources != null && resources.length > 0) {
- paths = new ArrayList(resources.length);
- types = new ArrayList(resources.length);
+ paths = new ArrayList<String>(resources.length);
+ types = new ArrayList<String>(resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if(resource != null) {
@@ -693,31 +719,31 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/**
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setPreferredLaunchDelegate(java.util.Set, java.lang.String)
*/
- public void setPreferredLaunchDelegate(Set modes, String delegateId) {
+ @Override
+ public void setPreferredLaunchDelegate(Set<String> modes, String delegateId) {
if(modes != null) {
try {
- Map delegates = getAttribute(LaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, (Map)null);
+ Map<String, String> delegates = getAttribute(LaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, (Map<String, String>) null);
//copy map to avoid pointer issues
- Map map = new HashMap();
- if(delegates != null) {
- map.putAll(delegates);
- }
- if(delegateId == null) {
- map.remove(modes.toString());
- }
- else {
- map.put(modes.toString(), delegateId);
- }
- setAttribute(LaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, map);
+ Map<String, String> map = new HashMap<String, String>();
+ if (delegates != null) {
+ map.putAll(delegates);
+ }
+ if (delegateId == null) {
+ map.remove(modes.toString());
+ } else {
+ map.put(modes.toString(), delegateId);
+ }
+ setAttribute(LaunchConfiguration.ATTR_PREFERRED_LAUNCHERS, map);
}
catch (CoreException ce) {DebugPlugin.log(ce);}
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy()
- * CONTEXTLAUNCHING
*/
+ @Override
public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
return new LaunchConfigurationWorkingCopy(this);
}
@@ -725,6 +751,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#removeAttribute(java.lang.String)
*/
+ @Override
public Object removeAttribute(String attributeName) {
return getInfo().removeAttribute(attributeName);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java
index 8ec2e22b9..e6dddf937 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 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,7 +29,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* Proxy to a launch delegate extension
* Clients can contribute launch delegates through the <code>launchDelegates</code> extension point
- *
+ *
* Example contribution of the local java launch delegate
* <pre>
* <extension point="org.eclipse.debug.core.launchDelegates">
@@ -39,36 +39,36 @@ import com.ibm.icu.text.MessageFormat;
modes="run, debug"
name="%localJavaApplication"
type="org.eclipse.jdt.launching.localJavaApplication">
- <modeCombination
+ <modeCombination
modes="run, profile">
perspective="com.example.Perspective">
</modeCombination>
</launchDelegate>
* </pre>
- *
+ *
* Clients are NOT intended to subclass this class
- *
+ *
* @see IConfigurationElementConstants
- *
+ *
* @since 3.3
*/
public final class LaunchDelegate implements ILaunchDelegate {
-
+
/**
* The configuration element for this delegate
*/
private IConfigurationElement fElement = null;
-
+
/**
* The cached delegate. Remains null until asked for, then persisted
*/
private ILaunchConfigurationDelegate fDelegate = null;
-
- //a listing of sets of
- private List fLaunchModes = null;
+
+ //a listing of sets of
+ private List<Set<String>> fLaunchModes = null;
private String fType = null;
- private HashMap fPerspectiveIds = null;
-
+ private HashMap<Set<String>, String> fPerspectiveIds = null;
+
/**
* Constructor
* @param element the configuration element to associate with this launch delegate
@@ -76,17 +76,18 @@ public final class LaunchDelegate implements ILaunchDelegate {
public LaunchDelegate(IConfigurationElement element) {
fElement = element;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchDelegateProxy#getDelegate()
*/
+ @Override
public ILaunchConfigurationDelegate getDelegate() throws CoreException {
if(fDelegate == null) {
Object obj = fElement.createExecutableExtension(IConfigurationElementConstants.DELEGATE);
if(obj instanceof ILaunchConfigurationDelegate) {
fDelegate = (ILaunchConfigurationDelegate)obj;
} else {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, MessageFormat.format(DebugCoreMessages.LaunchDelegate_3, new String[]{getId()}), null));
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, MessageFormat.format(DebugCoreMessages.LaunchDelegate_3, new Object[] { getId() }), null));
}
}
return fDelegate;
@@ -95,6 +96,7 @@ public final class LaunchDelegate implements ILaunchDelegate {
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchDelegateProxy#getId()
*/
+ @Override
public String getId() {
return fElement.getAttribute(IConfigurationElementConstants.ID);
}
@@ -114,16 +116,16 @@ public final class LaunchDelegate implements ILaunchDelegate {
}
return fType;
}
-
+
/**
* Simple method to parse mode strings (separated by commas)
* @param element the config element to read the mode string from
* @return a set of the parsed strings or an empty collection
* @since 3.3
*/
- private Set parseModes(IConfigurationElement element) {
- HashSet set = new HashSet();
- String modes = element.getAttribute(IConfigurationElementConstants.MODES);
+ private Set<String> parseModes(IConfigurationElement element) {
+ HashSet<String> set = new HashSet<String>();
+ String modes = element.getAttribute(IConfigurationElementConstants.MODES);
if (modes != null) {
String[] strings = modes.split(","); //$NON-NLS-1$
for (int i = 0; i < strings.length; i++) {
@@ -132,16 +134,17 @@ public final class LaunchDelegate implements ILaunchDelegate {
}
return set;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchDelegateProxy#getModes()
*/
- public List getModes() {
+ @Override
+ public List<Set<String>> getModes() {
if(fLaunchModes == null) {
- fLaunchModes = new ArrayList();
- fPerspectiveIds = new HashMap();
+ fLaunchModes = new ArrayList<Set<String>>();
+ fPerspectiveIds = new HashMap<Set<String>, String>();
IConfigurationElement[] children = fElement.getChildren(IConfigurationElementConstants.MODE_COMBINATION);
- Set modeset = null;
+ Set<String> modeset = null;
for (int i = 0; i < children.length; i++) {
modeset = parseModes(children[i]);
fLaunchModes.add(modeset);
@@ -150,11 +153,11 @@ public final class LaunchDelegate implements ILaunchDelegate {
//try to get the modes from the old definition and make each one
//a separate set of one element
modeset = null;
- String modes = fElement.getAttribute(IConfigurationElementConstants.MODES);
+ String modes = fElement.getAttribute(IConfigurationElementConstants.MODES);
if (modes != null) {
String[] strings = modes.split(","); //$NON-NLS-1$
for (int i = 0; i < strings.length; i++) {
- modeset = new HashSet();
+ modeset = new HashSet<String>();
modeset.add(strings[i].trim());
fLaunchModes.add(modeset);
}
@@ -162,11 +165,12 @@ public final class LaunchDelegate implements ILaunchDelegate {
}
return fLaunchModes;
}
-
+
/**
* Returns the human readable name for this launch delegate
* @return the human readable name for this launch delegate, or <code>null</code> if none
*/
+ @Override
public String getName() {
//try a delegateName attribute first, in the event this delegate was made from an ILaunchConfigurationType
String name = fElement.getAttribute(IConfigurationElementConstants.DELEGATE_NAME);
@@ -177,23 +181,24 @@ public final class LaunchDelegate implements ILaunchDelegate {
}
name = name.trim();
if (Character.isUpperCase(name.charAt(0))) {
- name = MessageFormat.format(DebugCoreMessages.LaunchDelegate_1, new String[]{name});
+ name = MessageFormat.format(DebugCoreMessages.LaunchDelegate_1, new Object[] { name });
} else {
- name = MessageFormat.format(DebugCoreMessages.LaunchDelegate_2, new String[]{name});
+ name = MessageFormat.format(DebugCoreMessages.LaunchDelegate_2, new Object[] { name });
}
}
return name;
}
-
+
/**
* Returns the contributor name of this delegate (plug-in name).
- *
+ *
* @return contributor name
*/
+ @Override
public String getContributorName() {
return fElement.getContributor().getName();
}
-
+
/**
* Returns the associated source locator id or <code>null</code>
* @return the associated source locator id or <code>null</code> if not provided
@@ -209,10 +214,11 @@ public final class LaunchDelegate implements ILaunchDelegate {
public String getSourcePathComputerId() {
return fElement.getAttribute(IConfigurationElementConstants.SOURCE_PATH_COMPUTER);
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchDelegate#getDescription()
*/
+ @Override
public String getDescription() {
String desc = fElement.getAttribute(IConfigurationElementConstants.DELEGATE_DESCRIPTION);
if(desc == null) {
@@ -220,10 +226,11 @@ public final class LaunchDelegate implements ILaunchDelegate {
}
return desc;
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchDelegate#getPluginIdentifier()
*/
+ @Override
public String getPluginIdentifier() {
return fElement.getContributor().getName();
}
@@ -231,6 +238,7 @@ public final class LaunchDelegate implements ILaunchDelegate {
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
if(obj == null) {
return false;
@@ -238,13 +246,20 @@ public final class LaunchDelegate implements ILaunchDelegate {
return obj instanceof ILaunchDelegate && getId() != null && getId().equals(((ILaunchDelegate)obj).getId());
}
+ @Override
+ public int hashCode() {
+ String id = getId();
+ return id == null ? 0 : id.hashCode();
+ }
+
/**
* @see org.eclipse.debug.core.ILaunchDelegate#getPerspectiveId(java.util.Set)
*/
- public String getPerspectiveId(Set modes) {
+ @Override
+ public String getPerspectiveId(Set<String> modes) {
if(fPerspectiveIds == null) {
getModes();
}
- return (String) fPerspectiveIds.get(modes);
+ return fPerspectiveIds.get(modes);
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index 6352f866d..0d77b6204 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -4,14 +4,14 @@
* 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
* Sebastian Davids - bug 50567 Eclipse native environment support on Win98
* Pawel Piech - Bug 82001: When shutting down the IDE, the debugger should first
* attempt to disconnect debug targets before terminating them
* Alena Laskavaia - Bug 259281
- * Marc Khouzam - Bug 313143: Preferred Launch Delegate not recovered from preferences
+ * Marc Khouzam - Bug 313143: Preferred Launch Delegate not recovered from preferences
*******************************************************************************/
package org.eclipse.debug.internal.core;
@@ -30,17 +30,16 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
-import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -74,12 +73,12 @@ import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
@@ -119,75 +118,76 @@ import com.ibm.icu.text.MessageFormat;
* @see ILaunchManager
*/
public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener {
-
+
/**
- * Preferred launch delegate preference name.
+ * Preferred launch delegate preference name.
* <p>
- * Prior to 3.5 this preferred launch delegates for all launch
+ * Prior to 3.5 this preferred launch delegates for all launch
* configuration types were serialized into a single XML string
- * and stored in this preference.
+ * and stored in this preference.
* </p>
* <p>
- * Since 3.5, the preferred launch delegates are stored in a separate
- * preference for each launch configuration type. The name of this
- * preference is composed of the prefix, followed by a slash, followed by
- * the launch configuration type id. The values contain a set of launch
- * delegates, delimited by a semicolon, and each delegate entry contains
- * the delegate ID, followed by a comma, followed by comma-delimited
+ * Since 3.5, the preferred launch delegates are stored in a separate
+ * preference for each launch configuration type. The name of this
+ * preference is composed of the prefix, followed by a slash, followed by
+ * the launch configuration type id. The values contain a set of launch
+ * delegates, delimited by a semicolon, and each delegate entry contains
+ * the delegate ID, followed by a comma, followed by comma-delimited
* launch modes.
- *
+ *
* @since 3.3
*/
protected static final String PREF_PREFERRED_DELEGATES = DebugPlugin.getUniqueIdentifier() + ".PREFERRED_DELEGATES"; //$NON-NLS-1$
-
+
/**
* Constant to define debug.ui for the status codes
- *
+ *
* @since 3.2
*/
private static final String DEBUG_UI = "org.eclipse.debug.ui"; //$NON-NLS-1$
-
+
/**
* Listing of unsupported launch configuration names for the Win 32 platform
* @since 3.5
*/
- static final String[] UNSUPPORTED_WIN32_CONFIG_NAMES = new String[] {"aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ static final String[] UNSUPPORTED_WIN32_CONFIG_NAMES = new String[] {"aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"com5", "com6", "com7", "com8", "com9", "con", "lpt1", "lpt2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "nul", "prn"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
-
+
/**
* Disallowed characters for launch configuration names
* '@' and '&' are disallowed because they corrupt menu items.
- *
+ *
* @since 3.5
*/
static final char[] DISALLOWED_CONFIG_NAME_CHARS = new char[] { '@', '&','\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' };
-
+
/**
* Status code for which a UI prompter is registered.
- *
+ *
* @since 3.2
*/
protected static final IStatus promptStatus = new Status(IStatus.INFO, DEBUG_UI, 200, IInternalDebugCoreConstants.EMPTY_STRING, null);
-
+
/**
* Step filter manager
*/
private StepFilterManager fStepFilterManager = null;
-
+
/**
* Notifies a launch config listener in a safe runnable to handle
* exceptions.
*/
class ConfigurationNotifier implements ISafeRunnable {
-
+
private ILaunchConfigurationListener fListener;
private int fType;
private ILaunchConfiguration fConfiguration;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during launch configuration change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -195,7 +195,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Notifies the given listener of the add/change/remove
- *
+ *
* @param configuration the configuration that has changed
* @param update the type of change
*/
@@ -210,12 +210,13 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
}
fConfiguration = null;
- fListener = null;
+ fListener = null;
}
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case ADDED:
@@ -227,24 +228,27 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
case CHANGED:
fListener.launchConfigurationChanged(fConfiguration);
break;
- }
+ default:
+ break;
+ }
}
}
-
+
/**
* Notifies a launch listener (multiple launches) in a safe runnable to
* handle exceptions.
*/
class LaunchesNotifier implements ISafeRunnable {
-
+
private ILaunchesListener fListener;
private int fType;
private ILaunch[] fNotifierLaunches;
private ILaunch[] fRegistered;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during launch change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -252,7 +256,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Notifies the given listener of the adds/changes/removes
- *
+ *
* @param launches the launches that changed
* @param update the type of change
*/
@@ -264,15 +268,16 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
for (int i= 0; i < copiedListeners.length; i++) {
fListener = (ILaunchesListener)copiedListeners[i];
SafeRunner.run(this);
- }
+ }
fNotifierLaunches = null;
fRegistered = null;
- fListener = null;
+ fListener = null;
}
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case ADDED:
@@ -284,15 +289,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
case CHANGED:
case TERMINATE:
if (fRegistered == null) {
- List registered = null;
+ List<ILaunch> registered = null;
for (int j = 0; j < fNotifierLaunches.length; j++) {
if (isRegistered(fNotifierLaunches[j])) {
if (registered != null) {
registered.add(fNotifierLaunches[j]);
- }
+ }
} else {
if (registered == null) {
- registered = new ArrayList(fNotifierLaunches.length);
+ registered = new ArrayList<ILaunch>(fNotifierLaunches.length);
for (int k = 0; k < j; k++) {
registered.add(fNotifierLaunches[k]);
}
@@ -302,7 +307,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if (registered == null) {
fRegistered = fNotifierLaunches;
} else {
- fRegistered = (ILaunch[])registered.toArray(new ILaunch[registered.size()]);
+ fRegistered = registered.toArray(new ILaunch[registered.size()]);
}
}
if (fRegistered.length > 0) {
@@ -314,33 +319,34 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
}
break;
+ default:
+ break;
}
}
}
-
+
/**
* Visitor for handling a resource begin deleted, and the need to check mapped configurations
* for auto-deletion
* @since 3.4
*/
class MappedResourceVisitor implements IResourceDeltaVisitor {
-
+
/* (non-Javadoc)
* @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
*/
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
return false;
}
if(delta.getKind() == IResourceDelta.REMOVED && delta.getFlags() != IResourceDelta.MOVED_TO) {
- ArrayList configs = collectAssociatedLaunches(delta.getResource());
- if(configs.size() > 0) {
- for(Iterator iter = configs.iterator(); iter.hasNext();) {
- try {
- ((ILaunchConfiguration)iter.next()).delete();
- } catch (CoreException e) {
- DebugPlugin.log(e.getStatus());
- }
+ ArrayList<ILaunchConfiguration> configs = collectAssociatedLaunches(delta.getResource());
+ for (ILaunchConfiguration config : configs) {
+ try {
+ config.delete();
+ } catch (CoreException e) {
+ DebugPlugin.log(e.getStatus());
}
}
return false;
@@ -348,15 +354,16 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
return true;
}
}
-
+
/**
* Visitor for handling resource deltas.
*/
class LaunchManagerVisitor implements IResourceDeltaVisitor {
-
+
/**
* @see IResourceDeltaVisitor#visit(IResourceDelta)
*/
+ @Override
public boolean visit(IResourceDelta delta) {
if (delta == null) {
return false;
@@ -366,7 +373,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IProject project = (IProject)delta.getResource();
if (project.isOpen()) {
LaunchManager.this.projectOpened(project);
- } else {
+ } else {
LaunchManager.this.projectClosed(project);
}
}
@@ -377,7 +384,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IFile file = (IFile)resource;
if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equals(file.getFileExtension())) {
ILaunchConfiguration handle = new LaunchConfiguration(file);
- switch (delta.getKind()) {
+ switch (delta.getKind()) {
case IResourceDelta.ADDED :
LaunchManager.this.launchConfigurationAdded(handle);
break;
@@ -387,6 +394,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
case IResourceDelta.CHANGED :
LaunchManager.this.launchConfigurationChanged(handle);
break;
+ default:
+ break;
}
}
return false;
@@ -394,20 +403,21 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
return true;
}
}
-
+
/**
* Notifies a launch listener (single launch) in a safe runnable to handle
* exceptions.
*/
class LaunchNotifier implements ISafeRunnable {
-
+
private ILaunchListener fListener;
private int fType;
private ILaunch fLaunch;
-
+
/**
* @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
*/
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "An exception occurred during launch change notification.", exception); //$NON-NLS-1$
DebugPlugin.log(status);
@@ -415,7 +425,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Notifies listeners of the add/change/remove
- *
+ *
* @param launch the launch that has changed
* @param update the type of change
*/
@@ -426,14 +436,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
for (int i= 0; i < copiedListeners.length; i++) {
fListener = (ILaunchListener)copiedListeners[i];
SafeRunner.run(this);
- }
+ }
fLaunch = null;
- fListener = null;
+ fListener = null;
}
/**
* @see org.eclipse.core.runtime.ISafeRunnable#run()
*/
+ @Override
public void run() throws Exception {
switch (fType) {
case ADDED:
@@ -447,24 +458,27 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fListener.launchChanged(fLaunch);
}
break;
- }
+ default:
+ break;
+ }
}
}
-
+
/**
* Collects files whose extension matches the launch configuration file
* extension.
*/
class ResourceProxyVisitor implements IResourceProxyVisitor {
-
- private List fList;
-
- protected ResourceProxyVisitor(List list) {
+
+ private List<IResource> fList;
+
+ protected ResourceProxyVisitor(List<IResource> list) {
fList= list;
}
/**
* @see org.eclipse.core.resources.IResourceProxyVisitor#visit(org.eclipse.core.resources.IResourceProxy)
*/
+ @Override
public boolean visit(IResourceProxy proxy) {
if (proxy.getType() == IResource.FILE) {
if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension())) {
@@ -475,36 +489,36 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
return true;
}
}
-
+
/**
* Internal class used to hold information about a preferred delegate
- *
+ *
* @since 3.3
*/
class PreferredDelegate {
private ILaunchDelegate fDelegate = null;
private String fTypeid = null;
- private Set fModes = null;
-
- public PreferredDelegate(ILaunchDelegate delegate, String typeid, Set modes) {
+ private Set<String> fModes = null;
+
+ public PreferredDelegate(ILaunchDelegate delegate, String typeid, Set<String> modes) {
fDelegate = delegate;
fTypeid = typeid;
fModes = modes;
}
-
+
public String getTypeId() {
return fTypeid;
}
-
- public Set getModes() {
+
+ public Set<String> getModes() {
return fModes;
}
-
+
public ILaunchDelegate getDelegate() {
return fDelegate;
}
}
-
+
/**
* Types of notifications
*/
@@ -512,14 +526,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
public static final int REMOVED= 1;
public static final int CHANGED= 2;
public static final int TERMINATE= 3;
-
+
/**
* The collection of native environment variables on the user's system. Cached
* after being computed once as the environment cannot change.
*/
- private static HashMap fgNativeEnv= null;
- private static HashMap fgNativeEnvCasePreserved= null;
-
+ private static HashMap<String, String> fgNativeEnv = null;
+ private static HashMap<String, String> fgNativeEnvCasePreserved = null;
+
/**
* Path to the local directory where local launch configurations
* are stored with the workspace.
@@ -542,7 +556,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Serializes a XML document into a string - encoded in UTF8 format,
* with platform line separators.
- *
+ *
* @param doc document to serialize
* @return the document as a string
* @throws TransformerException if an unrecoverable error occurs during the serialization
@@ -557,179 +571,189 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
DOMSource source = new DOMSource(doc);
StreamResult outputTarget = new StreamResult(s);
transformer.transform(source, outputTarget);
- return s.toString("UTF8"); //$NON-NLS-1$
+ return s.toString("UTF8"); //$NON-NLS-1$
}
-
+
/**
* Collection of defined launch configuration type
* extensions.
*/
- private List fLaunchConfigurationTypes = null;
+ private List<ILaunchConfigurationType> fLaunchConfigurationTypes = null;
/**
* Launch configuration cache. Keys are <code>LaunchConfiguration</code>,
* values are <code>LaunchConfigurationInfo</code>.
*/
- private Map fLaunchConfigurations = new HashMap(10);
-
+ private Map<ILaunchConfiguration, LaunchConfigurationInfo> fLaunchConfigurations = new HashMap<ILaunchConfiguration, LaunchConfigurationInfo>(10);
+
/**
* A cache of launch configuration names currently in the workspace.
*/
private String[] fSortedConfigNames = null;
-
+
/**
* Collection of all launch configurations in the workspace.
* <code>List</code> of <code>ILaunchConfiguration</code>.
*/
- private List fLaunchConfigurationIndex = null;
-
+ private List<ILaunchConfiguration> fLaunchConfigurationIndex = null;
+
/**
* Launch configuration comparator extensions,
* keyed by attribute name.
*/
- private Map fComparators = null;
-
+ private Map<String, LaunchConfigurationComparator> fComparators = null;
+
/**
* Registered launch modes, or <code>null</code> if not initialized.
* Keys are mode identifiers, values are <code>ILaunchMode</code>s.
*/
- private Map fLaunchModes = null;
-
+ private Map<String, ILaunchMode> fLaunchModes = null;
+
/**
* A map of LaunchDelegate objects stored by id of delegate, or launch config type
*/
- private HashMap fLaunchDelegates = null;
-
+ private HashMap<String, LaunchDelegate> fLaunchDelegates = null;
+
/**
* Initial startup cache of preferred delegate so that the debug preferences are only parsed once
- *
+ *
* @since 3.3
*/
- private Set fPreferredDelegates = null;
-
+ private Set<PreferredDelegate> fPreferredDelegates = null;
+
/**
* Collection of launches
*/
- private List fLaunches= new ArrayList(10);
+ private List<ILaunch> fLaunches = new ArrayList<ILaunch>(10);
/**
- * Set of launches for efficient 'isRegistered()' check
+ * Set of launches for efficient 'isRegistered()' check TODO remove this -
+ * Launches don't implement hashCode() or equals() - so its no more
+ * efficient than walking the other collection
*/
- private Set fLaunchSet = new HashSet(10);
-
+ private Set<ILaunch> fLaunchSet = new HashSet<ILaunch>(10);
+
/**
* Collection of listeners
*/
private ListenerList fListeners = new ListenerList();
-
+
/**
* Collection of "plural" listeners.
* @since 2.1
*/
- private ListenerList fLaunchesListeners = new ListenerList();
-
+ private ListenerList fLaunchesListeners = new ListenerList();
+
/**
* Visitor used to process resource deltas,
* to update launch configuration index.
*/
private LaunchManagerVisitor fgVisitor;
-
+
/**
* Visitor used to process a deleted resource,
* to remove mapped launch configurations in the event
* auto-removal of launch configurations is enabled
- *
+ *
* @since 3.4
*/
private MappedResourceVisitor fgMRVisitor;
-
+
/**
* Whether this manager is listening for resource change events
*/
private boolean fListening = false;
-
+
/**
* Launch configuration listeners
*/
private ListenerList fLaunchConfigurationListeners = new ListenerList();
-
+
/**
* Table of source locator extensions. Keys
* are identifiers, and values are associated
* configuration elements.
*/
- private Map fSourceLocators = null;
+ private Map<String, IConfigurationElement> fSourceLocators = null;
/**
* The handles of launch configurations being moved, or <code>null</code>
*/
private ILaunchConfiguration fFrom;
-
+
private ILaunchConfiguration fTo;
/**
* Map of source container type extensions. Keys are extension ids
* and values are associated configuration elements.
*/
- private Map sourceContainerTypes;
-
+ private Map<String, ISourceContainerType> sourceContainerTypes;
+
/**
* Map of source path computer extensions. Keys are extension ids
* and values are associated configuration elements.
*/
- private Map sourcePathComputers;
-
- private Set fActiveModes;
+ private Map<String, ISourcePathComputer> sourcePathComputers;
+
+ /**
+ * TODO, we can probably remove this too
+ */
+ private Set<String> fActiveModes;
/**
* @see ILaunchManager#addLaunch(ILaunch)
*/
+ @Override
public void addLaunch(ILaunch launch) {
if (internalAddLaunch(launch)) {
fireUpdate(launch, ADDED);
fireUpdate(new ILaunch[] {launch}, ADDED);
}
}
-
+
/**
* @see ILaunchManager#addLaunchConfigurationListener(ILaunchConfigurationListener)
*/
+ @Override
public void addLaunchConfigurationListener(ILaunchConfigurationListener listener) {
fLaunchConfigurationListeners.add(listener);
- }
-
+ }
+
/**
* @see org.eclipse.debug.core.ILaunchManager#addLaunches(org.eclipse.debug.core.ILaunch[])
*/
+ @Override
public void addLaunches(ILaunch[] launches) {
- List added = new ArrayList(launches.length);
+ List<ILaunch> added = new ArrayList<ILaunch>(launches.length);
for (int i = 0; i < launches.length; i++) {
if (internalAddLaunch(launches[i])) {
added.add(launches[i]);
}
}
if (!added.isEmpty()) {
- ILaunch[] addedLaunches = (ILaunch[])added.toArray(new ILaunch[added.size()]);
+ ILaunch[] addedLaunches = added.toArray(new ILaunch[added.size()]);
fireUpdate(addedLaunches, ADDED);
for (int i = 0; i < addedLaunches.length; i++) {
fireUpdate(launches[i], ADDED);
}
}
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchManager#addLaunchListener(org.eclipse.debug.core.ILaunchesListener)
*/
+ @Override
public void addLaunchListener(ILaunchesListener listener) {
fLaunchesListeners.add(listener);
- }
-
+ }
+
/**
* @see ILaunchManager#addLaunchListener(ILaunchListener)
*/
+ @Override
public void addLaunchListener(ILaunchListener listener) {
fListeners.add(listener);
- }
-
+ }
+
/**
* Computes and caches the native system environment variables as a map of
* variable names and values (Strings) in the given map.
@@ -738,13 +762,13 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* the case of variable names but is otherwise case insensitive.
* Depending on what you intend to do with the environment, the
* lack of normalization may or may not be create problems. This
- * method preserves mixed-case keys using the variable names
+ * method preserves mixed-case keys using the variable names
* recorded by the OS.
* </p>
* @param cache the map
* @since 3.1
- */
- private void cacheNativeEnvironment(Map cache) {
+ */
+ private void cacheNativeEnvironment(Map<String, String> cache) {
try {
String nativeCommand= null;
boolean isWin9xME= false; //see bug 50567
@@ -779,13 +803,13 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if (!file.delete()) {
file.deleteOnExit(); // if delete() fails try again on VM close
}
- for (Enumeration enumeration = p.keys(); enumeration.hasMoreElements();) {
+ for (Entry<Object, Object> entry : p.entrySet()) {
// Win32's environment variables are case insensitive. Put everything
// to uppercase so that (for example) the "PATH" variable will match
// "pAtH" correctly on Windows.
- String key= (String) enumeration.nextElement();
+ String key = (String) entry.getKey();
//no need to cast value
- cache.put(key, p.get(key));
+ cache.put(key, (String) p.get(key));
}
} else {
//read process directly on other platforms
@@ -860,10 +884,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fLaunchConfigurationIndex.clear();
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchManager#getEncoding(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public String getEncoding(ILaunchConfiguration configuration) throws CoreException {
String encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null);
if(encoding == null) {
@@ -873,7 +898,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if(res instanceof IFile) {
return ((IFile)res).getCharset();
}
- else if(res instanceof IContainer) {
+ else if(res instanceof IContainer) {
return ((IContainer)res).getDefaultCharset();
}
}
@@ -883,7 +908,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return encoding;
}
-
+
/**
* The launch config name cache is cleared when a config is added, deleted or changed.
*/
@@ -901,17 +926,17 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
return new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, message, throwable
+ DebugException.REQUEST_FAILED, message, throwable
)
);
}
-
+
/**
* Return a LaunchConfigurationInfo object initialized from XML contained in
* the specified stream. Simply pass out any exceptions encountered so that
* caller can deal with them. This is important since caller may need access to the
* actual exception.
- *
+ *
* @param stream the {@link InputStream} to read from
* @return the new {@link LaunchConfigurationInfo}
* @throws CoreException if a problem is encountered
@@ -930,38 +955,36 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
LaunchConfigurationInfo info = new LaunchConfigurationInfo();
info.initializeFromXML(root);
return info;
- }
-
+ }
+
/**
* Finds and returns all launch configurations in the given
* container (and sub-containers)
- *
+ *
* @param container the container to search
* @return all launch configurations in the given container
*/
- protected List findLaunchConfigurations(IContainer container) {
- List list = new ArrayList(10);
+ protected List<ILaunchConfiguration> findLaunchConfigurations(IContainer container) {
if (container instanceof IProject && !((IProject)container).isOpen()) {
- return list;
+ return Collections.EMPTY_LIST;
}
+ List<IResource> list = new ArrayList<IResource>(10);
ResourceProxyVisitor visitor= new ResourceProxyVisitor(list);
try {
container.accept(visitor, IResource.NONE);
} catch (CoreException ce) {
//Closed project...should not be possible with previous check
}
- Iterator iter = list.iterator();
- List configs = new ArrayList(list.size());
- ILaunchConfiguration config = null;
- while (iter.hasNext()) {
- config = getLaunchConfiguration((IFile)iter.next());
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>(list.size());
+ for (IResource resource : list) {
+ ILaunchConfiguration config = getLaunchConfiguration((IFile) resource);
if(config != null && config.exists()) {
configs.add(config);
}
}
return configs;
}
-
+
/**
* Searches for the {@link ILaunchConfiguration} with the given name
* @param name the name to search for
@@ -979,37 +1002,41 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return null;
}
-
+
/**
* Finds and returns all local launch configurations.
*
* @return all local launch configurations
*/
- protected List findLocalLaunchConfigurations() {
+ protected List<ILaunchConfiguration> findLocalLaunchConfigurations() {
IPath containerPath = LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- List configs = new ArrayList(10);
final File directory = containerPath.toFile();
if (directory.isDirectory()) {
FilenameFilter filter = new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
return dir.equals(directory) &&
name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
}
};
File[] files = directory.listFiles(filter);
- LaunchConfiguration config = null;
- for (int i = 0; i < files.length; i++) {
- config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(files[i].getName()), null);
- configs.add(config);
+ if (files.length > 0) {
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>(10);
+ LaunchConfiguration config = null;
+ for (int i = 0; i < files.length; i++) {
+ config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(files[i].getName()), null);
+ configs.add(config);
+ }
+ return configs;
}
}
- return configs;
+ return Collections.EMPTY_LIST;
}
-
+
/**
* Fires notification to (single) listeners that a launch has been
* added/changed/removed.
- *
+ *
* @param launch launch that has changed
* @param update type of change
*/
@@ -1020,7 +1047,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Fires notification to (plural) listeners that a launch has been
* added/changed/removed.
- *
+ *
* @param launches launches that have changed
* @param update type of change
*/
@@ -1031,47 +1058,50 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchManager#generateUniqueLaunchConfigurationNameFrom(java.lang.String)
*/
+ @Override
public String generateUniqueLaunchConfigurationNameFrom(String baseName) {
int index = 1;
- int length= baseName.length();
+ int length = baseName.length();
int copyIndex = baseName.lastIndexOf(" ("); //$NON-NLS-1$
+ String base = baseName;
if (copyIndex > -1 && length > copyIndex + 2 && baseName.charAt(length - 1) == ')') {
- String trailer = baseName.substring(copyIndex + 2, length -1);
+ String trailer = baseName.substring(copyIndex + 2, length - 1);
if (isNumber(trailer)) {
try {
index = Integer.parseInt(trailer);
- baseName = baseName.substring(0, copyIndex);
- }
+ base = baseName.substring(0, copyIndex);
+ }
catch (NumberFormatException nfe) {}
}
- }
- String newName = baseName;
+ }
+ String newName = base;
while (isExistingLaunchConfigurationName(newName)) {
- newName = MessageFormat.format(DebugCoreMessages.LaunchManager_31, new String[] {baseName, Integer.toString(index)});
+ newName = MessageFormat.format(DebugCoreMessages.LaunchManager_31, new Object[] {
+ base, Integer.toString(index) });
index++;
- }
+ }
return newName;
}
-
+
/**
* Return a String that can be used as the name of a launch configuration. The name
* is guaranteed to be unique (no existing or temporary launch configurations will have this name).
- * The name that is returned uses the <code>basename</code> as a starting point. If
+ * The name that is returned uses the <code>basename</code> as a starting point. If
* there is no existing launch configuration with this name, then <code>basename</code>
* is returned. Otherwise, the value returned consists of the specified base plus
* some suffix that guarantees uniqueness. Passing <code>null</code> as the set of reserved names will cause this
* method to return <code>generateUniqueLaunchConfigurationNameFrom(String baseName)</code>.
- *
+ *
* By specifying a set of reserved names, you can further constrain the name that will be generated
* by this method. For example you can give a base name of 'test' and a reserved set of [test(1), test(2)],
* which will result in a name of 'test(3)' being returned iff a configuration with the name 'test' already exists.
- *
+ *
* @return launch configuration name
* @param basename the String that the returned name must begin with
* @param reservednames a set of strings that is further used to constrain what names can be generated
* @since 3.3
*/
- public String generateUniqueLaunchConfigurationNameFrom(String basename, Set reservednames) {
+ public String generateUniqueLaunchConfigurationNameFrom(String basename, Set<String> reservednames) {
if(reservednames == null) {
return generateUniqueLaunchConfigurationNameFrom(basename);
}
@@ -1085,46 +1115,46 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
try {
index = Integer.parseInt(trailer);
base = base.substring(0, copyIndex);
- }
+ }
catch (NumberFormatException nfe) {}
}
- }
+ }
String newname = base;
StringBuffer buffer = null;
while (isExistingLaunchConfigurationName(newname) || reservednames.contains(newname)) {
buffer = new StringBuffer(base);
buffer.append(" ("); //$NON-NLS-1$
buffer.append(String.valueOf(index));
- index++;
+ index++;
buffer.append(')');
newname = buffer.toString();
- }
+ }
return newname;
}
-
+
/**
- * Returns a collection of all launch configuration handles in
+ * Returns a collection of all launch configuration handles in
* the workspace. This collection is initialized lazily.
- *
+ *
* @return all launch configuration handles
*/
- private synchronized List getAllLaunchConfigurations() {
+ private synchronized List<ILaunchConfiguration> getAllLaunchConfigurations() {
if (fLaunchConfigurationIndex == null) {
- try {
- fLaunchConfigurationIndex = new ArrayList(20);
- List configs = findLocalLaunchConfigurations();
+ try {
+ fLaunchConfigurationIndex = new ArrayList<ILaunchConfiguration>(20);
+ List<ILaunchConfiguration> configs = findLocalLaunchConfigurations();
verifyConfigurations(configs, fLaunchConfigurationIndex);
configs = findLaunchConfigurations(ResourcesPlugin.getWorkspace().getRoot());
verifyConfigurations(configs, fLaunchConfigurationIndex);
} finally {
- hookResourceChangeListener();
+ hookResourceChangeListener();
}
}
return fLaunchConfigurationIndex;
}
-
+
/**
- * Return a sorted array of the names of all <code>ILaunchConfiguration</code>s in
+ * Return a sorted array of the names of all <code>ILaunchConfiguration</code>s in
* the workspace. These are cached, and cache is cleared when a new config is added,
* deleted or changed.
* @return the sorted array of {@link ILaunchConfiguration} names
@@ -1140,51 +1170,51 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return fSortedConfigNames;
}
-
+
/**
* Returns the comparator registered for the given attribute, or
* <code>null</code> if none.
- *
+ *
* @param attributeName attribute for which a comparator is required
* @return comparator, or <code>null</code> if none
*/
- protected Comparator getComparator(String attributeName) {
- Map map = getComparators();
- return (Comparator)map.get(attributeName);
+ protected Comparator<Object> getComparator(String attributeName) {
+ Map<String, LaunchConfigurationComparator> map = getComparators();
+ return map.get(attributeName);
}
-
+
/**
* Returns comparators, loading if required
* @return the complete map of {@link ILaunchConfiguration} {@link Comparator}s
*/
- protected Map getComparators() {
+ protected Map<String, LaunchConfigurationComparator> getComparators() {
initializeComparators();
return fComparators;
- }
-
+ }
+
/**
* Returns the launch configurations specified by the given
* XML document.
- *
+ *
* @param root XML document
* @return list of launch configurations
* @throws CoreException if a problem is encountered
- */
- protected List getConfigsFromXML(Element root) throws CoreException {
- DebugException invalidFormat =
+ */
+ protected List<ILaunchConfiguration> getConfigsFromXML(Element root) throws CoreException {
+ DebugException invalidFormat =
new DebugException(
new Status(
IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchManager_Invalid_launch_configuration_index__18, null
+ DebugException.REQUEST_FAILED, DebugCoreMessages.LaunchManager_Invalid_launch_configuration_index__18, null
)
- );
-
+ );
+
if (!root.getNodeName().equalsIgnoreCase("launchConfigurations")) { //$NON-NLS-1$
throw invalidFormat;
}
-
- // read each launch configuration
- List configs = new ArrayList(4);
+
+ // read each launch configuration
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>(4);
NodeList list = root.getChildNodes();
int length = list.getLength();
Node node = null;
@@ -1207,34 +1237,32 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return configs;
}
-
+
protected ConfigurationNotifier getConfigurationNotifier() {
return new ConfigurationNotifier();
- }
-
+ }
+
/**
* @see ILaunchManager#getDebugTargets()
*/
+ @Override
public IDebugTarget[] getDebugTargets() {
synchronized (fLaunches) {
- List allTargets= new ArrayList(fLaunches.size());
- if (fLaunches.size() > 0) {
- Iterator e = fLaunches.iterator();
- IDebugTarget[] targets = null;
- while (e.hasNext()) {
- targets = ((ILaunch) e.next()).getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- allTargets.add(targets[i]);
- }
+ List<IDebugTarget> allTargets = new ArrayList<IDebugTarget>(fLaunches.size());
+ IDebugTarget[] targets = null;
+ for (ILaunch launch : fLaunches) {
+ targets = launch.getDebugTargets();
+ for (int i = 0; i < targets.length; i++) {
+ allTargets.add(targets[i]);
}
}
- return (IDebugTarget[])allTargets.toArray(new IDebugTarget[allTargets.size()]);
+ return allTargets.toArray(new IDebugTarget[allTargets.size()]);
}
}
-
+
/**
* Returns the resource delta visitor for the launch manager.
- *
+ *
* @return the resource delta visitor for the launch manager
*/
private LaunchManagerVisitor getDeltaVisitor() {
@@ -1243,11 +1271,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return fgVisitor;
}
-
+
/**
* Returns the resource delta visitor for auto-removal of mapped launch configurations
* @return the resource delta visitor for auto-removal of mapped launch configurations
- *
+ *
* @since 3.4
*/
private MappedResourceVisitor getMappedResourceVisitor() {
@@ -1260,32 +1288,28 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchManager#getEnvironment(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
- Map configEnv = configuration.getAttribute(ATTR_ENVIRONMENT_VARIABLES, (Map) null);
+ Map<String, String> configEnv = configuration.getAttribute(ATTR_ENVIRONMENT_VARIABLES, (Map<String, String>) null);
if (configEnv == null) {
return null;
}
- Map env = new HashMap();
+ Map<String, String> env = new HashMap<String, String>();
// build base environment
boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
if (append) {
env.putAll(getNativeEnvironmentCasePreserved());
}
-
+
// Add variables from config
- Iterator iter= configEnv.entrySet().iterator();
boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
- Map.Entry entry = null;
String key = null;
String value = null;
Object nativeValue = null;
- Iterator envIter = null;
- Map.Entry nativeEntry = null;
String nativeKey = null;
- while (iter.hasNext()) {
- entry = (Map.Entry) iter.next();
- key = (String) entry.getKey();
- value = (String) entry.getValue();
+ for (Entry<String, String> entry : configEnv.entrySet()) {
+ key = entry.getKey();
+ value = entry.getValue();
// translate any string substitution variables
if (value != null) {
value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
@@ -1301,10 +1325,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
// Win32 variables are case-insensitive. If an exact match isn't found, iterate to
// check for a case-insensitive match. We maintain the key's case (see bug 86725),
// but do a case-insensitive comparison (for example, "pAtH" will still override "PATH").
- envIter = env.entrySet().iterator();
- while (envIter.hasNext()) {
- nativeEntry = (Map.Entry) envIter.next();
- nativeKey = (String) (nativeEntry).getKey();
+ for (Entry<String, String> nativeEntry : env.entrySet()) {
+ nativeKey = (nativeEntry).getKey();
if (nativeKey.equalsIgnoreCase(key)) {
nativeEntry.setValue(value);
added = true;
@@ -1316,34 +1338,31 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if (!added) {
env.put(key, value);
}
- }
-
- iter = env.entrySet().iterator();
- List strings = new ArrayList(env.size());
+ }
+ List<String> strings = new ArrayList<String>(env.size());
StringBuffer buffer = null;
- while (iter.hasNext()) {
- entry = (Map.Entry) iter.next();
- buffer = new StringBuffer((String) entry.getKey());
- buffer.append('=').append((String) entry.getValue());
+ for (Entry<String, String> entry : env.entrySet()) {
+ buffer = new StringBuffer(entry.getKey());
+ buffer.append('=').append(entry.getValue());
strings.add(buffer.toString());
}
- return (String[]) strings.toArray(new String[strings.size()]);
+ return strings.toArray(new String[strings.size()]);
}
-
+
/**
* Returns the info object for the specified launch configuration.
* If the configuration exists, but is not yet in the cache,
* an info object is built and added to the cache.
* @param config the {@link ILaunchConfiguration} to get the info object from
* @return the {@link LaunchConfigurationInfo} object from the given {@link ILaunchConfiguration}
- *
+ *
* @exception CoreException if an exception occurs building
* the info object
* @exception DebugException if the config does not exist
* @since 3.5
*/
protected LaunchConfigurationInfo getInfo(LaunchConfiguration config) throws CoreException {
- LaunchConfigurationInfo info = (LaunchConfigurationInfo)fLaunchConfigurations.get(config);
+ LaunchConfigurationInfo info = fLaunchConfigurations.get(config);
if (info == null) {
IFileStore store = config.getFileStore();
if (config.exists()) {
@@ -1355,100 +1374,99 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fLaunchConfigurations.put(config, info);
}
} catch (FileNotFoundException e) {
- throwException(config, e);
+ throwException(config, e);
} catch (SAXException e) {
- throwException(config, e);
+ throwException(config, e);
} catch (ParserConfigurationException e) {
- throwException(config, e);
+ throwException(config, e);
} catch (IOException e) {
- throwException(config, e);
+ throwException(config, e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
- throwException(config, e);
+ throwException(config, e);
}
}
}
-
+
} else {
if (store != null){
- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new String[]{config.getName(), store.toURI().toString()}), null);
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new Object[] {
+ config.getName(), store.toURI().toString() }), null);
} else {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new String[]{config.getName()}), null);
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new Object[] { config.getName() }), null);
}
}
}
return info;
}
-
+
/**
* @see ILaunchManager#getLaunchConfiguration(IFile)
*/
+ @Override
public ILaunchConfiguration getLaunchConfiguration(IFile file) {
hookResourceChangeListener();
return new LaunchConfiguration(file);
}
-
+
/**
* @see ILaunchManager#getLaunchConfiguration(String)
*/
+ @Override
public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException {
hookResourceChangeListener();
return new LaunchConfiguration(memento);
}
-
+
/**
* @see ILaunchManager#getLaunchConfigurations()
*/
+ @Override
public synchronized ILaunchConfiguration[] getLaunchConfigurations() {
- List allConfigs = getAllLaunchConfigurations();
- return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
- }
-
+ List<ILaunchConfiguration> allConfigs = getAllLaunchConfigurations();
+ return allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
+ }
+
/**
* @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType)
*/
+ @Override
public synchronized ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- ILaunchConfiguration config = null;
- while (iter.hasNext()) {
- config = (ILaunchConfiguration)iter.next();
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();
+ for (ILaunchConfiguration config : getAllLaunchConfigurations()) {
if (config.getType().equals(type)) {
configs.add(config);
}
}
- return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
+ return configs.toArray(new ILaunchConfiguration[configs.size()]);
}
-
+
/**
* Returns all launch configurations that are stored as resources
* in the given project.
- *
+ *
* @param project a project
* @return collection of launch configurations that are stored as resources
* in the given project
*/
- protected synchronized List getLaunchConfigurations(IProject project) {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- ILaunchConfiguration config = null;
- IFile file = null;
- while (iter.hasNext()) {
- config = (ILaunchConfiguration)iter.next();
- file = config.getFile();
+ protected synchronized List<ILaunchConfiguration> getLaunchConfigurations(IProject project) {
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();
+ for (ILaunchConfiguration config : getAllLaunchConfigurations()) {
+ IFile file = config.getFile();
if (file != null && file.getProject().equals(project)) {
configs.add(config);
}
}
return configs;
}
-
+
/**
* @see ILaunchManager#getLaunchConfigurationType(String)
*/
+ @Override
public ILaunchConfigurationType getLaunchConfigurationType(String id) {
ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
for(int i = 0; i < types.length; i++) {
@@ -1462,79 +1480,82 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* @see ILaunchManager#getLaunchConfigurationTypes()
*/
+ @Override
public ILaunchConfigurationType[] getLaunchConfigurationTypes() {
initializeLaunchConfigurationTypes();
- return (ILaunchConfigurationType[])fLaunchConfigurationTypes.toArray(new ILaunchConfigurationType[fLaunchConfigurationTypes.size()]);
+ return fLaunchConfigurationTypes.toArray(new ILaunchConfigurationType[fLaunchConfigurationTypes.size()]);
}
-
+
/**
* @see ILaunchManager#getLaunches()
*/
+ @Override
public ILaunch[] getLaunches() {
synchronized (fLaunches) {
- return (ILaunch[])fLaunches.toArray(new ILaunch[fLaunches.size()]);
+ return fLaunches.toArray(new ILaunch[fLaunches.size()]);
}
}
-
+
/**)
* @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String)
*/
+ @Override
public ILaunchMode getLaunchMode(String mode) {
initializeLaunchModes();
- return (ILaunchMode) fLaunchModes.get(mode);
+ return fLaunchModes.get(mode);
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchManager#getLaunchModes()
*/
+ @Override
public ILaunchMode[] getLaunchModes() {
initializeLaunchModes();
- Collection collection = fLaunchModes.values();
- return (ILaunchMode[]) collection.toArray(new ILaunchMode[collection.size()]);
+ Collection<ILaunchMode> collection = fLaunchModes.values();
+ return collection.toArray(new ILaunchMode[collection.size()]);
}
-
+
/**
* Returns all of the launch delegates. The returned listing of delegates cannot be directly used to launch,
* instead the method <code>IlaunchDelegate.getDelegate</code> must be used to acquire an executable form of
* the delegate, allowing us to maintain lazy loading of the delegates themselves.
* @return all of the launch delegates
- *
+ *
* @since 3.3
*/
public ILaunchDelegate[] getLaunchDelegates() {
initializeLaunchDelegates();
- Collection col = fLaunchDelegates.values();
- return (ILaunchDelegate[]) col.toArray(new ILaunchDelegate[col.size()]);
+ Collection<LaunchDelegate> col = fLaunchDelegates.values();
+ return col.toArray(new ILaunchDelegate[col.size()]);
}
-
+
/**
- * Returns the listing of launch delegates that apply to the specified
+ * Returns the listing of launch delegates that apply to the specified
* <code>ILaunchConfigurationType</code> id
- * @param typeid the id of the launch configuration type to get delegates for
+ * @param typeid the id of the launch configuration type to get delegates for
* @return An array of <code>LaunchDelegate</code>s that apply to the specified launch configuration
* type, or an empty array, never <code>null</code>
- *
+ *
* @since 3.3
*/
public LaunchDelegate[] getLaunchDelegates(String typeid) {
initializeLaunchDelegates();
- ArrayList list = new ArrayList();
- LaunchDelegate ld = null;
- for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) {
- ld = (LaunchDelegate) fLaunchDelegates.get(iter.next());
- if(ld.getLaunchConfigurationTypeId().equals(typeid)) {
+ ArrayList<LaunchDelegate> list = new ArrayList<LaunchDelegate>();
+ for (Entry<String, LaunchDelegate> entry : fLaunchDelegates.entrySet()) {
+ LaunchDelegate ld = entry.getValue();
+ if (ld.getLaunchConfigurationTypeId().equals(typeid)) {
list.add(ld);
}
}
- return (LaunchDelegate[]) list.toArray(new LaunchDelegate[list.size()]);
+ return list.toArray(new LaunchDelegate[list.size()]);
}
-
+
/**
- * This method returns the <code>ILaunchDelegate</code> instance corresponding to the id
+ * This method returns the <code>ILaunchDelegate</code> instance corresponding to the id
* of the launch delegate specified
- * @param id the id of the <code>ILaunchDelegate</code> to find
+ * @param id the id of the <code>ILaunchDelegate</code> to find
* @return the <code>ILaunchDelegate</code> or <code>null</code> if not found
- *
+ *
* @since 3.3
*/
public ILaunchDelegate getLaunchDelegate(String id) {
@@ -1548,15 +1569,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return null;
}
-
+
/**
* Initializes the listing of delegates available to the launching framework
- *
+ *
* @since 3.3
*/
private synchronized void initializeLaunchDelegates() {
if(fLaunchDelegates == null) {
- fLaunchDelegates = new HashMap();
+ fLaunchDelegates = new HashMap<String, LaunchDelegate>();
//get all launch delegate contributions
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES);
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
@@ -1577,11 +1598,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
}
}
-
+
/**
* This method is used to initialize a simple listing of all preferred delegates, which is then used by each
* <code>ILaunchConfigurationType</code> to find if they have preferred delegates. Once an <code>ILaunchConfigurationType</code>
- * has used this listing to initialize its preferred delegates it will maintain changes to its preferred delegate, which are
+ * has used this listing to initialize its preferred delegates it will maintain changes to its preferred delegate, which are
* then written back to the preference store only when the launch manager shuts down.
* <p>
* This cache is not synchronized with the runtime preferred delegates stored in launch configuration types.
@@ -1590,7 +1611,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*/
private synchronized void initializePreferredDelegates() {
if(fPreferredDelegates == null) {
- fPreferredDelegates = new HashSet();
+ fPreferredDelegates = new HashSet<PreferredDelegate>();
String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_PREFERRED_DELEGATES, IInternalDebugCoreConstants.EMPTY_STRING, null);
if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(preferred)) {
try {
@@ -1598,13 +1619,13 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
NodeList nodes = root.getElementsByTagName(IConfigurationElementConstants.DELEGATE);
Element element = null;
String typeid = null;
- Set modeset = null;
+ Set<String> modeset = null;
for(int i = 0; i < nodes.getLength(); i++) {
element = (Element) nodes.item(i);
- String delegateid = element.getAttribute(IConfigurationElementConstants.ID);
+ String delegateid = element.getAttribute(IConfigurationElementConstants.ID);
typeid = element.getAttribute(IConfigurationElementConstants.TYPE_ID);
String[] modes = element.getAttribute(IConfigurationElementConstants.MODES).split(","); //$NON-NLS-1$
- modeset = new HashSet(Arrays.asList(modes));
+ modeset = new HashSet<String>(Arrays.asList(modes));
LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateid, modeset);
if (delegate != null) {
//take type id, modeset, delegate and create entry
@@ -1614,51 +1635,49 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
}
}
- catch (CoreException e) {DebugPlugin.log(e);}
+ catch (CoreException e) {DebugPlugin.log(e);}
}
}
}
-
+
/**
- * Allows internal access to reset preferred delegates when re-importing
- * preferences.
- *
+ * Allows internal access to reset preferred delegates when re-importing
+ * preferences.
+ *
* @since 3.6
*/
protected void resetPreferredDelegates() {
fPreferredDelegates = null;
}
-
+
/**
* Allows internal access to a preferred delegate for a given type and mode set
* @param typeid the id of the <code>ILaunchConfigurationType</code> to find a delegate for
* @param modes the set of modes for the delegate
* @return the preferred delegate for the specified type id and mode set, or <code>null</code> if none
- *
+ *
* @since 3.3
*/
- protected ILaunchDelegate getPreferredDelegate(String typeid, Set modes) {
- // Retrieve preferred delegates using legacy mechanism for backward
+ protected ILaunchDelegate getPreferredDelegate(String typeid, Set<String> modes) {
+ // Retrieve preferred delegates using legacy mechanism for backward
// compatibility.
initializePreferredDelegates();
- PreferredDelegate pd = null;
- for(Iterator iter = fPreferredDelegates.iterator(); iter.hasNext();) {
- pd = (PreferredDelegate) iter.next();
+ for (PreferredDelegate pd : fPreferredDelegates) {
if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) {
return pd.getDelegate();
}
}
// @since 3.5
- // If the legacy mechanism didn't work, try the new preference name for
- // the given launch type.
+ // If the legacy mechanism didn't work, try the new preference name for
+ // the given launch type.
String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), "//" + LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); //$NON-NLS-1$
if (preferred != null && preferred.length() != 0) {
StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$
while(tokenizer.hasMoreTokens()) {
StringTokenizer tokenizer2 = new StringTokenizer(tokenizer.nextToken(), ","); //$NON-NLS-1$
String delegateId = tokenizer2.nextToken();
- HashSet modeset = new HashSet();
+ HashSet<String> modeset = new HashSet<String>();
while(tokenizer2.hasMoreTokens()) {
modeset.add(tokenizer2.nextToken());
}
@@ -1667,28 +1686,28 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
return delegate;
}
}
-
+
}
return null;
}
-
+
/**
* Returns the launch delegate extension that matches the given type, delegate ID, and
* set of modes.
- *
+ *
* @param typeId Launch configuration type.
* @param id Launch delegate ID.
- * @param modeset Set of modes that the launch delegate applies to.
- * @return The launch delegate matching the specified parameters, or
+ * @param modeset Set of modes that the launch delegate applies to.
+ * @return The launch delegate matching the specified parameters, or
* <code>null</code> if not found.
- *
+ *
* @since 3.5
*/
- private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, Set modeset) {
+ private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, Set<String> modeset) {
LaunchDelegate[] extensions = getLaunchDelegates(typeId);
for(int j = 0; j < extensions.length; j++) {
- if(id.equals(extensions[j].getId())) {
- List modesets = extensions[j].getModes();
+ if(id.equals(extensions[j].getId())) {
+ List<Set<String>> modesets = extensions[j].getModes();
if(modesets.contains(modeset)) {
return extensions[j];
}
@@ -1696,25 +1715,22 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
return null;
}
-
+
/**
* Returns all launch configurations that are stored locally.
- *
+ *
* @return collection of launch configurations stored locally
*/
- protected synchronized List getLocalLaunchConfigurations() {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- ILaunchConfiguration config = null;
- while (iter.hasNext()) {
- config = (ILaunchConfiguration)iter.next();
+ protected synchronized List<ILaunchConfiguration> getLocalLaunchConfigurations() {
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();
+ for (ILaunchConfiguration config : getAllLaunchConfigurations()) {
if (config.isLocal()) {
configs.add(config);
}
}
return configs;
}
-
+
/**
* Returns the launch configurations mapping to the specified resource
* @param resource the resource to collect mapped launch configurations for
@@ -1722,138 +1738,140 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @since 3.2
*/
public ILaunchConfiguration[] getMappedConfigurations(IResource resource) {
- List configurations = new ArrayList();
- try {
- ILaunchConfiguration[] configs = getLaunchConfigurations();
- IResource[] resources = null;
- for(int i = 0; i < configs.length; i++) {
- resources = configs[i].getMappedResources();
+ List<ILaunchConfiguration> configurations = new ArrayList<ILaunchConfiguration>();
+ for (ILaunchConfiguration config : getAllLaunchConfigurations()) {
+ try {
+ IResource[] resources = config.getMappedResources();
if(resources != null) {
for(int j = 0; j < resources.length; j++) {
if(resources[j].equals(resource)) {
- configurations.add(configs[i]);
+ configurations.add(config);
+ break;
}
}
}
+ } catch (CoreException ce) {
+ DebugPlugin.log(ce);
}
}
- catch(CoreException e) {DebugPlugin.log(e);}
- return (ILaunchConfiguration[])configurations.toArray(new ILaunchConfiguration[configurations.size()]);
+ return configurations.toArray(new ILaunchConfiguration[configurations.size()]);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchManager#getMigrationCandidates()
*/
+ @Override
public ILaunchConfiguration[] getMigrationCandidates() throws CoreException {
- List configs = new ArrayList();
- ILaunchConfiguration[] candidates = getLaunchConfigurations();
- for(int i = 0; i < candidates.length; i++) {
- if(!candidates[i].isReadOnly() && candidates[i].isMigrationCandidate()) {
- configs.add(candidates[i]);
+ List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();
+ for (ILaunchConfiguration config : getAllLaunchConfigurations()) {
+ if (!config.isReadOnly() && config.isMigrationCandidate()) {
+ configs.add(config);
}
}
- return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
+ return configs.toArray(new ILaunchConfiguration[configs.size()]);
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchManager#getMovedFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public ILaunchConfiguration getMovedFrom(ILaunchConfiguration addedConfiguration) {
if (addedConfiguration.equals(fTo)) {
return fFrom;
}
return null;
}
-
+
/**
* @see org.eclipse.debug.core.ILaunchManager#getMovedTo(org.eclipse.debug.core.ILaunchConfiguration)
*/
+ @Override
public ILaunchConfiguration getMovedTo(ILaunchConfiguration removedConfiguration) {