Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.importexport')
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/.classpath2
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/.settings/org.eclipse.jdt.core.prefs63
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml2
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractImportPage.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java157
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java12
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java68
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java84
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/StyledErrorDialog.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FParser.java8
15 files changed, 244 insertions, 221 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/.classpath b/bundles/org.eclipse.equinox.p2.ui.importexport/.classpath
index 64c5e31b7..eca7bdba8 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/.classpath
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/.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.importexport/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui.importexport/.settings/org.eclipse.jdt.core.prefs
index 449cf187f..afaf14898 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/.settings/org.eclipse.jdt.core.prefs
@@ -6,10 +6,20 @@ 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
@@ -18,17 +28,23 @@ org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
@@ -36,41 +52,78 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=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.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.importexport/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
index aeeaa340f..99679218b 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.ui.importexport;singleton:=true
-Bundle-Version: 1.1.300.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
@@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.equinox.p2.extensionlocation,
org.eclipse.equinox.p2.metadata;bundle-version="2.1.0",
org.eclipse.ui.forms;bundle-version="3.5.0"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.equinox.internal.p2.metadata.repository.io,
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml b/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml
index ae0c1ca2b..a71c5751b 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.ui.importexport</artifactId>
- <version>1.1.300-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java
index b2f587d69..ba9eed473 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java
@@ -46,12 +46,14 @@ public class ImportExportImpl implements P2ImportExport {
}
}
+ @Override
public List<IUDetail> importP2F(InputStream input) throws IOException {
P2FParser parser = new P2FParser(Platform.getBundle(Constants.Bundle_ID).getBundleContext(), Constants.Bundle_ID);
parser.parse(input);
return parser.getIUs();
}
+ @Override
public IStatus exportP2F(OutputStream output, IInstallableUnit[] ius, boolean allowEntriesWithoutRepo, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
@@ -60,7 +62,7 @@ public class ImportExportImpl implements P2ImportExport {
//Collect repos where the IUs are going to be searched
IMetadataRepositoryManager repoManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
URI[] uris = repoManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_NON_LOCAL | IRepositoryManager.REPOSITORIES_NON_SYSTEM);
- List<IMetadataRepository> repos = new ArrayList<IMetadataRepository>(uris.length);
+ List<IMetadataRepository> repos = new ArrayList<>(uris.length);
for (URI uri : uris) {
try {
IMetadataRepository repo = repoManager.loadRepository(uri, subMonitor.newChild(500 / uris.length, SubMonitor.SUPPRESS_ALL_LABELS));
@@ -70,12 +72,12 @@ public class ImportExportImpl implements P2ImportExport {
}
}
subMonitor.setWorkRemaining(500);
- List<IUDetail> rootsToExport = new ArrayList<IUDetail>(ius.length);
+ List<IUDetail> rootsToExport = new ArrayList<>(ius.length);
SubMonitor sub2 = subMonitor.newChild(450, SubMonitor.SUPPRESS_ALL_LABELS);
sub2.setWorkRemaining(ius.length * 100);
MultiStatus queryRepoResult = new MultiStatus(Constants.Bundle_ID, 0, null, null);
for (IInstallableUnit iu : ius) {
- List<URI> referredRepos = new ArrayList<URI>(1);
+ List<URI> referredRepos = new ArrayList<>(1);
if (sub2.isCanceled())
throw new OperationCanceledException();
SubMonitor sub3 = sub2.newChild(100);
@@ -123,6 +125,7 @@ public class ImportExportImpl implements P2ImportExport {
return false;
}
+ @Override
public IStatus exportP2F(OutputStream output, List<IUDetail> ius, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractImportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractImportPage.java
index 8a17c9746..0699ef819 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractImportPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractImportPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -52,6 +52,7 @@ public abstract class AbstractImportPage extends AbstractPage {
super.createInstallationTable(parent);
viewer.getTree().addListener(SWT.Selection, new Listener() {
+ @Override
public void handleEvent(Event event) {
if (event.detail == SWT.CHECK) {
if (hasInstalled(ProvUI.getAdapter(event.item.getData(), IInstallableUnit.class))) {
@@ -97,10 +98,12 @@ public abstract class AbstractImportPage extends AbstractPage {
protected ICheckStateProvider getViewerDefaultState() {
return new ICheckStateProvider() {
+ @Override
public boolean isGrayed(Object element) {
return false;
}
+ @Override
public boolean isChecked(Object element) {
if (profile != null) {
IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java
index e998dc8d2..2c5324686 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -76,7 +76,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
*
*/
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);
@@ -93,42 +93,36 @@ public abstract class AbstractPage extends WizardPage implements Listener {
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();
});
}
}
@@ -215,7 +209,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
static {
BundleContext context = Platform.getBundle(Constants.Bundle_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();
@@ -274,6 +268,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
protected abstract void createContents(Composite composite);
+ @Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
initializeService();
@@ -312,15 +307,14 @@ public abstract class AbstractPage extends WizardPage implements Listener {
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
destinationNameField.setLayoutData(data);
destinationNameField.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
handleDestinationChanged(getDestinationValue());
}
});
- destinationNameField.addKeyListener(new KeyListener() {
+ destinationNameField.addKeyListener(new KeyAdapter() {
- /*
- * @see KeyListener.keyPressed
- */
+ @Override
public void keyPressed(KeyEvent e) {
if (e.character == SWT.CR) {
entryChanged = false;
@@ -328,27 +322,10 @@ public abstract class AbstractPage extends WizardPage implements Listener {
handleDestinationChanged(getDestinationValue());
}
}
-
- public void keyReleased(KeyEvent e) {
- // do nothing
- }
- });
- destinationNameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- entryChanged = true;
- }
});
- destinationNameField.addFocusListener(new FocusListener() {
- /*
- * @see FocusListener.focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- //Do nothing when getting focus
- }
-
- /*
- * @see FocusListener.focusLost(FocusEvent)
- */
+ destinationNameField.addModifyListener(e -> entryChanged = true);
+ destinationNameField.addFocusListener(new FocusAdapter() {
+ @Override
public void focusLost(FocusEvent e) {
//Clear the flag to prevent constant update
if (entryChanged) {
@@ -401,40 +378,37 @@ public abstract class AbstractPage extends WizardPage implements Listener {
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() {
@@ -482,11 +456,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
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.getControl().setSize(300, 200);
viewer.setInput(getInput());
@@ -629,6 +599,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
}
}
+ @Override
public void handleEvent(Event event) {
Widget source = event.widget;
@@ -643,7 +614,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
}
protected void initializeService() {
- ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<P2ImportExport, P2ImportExport>(Platform.getBundle(Constants.Bundle_ID).getBundleContext(), P2ImportExport.class.getName(), null);
+ ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(Platform.getBundle(Constants.Bundle_ID).getBundleContext(), P2ImportExport.class.getName(), null);
tracker.open();
importexportService = tracker.getService();
tracker.close();
@@ -709,7 +680,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
}
protected String[] addToHistory(String[] history, String newEntry) {
- List<String> l = new ArrayList<String>(Arrays.asList(history));
+ List<String> l = new ArrayList<>(Arrays.asList(history));
addToHistory(l, newEntry);
String[] r = new String[l.size()];
l.toArray(r);
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java
index 661f2b52f..c01cc6375 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -63,6 +63,7 @@ public class ExportPage extends AbstractPage {
final OutputStream out = stream;
getContainer().run(true, true, new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) throws InterruptedException {
try {
IInstallableUnit[] units = new IInstallableUnit[checked.length];
@@ -84,12 +85,9 @@ public class ExportPage extends AbstractPage {
}
sb.append(Messages.ExportPage_FixSuggestion);
sb.append(Messages.ExportPage_TryAgainQuestion);
- Runnable runnable = new Runnable() {
-
- public void run() {
- String title = Messages.ExportPage_Title;
- tryAgain = StyledErrorDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, sb.toString());
- }
+ Runnable runnable = () -> {
+ String title = Messages.ExportPage_Title;
+ tryAgain = StyledErrorDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, sb.toString());
};
Display.getDefault().syncExec(runnable);
if (tryAgain)
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java
index 23799a6e3..fe5f5a35c 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -40,6 +40,7 @@ public class ExportWizard extends AbstractWizard implements IExportWizard {
addPage(mainPage);
}
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
setWindowTitle(Messages.ExportWizard_WizardTitle);
setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java
index 3b787455c..9b8486794 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -36,7 +36,6 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
@@ -96,7 +95,7 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
private IProvisioningAgentProvider getAgentProvider() {
if (agentProvider == null) {
- ServiceTracker<IProvisioningAgentProvider, IProvisioningAgentProvider> tracker = new ServiceTracker<IProvisioningAgentProvider, IProvisioningAgentProvider>(Platform.getBundle(Constants.Bundle_ID).getBundleContext(), IProvisioningAgentProvider.class, null);
+ ServiceTracker<IProvisioningAgentProvider, IProvisioningAgentProvider> tracker = new ServiceTracker<>(Platform.getBundle(Constants.Bundle_ID).getBundleContext(), IProvisioningAgentProvider.class, null);
tracker.open();
agentProvider = tracker.getService();
tracker.close();
@@ -112,12 +111,9 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
Callable<Boolean> getSuperValidateDest = new Callable<Boolean>() {
Boolean validated;
+ @Override
public Boolean call() throws Exception {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- validated = ImportFromInstallationPage.super.validateDestinationGroup();
- }
- });
+ Display.getDefault().syncExec(() -> validated = ImportFromInstallationPage.super.validateDestinationGroup());
return validated;
}
};
@@ -141,13 +137,10 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
Callable<String> getDestinationValue = new Callable<String>() {
String des;
+ @Override
public String call() throws Exception {
if (Display.findDisplay(Thread.currentThread()) == null) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- des = getDestinationValue();
- }
- });
+ Display.getDefault().syncExec(() -> des = getDestinationValue());
} else
des = getDestinationValue();
return des;
@@ -251,11 +244,7 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
throw new Exception();
}
} catch (Exception e) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- setErrorMessage(getInvalidDestinationMessage());
- }
- });
+ Display.getDefault().asyncExec(() -> setErrorMessage(getInvalidDestinationMessage()));
rt = false;
if (otherInstanceAgent != null)
otherInstanceAgent.stop();
@@ -290,31 +279,25 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
@Override
protected void handleDestinationChanged(String newDestination) {
try {
- getContainer().run(true, false, new IRunnableWithProgress() {
-
- public void run(IProgressMonitor monitor) {
- Object input = null;
- if (validateDestinationGroup(monitor)) {
- final IProfile currentProfile = toBeImportedProfile;
- final ProfileElement element = new ProfileElement(null, currentProfile.getProfileId()) {
- @Override
- public org.eclipse.equinox.p2.query.IQueryable<?> getQueryable() {
- return currentProfile;
- }
- };
- element.setQueryable(currentProfile);
- input = element;
-
- }
- final Object viewerInput = input;
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- viewer.setInput(viewerInput);
- updatePageCompletion();
+ getContainer().run(true, false, monitor -> {
+ Object input = null;
+ if (validateDestinationGroup(monitor)) {
+ final IProfile currentProfile = toBeImportedProfile;
+ final ProfileElement element = new ProfileElement(null, currentProfile.getProfileId()) {
+ @Override
+ public org.eclipse.equinox.p2.query.IQueryable<?> getQueryable() {
+ return currentProfile;
}
- });
+ };
+ element.setQueryable(currentProfile);
+ input = element;
+
}
+ final Object viewerInput = input;
+ Display.getDefault().asyncExec(() -> {
+ viewer.setInput(viewerInput);
+ updatePageCompletion();
+ });
});
} catch (InvocationTargetException e) {
setErrorMessage(e.getLocalizedMessage());
@@ -400,15 +383,18 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
}
}
+ @Override
public Object[] getCheckedIUElements() {
return viewer.getCheckedElements();
}
+ @Override
public Object[] getSelectedIUElements() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public void setCheckedElements(Object[] elements) {
new UnsupportedOperationException();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java
index b2e296b15..0ea9730a5 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -44,6 +44,7 @@ public class ImportFromInstallationWizard extends InstallWizard implements IImpo
setDialogSettings(section);
}
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
setWindowTitle(Messages.ImportWizard_WINDOWTITLE);
setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java
index 9bc7fe3b1..3e09cac77 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -49,26 +49,32 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
class InstallationContentProvider implements ITreeContentProvider {
+ @Override
public void dispose() {
//
}
+ @Override
public Object[] getElements(Object inputElement) {
return (Object[]) inputElement;
}
+ @Override
public void inputChanged(Viewer viewer1, Object oldInput, Object newInput) {
//
}
+ @Override
public Object[] getChildren(Object parentElement) {
return new Object[0];
}
+ @Override
public Object getParent(Object element) {
return null;
}
+ @Override
public boolean hasChildren(Object element) {
return false;
}
@@ -77,10 +83,12 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
class InstallationLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider {
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
+ @Override
public String getColumnText(Object element, int columnIndex) {
IInstallableUnit iu = ((IUDetail) element).getIU();
switch (columnIndex) {
@@ -96,12 +104,14 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
}
+ @Override
public Color getForeground(Object element) {
if (hasInstalled(ProvUI.getAdapter(element, IInstallableUnit.class)))
return Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
return null;
}
+ @Override
public Color getBackground(Object element) {
return null;
}
@@ -129,10 +139,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.internal.dialogs.PatternFilter#isElementSelectable(java.lang.Object)
- */
+ @Override
public boolean isElementSelectable(Object element) {
return element instanceof IUDetail;
}
@@ -143,6 +150,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
* (non-Javadoc)
* @see org.eclipse.ui.dialogs.PatternFilter#setPattern(java.lang.String)
*/
+ @Override
public void setPattern(String patternString) {
super.setPattern(patternString);
this.patternString = patternString;
@@ -154,15 +162,14 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
* (non-Javadoc)
* @see org.eclipse.ui.dialogs.PatternFilter#isParentMatch(org.eclipse.jface.viewers.Viewer, java.lang.Object)
*/
+ @Override
protected boolean isParentMatch(Viewer viewer1, Object element) {
if (patternString == null || patternString.length() == 0)
return true;
return super.isParentMatch(viewer1, element);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.PatternFilter#isElementMatch(org.eclipse.jface.viewers.Viewer, java.lang.Object)
- */
+ @Override
protected boolean isLeafMatch(Viewer viewer1, Object element) {
String text = null;
if (element instanceof IUDetail) {
@@ -191,8 +198,8 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
}
private List<IUDetail> features;
- private final List<URI> loadRepos = new ArrayList<URI>();
- private final Map<IUDetail, IUDetail[]> newProposedFeature = new HashMap<IUDetail, IUDetail[]>();
+ private final List<URI> loadRepos = new ArrayList<>();
+ private final Map<IUDetail, IUDetail[]> newProposedFeature = new HashMap<>();
private Button contactAll;
private Button installLatest;
private String oldDestination;
@@ -319,9 +326,10 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
return super.validDestination() && target.exists() && target.canRead();
}
+ @Override
public Object[] getCheckedIUElements() {
Object[] checked = viewer.getCheckedElements();
- List<IUDetail> checkedFeatures = new ArrayList<IUDetail>(checked.length);
+ List<IUDetail> checkedFeatures = new ArrayList<>(checked.length);
for (int i = 0; i < checked.length; i++) {
IUDetail feature = (IUDetail) checked[i];
IUDetail[] existingFeatures = newProposedFeature.get(feature);
@@ -348,11 +356,13 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
return checkedFeatures.toArray(new IUDetail[checkedFeatures.size()]);
}
+ @Override
public Object[] getSelectedIUElements() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public void setCheckedElements(Object[] elements) {
new UnsupportedOperationException();
}
@@ -360,7 +370,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
public ProvisioningContext getProvisioningContext() {
if (agent != null) {
Object[] checked = viewer.getCheckedElements();
- List<URI> referredRepos = new ArrayList<URI>(checked.length);
+ List<URI> referredRepos = new ArrayList<>(checked.length);
for (Object checkItem : checked) {
IUDetail feature = (IUDetail) checkItem;
for (URI uri : feature.getReferencedRepositories()) {
@@ -390,6 +400,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
class GetCheckedElement implements Runnable {
Object[] checkedElements = null;
+ @Override
public void run() {
checkedElements = viewer.getCheckedElements();
}
@@ -417,7 +428,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
throw new InterruptedException();
SubMonitor sub2 = sub.newChild(100, SubMonitor.SUPPRESS_ALL_LABELS);
sub2.setWorkRemaining(feature.getReferencedRepositories().size() * 500 + 100);
- List<IRepository<IInstallableUnit>> repos = new ArrayList<IRepository<IInstallableUnit>>();
+ List<IRepository<IInstallableUnit>> repos = new ArrayList<>();
for (URI uri : feature.getReferencedRepositories()) {
if (!metaManager.contains(uri)) {
metaManager.addRepository(uri);
@@ -442,7 +453,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
// see bug 423628. Find a way to change the code to not produce
// the warning.
Set<IInstallableUnit> result = new CompoundQueryable<IInstallableUnit>(repos.toArray(new IRepository[repos.size()])).query(QueryUtil.createIUQuery(feature.getIU().getId(), new VersionRange(feature.getIU().getVersion(), true, null, false)), sub2.newChild(100)).toSet();
- List<IUDetail> existingFeatures = new ArrayList<IUDetail>(result.size());
+ List<IUDetail> existingFeatures = new ArrayList<>(result.size());
for (IInstallableUnit iu : result) {
existingFeatures.add(new IUDetail(iu, feature.getReferencedRepositories()));
}
@@ -456,6 +467,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
}
}
+ @Override
protected PatternFilter getPatternFilter() {
return new P2ImportIUPatternFilter(getColumnConfig());
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java
index 7eb1555e0..d155c3f29 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 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
@@ -30,7 +30,6 @@ import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
@@ -55,6 +54,7 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
setDialogSettings(section);
}
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
setWindowTitle(Messages.ImportWizard_WINDOWTITLE);
setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$
@@ -71,6 +71,7 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
return ((ImportPage) mainPage).getProvisioningContext();
}
+ @Override
public void recomputePlan(IRunnableContext runnableContext) {
recomputePlan(runnableContext, true);
}
@@ -85,57 +86,50 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
public void recomputePlan(IRunnableContext runnableContext, final boolean withRemediation) {
if (((ImportPage) mainPage).hasUnloadedRepo()) {
try {
- runnableContext.run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException {
- final SubMonitor sub = SubMonitor.convert(monitor, 1000);
- ((ImportPage) mainPage).recompute(sub.newChild(800));
- if (sub.isCanceled())
- throw new InterruptedException();
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- ProvisioningContext context = getProvisioningContext();
- initializeResolutionModelElements(getOperationSelections());
- if (planSelections.length == 0) {
- operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) {
- protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
- monitor.done();
- }
-
- public IStatus getResolutionResult() {
- if (sub.isCanceled())
- return Status.CANCEL_STATUS;
- return new Status(IStatus.ERROR, Constants.Bundle_ID, Messages.ImportWizard_CannotQuerySelection);
- }
- };
- } else {
- operation = getProfileChangeOperation(planSelections);
- operation.setProvisioningContext(context);
+ runnableContext.run(true, true, monitor -> {
+ final SubMonitor sub = SubMonitor.convert(monitor, 1000);
+ ((ImportPage) mainPage).recompute(sub.newChild(800));
+ if (sub.isCanceled())
+ throw new InterruptedException();
+ Display.getDefault().syncExec(() -> {
+ ProvisioningContext context = getProvisioningContext();
+ initializeResolutionModelElements(getOperationSelections());
+ if (planSelections.length == 0) {
+ operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) {
+ @Override
+ protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
+ monitor.done();
}
- }
- });
- if (sub.isCanceled())
- throw new InterruptedException();
- if (operation.resolveModal(sub.newChild(200)).getSeverity() == IStatus.CANCEL)
- throw new InterruptedException();
- else {
- if (withRemediation) {
- IStatus status = operation.getResolutionResult();
- if (remediationPage != null && shouldRemediate(status)) {
- computeRemediationOperation(operation, ui, monitor);
+
+ @Override
+ public IStatus getResolutionResult() {
+ if (sub.isCanceled())
+ return Status.CANCEL_STATUS;
+ return new Status(IStatus.ERROR, Constants.Bundle_ID, Messages.ImportWizard_CannotQuerySelection);
}
- }
+ };
+ } else {
+ operation = getProfileChangeOperation(planSelections);
+ operation.setProvisioningContext(context);
}
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- planChanged();
+ });
+ if (sub.isCanceled())
+ throw new InterruptedException();
+ if (operation.resolveModal(sub.newChild(200)).getSeverity() == IStatus.CANCEL)
+ throw new InterruptedException();
+ else {
+ if (withRemediation) {
+ IStatus status = operation.getResolutionResult();
+ if (remediationPage != null && shouldRemediate(status)) {
+ computeRemediationOperation(operation, ui, monitor);
}
- });
+ }
}
+ Display.getDefault().asyncExec(() -> planChanged());
});
} catch (InterruptedException e) {
operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) {
+ @Override
public IStatus getResolutionResult() {
return Status.CANCEL_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/StyledErrorDialog.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/StyledErrorDialog.java
index 592c67b5a..f062a0886 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/StyledErrorDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/StyledErrorDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 WindRiver Corporation and others.
+ * Copyright (c) 2015, 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
@@ -114,11 +114,12 @@ public class StyledErrorDialog extends MessageDialog {
text.setBackground(composite.getBackground());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo(toolkitComp);
text.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
public void linkActivated(HyperlinkEvent event) {
try {
URI uri = URI.create((String) event.data);
if ("pref".equals(uri.getScheme())) { //$NON-NLS-1$
- Map<String, String> para = new HashMap<String, String>();
+ Map<String, String> para = new HashMap<>();
para.put(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID, uri.getAuthority());
Command prefCommand = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class).getCommand(IWorkbenchCommandConstants.WINDOW_PREFERENCES);
prefCommand.executeWithChecks(new ExecutionEvent(prefCommand, para, null, null));
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FParser.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FParser.java
index fc755e86d..444f14763 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FParser.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2016 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
@@ -65,7 +65,7 @@ public class P2FParser extends XMLParser implements P2FConstants {
public RepositoriesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, REPOSITORIES_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- uris = (size == null) ? new ArrayList<URI>() : new ArrayList<URI>(Integer.parseInt(size));
+ uris = (size == null) ? new ArrayList<>() : new ArrayList<>(Integer.parseInt(size));
}
@Override
@@ -124,7 +124,7 @@ public class P2FParser extends XMLParser implements P2FConstants {
public IUsHandler(ContentHandler parentHandler, Attributes attributes) {
super(parentHandler, IUS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- ius = (size != null ? new ArrayList<IUDetail>(Integer.parseInt(size)) : new ArrayList<IUDetail>());
+ ius = (size != null ? new ArrayList<>(Integer.parseInt(size)) : new ArrayList<>());
}
@Override
@@ -225,7 +225,7 @@ public class P2FParser extends XMLParser implements P2FConstants {
public List<IUDetail> getIUs() {
if (iusListed == null) {
- iusListed = new ArrayList<IUDetail>();
+ iusListed = new ArrayList<>();
}
return iusListed;
}

Back to the top