diff options
author | Alexander Kurtakov | 2017-10-07 07:16:13 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-10-07 07:16:13 +0000 |
commit | 00c74b1e3292ff23717af783bd80356a225f4142 (patch) | |
tree | b5785c6f560fa051ce4fbc45c9c1864616682f23 /bundles/org.eclipse.equinox.p2.installer | |
parent | f3e69385e0ea86276610a8cbc1bb87d0fb266803 (diff) | |
download | rt.equinox.p2-00c74b1e3292ff23717af783bd80356a225f4142.tar.gz rt.equinox.p2-00c74b1e3292ff23717af783bd80356a225f4142.tar.xz rt.equinox.p2-00c74b1e3292ff23717af783bd80356a225f4142.zip |
Bug 525707 - Move installer bundle to Java 8
* Bump BREE.
* Bump minor version.
* Lambda conversions.
* Remove redundant type arguments.
* Add missing Override annotations.
Change-Id: Ie3a89c592bf41fee9f37a1ed8b2c34f4fe2b4fc5
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.installer')
13 files changed, 119 insertions, 115 deletions
diff --git a/bundles/org.eclipse.equinox.p2.installer/.classpath b/bundles/org.eclipse.equinox.p2.installer/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/bundles/org.eclipse.equinox.p2.installer/.classpath +++ b/bundles/org.eclipse.equinox.p2.installer/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs index 31e8a9c97..ebb3412f8 100644 --- a/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs @@ -10,18 +10,23 @@ 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.5 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.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 @@ -33,7 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=warning 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.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning @@ -50,7 +55,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.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 @@ -59,7 +64,7 @@ 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 @@ -67,20 +72,22 @@ 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=ignore 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=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=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=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled @@ -89,12 +96,16 @@ 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 @@ -102,6 +113,7 @@ 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 @@ -114,7 +126,7 @@ 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.5 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF index e69b784e5..a709ddbc6 100644 --- a/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.installer;singleton:=true Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-Version: 1.0.500.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.installer.InstallerActivator Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.osgi;bundle-version="[3.7.0,4.0.0)", @@ -20,7 +20,7 @@ Require-Bundle: org.eclipse.osgi;bundle-version="[3.7.0,4.0.0)", org.eclipse.core.net;bundle-version="1.1.0", org.eclipse.equinox.p2.repository;bundle-version="2.1.0", org.eclipse.equinox.p2.transport.ecf;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.eclipse.equinox.internal.p2.installer;x-internal:=true, org.eclipse.equinox.internal.p2.installer.ui;x-internal:=true, org.eclipse.equinox.internal.provisional.p2.installer;x-internal:=true diff --git a/bundles/org.eclipse.equinox.p2.installer/pom.xml b/bundles/org.eclipse.equinox.p2.installer/pom.xml index 69685c577..c4d1fc44d 100644 --- a/bundles/org.eclipse.equinox.p2.installer/pom.xml +++ b/bundles/org.eclipse.equinox.p2.installer/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.installer</artifactId> - <version>1.0.500-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/HeadlessInstallAdvisor.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/HeadlessInstallAdvisor.java index d34d10caf..0288a5cc3 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/HeadlessInstallAdvisor.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/HeadlessInstallAdvisor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,60 +21,74 @@ public class HeadlessInstallAdvisor extends InstallAdvisor { class HeadlessProgressMonitor implements IProgressMonitor { private boolean canceled; + @Override public void beginTask(String name, int totalWork) { setResult(new Status(IStatus.INFO, InstallerActivator.PI_INSTALLER, name)); } + @Override public void done() { //nothing to do } + @Override public void internalWorked(double work) { //nothing to do } + @Override public boolean isCanceled() { return canceled; } + @Override public void setCanceled(boolean value) { canceled = value; } + @Override public void setTaskName(String name) { setResult(new Status(IStatus.INFO, InstallerActivator.PI_INSTALLER, name)); } + @Override public void subTask(String name) { //nothing to do } + @Override public void worked(int work) { //nothing to do } } + @Override public IStatus performInstall(IInstallOperation operation) { return operation.install(new HeadlessProgressMonitor()); } + @Override public InstallDescription prepareInstallDescription(InstallDescription description) { // The headless advisor has no further input on the install location. return description; } + @Override public boolean promptForLaunch(InstallDescription description) { return false; } + @Override public void setResult(IStatus status) { LogHelper.log(status); } + @Override public void start() { //nothing to do } + @Override public void stop() { //nothing to do } diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java index 11e1936dd..811c42a2c 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -127,9 +127,7 @@ public class InstallApplication implements IApplication { } } - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) - */ + @Override public Object start(IApplicationContext appContext) { try { appContext.applicationRunning(); @@ -211,9 +209,7 @@ public class InstallApplication implements IApplication { } } - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#stop() - */ + @Override public void stop() { //note this method can be called from another thread InstallAdvisor tempContext = advisor; diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java index 938e41dfc..b80009593 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -140,7 +140,7 @@ public class InstallDescriptionParser { String rootSpec = properties.get(PROP_ROOTS); if (rootSpec != null) { String[] rootList = getArrayFromString(rootSpec, ","); //$NON-NLS-1$ - ArrayList<IVersionedId> roots = new ArrayList<IVersionedId>(rootList.length); + ArrayList<IVersionedId> roots = new ArrayList<>(rootList.length); for (int i = 0; i < rootList.length; i++) { try { roots.add(VersionedId.parse(rootList[i])); @@ -163,7 +163,7 @@ public class InstallDescriptionParser { */ private static void initializeProfileProperties(InstallDescription description, Map<String, String> properties) { //any remaining properties are profile properties - Map<String, String> profileProperties = new HashMap<String, String>(properties); + Map<String, String> profileProperties = new HashMap<>(properties); profileProperties.remove(PROP_PROFILE_NAME); profileProperties.remove(PROP_ARTIFACT_REPOSITORY); profileProperties.remove(PROP_METADATA_REPOSITORY); @@ -185,7 +185,7 @@ public class InstallDescriptionParser { */ private static URI[] getURIs(String spec, URI base) { String[] urlSpecs = getArrayFromString(spec, ","); //$NON-NLS-1$ - ArrayList<URI> result = new ArrayList<URI>(urlSpecs.length); + ArrayList<URI> result = new ArrayList<>(urlSpecs.length); for (int i = 0; i < urlSpecs.length; i++) { try { URI uri = URIUtil.fromString(urlSpecs[i]); @@ -216,7 +216,7 @@ public class InstallDescriptionParser { public static String[] getArrayFromString(String list, String separator) { if (list == null || list.trim().equals("")) //$NON-NLS-1$ return new String[0]; - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); for (StringTokenizer tokens = new StringTokenizer(list, separator); tokens.hasMoreTokens();) { String token = tokens.nextToken().trim(); if (!token.equals("")) //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java index 12d9851aa..f781a420d 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -56,7 +56,7 @@ public class InstallUpdateProductOperation implements IInstallOperation { * Determine what top level installable units should be installed by the director */ private Collection<IInstallableUnit> computeUnitsToInstall() throws CoreException { - ArrayList<IInstallableUnit> units = new ArrayList<IInstallableUnit>(); + ArrayList<IInstallableUnit> units = new ArrayList<>(); IVersionedId roots[] = installDescription.getRoots(); for (int i = 0; i < roots.length; i++) { IVersionedId root = roots[i]; @@ -80,7 +80,7 @@ public class InstallUpdateProductOperation implements IInstallOperation { private IProfile createProfile() throws ProvisionException { IProfile profile = getProfile(); if (profile == null) { - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, installDescription.getInstallLocation().toString()); EnvironmentInfo info = ServiceHelper.getService(InstallerActivator.getDefault().getContext(), EnvironmentInfo.class); String env = "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -198,9 +198,7 @@ public class InstallUpdateProductOperation implements IInstallOperation { return service; } - /* (non-Javadoc) - * @see org.eclipse.equinox.internal.provisional.p2.installer.IInstallOperation#install(org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IStatus install(IProgressMonitor pm) { SubMonitor monitor = SubMonitor.convert(pm, Messages.Op_Preparing, 100); try { diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallerActivator.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallerActivator.java index da6f3ff1e..b9d91a907 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallerActivator.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallerActivator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -48,19 +48,13 @@ public class InstallerActivator implements BundleActivator { return context; } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext aContext) throws Exception { this.context = aContext; plugin = this; } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ + @Override public void stop(BundleContext aContext) throws Exception { plugin = null; } diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/InstallDialog.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/InstallDialog.java index e9c91c256..9f00a4ba2 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/InstallDialog.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/InstallDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,36 +36,43 @@ public class InstallDialog { String subTaskName = ""; //$NON-NLS-1$ double totalWork, usedWork; + @Override public void beginTask(final String name, final int work) { totalWork = work; running = true; update(); } + @Override public void done() { running = false; usedWork = totalWork; update(); } + @Override public void internalWorked(double work) { usedWork = Math.min(usedWork + work, totalWork); update(); } + @Override public boolean isCanceled() { return returnCode == CANCEL; } + @Override public void setCanceled(boolean value) { returnCode = CANCEL; } + @Override public void setTaskName(String name) { subTaskName = name == null ? "" : name; //$NON-NLS-1$ update(); } + @Override public void subTask(String name) { subTaskName = name == null ? "" : name; //$NON-NLS-1$ update(); @@ -76,6 +83,7 @@ public class InstallDialog { if (display == null) return; display.asyncExec(new Runnable() { + @Override public void run() { Shell theShell = getShell(); if (theShell == null || theShell.isDisposed()) @@ -100,6 +108,7 @@ public class InstallDialog { }); } + @Override public void worked(int work) { internalWorked(work); } @@ -224,6 +233,7 @@ public class InstallDialog { okButton.setText(Messages.Dialog_InstallButton); okButton.setEnabled(false); okButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { buttonPressed(OK); } @@ -235,6 +245,7 @@ public class InstallDialog { cancelButton.setText(Messages.Dialog_CancelButton); cancelButton.setEnabled(false); cancelButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { buttonPressed(CANCEL); } @@ -250,11 +261,7 @@ public class InstallDialog { settingsGroup.setLayout(layout); settingsGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); - Listener validateListener = new Listener() { - public void handleEvent(Event event) { - validateInstallSettings(); - } - }; + Listener validateListener = event -> validateInstallSettings(); //The group asking for the product install directory Group installLocationGroup = new Group(settingsGroup, SWT.NONE); @@ -276,6 +283,7 @@ public class InstallDialog { settingsLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); settingsLocation.addListener(SWT.Modify, validateListener); settingsLocation.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent event) { if (event.character == SWT.CR || event.character == SWT.KEYPAD_CR) buttonPressed(OK); @@ -284,11 +292,7 @@ public class InstallDialog { settingsBrowse = new Button(locationFieldGroup, SWT.PUSH); settingsBrowse.setLayoutData(new GridData(BUTTON_WIDTH, SWT.DEFAULT)); settingsBrowse.setText(Messages.Dialog_BrowseButton); - settingsBrowse.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - browsePressed(); - } - }); + settingsBrowse.addListener(SWT.Selection, event -> browsePressed()); //Create the radio button group asking for the kind of install (shared vs. standalone) Group installKindGroup = new Group(settingsGroup, SWT.NONE); @@ -325,35 +329,31 @@ public class InstallDialog { manualProxyTypeCheckBox = new Button(proxySettingsFieldGroup, SWT.CHECK); manualProxyTypeCheckBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - manualProxyTypeCheckBox.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - IProxyService proxies = (IProxyService) InstallApplication.getService(InstallerActivator.getDefault().getContext(), IProxyService.class.getName()); - if (proxies != null) { - //When the manual check box is selected the system properties should be disabled. - //This cases the net component to switch to manual proxy provider. - proxies.setSystemProxiesEnabled(!manualProxyTypeCheckBox.getSelection()); - if (proxySettingsButton != null) { - proxySettingsButton.setEnabled(manualProxyTypeCheckBox.getSelection()); - } - } else { - openMessage(Messages.ProxiesDialog_ServiceNotAvailableMessage, SWT.ICON_ERROR | SWT.OK); + manualProxyTypeCheckBox.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + IProxyService proxies = (IProxyService) InstallApplication.getService(InstallerActivator.getDefault().getContext(), IProxyService.class.getName()); + if (proxies != null) { + //When the manual check box is selected the system properties should be disabled. + //This cases the net component to switch to manual proxy provider. + proxies.setSystemProxiesEnabled(!manualProxyTypeCheckBox.getSelection()); + if (proxySettingsButton != null) { + proxySettingsButton.setEnabled(manualProxyTypeCheckBox.getSelection()); } + } else { + openMessage(Messages.ProxiesDialog_ServiceNotAvailableMessage, SWT.ICON_ERROR | SWT.OK); } - }); + })); manualProxyTypeCheckBox.setText(Messages.Dialog_ManualProxyCheckBox); proxySettingsButton = new Button(proxySettingsFieldGroup, SWT.PUSH); proxySettingsButton.setLayoutData(new GridData(BUTTON_WIDTH, SWT.DEFAULT)); proxySettingsButton.setText(Messages.Dialog_SettingsButton); proxySettingsButton.setEnabled(manualProxyTypeCheckBox.getSelection()); - proxySettingsButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - IProxyService proxies = (IProxyService) InstallApplication.getService(InstallerActivator.getDefault().getContext(), IProxyService.class.getName()); - if (proxies != null) { - ProxiesDialog proxiesDialog = new ProxiesDialog(proxies); - proxiesDialog.open(); - } else { - openMessage(Messages.ProxiesDialog_ServiceNotAvailableMessage, SWT.ICON_ERROR | SWT.OK); - } + proxySettingsButton.addListener(SWT.Selection, event -> { + IProxyService proxies = (IProxyService) InstallApplication.getService(InstallerActivator.getDefault().getContext(), IProxyService.class.getName()); + if (proxies != null) { + ProxiesDialog proxiesDialog = new ProxiesDialog(proxies); + proxiesDialog.open(); + } else { + openMessage(Messages.ProxiesDialog_ServiceNotAvailableMessage, SWT.ICON_ERROR | SWT.OK); } }); @@ -483,6 +483,7 @@ public class InstallDialog { public IStatus run(final IInstallOperation operation) { final Result result = new Result(); Thread thread = new Thread() { + @Override public void run() { try { result.setStatus(operation.install(new Monitor())); @@ -497,10 +498,8 @@ public class InstallDialog { Display display = getDisplay(); //ensure all events from the operation have run if (display != null) { - display.syncExec(new Runnable() { - public void run() { - //do nothing - } + display.syncExec(() -> { + //do nothing }); } result.done(); diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java index 19a2ad4cc..38d7a2a35 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,8 @@ import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; import org.eclipse.equinox.internal.p2.installer.InstallerActivator; import org.eclipse.equinox.internal.p2.installer.Messages; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -107,18 +108,16 @@ public final class ProxiesDialog { typeCombo.add(types.get(i)); } - typeCombo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - String selection = typeCombo.getText(); - IProxyData selectedProxy = service.getProxyData(selection); - if (selectedProxy == null) { - updateStatus(new Status(IStatus.ERROR, InstallerActivator.PI_INSTALLER, IStatus.OK, Messages.ProxiesDialog_UnknownProxyTypeMessage, null)); - } else { - data = selectedProxy; - applyData(); - } + typeCombo.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + String selection = typeCombo.getText(); + IProxyData selectedProxy = service.getProxyData(selection); + if (selectedProxy == null) { + updateStatus(new Status(IStatus.ERROR, InstallerActivator.PI_INSTALLER, IStatus.OK, Messages.ProxiesDialog_UnknownProxyTypeMessage, null)); + } else { + data = selectedProxy; + applyData(); } - }); + })); hostLabel = new Label(composite, SWT.NONE); hostLabel.setText(Messages.ProxiesDialog_HostLabel); @@ -148,11 +147,7 @@ public final class ProxiesDialog { passwordText.setEchoChar('*'); passwordText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 3, 1)); - ModifyListener validationListener = new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateStatus(); - } - }; + ModifyListener validationListener = e -> updateStatus(); typeCombo.addModifyListener(validationListener); hostText.addModifyListener(validationListener); portText.addModifyListener(validationListener); @@ -186,21 +181,15 @@ public final class ProxiesDialog { gridData = new GridData(100, SWT.DEFAULT); okButton.setLayoutData(gridData); okButton.setText(Messages.ProxiesDialog_OkLabel); - okButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - okPressed(); - shell.dispose(); - } - }); + okButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { + okPressed(); + shell.dispose(); + })); cancelButton = new Button(buttonBar, SWT.PUSH); cancelButton.setLayoutData(gridData); cancelButton.setText(Messages.Dialog_CancelButton); - cancelButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - shell.dispose(); - } - }); + cancelButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> shell.dispose())); } public void create() { @@ -306,7 +295,7 @@ public final class ProxiesDialog { } private void initTypes() { - types = new ArrayList<String>(); + types = new ArrayList<>(); types.add(IProxyData.HTTP_PROXY_TYPE); types.add(IProxyData.HTTPS_PROXY_TYPE); types.add(IProxyData.SOCKS_PROXY_TYPE); diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/SWTInstallAdvisor.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/SWTInstallAdvisor.java index 236061516..72f647e24 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/SWTInstallAdvisor.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/SWTInstallAdvisor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,20 +23,24 @@ public class SWTInstallAdvisor extends InstallAdvisor { private boolean started = false; private boolean stopped = false; + @Override public IStatus performInstall(IInstallOperation operation) { return dialog.run(operation); } + @Override public InstallDescription prepareInstallDescription(InstallDescription description) { if (description.getInstallLocation() == null) dialog.promptForLocations(description); return description; } + @Override public boolean promptForLaunch(InstallDescription description) { return dialog.promptForLaunch(description); } + @Override public void setResult(IStatus status) { String message; if (status.getSeverity() == IStatus.CANCEL) { @@ -47,6 +51,7 @@ public class SWTInstallAdvisor extends InstallAdvisor { dialog.promptForClose(message); } + @Override public synchronized void start() { if (stopped || started) return; @@ -58,6 +63,7 @@ public class SWTInstallAdvisor extends InstallAdvisor { dialog.setMessage(Messages.Advisor_Preparing); } + @Override public synchronized void stop() { if (stopped || !started) return; @@ -70,11 +76,7 @@ public class SWTInstallAdvisor extends InstallAdvisor { final Display display = activeDialog.getDisplay(); if (display == null || display.isDisposed()) return; - display.syncExec(new Runnable() { - public void run() { - activeDialog.close(); - } - }); + display.syncExec(() -> activeDialog.close()); display.dispose(); } diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java index 76e45c4e3..b3a544436 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,7 +32,7 @@ public class InstallDescription { private URI[] metadataRepos; private String productName; private IVersionedId[] roots; - private final Map<String, String> profileProperties = new HashMap<String, String>(); + private final Map<String, String> profileProperties = new HashMap<>(); /** * Returns the p2 agent location, or <code>null</code> to indicate |