Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2021-03-29 13:18:46 +0000
committerLars Vogel2021-03-30 12:57:12 +0000
commitef53f46eaa75fa0899938d2969f83b0904d83970 (patch)
treece43c6ac0da4e9ac78edb9d65ffeb4dbd9d39494 /bundles/org.eclipse.equinox.p2.ui.importexport/src
parentedf1f0107360bee23e0abdb3d19e0e965b82e7bd (diff)
downloadrt.equinox.p2-ef53f46eaa75fa0899938d2969f83b0904d83970.tar.gz
rt.equinox.p2-ef53f46eaa75fa0899938d2969f83b0904d83970.tar.xz
rt.equinox.p2-ef53f46eaa75fa0899938d2969f83b0904d83970.zip
Bug 572410 - Remove activator from org.eclipse.equinox.p2.ui.imp
Uses new API from Bug 549929 to access the dialog settings. This way we can remove the activator. Change-Id: I3fe5aabedd94463f8e547c8256639ae180da1146 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.importexport/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java33
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportWizard.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationWizard.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportWizard.java37
4 files changed, 45 insertions, 58 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java
deleted file mode 100644
index 0be4d6f81..000000000
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportActivator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 WindRiver Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * WindRiver Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.importexport.internal;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-public class ImportExportActivator extends AbstractUIPlugin {
-
- private static ImportExportActivator instance = null;
-
- public static ImportExportActivator getDefault() {
- return instance;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- instance = this;
- }
-}
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 33f7a1ee7..07e3d9654 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
@@ -15,19 +15,21 @@ package org.eclipse.equinox.internal.p2.importexport.internal.wizard;
import java.io.File;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.internal.p2.importexport.internal.*;
+import org.eclipse.equinox.internal.p2.importexport.internal.Constants;
+import org.eclipse.equinox.internal.p2.importexport.internal.Messages;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.*;
+import org.osgi.framework.FrameworkUtil;
public class ExportWizard extends AbstractWizard implements IExportWizard {
public ExportWizard() {
- IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ExportWizard.class)).getDialogSettings();
String sectionName = "ExportWizard"; //$NON-NLS-1$
IDialogSettings section = workbenchSettings.getSection(sectionName);
if (section == null) {
@@ -46,7 +48,8 @@ public class ExportWizard extends AbstractWizard implements IExportWizard {
@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$
+ setDefaultPageImageDescriptor(ImageDescriptor
+ .createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$
setNeedsProgressMonitor(true);
}
@@ -54,7 +57,8 @@ public class ExportWizard extends AbstractWizard implements IExportWizard {
public boolean performFinish() {
File file = new File(((ExportPage) mainPage).getDestinationValue());
if (file.exists()) {
- if (!MessageDialog.openConfirm(this.getShell(), Messages.ExportWizard_ConfirmDialogTitle, NLS.bind(Messages.ExportWizard_OverwriteConfirm, file.getAbsolutePath())))
+ if (!MessageDialog.openConfirm(this.getShell(), Messages.ExportWizard_ConfirmDialogTitle,
+ NLS.bind(Messages.ExportWizard_OverwriteConfirm, file.getAbsolutePath())))
return false;
}
return super.performFinish();
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 0fb83516b..8d4568601 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
@@ -15,7 +15,8 @@ package org.eclipse.equinox.internal.p2.importexport.internal.wizard;
import java.util.Collection;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.internal.p2.importexport.internal.*;
+import org.eclipse.equinox.internal.p2.importexport.internal.Constants;
+import org.eclipse.equinox.internal.p2.importexport.internal.Messages;
import org.eclipse.equinox.internal.p2.ui.dialogs.ISelectableIUsPage;
import org.eclipse.equinox.internal.p2.ui.dialogs.InstallWizard;
import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
@@ -27,8 +28,8 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.*;
+import org.osgi.framework.FrameworkUtil;
public class ImportFromInstallationWizard extends InstallWizard implements IImportWizard {
@@ -36,9 +37,12 @@ public class ImportFromInstallationWizard extends InstallWizard implements IImpo
this(ProvisioningUI.getDefaultUI(), null, null, null);
}
- public ImportFromInstallationWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) {
+ public ImportFromInstallationWizard(ProvisioningUI ui, InstallOperation operation,
+ Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) {
super(ui, operation, initialSelections, preloadJob);
- IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ImportFromInstallationWizard.class))
+ .getDialogSettings();
String sectionName = "ImportFromInstallationWizard"; //$NON-NLS-1$
IDialogSettings section = workbenchSettings.getSection(sectionName);
if (section == null) {
@@ -50,7 +54,8 @@ public class ImportFromInstallationWizard extends InstallWizard implements IImpo
@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$
+ setDefaultPageImageDescriptor(ImageDescriptor
+ .createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$
setNeedsProgressMonitor(true);
}
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 075f603fa..22a8b1905 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
@@ -19,7 +19,8 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.importexport.internal.*;
+import org.eclipse.equinox.internal.p2.importexport.internal.Constants;
+import org.eclipse.equinox.internal.p2.importexport.internal.Messages;
import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.dialogs.ISelectableIUsPage;
@@ -36,9 +37,9 @@ import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.*;
import org.eclipse.ui.statushandlers.StatusManager;
+import org.osgi.framework.FrameworkUtil;
public class ImportWizard extends InstallWizard implements IImportWizard {
@@ -46,9 +47,12 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
this(ProvisioningUI.getDefaultUI(), null, null, null);
}
- public ImportWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections, LoadMetadataRepositoryJob preloadJob) {
+ public ImportWizard(ProvisioningUI ui, InstallOperation operation, Collection<IInstallableUnit> initialSelections,
+ LoadMetadataRepositoryJob preloadJob) {
super(ui, operation, initialSelections, preloadJob);
- IDialogSettings workbenchSettings = ImportExportActivator.getDefault().getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ImportFromInstallationWizard.class))
+ .getDialogSettings();
String sectionName = "ImportWizard"; //$NON-NLS-1$
IDialogSettings section = workbenchSettings.getSection(sectionName);
if (section == null) {
@@ -60,7 +64,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
@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$
+ setDefaultPageImageDescriptor(ImageDescriptor
+ .createFromURL(Platform.getBundle(Constants.Bundle_ID).getEntry("icons/wizban/install_wiz.png"))); //$NON-NLS-1$
setNeedsProgressMonitor(true);
}
@@ -80,8 +85,9 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
}
/**
- * Recompute the provisioning plan based on the items in the IUElementListRoot and the given provisioning context.
- * Report progress using the specified runnable context. This method may be called before the page is created.
+ * Recompute the provisioning plan based on the items in the IUElementListRoot
+ * and the given provisioning context. Report progress using the specified
+ * runnable context. This method may be called before the page is created.
*
* @param runnableContext
*/
@@ -98,9 +104,11 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
ProvisioningContext context = getProvisioningContext();
initializeResolutionModelElements(getOperationSelections());
if (planSelections.length == 0) {
- operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) {
+ operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent),
+ new ArrayList<IInstallableUnit>()) {
@Override
- protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor progressMonitor) {
+ protected void computeProfileChangeRequest(MultiStatus status,
+ IProgressMonitor progressMonitor) {
progressMonitor.done();
}
@@ -108,7 +116,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
public IStatus getResolutionResult() {
if (sub.isCanceled())
return Status.CANCEL_STATUS;
- return new Status(IStatus.ERROR, Constants.Bundle_ID, Messages.ImportWizard_CannotQuerySelection);
+ return new Status(IStatus.ERROR, Constants.Bundle_ID,
+ Messages.ImportWizard_CannotQuerySelection);
}
};
} else {
@@ -129,7 +138,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
Display.getDefault().asyncExec(this::planChanged);
});
} catch (InterruptedException e) {
- operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent), new ArrayList<IInstallableUnit>()) {
+ operation = new InstallOperation(new ProvisioningSession(AbstractPage.agent),
+ new ArrayList<IInstallableUnit>()) {
@Override
public IStatus getResolutionResult() {
@@ -149,7 +159,8 @@ public class ImportWizard extends InstallWizard implements IImportWizard {
if (message != null) {
couldNotResolveStatus = new Status(IStatus.ERROR, Constants.Bundle_ID, message, null);
} else {
- couldNotResolveStatus = new Status(IStatus.ERROR, Constants.Bundle_ID, ProvUIMessages.ProvisioningOperationWizard_UnexpectedFailureToResolve, null);
+ couldNotResolveStatus = new Status(IStatus.ERROR, Constants.Bundle_ID,
+ ProvUIMessages.ProvisioningOperationWizard_UnexpectedFailureToResolve, null);
}
StatusManager.getManager().handle(couldNotResolveStatus, StatusManager.LOG);
}

Back to the top