diff options
author | Alexander Kurtakov | 2017-10-06 19:18:48 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-10-06 19:18:48 +0000 |
commit | f3e69385e0ea86276610a8cbc1bb87d0fb266803 (patch) | |
tree | 390908237f1387ef77f3942e4804e0cfc9a38916 /bundles | |
parent | e1f190e26d95d021be5b22195f96e0971356bff1 (diff) | |
download | rt.equinox.p2-f3e69385e0ea86276610a8cbc1bb87d0fb266803.tar.gz rt.equinox.p2-f3e69385e0ea86276610a8cbc1bb87d0fb266803.tar.xz rt.equinox.p2-f3e69385e0ea86276610a8cbc1bb87d0fb266803.zip |
Bug 525698 - Move ui.sdk.* bundles to Java 8I20171006-2000
* Bump BREE
* Bump minor version
* Update warnings for newer Java versions
* Add missing Override annotations
* Lambda conversion
* Remove redundant type arguments
Change-Id: I112e7295fd80f8132e4d1574c32264c244609f19
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
30 files changed, 371 insertions, 288 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.classpath b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.classpath +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.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.ui.sdk.scheduler/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.settings/org.eclipse.jdt.core.prefs index 449cf187f..cdc9e4eee 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/.settings/org.eclipse.jdt.core.prefs @@ -6,29 +6,46 @@ 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.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 +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=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 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 @@ -36,41 +53,79 @@ 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=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=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.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.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.ui.sdk.scheduler/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF index 7afb732b6..dbf4b892a 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.ui.sdk.scheduler;singleton:=true -Bundle-Version: 1.3.100.qualifier +Bundle-Version: 1.4.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.equinox.p2.updatechecker, org.eclipse.equinox.p2.ui, org.eclipse.equinox.p2.repository;bundle-version="2.3.0" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: com.ibm.icu.util;version="4.0.1", org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml index 8b814df37..e84d801c8 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.sdk.scheduler</artifactId> - <version>1.3.100-SNAPSHOT</version> + <version>1.4.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java index b50b44291..3cc40d76b 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -74,13 +74,7 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin { // constructor } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ + @Override public void start(BundleContext bundleContext) throws Exception { super.start(bundleContext); plugin = this; @@ -91,6 +85,7 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin { PreferenceInitializer.migratePreferences(); } + @Override public void stop(BundleContext bundleContext) throws Exception { if (scheduler != null) { scheduler.shutdown(); @@ -130,10 +125,9 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin { } /* - * Overridden to use a profile scoped preference store. (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() + * Overridden to use a profile scoped preference store. */ + @Override public IPreferenceStore getPreferenceStore() { // Create the preference store lazily. if (preferenceStore == null) { @@ -163,6 +157,7 @@ public class AutomaticUpdatePlugin extends AbstractUIPlugin { } } + @Override protected void initializeImageRegistry(ImageRegistry reg) { createImageDescriptor(IMG_TOOL_UPDATE, reg); createImageDescriptor(IMG_TOOL_UPDATE_PROBLEMS, reg); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java index c01c8c79e..141165a3e 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,6 +67,7 @@ public class AutomaticUpdateScheduler implements IStartup { profileId = IProfileRegistry.SELF; } + @Override public void earlyStartup() { IProvisioningAgent agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); @@ -142,10 +143,12 @@ public class AutomaticUpdateScheduler implements IStartup { // too soon. // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=227582 listener = new IUpdateListener() { + @Override public void updatesAvailable(UpdateEvent event) { AutomaticUpdatePlugin.getDefault().getAutomaticUpdater().updatesAvailable(event); } + @Override public void checkingForUpdates() { AutomaticUpdatePlugin.getDefault().getAutomaticUpdater().checkingForUpdates(); } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java index b18c09590..9dcce0422 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,7 +32,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.*; import org.eclipse.ui.statushandlers.StatusManager; @@ -56,13 +56,11 @@ public class AutomaticUpdater implements IUpdateListener { } private void createProfileListener() { - profileListener = new ProvisioningListener() { - public void notify(EventObject o) { - if (o instanceof IProfileEvent) { - IProfileEvent event = (IProfileEvent) o; - if (event.getReason() == IProfileEvent.CHANGED && sameProfile(event.getProfileId())) { - triggerNewUpdateNotification(); - } + profileListener = o -> { + if (o instanceof IProfileEvent) { + IProfileEvent event = (IProfileEvent) o; + if (event.getReason() == IProfileEvent.CHANGED && sameProfile(event.getProfileId())) { + triggerNewUpdateNotification(); } } }; @@ -85,19 +83,12 @@ public class AutomaticUpdater implements IUpdateListener { return (profileId == another) || (profileId != null && profileId.equals(another)); } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.equinox.internal.provisional.p2.updatechecker.IUpdateListener - * # - * updatesAvailable(org.eclipse.equinox.internal.provisional.p2.updatechecker - * .UpdateEvent) - */ + @Override public void updatesAvailable(UpdateEvent event) { updatesAvailable(event, true); } + @Override public void checkingForUpdates() { new LastAutoCheckForUpdateMemo(AutomaticUpdatePlugin.getDefault().getAgentLocation()).store(Calendar.getInstance().getTime()); } @@ -118,11 +109,7 @@ public class AutomaticUpdater implements IUpdateListener { if (!status.isOK() || operation.getPossibleUpdates() == null || operation.getPossibleUpdates().length == 0) { if (PlatformUI.isWorkbenchRunning()) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - clearUpdateAffordances(); - } - }); + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> clearUpdateAffordances()); } return; } @@ -135,15 +122,12 @@ public class AutomaticUpdater implements IUpdateListener { job.setUser(false); job.setSystem(true); job.addJobChangeListener(new JobChangeAdapter() { + @Override public void done(IJobChangeEvent jobEvent) { IStatus jobStatus = jobEvent.getResult(); if (jobStatus.isOK()) { alreadyDownloaded = true; - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - notifyUserOfUpdates(operation.getResolutionResult().isOK(), notifyWithPopup, showUpdateWizard); - } - }); + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> notifyUserOfUpdates(operation.getResolutionResult().isOK(), notifyWithPopup, showUpdateWizard)); } else if (jobStatus.getSeverity() != IStatus.CANCEL) { StatusManager.getManager().handle(jobStatus, StatusManager.LOG); } @@ -151,11 +135,7 @@ public class AutomaticUpdater implements IUpdateListener { }); job.schedule(); } else { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - notifyUserOfUpdates(operation.getResolutionResult().isOK(), notifyWithPopup, showUpdateWizard); - } - }); + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> notifyUserOfUpdates(operation.getResolutionResult().isOK(), notifyWithPopup, showUpdateWizard)); } } @@ -178,7 +158,7 @@ public class AutomaticUpdater implements IUpdateListener { */ void validateIusToUpdate() { - ArrayList<IInstallableUnit> list = new ArrayList<IInstallableUnit>(iusWithUpdates.size()); + ArrayList<IInstallableUnit> list = new ArrayList<>(iusWithUpdates.size()); IProfile profile = getProfileRegistry().getProfile(profileId); if (profile != null) { @@ -267,11 +247,7 @@ public class AutomaticUpdater implements IUpdateListener { void createUpdateAffordance() { updateAffordance = new StatusLineCLabelContribution(AUTO_UPDATE_STATUS_ITEM, 5); - updateAffordance.addListener(SWT.MouseDown, new Listener() { - public void handleEvent(Event event) { - launchUpdate(); - } - }); + updateAffordance.addListener(SWT.MouseDown, event -> launchUpdate()); IStatusLineManager manager = getStatusLineManager(); if (manager != null) { manager.add(updateAffordance); @@ -350,6 +326,7 @@ public class AutomaticUpdater implements IUpdateListener { */ void triggerNewUpdateNotification() { Job notifyJob = new Job("Update validate job") { //$NON-NLS-1$ + @Override public IStatus run(IProgressMonitor monitor) { if (monitor.isCanceled()) return Status.CANCEL_STATUS; diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPopup.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPopup.java index 1b8acef28..66b2971b4 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPopup.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPopup.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 @@ -60,12 +60,14 @@ public class AutomaticUpdatesPopup extends PopupDialog { this.prefs = prefs; remindDelay = computeRemindDelay(); clickListener = new MouseAdapter() { + @Override public void mouseDown(MouseEvent e) { AutomaticUpdatePlugin.getDefault().getAutomaticUpdater().launchUpdate(); } }; } + @Override protected Control createDialogArea(Composite parent) { dialogArea = new Composite(parent, SWT.NONE); dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH)); @@ -93,6 +95,7 @@ public class AutomaticUpdatesPopup extends PopupDialog { remindLink = new Link(parent, SWT.MULTI | SWT.WRAP | SWT.RIGHT); updateRemindText(); remindLink.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), PreferenceConstants.PREF_PAGE_AUTO_UPDATES, null, null); dialog.open(); @@ -119,16 +122,14 @@ public class AutomaticUpdatesPopup extends PopupDialog { return section; } + @Override public int open() { - prefListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - handlePreferenceChange(event); - } - }; + prefListener = event -> handlePreferenceChange(event); prefs.addPropertyChangeListener(prefListener); return super.open(); } + @Override public boolean close() { return close(true); } @@ -154,6 +155,7 @@ public class AutomaticUpdatesPopup extends PopupDialog { if (remindDelay < 0) return; remindJob = new WorkbenchJob(AutomaticUpdateMessages.AutomaticUpdatesPopup_ReminderJobTitle) { + @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (monitor.isCanceled()) return Status.CANCEL_STATUS; @@ -198,16 +200,13 @@ public class AutomaticUpdatesPopup extends PopupDialog { } } + @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(AutomaticUpdateMessages.AutomaticUpdatesPopup_UpdatesAvailableTitle); } - /** - * (non-Javadoc) - * - * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point) - */ + @Override protected Point getInitialLocation(Point initialSize) { Shell parent = getParentShell(); Point parentSize, parentLocation; @@ -255,6 +254,7 @@ public class AutomaticUpdatesPopup extends PopupDialog { * Overridden so that clicking in the title menu area closes the dialog. * Also creates a close box menu in the title area. */ + @Override protected Control createTitleMenuArea(Composite parent) { Composite titleComposite = (Composite) super.createTitleMenuArea(parent); titleComposite.addMouseListener(clickListener); @@ -266,12 +266,14 @@ public class AutomaticUpdatesPopup extends PopupDialog { closeButton.setImage(AutomaticUpdatePlugin.getDefault().getImageRegistry().get((AutomaticUpdatePlugin.IMG_TOOL_CLOSE))); closeButton.setHotImage(AutomaticUpdatePlugin.getDefault().getImageRegistry().get((AutomaticUpdatePlugin.IMG_TOOL_CLOSE_HOT))); closeButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { close(); } }); // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=177183 toolBar.addMouseListener(new MouseAdapter() { + @Override public void mouseDown(MouseEvent e) { close(); } @@ -285,6 +287,7 @@ public class AutomaticUpdatesPopup extends PopupDialog { * (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#createTitleControl(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createTitleControl(Composite parent) { Control control = super.createTitleControl(parent); Object data = control.getLayoutData(); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPreferencePage.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPreferencePage.java index 516d17f55..b419d774a 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPreferencePage.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatesPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 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 @@ -49,10 +49,12 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW private Combo remindElapseCombo; private Group updateScheduleGroup, downloadGroup, remindGroup; + @Override public void init(IWorkbench workbench) { // nothing to init } + @Override protected Control createContents(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IAutomaticUpdaterHelpContextIds.AUTOMATIC_UPDATES_PREFERENCE_PAGE); @@ -82,6 +84,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW gd.horizontalSpan = 3; onStartupRadio.setLayoutData(gd); onStartupRadio.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -93,6 +96,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW gd.horizontalSpan = 3; onFuzzyScheduleRadio.setLayoutData(gd); onFuzzyScheduleRadio.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -122,6 +126,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW gd.horizontalSpan = 3; searchOnlyRadio.setLayoutData(gd); searchOnlyRadio.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -133,6 +138,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW gd.horizontalSpan = 3; searchAndDownloadRadio.setLayoutData(gd); searchAndDownloadRadio.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -154,6 +160,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW gd.horizontalSpan = 3; remindOnceRadio.setLayoutData(gd); remindOnceRadio.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -165,6 +172,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW gd.horizontalSpan = 3; remindScheduleRadio.setLayoutData(gd); remindScheduleRadio.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -186,6 +194,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW initialize(); enabledCheck.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { pageChanged(); } @@ -253,6 +262,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW showUpdateWizard.setEnabled(master); } + @Override protected void performDefaults() { super.performDefaults(); IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore(); @@ -275,6 +285,7 @@ public class AutomaticUpdatesPreferencePage extends PreferencePage implements IW /** * Method declared on IPreferencePage. Subclasses should override */ + @Override public boolean performOk() { IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore(); pref.setValue(PreferenceConstants.PREF_AUTO_UPDATE_ENABLED, enabledCheck.getSelection()); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceInitializer.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceInitializer.java index 80b8276c7..461e8e0d2 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceInitializer.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -136,7 +136,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=498116 final String autoUpdateSchedule = pref.get(PreferenceConstants.PREF_AUTO_UPDATE_SCHEDULE, null); if (autoUpdateSchedule != null) { - if (PreferenceConstants.PREF_UPDATE_ON_SCHEDULE.equals(autoUpdateSchedule)) { + if (PreferenceConstants.PREF_UPDATE_ON_SCHEDULE.equals(autoUpdateSchedule)) { //Before neon.2, the update schedule could be specified to be done daily or at a specific day and time pref.put(PreferenceConstants.PREF_AUTO_UPDATE_SCHEDULE, PreferenceConstants.PREF_UPDATE_ON_FUZZY_SCHEDULE); final String PRE_NEON2_PREF_KEY_FOR_SCHEDULE = "day"; //$NON-NLS-1$ @@ -183,6 +183,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { StatusManager.getManager().handle(new Status(IStatus.ERROR, AutomaticUpdatePlugin.PLUGIN_ID, 0, message, e), StatusManager.LOG); } + @Override public void initializeDefaultPreferences() { // initialize the default scope Preferences node = DefaultScope.INSTANCE.getNode(AutomaticUpdatePlugin.PLUGIN_ID); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java index 325568f76..a78815a32 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 Ericsson AB and others. + * Copyright (c) 2013, 2017 Ericsson AB 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 @@ -97,6 +97,7 @@ public class PreviousConfigurationFinder { return "" + major + '.' + minor + '.' + service; //$NON-NLS-1$ } + @Override public int compareTo(Identifier o) { if (o != null) { @@ -160,6 +161,7 @@ public class PreviousConfigurationFinder { public static class ConfigurationDescriptorComparator implements Comparator<ConfigurationDescriptor> { // compare ConfigurationDescriptor according to their versions and when equals according to their lastModified field + @Override public int compare(ConfigurationDescriptor o1, ConfigurationDescriptor o2) { int result = -1; if (o1 != null && o2 != null) { @@ -220,14 +222,12 @@ public class PreviousConfigurationFinder { String[] prefixes = prefixesAsString.split(","); //$NON-NLS-1$ for (String prefix : prefixes) { final String p = prefix; - File[] match = searchRoot.listFiles(new FileFilter() { - public boolean accept(File candidate) { - if (!candidate.isDirectory()) - return false; - if (currentConfig.equals(candidate)) - return false; - return candidate.getName().contains(p); - } + File[] match = searchRoot.listFiles((FileFilter) candidate -> { + if (!candidate.isDirectory()) + return false; + if (currentConfig.equals(candidate)) + return false; + return candidate.getName().contains(p); }); if (match.length != 0) return new ConfigurationDescriptor("unknown", new Identifier("0.0.0"), "unknown", "unknown", match[0]); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ @@ -283,8 +283,8 @@ public class PreviousConfigurationFinder { public ConfigurationDescriptor findMostRelevantConfigurationFromProductId(List<ConfigurationDescriptor> configurations, ConfigurationDescriptor configToMatch) { ConfigurationDescriptor bestMatch = null; - List<ConfigurationDescriptor> candidates = new ArrayList<ConfigurationDescriptor>(); - List<ConfigurationDescriptor> candidatesWithUnkonwArchitecture = new ArrayList<ConfigurationDescriptor>(); + List<ConfigurationDescriptor> candidates = new ArrayList<>(); + List<ConfigurationDescriptor> candidatesWithUnkonwArchitecture = new ArrayList<>(); for (ConfigurationDescriptor candidate : configurations) { if (configToMatch.getProductId().equals(candidate.getProductId()) && configToMatch.getVersion().isGreaterEqualTo(candidate.getVersion())) { if (configToMatch.getPlatformConfig().equals(candidate.getPlatformConfig())) { @@ -322,23 +322,16 @@ public class PreviousConfigurationFinder { Identifier appVersion = null; if (eclipseProduct.exists()) { Properties props = new Properties(); - FileInputStream is = null; - try { - try { - is = new FileInputStream(eclipseProduct); - props.load(is); - appId = props.getProperty(PRODUCT_SITE_ID); - if (appId == null || appId.trim().length() == 0) - appId = ECLIPSE; - String version = props.getProperty(PRODUCT_SITE_VERSION); - if (version == null || version.trim().length() == 0) - appVersion = new Identifier(0, 0, 0); - else - appVersion = new Identifier(version); - } finally { - if (is != null) - is.close(); - } + try (FileInputStream is = new FileInputStream(eclipseProduct)) { + props.load(is); + appId = props.getProperty(PRODUCT_SITE_ID); + if (appId == null || appId.trim().length() == 0) + appId = ECLIPSE; + String version = props.getProperty(PRODUCT_SITE_VERSION); + if (version == null || version.trim().length() == 0) + appVersion = new Identifier(0, 0, 0); + else + appVersion = new Identifier(version); } catch (IOException e) { return new String[0]; } @@ -351,7 +344,7 @@ public class PreviousConfigurationFinder { //Iterate through a folder to look for potential configuration folders and reify them. public List<ConfigurationDescriptor> readPreviousConfigurations(File configurationFolder) { File[] candidates = configurationFolder.listFiles(); - List<ConfigurationDescriptor> configurations = new ArrayList<ConfigurationDescriptor>(candidates.length); + List<ConfigurationDescriptor> configurations = new ArrayList<>(candidates.length); for (File candidate : candidates) { if (!candidate.isDirectory()) continue; diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/StatusLineCLabelContribution.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/StatusLineCLabelContribution.java index 224afa793..3e7a715d5 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/StatusLineCLabelContribution.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/StatusLineCLabelContribution.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 @@ -41,6 +41,7 @@ public class StatusLineCLabelContribution extends ContributionItem { setVisible(false); // no text to start with } + @Override public void fill(Composite parent) { label = new CLabel(parent, SWT.DEFAULT); StatusLineLayoutData statusLineLayoutData = new StatusLineLayoutData(); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java index 9d446d270..ccaecb392 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 WindRiver Corporation and others. + * Copyright (c) 2011, 2017 WindRiver 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 @@ -37,7 +37,6 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.equinox.p2.ui.ProvisioningUI; import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.*; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.osgi.util.NLS; @@ -89,7 +88,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis * */ final class ImportExportFilteredTree extends FilteredTree { - ArrayList<Object> checkState = new ArrayList<Object>(); + ArrayList<Object> checkState = new ArrayList<>(); ImportExportFilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) { super(parent, treeStyle, filter, useNewLook); @@ -106,42 +105,36 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis job.addJobChangeListener(new JobChangeAdapter() { @Override public void aboutToRun(IJobChangeEvent event) { - Display.getDefault().syncExec(new Runnable() { - - public void run() { - Object[] checked = viewer.getCheckedElements(); - if (checkState == null) - checkState = new ArrayList<Object>(checked.length); - for (int i = 0; i < checked.length; i++) - if (!viewer.getGrayed(checked[i])) - if (!checkState.contains(checked[i])) - checkState.add(checked[i]); - } + Display.getDefault().syncExec(() -> { + Object[] checked = viewer.getCheckedElements(); + if (checkState == null) + checkState = new ArrayList<>(checked.length); + for (int i = 0; i < checked.length; i++) + if (!viewer.getGrayed(checked[i])) + if (!checkState.contains(checked[i])) + checkState.add(checked[i]); }); } @Override public void done(IJobChangeEvent event) { if (event.getResult().isOK()) { - Display.getDefault().asyncExec(new Runnable() { - - public void run() { - if (viewer == null || viewer.getTree().isDisposed()) - return; - if (checkState == null) - return; - - viewer.setCheckedElements(new Object[0]); - viewer.setGrayedElements(new Object[0]); - // Now we are only going to set the check state of the leaf nodes - // and rely on our container checked code to update the parents properly. - Iterator<Object> iter = checkState.iterator(); - while (iter.hasNext()) { - viewer.setChecked(iter.next(), true); - } - - updatePageCompletion(); + Display.getDefault().asyncExec(() -> { + if (viewer == null || viewer.getTree().isDisposed()) + return; + if (checkState == null) + return; + + viewer.setCheckedElements(new Object[0]); + viewer.setGrayedElements(new Object[0]); + // Now we are only going to set the check state of the leaf nodes + // and rely on our container checked code to update the parents properly. + Iterator<Object> iter = checkState.iterator(); + while (iter.hasNext()) { + viewer.setChecked(iter.next(), true); } + + updatePageCompletion(); }); } } @@ -228,7 +221,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis static { BundleContext context = Platform.getBundle(ProvUIActivator.PLUGIN_ID).getBundleContext(); - ServiceTracker<IProvisioningAgent, IProvisioningAgent> tracker = new ServiceTracker<IProvisioningAgent, IProvisioningAgent>(context, IProvisioningAgent.class, null); + ServiceTracker<IProvisioningAgent, IProvisioningAgent> tracker = new ServiceTracker<>(context, IProvisioningAgent.class, null); tracker.open(); agent = tracker.getService(); tracker.close(); @@ -305,6 +298,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis viewer.refresh(false); } + @Override public void createControl(Composite parent) { initializeDialogUnits(parent); // initializeService(); @@ -368,40 +362,37 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis final ITreeContentProvider contentProvider = getContentProvider(); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(getLabelProvider()); - viewer.addCheckStateListener(new ICheckStateListener() { - - public void checkStateChanged(CheckStateChangedEvent event) { - if (!event.getChecked() && filteredTree.checkState != null) { - ArrayList<Object> toRemove = new ArrayList<Object>(1); - // See bug 258117. Ideally we would get check state changes - // for children when the parent state changed, but we aren't, so - // we need to remove all children from the additive check state - // cache. - if (contentProvider.hasChildren(event.getElement())) { - Set<Object> unchecked = new HashSet<Object>(); - Object[] children = contentProvider.getChildren(event.getElement()); - for (int i = 0; i < children.length; i++) { - unchecked.add(children[i]); - } - Iterator<Object> iter = filteredTree.checkState.iterator(); - while (iter.hasNext()) { - Object current = iter.next(); - if (current != null && unchecked.contains(current)) { - toRemove.add(current); - } + viewer.addCheckStateListener(event -> { + if (!event.getChecked() && filteredTree.checkState != null) { + ArrayList<Object> toRemove = new ArrayList<>(1); + // See bug 258117. Ideally we would get check state changes + // for children when the parent state changed, but we aren't, so + // we need to remove all children from the additive check state + // cache. + if (contentProvider.hasChildren(event.getElement())) { + Set<Object> unchecked = new HashSet<>(); + Object[] children = contentProvider.getChildren(event.getElement()); + for (int i = 0; i < children.length; i++) { + unchecked.add(children[i]); + } + Iterator<Object> iter = filteredTree.checkState.iterator(); + while (iter.hasNext()) { + Object current = iter.next(); + if (current != null && unchecked.contains(current)) { + toRemove.add(current); } - } else { - for (Object element : filteredTree.checkState) { - if (viewer.getComparer().equals(element, event.getElement())) { - toRemove.add(element); - // Do not break out of the loop. We may have duplicate equal - // elements in the cache. Since the cache is additive, we want - // to be sure we've gotten everything. - } + } + } else { + for (Object element : filteredTree.checkState) { + if (viewer.getComparer().equals(element, event.getElement())) { + toRemove.add(element); + // Do not break out of the loop. We may have duplicate equal + // elements in the cache. Since the cache is additive, we want + // to be sure we've gotten everything. } } - filteredTree.checkState.removeAll(toRemove); } + filteredTree.checkState.removeAll(toRemove); } }); parent.addControlListener(new ControlAdapter() { @@ -452,27 +443,21 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis if (provider != null) viewer.setCheckStateProvider(provider); else - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updatePageCompletion(); - } - }); + viewer.addSelectionChangedListener(event -> updatePageCompletion()); viewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); viewer.setInput(getInput()); - viewer.getTree().addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - if (event.item instanceof TreeItem && event.detail == SWT.CHECK) { - TreeItem treeItem = (TreeItem) event.item; - IInstallableUnit iu = ProvUI.getAdapter(event.item.getData(), IInstallableUnit.class); - if (treeItem.getChecked()) { - selectedUnitsToMigrate.add(iu); - } else { - selectedUnitsToMigrate.remove(iu); - } + viewer.getTree().addListener(SWT.Selection, event -> { + if (event.item instanceof TreeItem && event.detail == SWT.CHECK) { + TreeItem treeItem = (TreeItem) event.item; + IInstallableUnit iu = ProvUI.getAdapter(event.item.getData(), IInstallableUnit.class); + if (treeItem.getChecked()) { + selectedUnitsToMigrate.add(iu); + } else { + selectedUnitsToMigrate.remove(iu); } - updatePageCompletion(); } + updatePageCompletion(); }); Composite buttons = new Composite(sashComposite, SWT.NONE); @@ -522,7 +507,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis private Set<IInstallableUnit> identifyUnitsToBeMigrated() { - Set<IInstallableUnit> ius = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> ius = new HashSet<>(); if (profile != null) { for (IInstallableUnit iu : unitsToMigrate) { IQueryResult<IInstallableUnit> collector = profile.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, false)), new NullProgressMonitor()); @@ -556,10 +541,12 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis protected ICheckStateProvider getViewerDefaultState() { return new ICheckStateProvider() { + @Override public boolean isGrayed(Object element) { return false; } + @Override public boolean isChecked(Object element) { IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); if (selectedUnitsToMigrate.contains(iu)) { @@ -610,6 +597,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } //TODO remove the implementation of Listener + @Override public void handleEvent(Event event) { // Widget source = event.widget; // @@ -690,7 +678,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis protected Object getInput() { IUElementListRoot root = new IUElementListRoot(ui); - List<AvailableIUElement> elements = new ArrayList<AvailableIUElement>(unitsToMigrate.size()); + List<AvailableIUElement> elements = new ArrayList<>(unitsToMigrate.size()); for (IInstallableUnit unit : unitsToMigrate) { elements.add(new AvailableIUElement(root, unit, toImportFrom.getProfileId(), false)); } @@ -756,10 +744,13 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis // Both checkedElements and checkedElementsUpdates and the logic inside the getCheckedIUElements method // are used to prevent unnecessary call to getUpdates method due to computational cost. - @SuppressWarnings("rawtypes") private Set checkedElements; - @SuppressWarnings("rawtypes") private Set checkedElementsUpdates; + @SuppressWarnings("rawtypes") + private Set checkedElements; + @SuppressWarnings("rawtypes") + private Set checkedElementsUpdates; private boolean getUpdatesCanceled; + @Override public Object[] getCheckedIUElements() { if (isUpdateToLatest()) { @@ -799,11 +790,13 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis return this.checkedElementsUpdates.toArray(); } + @Override public Object[] getSelectedIUElements() { // TODO Auto-generated method stub return null; } + @Override public void setCheckedElements(Object[] elements) { new UnsupportedOperationException(); } @@ -811,40 +804,36 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis // Look for update of the current selected installation units and replace the old ons with the updated version private Object[] getUpdates(final Object[] _checkedElements) { - final Collection<IInstallableUnit> toInstall = new ArrayList<IInstallableUnit>(); + final Collection<IInstallableUnit> toInstall = new ArrayList<>(); try { - getContainer().run(false, true, new IRunnableWithProgress() { + getContainer().run(false, true, monitor -> { + SubMonitor sub = SubMonitor.convert(monitor, _checkedElements.length); + ProvisioningContext context = new ProvisioningContext(getProvisioningUI().getSession().getProvisioningAgent()); - public void run(IProgressMonitor monitor) { - SubMonitor sub = SubMonitor.convert(monitor, _checkedElements.length); - ProvisioningContext context = new ProvisioningContext(getProvisioningUI().getSession().getProvisioningAgent()); + for (Object iu : _checkedElements) { - for (Object iu : _checkedElements) { - - if (sub.isCanceled()) { - MigrationPage.this.getUpdatesCanceled = true; - toInstall.clear(); - sub.done(); - return; - } - - if (iu instanceof AvailableIUElement) { - IInstallableUnit unit = ((AvailableIUElement) iu).getIU(); - IuUpdateAndPatches updateAndPatches = filterToInstall(unit, updatesFor(unit, context, sub.newChild(1))); - if (updateAndPatches.update != null) { - toInstall.add(updateAndPatches.update); - } else { - toInstall.add(updateAndPatches.iu); // because it is not yet installed - toInstall.addAll(updateAndPatches.patches); - } + if (sub.isCanceled()) { + MigrationPage.this.getUpdatesCanceled = true; + toInstall.clear(); + sub.done(); + return; + } + if (iu instanceof AvailableIUElement) { + IInstallableUnit unit = ((AvailableIUElement) iu).getIU(); + IuUpdateAndPatches updateAndPatches = filterToInstall(unit, updatesFor(unit, context, sub.newChild(1))); + if (updateAndPatches.update != null) { + toInstall.add(updateAndPatches.update); + } else { + toInstall.add(updateAndPatches.iu); // because it is not yet installed + toInstall.addAll(updateAndPatches.patches); } - sub.worked(1); } - } + sub.worked(1); + } }); } catch (InterruptedException e) { // Nothing to report if thread was interrupted @@ -877,7 +866,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis // IPlanner planner = (IPlanner) getProvisioningUI().getSession().getProvisioningAgent().getService(IPlanner.SERVICE_NAME); // return planner.updatesFor(toUpdate, context, monitor).toSet(); - Map<String, IInstallableUnit> resultsMap = new HashMap<String, IInstallableUnit>(); + Map<String, IInstallableUnit> resultsMap = new HashMap<>(); SubMonitor sub = SubMonitor.convert(monitor, 1000); IQueryable<IInstallableUnit> queryable = context.getMetadata(sub.newChild(500)); @@ -900,7 +889,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis IuUpdateAndPatches(IInstallableUnit iu) { this.iu = iu; - this.patches = new ArrayList<IInstallableUnit>(); + this.patches = new ArrayList<>(); } } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java index 7e18f4bac..f2cd0c33d 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 Ericsson AB and others. All rights reserved. This + * Copyright (c) 2013, 2017 Ericsson AB and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -181,12 +181,10 @@ public class MigrationSupport { protected void openMigrationWizard(final IProfile inputProfile, final Collection<IInstallableUnit> unitsToMigrate, final URI[] reposToMigrate) { Display d = Display.getDefault(); - d.asyncExec(new Runnable() { - public void run() { - WizardDialog migrateWizard = new MigrationWizardDialog(getWorkbenchWindowShell(), new MigrationWizard(inputProfile, unitsToMigrate, reposToMigrate, reposToMigrate != null)); - migrateWizard.create(); - migrateWizard.open(); - } + d.asyncExec(() -> { + WizardDialog migrateWizard = new MigrationWizardDialog(getWorkbenchWindowShell(), new MigrationWizard(inputProfile, unitsToMigrate, reposToMigrate, reposToMigrate != null)); + migrateWizard.create(); + migrateWizard.open(); }); } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java index ca75cf442..aa8f37f5a 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 WindRiver Corporation and others. + * Copyright (c) 2011, 2017 WindRiver 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 @@ -47,7 +47,7 @@ public class MigrationWizard extends InstallWizard implements IImportWizard { private IProfile toImportFrom; Collection<IInstallableUnit> unitsToMigrate; private URI[] reposToMigrate; - private List<URI> addedRepos = new ArrayList<URI>(); + private List<URI> addedRepos = new ArrayList<>(); private boolean firstTime = false; public MigrationWizard() { @@ -67,6 +67,7 @@ public class MigrationWizard extends InstallWizard implements IImportWizard { super(ui, operation, initialSelections, preloadJob); } + @Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(firstTime ? ProvUIMessages.MigrationWizard_WINDOWTITLE_FIRSTRUN : ProvUIMessages.MigrationWizard_WINDOWTITLE); setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(ProvUIActivator.PLUGIN_ID).getEntry("icons/install_wiz.png"))); //$NON-NLS-1$ @@ -145,6 +146,7 @@ public class MigrationWizard extends InstallWizard implements IImportWizard { } } + @Override public boolean performCancel() { String[] buttons = new String[] {IDialogConstants.YES_LABEL, ProvUIMessages.MigrationPage_LATER_BUTTON, IDialogConstants.NO_LABEL}; MessageDialog dialog = new MessageDialog(getShell(), ProvUIMessages.MigrationPage_CONFIRMATION_TITLE, null, ProvUIMessages.MigrationPage_CONFIRMATION_DIALOG, MessageDialog.QUESTION, buttons, 2); @@ -174,6 +176,7 @@ public class MigrationWizard extends InstallWizard implements IImportWizard { return result; } + @Override public IWizardPage getNextPage(IWizardPage page) { IWizardPage toReturn = page; diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java index ac0f522f5..ed176499c 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationWizardDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 Ericsson AB and others. + * Copyright (c) 2013, 2017 Ericsson AB and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ public class MigrationWizardDialog extends WizardDialog { setShellStyle(getShellStyle() | SWT.RESIZE); } + @Override protected IDialogSettings getDialogBoundsSettings() { IDialogSettings settings = AutomaticUpdatePlugin.getDefault().getDialogSettings(); IDialogSettings section = settings.getSection(wizard.getDialogSettingsSectionName()); @@ -50,6 +51,7 @@ public class MigrationWizardDialog extends WizardDialog { /** * @see org.eclipse.jface.window.Window#close() */ + @Override public boolean close() { if (getShell() != null && !getShell().isDisposed()) { wizard.saveBoundsRelatedSettings(); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/.classpath b/bundles/org.eclipse.equinox.p2.ui.sdk/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/.classpath +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.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.ui.sdk/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs index 449cf187f..6cf497422 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/.settings/org.eclipse.jdt.core.prefs @@ -6,29 +6,46 @@ 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.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 +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=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 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 @@ -36,41 +53,79 @@ 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=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=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.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.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.ui.sdk/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF index af6e20896..bbb097c85 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.ui.sdk;singleton:=true -Bundle-Version: 1.0.500.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.ProvSDKUIActivator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -27,4 +27,4 @@ Import-Package: javax.xml.parsers, org.xml.sax Service-Component: OSGI-INF/policy_component.xml, OSGI-INF/licenseManager_component.xml Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml b/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml index f3c57b824..1cfd9a034 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.ui.sdk</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.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallNewSoftwareHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallNewSoftwareHandler.java index 5c6da40e6..63982dc0d 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallNewSoftwareHandler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallNewSoftwareHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,10 +27,12 @@ public class InstallNewSoftwareHandler extends PreloadingRepositoryHandler { super(); } + @Override protected void doExecute(LoadMetadataRepositoryJob job) { getProvisioningUI().openInstallWizard(null, null, job); } + @Override protected boolean waitForPreload() { // If the user cannot see repositories, then we may as well wait // for existing repos to load so that content is available. @@ -39,6 +41,7 @@ public class InstallNewSoftwareHandler extends PreloadingRepositoryHandler { return !getProvisioningUI().getPolicy().getRepositoriesVisible(); } + @Override protected void setLoadJobProperties(Job loadJob) { super.setLoadJobProperties(loadJob); // If we are doing a background load, we do not wish to authenticate, as the diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java index e8a3822b0..d4b418303 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -43,6 +43,7 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { /** * Execute the command. */ + @Override public Object execute(ExecutionEvent event) { // Look for a profile. We may not immediately need it in the // handler, but if we don't have one, whatever we are trying to do @@ -63,11 +64,7 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { // Log the detailed message StatusManager.getManager().handle(ProvSDKUIActivator.getNoSelfProfileStatus()); } else { - BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { - public void run() { - doExecuteAndLoad(); - } - }); + BusyIndicator.showWhile(getShell().getDisplay(), () -> doExecuteAndLoad()); } return null; } @@ -78,6 +75,7 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY); final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) { + @Override public IStatus runModal(IProgressMonitor monitor) { SubMonitor sub = SubMonitor.convert(monitor, getProgressTaskName(), 1000); IStatus status = super.runModal(sub.newChild(500)); @@ -100,14 +98,11 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { setLoadJobProperties(loadJob); if (waitForPreload()) { loadJob.addJobChangeListener(new JobChangeAdapter() { + @Override public void done(IJobChangeEvent event) { if (PlatformUI.isWorkbenchRunning()) if (event.getResult().isOK()) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - doExecute(loadJob); - } - }); + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> doExecute(loadJob)); } } }); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java index f6cc655ac..069909870 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKUIActivator.java @@ -26,7 +26,6 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.eclipse.ui.statushandlers.StatusManager; @@ -75,11 +74,7 @@ public class ProvSDKUIActivator extends AbstractUIPlugin { // constructor } - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext bundleContext) throws Exception { super.start(bundleContext); plugin = this; @@ -90,11 +85,7 @@ public class ProvSDKUIActivator extends AbstractUIPlugin { private IPropertyChangeListener getPreferenceListener() { if (preferenceListener == null) { - preferenceListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - updateWithPreferences(getPolicy()); - } - }; + preferenceListener = event -> updateWithPreferences(getPolicy()); } return preferenceListener; } @@ -111,6 +102,7 @@ public class ProvSDKUIActivator extends AbstractUIPlugin { return getProvisioningUI().getSession().getProvisioningAgent(); } + @Override public void stop(BundleContext bundleContext) throws Exception { plugin = null; getPreferenceStore().removePropertyChangeListener(preferenceListener); @@ -144,9 +136,8 @@ public class ProvSDKUIActivator extends AbstractUIPlugin { /* * Overridden to use a profile scoped preference store. - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() */ + @Override public IPreferenceStore getPreferenceStore() { // Create the preference store lazily. if (preferenceStore == null) { diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageExtensionFactory.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageExtensionFactory.java index 74824d37b..4d5b2cddc 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageExtensionFactory.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageExtensionFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc. + * Copyright (c) 2011, 2017 Sonatype, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,10 +17,7 @@ import org.osgi.framework.Bundle; public class RevertProfilePageExtensionFactory implements IExecutableExtensionFactory { - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.IExecutableExtensionFactory#create() - */ + @Override public Object create() { Bundle bundle = Platform.getBundle("org.eclipse.compare"); //$NON-NLS-1$ if (bundle == null) { diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageWithCompare.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageWithCompare.java index 9a1f7776a..314e3c7b3 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageWithCompare.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/RevertProfilePageWithCompare.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 @@ -45,10 +45,7 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { private static final int COMPARE_ID = IDialogConstants.CLIENT_ID + 2; Button compareButton; - /* - * (non-Javadoc) - * @see org.eclipse.ui.about.InstallationPage#createPageButtons(org.eclipse.swt.widgets.Composite) - */ + @Override public void createPageButtons(Composite parent) { if (ProvisioningUI.getDefaultUI().getProfileId() == null) return; @@ -58,6 +55,7 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { super.createPageButtons(parent); } + @Override protected void buttonPressed(int buttonId) { switch (buttonId) { case COMPARE_ID : @@ -82,6 +80,7 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { return false; } + @Override protected void handleSelectionChanged(IStructuredSelection selection) { super.handleSelectionChanged(selection); if (!selection.isEmpty()) { @@ -132,6 +131,7 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { r = new ProvElementNode(rpe[1]); } + @Override protected Object prepareInput(IProgressMonitor monitor) { initLabels(); Differencer d = new Differencer(); @@ -149,6 +149,7 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { cc.setRightImage(r.getImage()); } + @Override public String getOKButtonLabel() { return IDialogConstants.OK_LABEL; } @@ -168,8 +169,9 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { } } + @Override public Object[] getChildren() { - Set<ProvElementNode> children = new HashSet<ProvElementNode>(); + Set<ProvElementNode> children = new HashSet<>(); if (pe instanceof RollbackProfileElement) { Object[] c = ((RollbackProfileElement) pe).getChildren(null); for (int i = 0; i < c.length; i++) { @@ -189,6 +191,7 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { * @param other the object to compare this <code>ProvElementNode</code> against. * @return <code>true</code> if the <code>ProvElementNodes</code>are equal; <code>false</code> otherwise. */ + @Override public boolean equals(Object other) { if (other instanceof ProvElementNode) return id.equals(((ProvElementNode) other).id); @@ -199,14 +202,17 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { * Implementation based on <code>id</code>. * @return a hash code for this object. */ + @Override public int hashCode() { return id.hashCode(); } + @Override public Image getImage() { return pe.getImage(null); } + @Override public String getName() { if (iu != null) { return iu.getProperty(IInstallableUnit.PROP_NAME, null); @@ -214,10 +220,12 @@ public class RevertProfilePageWithCompare extends RevertProfilePage { return pe.getLabel(null); } + @Override public String getType() { return ITypedElement.UNKNOWN_TYPE; } + @Override public InputStream getContents() { String contents = BLANK; if (iu != null) { diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SDKPolicy.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SDKPolicy.java index c6149bc17..db2082d81 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SDKPolicy.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SDKPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -42,6 +42,7 @@ public class SDKPolicy extends Policy { ProvSDKUIActivator.getDefault().updateWithPreferences(this); } + @Override public IStatus getNoProfileChosenStatus() { return ProvSDKUIActivator.getNoSelfProfileStatus(); } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java index 166b2ef4e..ebb900824 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/SimpleLicenseManager.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 @@ -29,7 +29,7 @@ import org.osgi.service.prefs.Preferences; * @since 3.6 */ public class SimpleLicenseManager extends LicenseManager { - java.util.Set<String> accepted = new HashSet<String>(); + java.util.Set<String> accepted = new HashSet<>(); String profileId; public SimpleLicenseManager(String profileId) { @@ -42,22 +42,26 @@ public class SimpleLicenseManager extends LicenseManager { this(IProfileRegistry.SELF); } + @Override public boolean accept(ILicense license) { accepted.add(license.getUUID()); updatePreferences(); return true; } + @Override public boolean reject(ILicense license) { accepted.remove(license.getUUID()); updatePreferences(); return true; } + @Override public boolean isAccepted(ILicense license) { return accepted.contains(license.getUUID()); } + @Override public boolean hasAcceptedLicenses() { return !accepted.isEmpty(); } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java index d38b2a8cc..95a34ae94 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.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 @@ -29,6 +29,7 @@ public class UpdateHandler extends PreloadingRepositoryHandler { boolean hasNoRepos = false; UpdateOperation operation; + @Override protected void doExecute(LoadMetadataRepositoryJob job) { if (hasNoRepos) { if (getProvisioningUI().getPolicy().getRepositoriesVisible()) { @@ -56,13 +57,10 @@ public class UpdateHandler extends PreloadingRepositoryHandler { } }; job2.addJobChangeListener(new JobChangeAdapter() { + @Override public void done(IJobChangeEvent event) { if (PlatformUI.isWorkbenchRunning()) { - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - getProvisioningUI().openUpdateWizard(true, operation, remediationOperation, null); - } - }); + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> getProvisioningUI().openUpdateWizard(true, operation, remediationOperation, null)); } } @@ -72,6 +70,7 @@ public class UpdateHandler extends PreloadingRepositoryHandler { } } + @Override protected void doPostLoadBackgroundWork(IProgressMonitor monitor) throws OperationCanceledException { operation = getProvisioningUI().getUpdateOperation(null, null); // check for updates @@ -80,6 +79,7 @@ public class UpdateHandler extends PreloadingRepositoryHandler { throw new OperationCanceledException(); } + @Override protected boolean preloadRepositories() { hasNoRepos = false; RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker(); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java index 151579b36..cc2494eea 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceInitializer.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 @@ -53,9 +53,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { } } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ + @Override public void initializeDefaultPreferences() { Preferences node = DefaultScope.INSTANCE.getNode("org.eclipse.equinox.p2.ui.sdk"); //$NON-NLS-1$ // default values diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ProvisioningPreferencePage.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ProvisioningPreferencePage.java index 7f6d1566e..d5cbf90c4 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ProvisioningPreferencePage.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ProvisioningPreferencePage.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,6 +36,7 @@ public class ProvisioningPreferencePage extends PreferencePage implements IWorkb private Button showLatestRadio, showAllRadio; private Button alwaysShowFailedPlan, neverShowFailedPlan, promptOnFailedPlan; + @Override protected Control createContents(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IProvSDKHelpContextIds.PROVISIONING_PREFERENCE_PAGE); @@ -96,11 +97,7 @@ public class ProvisioningPreferencePage extends PreferencePage implements IWorkb //See https://bugs.eclipse.org/bugs/show_bug.cgi?id=313242 Link link = new Link(container, SWT.PUSH); link.setText(ProvSDKMessages.ProvisioningPreferencePage_UninstallUpdateLink); - link.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - ProvUI.openInstallationDialog(event); - } - }); + link.addListener(SWT.Selection, event -> ProvUI.openInstallationDialog(event)); initialize(); @@ -119,6 +116,7 @@ public class ProvisioningPreferencePage extends PreferencePage implements IWorkb promptOnFailedPlan.setSelection(openWizard.equals(MessageDialogWithToggle.PROMPT)); } + @Override protected void performDefaults() { super.performDefaults(); Preferences pref = DefaultScope.INSTANCE.getNode(ProvSDKUIActivator.PLUGIN_ID); @@ -130,6 +128,7 @@ public class ProvisioningPreferencePage extends PreferencePage implements IWorkb promptOnFailedPlan.setSelection(openWizard.equals(MessageDialogWithToggle.PROMPT)); } + @Override public boolean performOk() { IPreferenceStore pref = ProvSDKUIActivator.getDefault().getPreferenceStore(); pref.setValue(PreferenceConstants.PREF_SHOW_LATEST_VERSION, showLatestRadio.getSelection()); @@ -144,6 +143,7 @@ public class ProvisioningPreferencePage extends PreferencePage implements IWorkb return true; } + @Override public void init(IWorkbench workbench) { // Nothing to do } |