diff options
author | Alexander Kurtakov | 2019-07-16 09:47:36 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-07-16 09:47:36 +0000 |
commit | 8f540ec08cb091dc58b1e4b851faac56fb009f2f (patch) | |
tree | 56a30299edb7d208ed8cdf11f750c983abdb1b71 | |
parent | a77a119ab811a6b37b191738dea96d2931d6449c (diff) | |
download | rt.equinox.p2-8f540ec08cb091dc58b1e4b851faac56fb009f2f.tar.gz rt.equinox.p2-8f540ec08cb091dc58b1e4b851faac56fb009f2f.tar.xz rt.equinox.p2-8f540ec08cb091dc58b1e4b851faac56fb009f2f.zip |
Stricter warnings in toucpoint.eclipse and fix them.Y20190805-0900Y20190801-0900Y20190730-0135Y20190730-0055Y20190729-0900Y20190725-0900Y20190722-0900Y20190718-0905Y20190718-0450I20190806-1800I20190805-1800I20190804-1800I20190803-1800I20190802-1800I20190801-1800I20190801-0600I20190731-1800I20190730-1800I20190729-1800I20190728-1800I20190727-1800I20190726-1800I20190725-1800I20190724-1800I20190723-1800I20190722-1800I20190721-1800I20190720-1800I20190719-1800I20190718-1800I20190717-1800I20190716-1800
Change-Id: Ifc1845ab1491a890b8a04458a7039e124f8e0a66
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
37 files changed, 349 insertions, 167 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs index d1dc2cc40..2575694e1 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/.settings/org.eclipse.jdt.core.prefs @@ -7,6 +7,15 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve @@ -16,20 +25,27 @@ 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=1000 +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=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.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning @@ -37,39 +53,78 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error 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.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -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 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled 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.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Activator.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Activator.java index ac07ab4d4..9a1958e4a 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Activator.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Activator.java @@ -20,10 +20,12 @@ public class Activator implements BundleActivator { public static final String ID = "org.eclipse.equinox.p2.touchpoint.eclipse"; //$NON-NLS-1$ private static BundleContext context = null; + @Override public void start(BundleContext ctx) throws Exception { Activator.context = ctx; } + @Override public void stop(BundleContext ctx) throws Exception { Activator.context = null; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AgentFromInstall.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AgentFromInstall.java index 66cbafa27..ed3090ac8 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AgentFromInstall.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AgentFromInstall.java @@ -21,38 +21,48 @@ import org.eclipse.equinox.internal.provisional.frameworkadmin.*; import org.eclipse.equinox.p2.core.*; /** - * Given an eclipse installation folder and / or an eclipse configuration folder, - * this class creates the agent representing the system point at. + * Given an eclipse installation folder and / or an eclipse configuration + * folder, this class creates the agent representing the system point at. */ public class AgentFromInstall { - //Input + // Input private File configurationFolder; private File installFolder; private IProvisioningAgentProvider agentProvider; - //Figured out + // Figured out private String profileId; private String p2DataAreaURI; private String userSpecifiedProfileId; - private AgentFromInstall(IProvisioningAgentProvider agentProvider, File installFolder, File configurationFolder, String profileId) { + private AgentFromInstall(IProvisioningAgentProvider agentProvider, File installFolder, File configurationFolder, + String profileId) { this.installFolder = installFolder; this.configurationFolder = configurationFolder; this.agentProvider = agentProvider; this.userSpecifiedProfileId = profileId; } - /** - * Creates an agent deriving the p2 data area from the information contained in the installFolder or the configurationFolder. - * In the returned agent, the services will be initialized such that the SELF variable is bound to the default profile referred to in the configuration files. - * - * @param agentProvider an instance of an agent provider from which the agent will be created. - * @param installFolder null or a file referring to the installation folder of eclipse. - * @param configurationFolder null or a file referring to the configuration folder of eclipse. - * @param profileId null or the name of the expected profile. This value is used when the detection of the profile id from the configuration file does not succeed. + /** + * Creates an agent deriving the p2 data area from the information contained in + * the installFolder or the configurationFolder. In the returned agent, the + * services will be initialized such that the SELF variable is bound to the + * default profile referred to in the configuration files. + * + * @param agentProvider an instance of an agent provider from which the + * agent will be created. + * @param installFolder null or a file referring to the installation + * folder of eclipse. + * @param configurationFolder null or a file referring to the configuration + * folder of eclipse. + * @param profileId null or the name of the expected profile. This + * value is used when the detection of the profile id + * from the configuration file does not succeed. */ - static public IProvisioningAgent createAgentFrom(IProvisioningAgentProvider agentProvider, File installFolder, File configurationFolder, String profileId) { - AgentFromInstall newInstance = new AgentFromInstall(agentProvider, installFolder, configurationFolder, profileId); + static public IProvisioningAgent createAgentFrom(IProvisioningAgentProvider agentProvider, File installFolder, + File configurationFolder, String profileId) { + AgentFromInstall newInstance = new AgentFromInstall(agentProvider, installFolder, configurationFolder, + profileId); return newInstance.loadAgent(); } @@ -78,11 +88,12 @@ public class AgentFromInstall { try { agent = agentProvider.createAgent(URIUtil.fromString(p2DataAreaURI)); } catch (ProvisionException e) { - //Can't happen + // Can't happen } catch (URISyntaxException e) { - //Can't happen since we are always constructing the string from code that manipulate files (included the code in the Manipulator) + // Can't happen since we are always constructing the string from code that + // manipulate files (included the code in the Manipulator) } - agent.registerService("FORCED_SELF", profileId); + agent.registerService("FORCED_SELF", profileId); //$NON-NLS-1$ return agent; } @@ -92,7 +103,8 @@ public class AgentFromInstall { return false; Manipulator manipulator = fwk.getManipulator(); LauncherData launcherData = manipulator.getLauncherData(); - launcherData.setFwConfigLocation(configurationFolder != null ? configurationFolder : new File(installFolder, "configuration/config.ini")); //$NON-NLS-1$ + launcherData.setFwConfigLocation(configurationFolder != null ? configurationFolder + : new File(installFolder, "configuration/config.ini")); //$NON-NLS-1$ launcherData.setHome(installFolder); try { manipulator.load(); @@ -121,11 +133,11 @@ public class AgentFromInstall { } } - private File getProfileRegistryFolder(File p2Folder) { + private static File getProfileRegistryFolder(File p2Folder) { return new File(p2Folder, "org.eclipse.equinox.p2.engine/profileRegistry/"); //$NON-NLS-1$ } - private String findProfile(File profileDirectory) { + private static String findProfile(File profileDirectory) { final String PROFILE_EXT = ".profile"; //$NON-NLS-1$ File[] profileDirectories = profileDirectory.listFiles(new FileFilter() { @Override diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java index 3abf3cb44..bb4c15036 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/AggregatedBundleRepository.java @@ -29,11 +29,13 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple private static final String REPOSITORY_TYPE = AggregatedBundleRepository.class.getName(); private final Collection<IFileArtifactRepository> bundleRepositories; - public AggregatedBundleRepository(IProvisioningAgent agent, Collection<IFileArtifactRepository> bundleRepositories) { + public AggregatedBundleRepository(IProvisioningAgent agent, + Collection<IFileArtifactRepository> bundleRepositories) { super(agent, REPOSITORY_TYPE, REPOSITORY_TYPE, "1.0", null, null, null, null); //$NON-NLS-1$ this.bundleRepositories = bundleRepositories; } + @Override public File getArtifactFile(IArtifactKey key) { for (IFileArtifactRepository repository : bundleRepositories) { File artifactFile = repository.getArtifactFile(key); @@ -43,6 +45,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple return null; } + @Override public File getArtifactFile(IArtifactDescriptor descriptor) { for (IFileArtifactRepository repository : bundleRepositories) { File artifactFile = repository.getArtifactFile(descriptor); @@ -52,6 +55,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple return null; } + @Override public boolean contains(IArtifactDescriptor descriptor) { for (IFileArtifactRepository repository : bundleRepositories) { if (repository.contains(descriptor)) @@ -60,6 +64,7 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple return false; } + @Override public boolean contains(IArtifactKey key) { for (IFileArtifactRepository repository : bundleRepositories) { if (repository.contains(key)) @@ -68,8 +73,9 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple return false; } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { - Set<IArtifactDescriptor> artifactDescriptors = new HashSet<IArtifactDescriptor>(); + Set<IArtifactDescriptor> artifactDescriptors = new HashSet<>(); for (IFileArtifactRepository repository : bundleRepositories) { IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key); if (descriptors != null) @@ -78,38 +84,45 @@ public class AggregatedBundleRepository extends AbstractArtifactRepository imple return artifactDescriptors.toArray(new IArtifactDescriptor[artifactDescriptors.size()]); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { throw new UnsupportedOperationException(Messages.artifact_retrieval_unsupported); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { throw new UnsupportedOperationException(Messages.artifact_retrieval_unsupported); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { throw new UnsupportedOperationException(Messages.artifact_retrieval_unsupported); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) { throw new UnsupportedOperationException(Messages.artifact_write_unsupported); } /** * Exposed for testing and debugging purposes. + * * @noreference This method is not intended to be referenced by clients. */ public Collection<IFileArtifactRepository> testGetBundleRepositories() { return bundleRepositories; } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { // Query all the all the repositories IQueryable<IArtifactKey> queryable = QueryUtil.compoundQueryable(bundleRepositories); return queryable.query(query, monitor); } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { - List<IQueryable<IArtifactDescriptor>> descQueryables = new ArrayList<IQueryable<IArtifactDescriptor>>(bundleRepositories.size()); + List<IQueryable<IArtifactDescriptor>> descQueryables = new ArrayList<>(bundleRepositories.size()); for (IFileArtifactRepository repository : bundleRepositories) descQueryables.add(repository.descriptorQueryable()); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java index 4d9ab57c2..afa04ed1c 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java @@ -38,8 +38,9 @@ public class EclipseMarkSetProvider extends MarkSetProvider { private Collection<IArtifactKey> artifactKeyList = null; + @Override public MarkSet[] getMarkSets(IProvisioningAgent agent, IProfile inProfile) { - artifactKeyList = new HashSet<IArtifactKey>(); + artifactKeyList = new HashSet<>(); IArtifactRepository repositoryToGC = Util.getBundlePoolRepository(agent, inProfile); if (repositoryToGC == null) return new MarkSet[0]; @@ -68,7 +69,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider { } } - private List<Feature> getAllFeatures(Configuration cfg) { + private static List<Feature> getAllFeatures(Configuration cfg) { if (cfg == null) return Collections.emptyList(); List<Site> sites = cfg.getSites(); @@ -82,7 +83,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider { return result; } - private IProfile getCurrentProfile(IProvisioningAgent agent) { + private static IProfile getCurrentProfile(IProvisioningAgent agent) { IProfileRegistry pr = agent.getService(IProfileRegistry.class); if (pr == null) return null; @@ -99,6 +100,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider { } } + @Override public IArtifactRepository getRepository(IProvisioningAgent agent, IProfile aProfile) { return Util.getBundlePoolRepository(agent, aProfile); } @@ -107,7 +109,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider { artifactKeyList.addAll(findCorrespondinArtifacts(new WhatIsRunning().getBundlesBeingRun(), repo)); } - private IArtifactKey searchArtifact(String searchedId, Version searchedVersion, String classifier, + private static IArtifactKey searchArtifact(String searchedId, Version searchedVersion, String classifier, IArtifactRepository repo) { // This is somewhat cheating since normally we should get the artifact key from // the IUs that were representing the running system (e.g. we could get that @@ -123,8 +125,8 @@ public class EclipseMarkSetProvider extends MarkSetProvider { } // Find for each bundle info a corresponding artifact in repo - private List<IArtifactKey> findCorrespondinArtifacts(BundleInfo[] bis, IArtifactRepository repo) { - ArrayList<IArtifactKey> toRetain = new ArrayList<IArtifactKey>(); + private static List<IArtifactKey> findCorrespondinArtifacts(BundleInfo[] bis, IArtifactRepository repo) { + ArrayList<IArtifactKey> toRetain = new ArrayList<>(); for (int i = 0; i < bis.length; i++) { // if version is "0.0.0", we will use null to find all versions, see bug 305710 Version version = BundleInfo.EMPTY_VERSION.equals(bis[i].getVersion()) ? null diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java index e64b01ee7..265b3661c 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseTouchpoint.java @@ -41,13 +41,13 @@ public class EclipseTouchpoint extends Touchpoint { private static final Object PARM_AGENT = "agent"; //$NON-NLS-1$ private static final String NATIVE_TOUCHPOINT_ID = "org.eclipse.equinox.p2.touchpoint.natives"; //$NON-NLS-1$ - private static List<String> NATIVE_ACTIONS = Arrays.asList(new String[] {"mkdir", "rmdir"}); //$NON-NLS-1$//$NON-NLS-2$ + private static List<String> NATIVE_ACTIONS = Arrays.asList(new String[] { "mkdir", "rmdir" }); //$NON-NLS-1$//$NON-NLS-2$ private static final String VALIDATE_PROFILE = "org.eclipse.equinox.internal.p2.touchpoint.eclipse.validateProfile"; //$NON-NLS-1$ - private static Map<IProfile, LazyManipulator> manipulators = new WeakHashMap<IProfile, LazyManipulator>(); - private static Map<IProfile, PlatformConfigurationWrapper> wrappers = new WeakHashMap<IProfile, PlatformConfigurationWrapper>(); - private static Map<IProfile, SourceManipulator> sourceManipulators = new WeakHashMap<IProfile, SourceManipulator>(); - private static Map<IProfile, Map<IInstallableUnit, IInstallableUnit>> preparedIUs = new WeakHashMap<IProfile, Map<IInstallableUnit, IInstallableUnit>>(); + private static Map<IProfile, LazyManipulator> manipulators = new WeakHashMap<>(); + private static Map<IProfile, PlatformConfigurationWrapper> wrappers = new WeakHashMap<>(); + private static Map<IProfile, SourceManipulator> sourceManipulators = new WeakHashMap<>(); + private static Map<IProfile, Map<IInstallableUnit, IInstallableUnit>> preparedIUs = new WeakHashMap<>(); private static synchronized LazyManipulator getManipulator(IProvisioningAgent agent, IProfile profile) { LazyManipulator manipulator = manipulators.get(profile); @@ -58,13 +58,15 @@ public class EclipseTouchpoint extends Touchpoint { return manipulator; } - private static synchronized void saveManipulator(IProfile profile) throws FrameworkAdminRuntimeException, IOException { + private static synchronized void saveManipulator(IProfile profile) + throws FrameworkAdminRuntimeException, IOException { LazyManipulator manipulator = manipulators.remove(profile); if (manipulator != null) manipulator.save(false); } - private static synchronized PlatformConfigurationWrapper getPlatformConfigurationWrapper(IProvisioningAgent agent, IProfile profile, LazyManipulator manipulator) { + private static synchronized PlatformConfigurationWrapper getPlatformConfigurationWrapper(IProvisioningAgent agent, + IProfile profile, LazyManipulator manipulator) { PlatformConfigurationWrapper wrapper = wrappers.get(profile); if (wrapper == null) { File configLocation = Util.getConfigurationFolder(profile); @@ -107,7 +109,7 @@ public class EclipseTouchpoint extends Touchpoint { private static synchronized void savePreparedIU(IProfile profile, IInstallableUnit iu) { Map<IInstallableUnit, IInstallableUnit> preparedProfileIUs = preparedIUs.get(profile); if (preparedProfileIUs == null) { - preparedProfileIUs = new HashMap<IInstallableUnit, IInstallableUnit>(); + preparedProfileIUs = new HashMap<>(); preparedIUs.put(profile, preparedProfileIUs); } preparedProfileIUs.put(iu, iu); @@ -124,6 +126,7 @@ public class EclipseTouchpoint extends Touchpoint { preparedIUs.remove(profile); } + @Override public IStatus prepare(IProfile profile) { try { if (hasPreparedIUs(profile)) @@ -134,6 +137,7 @@ public class EclipseTouchpoint extends Touchpoint { return Status.OK_STATUS; } + @Override public IStatus commit(IProfile profile) { MultiStatus status = new MultiStatus(Activator.ID, IStatus.OK, null, null); try { @@ -161,25 +165,31 @@ public class EclipseTouchpoint extends Touchpoint { return status; } + @Override public IStatus rollback(IProfile profile) { clearProfileState(profile); return Status.OK_STATUS; } + @Override public String qualifyAction(String actionId) { String touchpointQualifier = NATIVE_ACTIONS.contains(actionId) ? NATIVE_TOUCHPOINT_ID : Activator.ID; return touchpointQualifier + "." + actionId; //$NON-NLS-1$ } - public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map<String, Object> touchpointParameters) { + @Override + public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, + Map<String, Object> touchpointParameters) { IProvisioningAgent agent = (IProvisioningAgent) touchpointParameters.get(PARM_AGENT); LazyManipulator manipulator = getManipulator(agent, profile); touchpointParameters.put(PARM_MANIPULATOR, manipulator); touchpointParameters.put(PARM_SOURCE_BUNDLES, getSourceManipulator(profile)); - touchpointParameters.put(PARM_PLATFORM_CONFIGURATION, getPlatformConfigurationWrapper(agent, profile, manipulator)); + touchpointParameters.put(PARM_PLATFORM_CONFIGURATION, + getPlatformConfigurationWrapper(agent, profile, manipulator)); return null; } + @Override public IStatus initializeOperand(IProfile profile, Map<String, Object> parameters) { IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); IArtifactKey artifactKey = (IArtifactKey) parameters.get(PARM_ARTIFACT); @@ -200,7 +210,8 @@ public class EclipseTouchpoint extends Touchpoint { return Status.OK_STATUS; } - public IInstallableUnit prepareIU(IProvisioningAgent agent, IProfile profile, IInstallableUnit iu, IArtifactKey artifactKey) { + public IInstallableUnit prepareIU(IProvisioningAgent agent, IProfile profile, IInstallableUnit iu, + IArtifactKey artifactKey) { IInstallableUnit preparedIU = getPreparedIU(profile, iu); if (preparedIU != null) return preparedIU; @@ -237,7 +248,7 @@ public class EclipseTouchpoint extends Touchpoint { throw new IllegalStateException(Messages.unexpected_prepareiu_error); } - private IStatus validateProfile(IProfile profile) { + private static IStatus validateProfile(IProfile profile) { // by default we validate if (Boolean.FALSE.toString().equals(profile.getProperty(VALIDATE_PROFILE))) return Status.OK_STATUS; @@ -246,7 +257,7 @@ public class EclipseTouchpoint extends Touchpoint { try { c = Class.forName("org.eclipse.equinox.p2.planner.IPlanner"); //$NON-NLS-1$ } catch (ClassNotFoundException e) { - //ignore and proceed without validation + // ignore and proceed without validation return null; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java index 9d29e2358..c7e342f28 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/LazyManipulator.java @@ -25,10 +25,12 @@ import org.osgi.util.tracker.ServiceTracker; public class LazyManipulator implements Manipulator { - private final static String FILTER_OBJECTCLASS = "(" + Constants.OBJECTCLASS + '=' + FrameworkAdmin.class.getName() + ')'; //$NON-NLS-1$ + private final static String FILTER_OBJECTCLASS = "(" + Constants.OBJECTCLASS + '=' + FrameworkAdmin.class.getName() //$NON-NLS-1$ + + ')'; private final static String filterFwName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_FW_NAME + "=Equinox)"; //$NON-NLS-1$ //$NON-NLS-2$ - private final static String filterLauncherName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME + "=Eclipse.exe)"; //$NON-NLS-1$ //$NON-NLS-2$ - private final static String filterFwAdmin = "(&" + FILTER_OBJECTCLASS + filterFwName + filterLauncherName + ')'; //$NON-NLS-1$; + private final static String filterLauncherName = "(" + FrameworkAdmin.SERVICE_PROP_KEY_LAUNCHER_NAME //$NON-NLS-1$ + + "=Eclipse.exe)"; //$NON-NLS-1$ + private final static String filterFwAdmin = "(&" + FILTER_OBJECTCLASS + filterFwName + filterLauncherName + ')'; //$NON-NLS-1$ ; private Manipulator manipulator; private final IProfile profile; @@ -57,7 +59,7 @@ public class LazyManipulator implements Manipulator { try { manipulator.load(); } catch (IllegalStateException e) { - //if fwJar is not included, this exception will be thrown. But ignore it. + // if fwJar is not included, this exception will be thrown. But ignore it. LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); throw new IllegalStateException(Messages.error_loading_manipulator); } catch (FrameworkAdminRuntimeException e) { @@ -66,21 +68,22 @@ public class LazyManipulator implements Manipulator { LogHelper.log(Util.createError(Messages.error_loading_manipulator, e)); throw new IllegalStateException(Messages.error_loading_manipulator); } - //TODO These values should be inserted by a configuration unit (bug 204124) + // TODO These values should be inserted by a configuration unit (bug 204124) manipulator.getConfigData().setProperty("eclipse.p2.profile", profile.getProfileId()); //$NON-NLS-1$ - manipulator.getConfigData().setProperty("eclipse.p2.data.area", Util.getAgentLocation(agent).getRootLocation().toString()); //$NON-NLS-1$ + manipulator.getConfigData().setProperty("eclipse.p2.data.area", //$NON-NLS-1$ + Util.getAgentLocation(agent).getRootLocation().toString()); } public static FrameworkAdmin getFrameworkAdmin() { ServiceTracker<FrameworkAdmin, FrameworkAdmin> fwAdminTracker = null; try { Filter filter = Activator.getContext().createFilter(filterFwAdmin); - fwAdminTracker = new ServiceTracker<FrameworkAdmin, FrameworkAdmin>(Activator.getContext(), filter, null); + fwAdminTracker = new ServiceTracker<>(Activator.getContext(), filter, null); fwAdminTracker.open(); FrameworkAdmin fwAdmin = fwAdminTracker.getService(); return fwAdmin; } catch (InvalidSyntaxException e) { - //Can't happen we are writing the filter ourselves + // Can't happen we are writing the filter ourselves return null; } finally { if (fwAdminTracker != null) @@ -88,13 +91,14 @@ public class LazyManipulator implements Manipulator { } } - private Manipulator getFrameworkManipulator() { + private static Manipulator getFrameworkManipulator() { FrameworkAdmin fwAdmin = getFrameworkAdmin(); if (fwAdmin != null) return fwAdmin.getManipulator(); return null; } + @Override public void save(boolean backup) throws IOException, FrameworkAdminRuntimeException { if (manipulator != null) manipulator.save(backup); @@ -102,45 +106,54 @@ public class LazyManipulator implements Manipulator { // DELEGATE METHODS + @Override public BundlesState getBundlesState() throws FrameworkAdminRuntimeException { loadDelegate(); return manipulator.getBundlesState(); } + @Override public ConfigData getConfigData() throws FrameworkAdminRuntimeException { loadDelegate(); return manipulator.getConfigData(); } + @Override public BundleInfo[] getExpectedState() throws IllegalStateException, IOException, FrameworkAdminRuntimeException { loadDelegate(); return manipulator.getExpectedState(); } + @Override public LauncherData getLauncherData() throws FrameworkAdminRuntimeException { loadDelegate(); return manipulator.getLauncherData(); } + @Override public long getTimeStamp() { loadDelegate(); return manipulator.getTimeStamp(); } + @Override public void initialize() { loadDelegate(); manipulator.initialize(); } + @Override public void load() throws IllegalStateException, FrameworkAdminRuntimeException { loadDelegate(); } + @Override public void setConfigData(ConfigData configData) { loadDelegate(); manipulator.setConfigData(configData); } + @Override public void setLauncherData(LauncherData launcherData) { loadDelegate(); manipulator.setLauncherData(launcherData); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java index 75b8742c6..90e954d62 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PlatformConfigurationWrapper.java @@ -26,10 +26,10 @@ import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.osgi.service.environment.Constants; import org.eclipse.osgi.util.NLS; -/** - * This class provides a wrapper for reading and writing platform.xml. +/** + * This class provides a wrapper for reading and writing platform.xml. * - * Only a minimal set of operations is exposed. + * Only a minimal set of operations is exposed. */ public class PlatformConfigurationWrapper { @@ -46,10 +46,9 @@ public class PlatformConfigurationWrapper { * just use the Location service here because we may not be installing into * ourselves. (see https://bugs.eclipse.org/354552) * - * First try and calculate the location based relative to the data provided - * in the manipulator's launcher data. If that doesn't work then calculate - * it based on the location of known JARs. If that still doesn't work then - * return null. + * First try and calculate the location based relative to the data provided in + * the manipulator's launcher data. If that doesn't work then calculate it based + * on the location of known JARs. If that still doesn't work then return null. */ private static URL getOSGiInstallArea(Manipulator manipulator) { @@ -64,7 +63,8 @@ public class PlatformConfigurationWrapper { } } - // next try and calculate the value based on the location of the framework (OSGi) jar. + // next try and calculate the value based on the location of the framework + // (OSGi) jar. File fwkJar = launcherData.getFwJar(); if (fwkJar != null) { try { @@ -74,15 +74,17 @@ public class PlatformConfigurationWrapper { } } - // finally calculate the value based on the location of the launcher executable itself + // finally calculate the value based on the location of the launcher executable + // itself File launcherFile = launcherData.getLauncher(); if (launcherFile != null) { if (Constants.OS_MACOSX.equals(launcherData.getOS())) { - //the equinox launcher will look 3 levels up on the mac when going from executable to launcher.jar - //see org.eclipse.equinox.executable/library/eclipse.c : findStartupJar(); + // the equinox launcher will look 3 levels up on the mac when going from + // executable to launcher.jar + // see org.eclipse.equinox.executable/library/eclipse.c : findStartupJar(); IPath launcherPath = new Path(launcherFile.getAbsolutePath()); if (launcherPath.segmentCount() > 2) { - //removing "Eclipse.app/Contents/MacOS/eclipse" + // removing "Eclipse.app/Contents/MacOS/eclipse" launcherPath = launcherPath.removeLastSegments(2); try { return launcherPath.toFile().toURI().toURL(); @@ -110,7 +112,7 @@ public class PlatformConfigurationWrapper { if (bis[i].getLocation().getScheme().equals("file")) //$NON-NLS-1$ return fromOSGiJarToOSGiInstallArea(bis[i].getLocation().getPath()).toURI().toURL(); } catch (MalformedURLException e) { - //do nothing + // do nothing } } if (searchFor.equals(OSGI)) @@ -161,9 +163,9 @@ public class PlatformConfigurationWrapper { } /* - * Return the default policy to use when creating a new site. If there are - * any sites with the MANAGED-ONLY policy, then that is the default. - * Otherwise the default is USER-EXCLUDE. + * Return the default policy to use when creating a new site. If there are any + * sites with the MANAGED-ONLY policy, then that is the default. Otherwise the + * default is USER-EXCLUDE. */ private String getDefaultPolicy() { for (Site site : configuration.getSites()) { @@ -176,7 +178,7 @@ public class PlatformConfigurationWrapper { /* * Create and return a site object based on the given location. */ - private Site createSite(URI location, String policy) { + private static Site createSite(URI location, String policy) { Site result = new Site(); result.setUrl(location.toString()); result.setPolicy(policy); @@ -199,15 +201,15 @@ public class PlatformConfigurationWrapper { if (nextFile.equals(file)) return nextSite; } catch (URISyntaxException e) { - //ignore incorrectly formed site + // ignore incorrectly formed site } } return null; } /* - * Look in the configuration and return the site which contains the feature - * with the given identifier and version. Return null if there is none. + * Look in the configuration and return the site which contains the feature with + * the given identifier and version. Return null if there is none. */ private Site getSite(String id, String version) { List<Site> sites = configuration.getSites(); @@ -221,7 +223,8 @@ public class PlatformConfigurationWrapper { return null; } - public IStatus addFeatureEntry(File file, String id, String version, String pluginIdentifier, String pluginVersion, boolean primary, String application, URL[] root, String linkFile) { + public IStatus addFeatureEntry(File file, String id, String version, String pluginIdentifier, String pluginVersion, + boolean primary, String application, URL[] root, String linkFile) { loadDelegate(); if (configuration == null) return new Status(IStatus.WARNING, Activator.ID, Messages.platform_config_unavailable, null); @@ -229,10 +232,12 @@ public class PlatformConfigurationWrapper { URI fileURL = null; File featureDir = file.getParentFile(); if (featureDir == null || !featureDir.getName().equals("features")) //$NON-NLS-1$ - return new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.parent_dir_features, file.getAbsolutePath()), null); + return new Status(IStatus.ERROR, Activator.ID, + NLS.bind(Messages.parent_dir_features, file.getAbsolutePath()), null); File locationDir = featureDir.getParentFile(); if (locationDir == null) - return new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.cannot_calculate_extension_location, file.getAbsolutePath()), null); + return new Status(IStatus.ERROR, Activator.ID, + NLS.bind(Messages.cannot_calculate_extension_location, file.getAbsolutePath()), null); fileURL = locationDir.toURI(); Site site = getSite(fileURL); @@ -293,7 +298,7 @@ public class PlatformConfigurationWrapper { } private static String makeFeatureURL(String id, String version) { - return FEATURES + id + "_" + version + "/"; //$NON-NLS-1$ //$NON-NLS-2$; + return FEATURES + id + "_" + version + "/"; //$NON-NLS-1$ //$NON-NLS-2$ ; } } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java index 79d7fa4c3..8074469c6 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java @@ -113,7 +113,7 @@ public class Util { public static IFileArtifactRepository getAggregatedBundleRepository(IProvisioningAgent agent, IProfile profile, int repoFilter) { - List<IFileArtifactRepository> bundleRepositories = new ArrayList<IFileArtifactRepository>(); + List<IFileArtifactRepository> bundleRepositories = new ArrayList<>(); // we check for a shared bundle pool first as it should be preferred over the // user bundle pool in a shared install @@ -332,7 +332,7 @@ public class Util { } if (os.equals(org.eclipse.osgi.service.environment.Constants.OS_MACOSX)) { - return "../MacOS/" + name; + return "../MacOS/" + name; //$NON-NLS-1$ } return name; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/WhatIsRunning.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/WhatIsRunning.java index bfafdd8d9..884df1997 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/WhatIsRunning.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/WhatIsRunning.java @@ -22,7 +22,7 @@ public class WhatIsRunning { return getFrameworkManipulator().getConfigData().getBundles(); } - private Manipulator getFrameworkManipulator() { + private static Manipulator getFrameworkManipulator() { FrameworkAdmin fwAdmin = LazyManipulator.getFrameworkAdmin(); if (fwAdmin != null) return fwAdmin.getRunningManipulator(); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java index f324b3e80..d65fcf9b6 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddJVMArgumentAction.java @@ -25,13 +25,15 @@ import org.eclipse.osgi.util.NLS; public class AddJVMArgumentAction extends ProvisioningAction { public static final String ID = "addJvmArg"; //$NON-NLS-1$ - protected static final String STORAGE = "org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions" + File.separator + "jvmargs"; //$NON-NLS-1$//$NON-NLS-2$ + protected static final String STORAGE = "org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions" //$NON-NLS-1$ + + File.separator + "jvmargs"; //$NON-NLS-1$ protected static final String XMX = "-Xmx"; //$NON-NLS-1$ protected static final String XMS = "-Xms"; //$NON-NLS-1$ protected static final String XX_MAX_PERM_SIZE = "-XX:MaxPermSize="; //$NON-NLS-1$ protected static final String PREFIX_USER_VALUE = "eclipse.userDefined:"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG); if (jvmArg == null) @@ -39,6 +41,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { return addArg(jvmArg, parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG); if (jvmArg == null) @@ -51,7 +54,8 @@ public class AddJVMArgumentAction extends ProvisioningAction { } protected static IStatus addArg(String arg, Map<String, Object> parameters) { - LauncherData launcherData = ((Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR)).getLauncherData(); + LauncherData launcherData = ((Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR)) + .getLauncherData(); File storageArea = (File) parameters.get(ActionConstants.PARM_PROFILE_DATA_DIRECTORY); try { if (arg.startsWith(XMS)) @@ -71,7 +75,8 @@ public class AddJVMArgumentAction extends ProvisioningAction { return Status.OK_STATUS; } - protected static void addByteArg(String arg, String flag, LauncherData launcherData, File storageArea) throws IOException { + protected static void addByteArg(String arg, String flag, LauncherData launcherData, File storageArea) + throws IOException { Properties storedValues = load(storageArea); String currentArg = getCurrentArg(flag, launcherData.getJvmArgs()); @@ -87,7 +92,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { save(storedValues, storageArea); } - // Throws exception if the argument is not a valid byte argument + // Throws exception if the argument is not a valid byte argument protected static void validateValue(String arg) { getByteValue(arg, getBytePower(arg)); } @@ -100,7 +105,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { // User has removed value from file setUserArg(storedValues, flag, null); else if (maxValue == null || !maxValue.equals(currentValue.substring(flag.length()))) - // User has set an initial value, or modified the file + // User has set an initial value, or modified the file setUserArg(storedValues, flag, currentValue.substring(flag.length())); } @@ -132,7 +137,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { } } - // Returns: 1 when a>b, 0 when a=b, -1 when a<b + // Returns: 1 when a>b, 0 when a=b, -1 when a<b protected static int compareSize(String a, String b) { double aVal, bVal; int aPower = getBytePower(a); @@ -140,7 +145,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { aVal = getByteValue(a, aPower); bVal = getByteValue(b, bPower); - // Ensure a value is expressed with the highest power (e.g. 2G not 2048M) + // Ensure a value is expressed with the highest power (e.g. 2G not 2048M) while (aVal > 1024) { aVal /= 1024; aPower += 10; @@ -154,7 +159,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { return 1; else if (aPower < bPower && bVal != 0) return -1; - // Both have same power, so direct comparison + // Both have same power, so direct comparison else if (aVal > bVal) return 1; else if (aVal < bVal) @@ -175,24 +180,24 @@ public class AddJVMArgumentAction extends ProvisioningAction { } private static int getBytePower(String arg) { - // If last digit determines if the value is in bytes, - // kilobytes, megabytes, or gigabytes + // If last digit determines if the value is in bytes, + // kilobytes, megabytes, or gigabytes switch (arg.charAt(arg.length() - 1)) { - case 'k' : - case 'K' : - return 10; - case 'm' : - case 'M' : - return 20; - case 'g' : - case 'G' : - return 30; - default : - return 0; + case 'k': + case 'K': + return 10; + case 'm': + case 'M': + return 20; + case 'g': + case 'G': + return 30; + default: + return 0; } } - // Get the current used argument if there is one + // Get the current used argument if there is one protected static String getCurrentArg(String flag, String[] jvmArgs) { for (int i = 0; i < jvmArgs.length; i++) if (jvmArgs[i] != null && jvmArgs[i].startsWith(flag)) @@ -271,7 +276,7 @@ public class AddJVMArgumentAction extends ProvisioningAction { FileOutputStream out = null; File file = new File(storageArea, STORAGE); if (!file.exists()) - // Ensure parent directory exists + // Ensure parent directory exists file.getParentFile().mkdirs(); try { diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java index 08ca6dbe5..158abf075 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java @@ -24,6 +24,7 @@ import org.eclipse.osgi.util.NLS; public class AddProgramArgumentAction extends ProvisioningAction { public static final String ID = "addProgramArg"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG); @@ -57,6 +58,7 @@ public class AddProgramArgumentAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramPropertyAction.java index 30a597086..dc628f87b 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramPropertyAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramPropertyAction.java @@ -45,6 +45,7 @@ public class AddProgramPropertyAction extends ProvisioningAction { return buffer.toString(); } + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); @@ -75,6 +76,7 @@ public class AddProgramPropertyAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java index 2b5a6bc56..14b391a8d 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java @@ -27,6 +27,7 @@ import org.eclipse.equinox.p2.engine.IProfileRegistry; public class AddRepositoryAction extends RepositoryAction { public static final String ID = "addRepository"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { try { IProvisioningAgent agent = getAgent(parameters); @@ -52,6 +53,7 @@ public class AddRepositoryAction extends RepositoryAction { return ID; } + @Override public IStatus undo(Map<String, Object> parameters) { try { IProvisioningAgent agent = getAgent(parameters); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java index 679a0a2f2..2e09d9790 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddSourceBundleAction.java @@ -30,10 +30,12 @@ import org.eclipse.osgi.util.NLS; public class AddSourceBundleAction extends ProvisioningAction { public static final String ID = "addSourceBundle"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { return AddSourceBundleAction.addSourceBundle(parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { return RemoveSourceBundleAction.removeSourceBundle(parameters); } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java index 0860dd56f..201535517 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CheckTrustAction.java @@ -36,6 +36,7 @@ public class CheckTrustAction extends ProvisioningAction { public static final String ID = "checkTrust"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); if (iu == null) @@ -58,6 +59,7 @@ public class CheckTrustAction extends ProvisioningAction { return null; } + @Override public IStatus undo(Map<String, Object> parameters) { return Status.OK_STATUS; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java index bdd2abf00..a7186cf0b 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java @@ -29,10 +29,12 @@ public class ChmodAction extends ProvisioningAction { private static final String ACTION_CHMOD = "chmod"; //$NON-NLS-1$ private static final boolean WINDOWS = java.io.File.separatorChar == '\\'; + @Override public IStatus execute(Map<String, Object> parameters) { String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR); if (targetDir == null) - return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_DIR, ACTION_CHMOD)); + return Util + .createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_DIR, ACTION_CHMOD)); if (targetDir.equals(ActionConstants.PARM_AT_ARTIFACT)) { try { targetDir = Util.resolveArtifactParam(parameters); @@ -48,16 +50,19 @@ public class ChmodAction extends ProvisioningAction { String targetFile = (String) parameters.get(ActionConstants.PARM_TARGET_FILE); if (targetFile == null) - return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_FILE, ACTION_CHMOD)); + return Util + .createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_FILE, ACTION_CHMOD)); String permissions = (String) parameters.get(ActionConstants.PARM_PERMISSIONS); if (permissions == null) - return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PERMISSIONS, ACTION_CHMOD)); + return Util + .createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PERMISSIONS, ACTION_CHMOD)); String optionsString = (String) parameters.get(ActionConstants.PARM_OPTIONS); // Check that file exist File probe = new File(targetDir + IPath.SEPARATOR + targetFile); if (!probe.exists()) - return Util.createError(NLS.bind(Messages.action_0_failed_file_1_doesNotExist, ACTION_CHMOD, probe.toString())); + return Util.createError( + NLS.bind(Messages.action_0_failed_file_1_doesNotExist, ACTION_CHMOD, probe.toString())); String options[] = null; if (optionsString != null) { @@ -83,8 +88,9 @@ public class ChmodAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { - //TODO: implement undo ?? + // TODO: implement undo ?? return Status.OK_STATUS; } @@ -117,7 +123,7 @@ public class ChmodAction extends ProvisioningAction { } } - private void readOffStream(InputStream inputStream) { + private static void readOffStream(InputStream inputStream) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); try { while (reader.readLine() != null) { diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java index 279addd8b..7cb5074ad 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/CollectAction.java @@ -29,6 +29,7 @@ public class CollectAction extends ProvisioningAction { public static final String ID = "collect"; //$NON-NLS-1$ public static final String ARTIFACT_FOLDER = "artifact.folder"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT); IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); @@ -41,11 +42,13 @@ public class CollectAction extends ProvisioningAction { } @SuppressWarnings("unchecked") - Collection<IArtifactRequest[]> artifactRequests = (Collection<IArtifactRequest[]>) parameters.get(ActionConstants.PARM_ARTIFACT_REQUESTS); + Collection<IArtifactRequest[]> artifactRequests = (Collection<IArtifactRequest[]>) parameters + .get(ActionConstants.PARM_ARTIFACT_REQUESTS); artifactRequests.add(requests); return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { // nothing to do for now return Status.OK_STATUS; @@ -71,7 +74,8 @@ public class CollectAction extends ProvisioningAction { } // TODO: Here we may want to consult multiple caches - static IArtifactRequest[] collect(IProvisioningAgent agent, IProfile profile, IInstallableUnit installableUnit) throws ProvisionException { + static IArtifactRequest[] collect(IProvisioningAgent agent, IProfile profile, IInstallableUnit installableUnit) + throws ProvisionException { Collection<IArtifactKey> toDownload = installableUnit.getArtifacts(); if (toDownload == null || toDownload.size() == 0) return IArtifactRepositoryManager.NO_ARTIFACT_REQUEST; @@ -81,11 +85,13 @@ public class CollectAction extends ProvisioningAction { if (bundlePool == null) throw new ProvisionException(Util.createError(NLS.bind(Messages.no_bundle_pool, profile.getProfileId()))); - List<IArtifactRequest> requests = new ArrayList<IArtifactRequest>(); + List<IArtifactRequest> requests = new ArrayList<>(); for (IArtifactKey key : toDownload) { if (!aggregatedRepositoryView.contains(key)) { - Map<String, String> repositoryProperties = CollectAction.createArtifactDescriptorProperties(installableUnit); - requests.add(Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, bundlePool, null, repositoryProperties, profile.getProperty(IProfile.PROP_STATS_PARAMETERS))); + Map<String, String> repositoryProperties = CollectAction + .createArtifactDescriptorProperties(installableUnit); + requests.add(Util.getArtifactRepositoryManager(agent).createMirrorRequest(key, bundlePool, null, + repositoryProperties, profile.getProperty(IProfile.PROP_STATS_PARAMETERS))); } } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java index 9aab8d648..f105de603 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallBundleAction.java @@ -33,10 +33,12 @@ import org.eclipse.osgi.util.NLS; public class InstallBundleAction extends ProvisioningAction { public static final String ID = "installBundle"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { return InstallBundleAction.installBundle(parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { return UninstallBundleAction.uninstallBundle(parameters); } @@ -50,7 +52,7 @@ public class InstallBundleAction extends ProvisioningAction { if (bundleId == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID)); - //TODO: eventually remove this. What is a fragment doing here?? + // TODO: eventually remove this. What is a fragment doing here?? if (QueryUtil.isFragment(iu)) { System.out.println("What is a fragment doing here!!! -- " + iu); //$NON-NLS-1$ return Status.OK_STATUS; diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java index d8b39566f..81f5e291b 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/InstallFeatureAction.java @@ -32,17 +32,20 @@ public class InstallFeatureAction extends ProvisioningAction { private static final String UPDATE_FEATURE_PLUGIN_PROP = "org.eclipse.update.feature.plugin"; //$NON-NLS-1$ private static final String UPDATE_FEATURE_PRIMARY_PROP = "org.eclipse.update.feature.primary"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { return InstallFeatureAction.installFeature(parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { return UninstallFeatureAction.uninstallFeature(parameters); } public static IStatus installFeature(Map<String, Object> parameters) { IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); - PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION); + PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters + .get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION); String feature = (String) parameters.get(ActionConstants.PARM_FEATURE); String featureId = (String) parameters.get(ActionConstants.PARM_FEATURE_ID); String featureVersion = (String) parameters.get(ActionConstants.PARM_FEATURE_VERSION); @@ -80,8 +83,10 @@ public class InstallFeatureAction extends ProvisioningAction { String pluginId = iu.getProperty(UPDATE_FEATURE_PLUGIN_PROP); boolean isPrimary = Boolean.parseBoolean(iu.getProperty(UPDATE_FEATURE_PRIMARY_PROP)); String application = iu.getProperty(UPDATE_FEATURE_APPLICATION_PROP); - // TODO this isn't right... but we will leave it for now because we don't actually use the value in the install + // TODO this isn't right... but we will leave it for now because we don't + // actually use the value in the install String pluginVersion = artifactKey.getVersion().toString(); - return configuration.addFeatureEntry(file, featureId, featureVersion, pluginId, pluginVersion, isPrimary, application, /*root*/null, iu.getProperty(Site.PROP_LINK_FILE)); + return configuration.addFeatureEntry(file, featureId, featureVersion, pluginId, pluginVersion, isPrimary, + application, /* root */null, iu.getProperty(Site.PROP_LINK_FILE)); } } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java index 9c34f2511..1ea9bc70e 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java @@ -26,6 +26,7 @@ public class LinkAction extends ProvisioningAction { public static final String ID = "ln"; //$NON-NLS-1$ private static final boolean WINDOWS = java.io.File.separatorChar == '\\'; + @Override public IStatus execute(Map<String, Object> parameters) { String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR); if (targetDir == null) @@ -57,26 +58,29 @@ public class LinkAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { return null; } /** - * Creates a link to the source file linkTarget - the created link is targetDir/linkName. - * TODO: Only runs on systems with a "ln -s" command supported. - * TODO: Does not report errors if the "ln -s" fails - * @param targetDir the directory where the link is created + * Creates a link to the source file linkTarget - the created link is + * targetDir/linkName. TODO: Only runs on systems with a "ln -s" command + * supported. TODO: Does not report errors if the "ln -s" fails + * + * @param targetDir the directory where the link is created * @param linkTarget the source - * @param linkName the name of the created link - * @param force if overwrite of existing file should be performed. + * @param linkName the name of the created link + * @param force if overwrite of existing file should be performed. */ - private void ln(String targetDir, String linkTarget, String linkName, boolean force) { + private static void ln(String targetDir, String linkTarget, String linkName, boolean force) { if (WINDOWS) return; Runtime r = Runtime.getRuntime(); try { - Process process = r.exec(new String[] {"ln", "-s" + (force ? "f" : ""), linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + Process process = r.exec(new String[] { "ln", "-s" + (force ? "f" : ""), linkTarget, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + targetDir + IPath.SEPARATOR + linkName }); readOffStream(process.getErrorStream()); readOffStream(process.getInputStream()); try { @@ -90,7 +94,7 @@ public class LinkAction extends ProvisioningAction { } } - private void readOffStream(InputStream inputStream) { + private static void readOffStream(InputStream inputStream) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); try { while (reader.readLine() != null) { diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java index 5f805f8af..cc940ad82 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java @@ -27,6 +27,7 @@ import org.eclipse.osgi.util.NLS; public class MarkStartedAction extends ProvisioningAction { public static final String ID = "markStarted"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); @@ -35,7 +36,8 @@ public class MarkStartedAction extends ProvisioningAction { return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_STARTED, ID)); } - // Changes to this object will be reflected in the backing runtime configuration store + // Changes to this object will be reflected in the backing runtime configuration + // store BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu); if (bundleInfo == null) { return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu)); @@ -51,6 +53,7 @@ public class MarkStartedAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Boolean previousStarted = (Boolean) getMemento().get(ActionConstants.PARM_PREVIOUS_STARTED); if (previousStarted == null) { @@ -60,7 +63,8 @@ public class MarkStartedAction extends ProvisioningAction { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); - // Changes to this object will be reflected in the backing runtime configuration store + // Changes to this object will be reflected in the backing runtime configuration + // store BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu); if (bundleInfo == null) { return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu)); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java index bc733872b..b7c987924 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveJVMArgumentAction.java @@ -28,6 +28,7 @@ import org.eclipse.osgi.util.NLS; public class RemoveJVMArgumentAction extends ProvisioningAction { public static final String ID = "removeJvmArg"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG); if (jvmArg == null) @@ -36,6 +37,7 @@ public class RemoveJVMArgumentAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM_ARG); if (jvmArg == null) @@ -45,7 +47,8 @@ public class RemoveJVMArgumentAction extends ProvisioningAction { } public static IStatus removeArg(String arg, Map<String, Object> parameters) { - LauncherData launcherData = ((Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR)).getLauncherData(); + LauncherData launcherData = ((Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR)) + .getLauncherData(); File storageArea = (File) parameters.get(ActionConstants.PARM_PROFILE_DATA_DIRECTORY); try { @@ -66,7 +69,8 @@ public class RemoveJVMArgumentAction extends ProvisioningAction { return Status.OK_STATUS; } - private static void removeByteArg(String arg, String flag, LauncherData launcherData, File storageArea) throws IOException { + private static void removeByteArg(String arg, String flag, LauncherData launcherData, File storageArea) + throws IOException { Properties storedValues = AddJVMArgumentAction.load(storageArea); String argValue = arg.substring(flag.length()); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java index 7e4824dac..923eafad8 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java @@ -26,6 +26,7 @@ public class RemoveProgramArgumentAction extends ProvisioningAction { public static final String ID = "removeProgramArg"; //$NON-NLS-1$ public static final String EMPTY_ARGUMENT = ""; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG); @@ -51,6 +52,7 @@ public class RemoveProgramArgumentAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String programArg = (String) parameters.get(ActionConstants.PARM_PROGRAM_ARG); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramPropertyAction.java index ae46ce101..19410bbe7 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramPropertyAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramPropertyAction.java @@ -27,6 +27,7 @@ import org.eclipse.osgi.util.NLS; public class RemoveProgramPropertyAction extends ProvisioningAction { public static final String ID = "removeProgramProperty"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); @@ -57,6 +58,7 @@ public class RemoveProgramPropertyAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java index d0ba4bea2..c1811578f 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java @@ -27,6 +27,7 @@ import org.eclipse.equinox.p2.engine.IProfileRegistry; public class RemoveRepositoryAction extends RepositoryAction { public static final String ID = "removeRepository"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { try { IProvisioningAgent agent = getAgent(parameters); @@ -47,6 +48,7 @@ public class RemoveRepositoryAction extends RepositoryAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { try { IProvisioningAgent agent = getAgent(parameters); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java index 4eccc230e..d2fcda0f1 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveSourceBundleAction.java @@ -30,10 +30,12 @@ import org.eclipse.osgi.util.NLS; public class RemoveSourceBundleAction extends ProvisioningAction { public static final String ID = "removeSourceBundle"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { return RemoveSourceBundleAction.removeSourceBundle(parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { return AddSourceBundleAction.addSourceBundle(parameters); } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java index 0b6868dae..2532dc4f0 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java @@ -260,7 +260,7 @@ abstract class RepositoryAction extends ProvisioningAction { /* * Copied from AbstractRepositoryManager */ - private String getKey(URI location) { + private static String getKey(URI location) { String key = location.toString().replace('/', '_'); // remove trailing slash if (key.endsWith("_")) //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetJvmAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetJvmAction.java index 9a682eb1e..1005ac00c 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetJvmAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetJvmAction.java @@ -33,6 +33,7 @@ import org.eclipse.osgi.util.NLS; public class SetJvmAction extends ProvisioningAction { public static final String ID = "setJvm"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM); if (jvmArg == null) @@ -47,6 +48,7 @@ public class SetJvmAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { String jvmArg = (String) parameters.get(ActionConstants.PARM_JVM); if (jvmArg == null) diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java index 2e74c6bc6..ce6f5878b 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java @@ -27,15 +27,18 @@ import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; public class SetLauncherNameAction extends ProvisioningAction { public static final String ID = "setLauncherName"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); - getMemento().put(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME)); + getMemento().put(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, + profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME)); String launcherName = (String) parameters.get(ActionConstants.PARM_LAUNCHERNAME); setLauncher(manipulator, profile, launcherName); return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); @@ -45,7 +48,8 @@ public class SetLauncherNameAction extends ProvisioningAction { } private static void setLauncher(Manipulator manipulator, IProfile profile, String launcherName) { - //Get the launcherData before changing the name so we don't lose anything from the old launcher.ini + // Get the launcherData before changing the name so we don't lose anything from + // the old launcher.ini LauncherData launcherData = manipulator.getLauncherData(); if (launcherName != null) ((Profile) profile).setProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, launcherName); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java index 0630090cc..a24e1672f 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetProgramPropertyAction.java @@ -24,6 +24,7 @@ import org.eclipse.osgi.util.NLS; public class SetProgramPropertyAction extends ProvisioningAction { public static final String ID = "setProgramProperty"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); @@ -43,6 +44,7 @@ public class SetProgramPropertyAction extends ProvisioningAction { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); String propName = (String) parameters.get(ActionConstants.PARM_PROP_NAME); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java index 787ee678f..9efb50802 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java @@ -27,6 +27,7 @@ import org.eclipse.osgi.util.NLS; public class SetStartLevelAction extends ProvisioningAction { public static final String ID = "setStartLevel"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); @@ -35,7 +36,8 @@ public class SetStartLevelAction extends ProvisioningAction { return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_START_LEVEL, ID)); } - // Changes to this object will be reflected in the backing runtime configuration store + // Changes to this object will be reflected in the backing runtime configuration + // store BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu); if (bundleInfo == null) { return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu)); @@ -51,10 +53,12 @@ public class SetStartLevelAction extends ProvisioningAction { bundleInfo.setStartLevel(Integer.parseInt(startLevel)); return Status.OK_STATUS; } catch (NumberFormatException e) { - return Util.createError(NLS.bind(Messages.error_parsing_startlevel, startLevel, bundleInfo.getSymbolicName()), e); + return Util.createError( + NLS.bind(Messages.error_parsing_startlevel, startLevel, bundleInfo.getSymbolicName()), e); } } + @Override public IStatus undo(Map<String, Object> parameters) { Integer previousStartLevel = (Integer) getMemento().get(ActionConstants.PARM_PREVIOUS_START_LEVEL); if (previousStartLevel == null) { @@ -63,7 +67,8 @@ public class SetStartLevelAction extends ProvisioningAction { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); - // Changes to this object will be reflected in the backing runtime configuration store + // Changes to this object will be reflected in the backing runtime configuration + // store BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu); if (bundleInfo == null) { return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu)); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java index 869d76750..cbd1ea1fa 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallBundleAction.java @@ -28,10 +28,12 @@ import org.eclipse.osgi.util.NLS; public class UninstallBundleAction extends ProvisioningAction { public static final String ID = "uninstallBundle"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { return UninstallBundleAction.uninstallBundle(parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { return InstallBundleAction.installBundle(parameters); } @@ -44,13 +46,14 @@ public class UninstallBundleAction extends ProvisioningAction { return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_BUNDLE, ID)); } - //TODO: eventually remove this. What is a fragment doing here?? + // TODO: eventually remove this. What is a fragment doing here?? if (QueryUtil.isFragment(iu)) { System.out.println("What is a fragment doing here!!! -- " + iu); //$NON-NLS-1$ return Status.OK_STATUS; } - // Changes to this object will be reflected in the backing runtime configuration store + // Changes to this object will be reflected in the backing runtime configuration + // store BundleInfo bundleInfo = Util.findBundleInfo(manipulator.getConfigData(), iu); if (bundleInfo == null) { return Util.createWarning(NLS.bind(Messages.failed_find_bundleinfo, iu)); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java index 152e2ddd3..127f3f1b7 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/UninstallFeatureAction.java @@ -25,17 +25,20 @@ import org.eclipse.osgi.util.NLS; public class UninstallFeatureAction extends ProvisioningAction { public static final String ID = "uninstallFeature"; //$NON-NLS-1$ + @Override public IStatus execute(Map<String, Object> parameters) { return UninstallFeatureAction.uninstallFeature(parameters); } + @Override public IStatus undo(Map<String, Object> parameters) { return InstallFeatureAction.installFeature(parameters); } public static IStatus uninstallFeature(Map<String, Object> parameters) { IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); - PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters.get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION); + PlatformConfigurationWrapper configuration = (PlatformConfigurationWrapper) parameters + .get(EclipseTouchpoint.PARM_PLATFORM_CONFIGURATION); String feature = (String) parameters.get(ActionConstants.PARM_FEATURE); String featureId = (String) parameters.get(ActionConstants.PARM_FEATURE_ID); String featureVersion = (String) parameters.get(ActionConstants.PARM_FEATURE_VERSION); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java index 09ec40422..f8dc9de3e 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationCache.java @@ -23,7 +23,7 @@ import java.util.Map; * */ public class ConfigurationCache { - private static Map<String, CacheEntry> cache = new HashMap<String, CacheEntry>(); + private static Map<String, CacheEntry> cache = new HashMap<>(); // class used to represent cache values static class CacheEntry { @@ -43,9 +43,9 @@ public class ConfigurationCache { } /* - * Return the configuration object in the cache which is represented - * by the given file. Do a check on disk to see if the cache is up-to-date. - * If not, then treat it as a cache miss. + * Return the configuration object in the cache which is represented by the + * given file. Do a check on disk to see if the cache is up-to-date. If not, + * then treat it as a cache miss. */ public static Configuration get(File file) { String key = toKey(file); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java index de0ccdd28..c1c5c0542 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/ConfigurationParser.java @@ -26,7 +26,7 @@ import org.w3c.dom.*; import org.xml.sax.SAXException; /** - * Parser for platform.xml files. + * Parser for platform.xml files. * * @since 1.0 */ @@ -35,8 +35,8 @@ public class ConfigurationParser implements ConfigurationConstants { private URL osgiInstallArea; /* - * Parse the given file handle which points to a platform.xml file and a configuration object. - * Returns null if the file doesn't exist. + * Parse the given file handle which points to a platform.xml file and a + * configuration object. Returns null if the file doesn't exist. */ static Configuration parse(File file, URL osgiInstallArea) throws ProvisionException { return new ConfigurationParser(osgiInstallArea).internalParse(file); @@ -47,10 +47,9 @@ public class ConfigurationParser implements ConfigurationConstants { } /* - * Create a feature object based on the given DOM node. - * Return the new feature. + * Create a feature object based on the given DOM node. Return the new feature. */ - private Feature createFeature(Node node, Site site) { + private static Feature createFeature(Node node, Site site) { Feature result = new Feature(site); String id = getAttribute(node, ATTRIBUTE_ID); if (id != null) @@ -102,7 +101,7 @@ public class ConfigurationParser implements ConfigurationConstants { /* * Create the features from the given DOM node. */ - private void createFeatures(Node node, Site site) { + private static void createFeatures(Node node, Site site) { NodeList children = node.getChildNodes(); int size = children.getLength(); for (int i = 0; i < size; i++) { @@ -154,11 +153,10 @@ public class ConfigurationParser implements ConfigurationConstants { } /* - * Convert the given url string to an absolute url. If the string is - * platform:/base/ then return a string which represents the osgi - * install area. + * Convert the given url string to an absolute url. If the string is + * platform:/base/ then return a string which represents the osgi install area. */ - private URI getLocation(URI location, URI osgiArea) { + private static URI getLocation(URI location, URI osgiArea) { if (osgiArea == null) return location; if (PLATFORM_BASE.equals(location.toString())) @@ -167,10 +165,9 @@ public class ConfigurationParser implements ConfigurationConstants { } /* - * Return the attribute with the given name, or null if it does - * not exist. + * Return the attribute with the given name, or null if it does not exist. */ - private String getAttribute(Node node, String name) { + private static String getAttribute(Node node, String name) { NamedNodeMap attributes = node.getAttributes(); Node temp = attributes.getNamedItem(name); return temp == null ? null : temp.getNodeValue(); @@ -179,7 +176,7 @@ public class ConfigurationParser implements ConfigurationConstants { /* * Load the given file into a DOM document. */ - private Document load(InputStream input) throws ParserConfigurationException, IOException, SAXException { + private static Document load(InputStream input) throws ParserConfigurationException, IOException, SAXException { // load the feature xml DocumentBuilderFactory factory = SecureXMLUtil.newSecureDocumentBuilderFactory(); DocumentBuilder builder = factory.newDocumentBuilder(); @@ -197,8 +194,8 @@ public class ConfigurationParser implements ConfigurationConstants { } /* - * Parse the given file handle which points to a platform.xml file and a configuration object. - * Returns null if the file doesn't exist. + * Parse the given file handle which points to a platform.xml file and a + * configuration object. Returns null if the file doesn't exist. */ private Configuration internalParse(File file) throws ProvisionException { if (!file.exists()) { @@ -227,8 +224,7 @@ public class ConfigurationParser implements ConfigurationConstants { } /* - * Process the given DOM document and create the appropriate - * site objects. + * Process the given DOM document and create the appropriate site objects. */ private Configuration process(Document document) { Node node = getConfigElement(document); @@ -250,7 +246,7 @@ public class ConfigurationParser implements ConfigurationConstants { return configuration; } - private Configuration createConfiguration(Node node) { + private static Configuration createConfiguration(Node node) { Configuration result = new Configuration(); String value = getAttribute(node, ATTRIBUTE_DATE); if (value != null) @@ -267,7 +263,7 @@ public class ConfigurationParser implements ConfigurationConstants { return result; } - private Node getConfigElement(Document doc) { + private static Node getConfigElement(Document doc) { NodeList children = doc.getChildNodes(); int size = children.getLength(); for (int i = 0; i < size; i++) { diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java index 82abd4668..942c6bc4d 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java @@ -122,7 +122,7 @@ public class Feature { return true; } - private boolean equals(Object one, Object two) { + private static boolean equals(Object one, Object two) { return one == null ? two == null : one.equals(two); } |