viewsFromEditor = getViewsFromEditor(activeEditor, semanticElements);
if (viewsFromEditor.isEmpty()) {
- return new Status(IStatus.INFO, CapellaNavigatorPlugin.PLUGIN_ID,
+ return new Status(IStatus.INFO, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
Messages.ShowInDiagramAction_UnknownElement_Message);
}
@@ -99,7 +99,7 @@ public IStatus runWithStatus() {
// return a status containing the reason
DDiagramElement diagramElement = viewsFromEditor.iterator().next();
String message = getUnavailableElementMessage(diagramElement);
- return new Status(IStatus.INFO, CapellaNavigatorPlugin.PLUGIN_ID, message);
+ return new Status(IStatus.INFO, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), message);
}
if (activeEditor instanceof DialectEditor) {
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.navigator/src/org/polarsys/capella/core/platform/sirius/ui/navigator/preferences/CapellaNavigatorPreferencesInitializer.java b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.navigator/src/org/polarsys/capella/core/platform/sirius/ui/navigator/preferences/CapellaNavigatorPreferencesInitializer.java
index 06ff15ffc4..3ac75332ce 100644
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.navigator/src/org/polarsys/capella/core/platform/sirius/ui/navigator/preferences/CapellaNavigatorPreferencesInitializer.java
+++ b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.navigator/src/org/polarsys/capella/core/platform/sirius/ui/navigator/preferences/CapellaNavigatorPreferencesInitializer.java
@@ -13,9 +13,8 @@
package org.polarsys.capella.core.platform.sirius.ui.navigator.preferences;
import org.eclipse.jface.preference.IPreferenceStore;
-
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.AbstractPreferencesInitializer;
-import org.polarsys.capella.core.platform.sirius.ui.navigator.CapellaNavigatorPlugin;
import org.polarsys.capella.core.preferences.Activator;
/**
@@ -25,7 +24,7 @@ public class CapellaNavigatorPreferencesInitializer extends AbstractPreferencesI
/**
*/
public CapellaNavigatorPreferencesInitializer() {
- super(CapellaNavigatorPlugin.PLUGIN_ID);
+ super(FrameworkUtil.getBundle(CapellaNavigatorPreferencesInitializer.class).getSymbolicName());
}
/**
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/META-INF/MANIFEST.MF
index 06be5884ed..20292d3b8e 100644
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.platform.sirius.ui.perspective;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.platform.sirius.ui.PerspectivePlugin
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Export-Package: org.polarsys.capella.core.platform.sirius.ui,
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/src/org/polarsys/capella/core/platform/sirius/ui/PerspectivePlugin.java b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/src/org/polarsys/capella/core/platform/sirius/ui/PerspectivePlugin.java
deleted file mode 100644
index 8a20859d89..0000000000
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.perspective/src/org/polarsys/capella/core/platform/sirius/ui/PerspectivePlugin.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-
-package org.polarsys.capella.core.platform.sirius.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class PerspectivePlugin extends AbstractUIPlugin {
- /**
- * The shared instance
- */
- private static PerspectivePlugin __plugin;
-
- /*
- *
- */
- public static final String PLUGIN_ID = "org.polarsys.capella.core.platform.sirius.ui.perspective"; //$NON-NLS-1$
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context_p) throws Exception {
- super.start(context_p);
- __plugin = this;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context_p) throws Exception {
- super.stop(context_p);
- __plugin = null;
- }
-
- /**
- * Returns the shared instance
- * @return the shared instance
- */
- public static PerspectivePlugin getDefault() {
- return __plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/CapellaProjectActivator.java b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/CapellaProjectActivator.java
index 4d9b091f0a..130de6463c 100644
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/CapellaProjectActivator.java
+++ b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/CapellaProjectActivator.java
@@ -30,8 +30,6 @@ public class CapellaProjectActivator extends AbstractUIActivator implements ISta
// The shared instance
private static CapellaProjectActivator __plugin;
- public static final String PLUGIN_ID = "org.polarsys.capella.core.platform.sirius.ui.project"; //$NON-NLS-1$
-
private MonitorFileSyncJob monitorFileSyncJob = new MonitorFileSyncJob();
/**
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/NewProjectWizard.java b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/NewProjectWizard.java
index 84f1d3417c..52ec6f261c 100644
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/NewProjectWizard.java
+++ b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/NewProjectWizard.java
@@ -49,7 +49,7 @@
import org.polarsys.capella.core.platform.sirius.ui.project.operations.ProjectSessionCreationHelper;
import org.polarsys.capella.core.platform.sirius.ui.project.operations.SessionCreationHelper;
import org.polarsys.capella.core.preferences.configuration.project.nature.ConfigurationProjectNature;
-import org.polarsys.capella.core.preferences.configuration.project.ui.wizards.ReferecedConfigurationProjectSelectionPage;
+import org.polarsys.capella.core.preferences.configuration.project.ui.wizards.ReferencedConfigurationProjectSelectionPage;
import org.polarsys.capella.core.sirius.ui.actions.OpenSessionAction;
/**
@@ -74,7 +74,7 @@ public class NewProjectWizard extends BasicNewResourceWizard {
private WizardPage viewpointWizardPage;
- private ReferecedConfigurationProjectSelectionPage referencedConfigurationProjectPage;
+ private ReferencedConfigurationProjectSelectionPage referencedConfigurationProjectPage;
/**
* Constructs the wizard allowing to initialize a new Capella project.
@@ -105,7 +105,7 @@ public void addPages() {
*/
protected void createReferencedConfigurationProjectsPage() {
referencedConfigurationProjectPage =
- new ReferecedConfigurationProjectSelectionPage(Messages.getString("NewModelWizard.title"), new String[] { ConfigurationProjectNature.NATURE_ID });
+ new ReferencedConfigurationProjectSelectionPage(Messages.getString("NewModelWizard.title"), new String[] { ConfigurationProjectNature.NATURE_ID });
addPage(referencedConfigurationProjectPage);
}
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/WizardNewProjectCreationPage.java b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/WizardNewProjectCreationPage.java
index d987d532fa..e9b26738b7 100644
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/WizardNewProjectCreationPage.java
+++ b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/WizardNewProjectCreationPage.java
@@ -46,7 +46,7 @@
import org.polarsys.capella.core.model.handler.command.CapellaResourceNamingHelper;
import org.polarsys.capella.core.model.handler.helpers.CapellaProjectHelper;
import org.polarsys.capella.core.model.handler.helpers.CapellaProjectHelper.ProjectApproach;
-import org.polarsys.capella.core.model.preferences.CapellaModelPreferencesPlugin;
+import org.polarsys.capella.core.model.preferences.helpers.PreferencesHelper;
import org.polarsys.capella.core.platform.sirius.ui.project.internal.ProjectContentsLocationArea.IErrorMessageReporter;
/**
@@ -204,7 +204,7 @@ protected void createProjectApproachGroup(Composite parent) {
}
selectedButton.setSelection(true);
- boolean isReuseOfComponentsAllowed = CapellaModelPreferencesPlugin.getDefault().isReuseOfComponentsAllowed();
+ boolean isReuseOfComponentsAllowed = PreferencesHelper.isReuseOfComponentsAllowed();
radioRC.setEnabled(isReuseOfComponentsAllowed);
radioSC.setEnabled(isReuseOfComponentsAllowed);
radioBox.setEnabled(isReuseOfComponentsAllowed);
diff --git a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/preferences/PreferencesInitializer.java b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/preferences/PreferencesInitializer.java
index 648f1f4816..7caac91d58 100644
--- a/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/preferences/PreferencesInitializer.java
+++ b/core/plugins/org.polarsys.capella.core.platform.sirius.ui.project/src/org/polarsys/capella/core/platform/sirius/ui/project/internal/preferences/PreferencesInitializer.java
@@ -13,8 +13,8 @@
package org.polarsys.capella.core.platform.sirius.ui.project.internal.preferences;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.AbstractPreferencesInitializer;
-import org.polarsys.capella.core.platform.sirius.ui.project.CapellaProjectActivator;
import org.polarsys.capella.core.preferences.Activator;
/**
@@ -25,7 +25,7 @@ public class PreferencesInitializer extends AbstractPreferencesInitializer {
* @param pluginID_p
*/
public PreferencesInitializer() {
- super(CapellaProjectActivator.PLUGIN_ID);
+ super(FrameworkUtil.getBundle(PreferencesInitializer.class).getSymbolicName());
}
/**
diff --git a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/META-INF/MANIFEST.MF
index 9a3d183004..eba093b9bd 100644
--- a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/META-INF/MANIFEST.MF
@@ -15,8 +15,6 @@ Export-Package: org.polarsys.capella.core.preferences.configuration.project,
org.polarsys.capella.core.preferences.configuration.project.actions,
org.polarsys.capella.core.preferences.configuration.project.nature,
org.polarsys.capella.core.preferences.configuration.project.ui.wizards,
- org.polarsys.capella.core.preferences.project.configuration.project,
- org.polarsys.capella.core.preferences.trasferers
-Bundle-Activator: org.polarsys.capella.core.preferences.project.configuration.project.ConfigurationPlugin
+ org.polarsys.capella.core.preferences.transferers
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ProjectWizard.java b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ProjectWizard.java
index 18ddc2004b..e2e18189b9 100644
--- a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ProjectWizard.java
+++ b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ProjectWizard.java
@@ -33,10 +33,12 @@
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.preferences.configuration.project.nature.ConfigurationProjectNature;
-import org.polarsys.capella.core.preferences.configuration.project.ui.wizards.ReferecedConfigurationProjectSelectionPage;
-import org.polarsys.capella.core.preferences.project.configuration.project.ConfigurationPlugin;
+import org.polarsys.capella.core.preferences.configuration.project.ui.wizards.ReferencedConfigurationProjectSelectionPage;
+import org.polarsys.capella.core.preferences.project.configuration.utils.Utils;
/**
*
@@ -46,6 +48,8 @@ public class ProjectWizard extends BasicNewResourceWizard {
private static final int STEP_TICK_COUNT = 100;
private static final String CAPELLA_PROJECT_NATURE_ID = "org.polarsys.capella.project.nature";
+
+ public static final String PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG = "config_project_wizard.gif"; //$NON-NLS-1$
// Reuse of the new project page provided by the platform UI dialogs.
protected WizardProjectCreationPage _localProjectDescriptionPage;
@@ -53,7 +57,7 @@ public class ProjectWizard extends BasicNewResourceWizard {
// The New Model wizard page.
protected NewModelWizardPage _modelPage;
- private ReferecedConfigurationProjectSelectionPage referencersProjectsPage;
+ private ReferencedConfigurationProjectSelectionPage referencersProjectsPage;
public static ProjectScope projectScope;
@@ -74,8 +78,8 @@ public void addPages() {
protected void createReferencersProjectsPages() {
referencersProjectsPage =
- new ReferecedConfigurationProjectSelectionPage("Capella Configuration Project", "Referencers Capella Project",
- ConfigurationPlugin.getImageDescriptor(ConfigurationPlugin.PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG),
+ new ReferencedConfigurationProjectSelectionPage("Capella Configuration Project", "Referencers Capella Project",
+ Utils.getImageDescriptor(PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG),
new String[] { CAPELLA_PROJECT_NATURE_ID });
addPage(referencersProjectsPage);
@@ -108,7 +112,7 @@ protected ProjectContentsLocationArea handleDefaultProjectLocation(Composite par
mainPage.setInitialProjectName(null);
mainPage.setDescription("Create a new project configuration"); //$NON-NLS-1$
mainPage.setTitle("Capella Configuration Project"); //$NON-NLS-1$
- mainPage.setImageDescriptor(ConfigurationPlugin.getWizadrConfigurationProjectIcon());
+ mainPage.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), Utils.ICONS_PATH + PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG));
return mainPage;
}
diff --git a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ui/wizards/ReferecedConfigurationProjectSelectionPage.java b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ui/wizards/ReferencedConfigurationProjectSelectionPage.java
similarity index 89%
rename from core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ui/wizards/ReferecedConfigurationProjectSelectionPage.java
rename to core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ui/wizards/ReferencedConfigurationProjectSelectionPage.java
index 8b0c91ae76..6aac56330f 100644
--- a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ui/wizards/ReferecedConfigurationProjectSelectionPage.java
+++ b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/configuration/project/ui/wizards/ReferencedConfigurationProjectSelectionPage.java
@@ -28,8 +28,10 @@
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
@@ -54,13 +56,14 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE.SharedImages;
import org.polarsys.capella.core.preferences.configuration.project.ConfigurationProject;
+import org.polarsys.capella.core.preferences.configuration.project.ProjectWizard;
import org.polarsys.capella.core.preferences.configuration.project.nature.ConfigurationProjectNature;
-import org.polarsys.capella.core.preferences.project.configuration.project.ConfigurationPlugin;
+import org.polarsys.capella.core.preferences.project.configuration.utils.Utils;
/**
* A class which to show swt widgets with available viewpoints.
*/
-public final class ReferecedConfigurationProjectSelectionPage extends WizardPage {
+public final class ReferencedConfigurationProjectSelectionPage extends WizardPage {
/*
*
@@ -79,16 +82,16 @@ public final class ReferecedConfigurationProjectSelectionPage extends WizardPage
/**
* @param pageName_p
*/
- public ReferecedConfigurationProjectSelectionPage(String pageName_p, String[] projectsNaturesIds) {
- this(pageName_p, "Referenced Capella Configuration Project", ConfigurationPlugin
- .getImageDescriptor(ConfigurationPlugin.PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG), projectsNaturesIds);
+ public ReferencedConfigurationProjectSelectionPage(String pageName_p, String[] projectsNaturesIds) {
+ this(pageName_p, "Referenced Capella Configuration Project", Utils
+ .getImageDescriptor(ProjectWizard.PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG), projectsNaturesIds);
initilizeSelectedProject(projectsNaturesIds);
}
/**
* @param pageName_p
*/
- public ReferecedConfigurationProjectSelectionPage(String pageName_p, String title, ImageDescriptor imageDescriptor_p, String[] all) {
+ public ReferencedConfigurationProjectSelectionPage(String pageName_p, String title, ImageDescriptor imageDescriptor_p, String[] all) {
super(pageName_p, title, imageDescriptor_p);
initilizeSelectedProject(all);
this.labelProvider = new WizardTableLabelProvider();
@@ -312,14 +315,16 @@ private Image getOtherProjectIcon() {
IWorkbench workbench = PlatformUI.getWorkbench();
ISharedImages sharedImages = workbench.getSharedImages();
Image image = sharedImages.getImage(SharedImages.IMG_OBJ_PROJECT);
- image = ConfigurationPlugin.getOverlayedDescriptor(image, "capella_8x8.png").createImage();
+ final ImageDescriptor decoratorDescriptor = Utils.getImageDescriptor("capella_8x8.png");
+ image = new DecorationOverlayIcon(image, decoratorDescriptor, IDecoration.TOP_RIGHT).createImage();
return image;
}
private Image getConfigurationProjectIcon() {
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
Image image = sharedImages.getImage(SharedImages.IMG_OBJ_PROJECT);
- image = ConfigurationPlugin.getOverlayedDescriptor(image, "config_8x8.gif").createImage();
+ final ImageDescriptor decoratorDescriptor = Utils.getImageDescriptor("config_8x8.gif");
+ image = new DecorationOverlayIcon(image, decoratorDescriptor, IDecoration.TOP_RIGHT).createImage();
return image;
}
@@ -334,9 +339,9 @@ public Image getImage(final Object element) {
case 0:
if (element instanceof ConfigurationProject) {
final ConfigurationProject vp = (ConfigurationProject) element;
- image = ConfigurationPlugin.getImageDescriptor("disabled_checkbox.gif").createImage();
+ image = Utils.getImageDescriptor("disabled_checkbox.gif").createImage();
if (vp.getIsSelected()) {
- image = ConfigurationPlugin.getImageDescriptor("enabled_checkbox.gif").createImage();
+ image = Utils.getImageDescriptor("enabled_checkbox.gif").createImage();
}
}
break;
diff --git a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/project/configuration/project/ConfigurationPlugin.java b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/project/configuration/project/ConfigurationPlugin.java
deleted file mode 100644
index a8550551b9..0000000000
--- a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/project/configuration/project/ConfigurationPlugin.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.preferences.project.configuration.project;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DecorationOverlayIcon;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.swt.graphics.Image;
-import org.osgi.framework.BundleContext;
-
-public class ConfigurationPlugin extends Plugin {
-
- private static ConfigurationPlugin plugin;
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.preferences.project.configuration";//$NON-NLS-1$
-
- private static final String ICONS = "icons/"; //$NON-NLS-1$
-
- public static final String PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG = "config_project_wizard.gif"; //$NON-NLS-1$
-
- /**
- * The constructor
- */
- public ConfigurationPlugin() {
- super();
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- * @return the shared instance
- */
- public static ConfigurationPlugin getDefault() {
- return plugin;
- }
-
- /**
- *
- * Returns an {@link ImageDescriptor}whose path, relative to the plugin directory's icons/ directory, is imageFile
. If the image
- * descriptor cannot be created, either because the file does not exist or because of an internal error, then the result is the Eclipse default
- * "missing image" descriptor.
- *
- *
- * Note that the file specified must not have any leading "." or path separators "/" or "\". It is strictly relative to the icons/ directory.
- * @param imageFile the name of the image file to retrieve
- * @return the corresponding image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String imageFile) {
- URL fullPath = FileLocator.find(getDefault().getBundle(), new Path(ICONS + imageFile), null);
- if (fullPath != null) {
- return ImageDescriptor.createFromURL(fullPath);
- }
-
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- public static ImageDescriptor getWizadrConfigurationProjectIcon() {
-
- return getImageDescriptor(ConfigurationPlugin.PROJECT_WIZARD_CONFIGURATION_FOLDER_IMG);
- }
-
- /**
- * @param baseImage
- * @param decoratorPath
- * @return
- */
- public static ImageDescriptor getOverlayedDescriptor(final Image baseImage, final String decoratorPath) {
- final ImageDescriptor decoratorDescriptor = ConfigurationPlugin.getImageDescriptor(decoratorPath);
- return new DecorationOverlayIcon(baseImage, decoratorDescriptor, IDecoration.TOP_RIGHT);
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/project/configuration/utils/Utils.java b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/project/configuration/utils/Utils.java
new file mode 100644
index 0000000000..a4815871b7
--- /dev/null
+++ b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/project/configuration/utils/Utils.java
@@ -0,0 +1,37 @@
+package org.polarsys.capella.core.preferences.project.configuration.utils;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+public class Utils {
+
+ Utils() {}
+
+ public static final String ICONS_PATH = "icons/"; //$NON-NLS-1$
+
+ /**
+ *
+ * Returns an {@link ImageDescriptor}whose path, relative to the plugin directory's icons/ directory, is imageFile
. If the image
+ * descriptor cannot be created, either because the file does not exist or because of an internal error, then the result is the Eclipse default
+ * "missing image" descriptor.
+ *
+ *
+ * Note that the file specified must not have any leading "." or path separators "/" or "\". It is strictly relative to the icons/ directory.
+ * @param imageFile the name of the image file to retrieve
+ * @return the corresponding image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String imageFile) {
+ Bundle bundle = FrameworkUtil.getBundle(Utils.class);
+ URL fullPath = FileLocator.find(bundle, new Path(ICONS_PATH + imageFile), null);
+ if (fullPath != null) {
+ return ImageDescriptor.createFromURL(fullPath);
+ }
+
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+}
diff --git a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/trasferers/WizardPreferencesTransfererExportPage.java b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/transferers/WizardPreferencesTransfererExportPage.java
similarity index 99%
rename from core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/trasferers/WizardPreferencesTransfererExportPage.java
rename to core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/transferers/WizardPreferencesTransfererExportPage.java
index 9b06905b6f..3be039d012 100644
--- a/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/trasferers/WizardPreferencesTransfererExportPage.java
+++ b/core/plugins/org.polarsys.capella.core.preferences.project.configuration/src/org/polarsys/capella/core/preferences/transferers/WizardPreferencesTransfererExportPage.java
@@ -10,7 +10,7 @@
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
-package org.polarsys.capella.core.preferences.trasferers;
+package org.polarsys.capella.core.preferences.transferers;
import java.io.File;
import java.io.FileOutputStream;
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/CommandsPreferencesInitializer.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/CommandsPreferencesInitializer.java
index 59f01058fb..e49842c655 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/CommandsPreferencesInitializer.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/CommandsPreferencesInitializer.java
@@ -21,10 +21,9 @@
import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin;
-
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.IItemDescriptor;
import org.polarsys.capella.core.commands.preferences.service.PreferencesItemsRegistry;
-import org.polarsys.capella.core.preferences.Activator;
/**
*/
@@ -38,7 +37,7 @@ public void initializeDefaultPreferences() {
Collection constraints = PreferencesItemsRegistry.getInstance().getAllDescriptors();
- IEclipsePreferences eclipsePreferenceNode = new DefaultScope().getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences eclipsePreferenceNode = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
for (IItemDescriptor capellaPreferenceNode : constraints) {
eclipsePreferenceNode.put(capellaPreferenceNode.getId(), String.valueOf(capellaPreferenceNode.isEnabledByDefault()));
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/preferences/ConfigurabilityPreferences.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/preferences/ConfigurabilityPreferences.java
index 6808775a0e..174f584055 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/preferences/ConfigurabilityPreferences.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/preferences/ConfigurabilityPreferences.java
@@ -15,20 +15,20 @@
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.service.prefs.BackingStoreException;
import org.polarsys.capella.core.commands.preferences.properties.PreferencesHandler;
import org.polarsys.capella.core.commands.preferences.service.IItemDescriptor;
import org.polarsys.capella.core.commands.preferences.service.PreferencesItemsRegistry;
-import org.polarsys.capella.core.preferences.Activator;
/**
* Preferences manager for the commands plug-in.
*/
public class ConfigurabilityPreferences {
- private static final IEclipsePreferences defaultScopPref = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ private static final IEclipsePreferences defaultScopPref = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(ConfigurabilityPreferences.class).getSymbolicName());
- private static final IEclipsePreferences instanceScopPrefs = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ private static final IEclipsePreferences instanceScopPrefs = InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(ConfigurabilityPreferences.class).getSymbolicName());
/**
* Not instantiable, as all features are static.
@@ -43,7 +43,7 @@ private ConfigurabilityPreferences() {
public static void save() {
try {
- InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).flush();
+ InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(ConfigurabilityPreferences.class).getSymbolicName()).flush();
instanceScopPrefs.flush();
} catch (BackingStoreException exception) {
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/CapellaCommandsPreferencesPropertyTester.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/CapellaCommandsPreferencesPropertyTester.java
index 728c708015..b844f9e765 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/CapellaCommandsPreferencesPropertyTester.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/CapellaCommandsPreferencesPropertyTester.java
@@ -15,9 +15,9 @@
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.IItemDescriptor;
import org.polarsys.capella.core.commands.preferences.service.PreferencesItemsRegistry;
-import org.polarsys.capella.core.preferences.Activator;
public class CapellaCommandsPreferencesPropertyTester extends PropertyTester {
@@ -42,7 +42,7 @@ public boolean test(Object receiver, String property, Object[] args, Object expe
|| CAPELLA_CMD_MODELING_PREFERENCES_PROPERTY.equals(property)) {
IItemDescriptor itemDescriptor = PreferencesItemsRegistry.getInstance().getDescriptor((String) expectedValue);
boolean defaultValue = itemDescriptor != null ? itemDescriptor.isEnabledByDefault() : true;
- IEclipsePreferences commandsPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences commandsPreferences = InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
return commandsPreferences.getBoolean((String) expectedValue, defaultValue);
}
return false;
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/PreferencesHandler.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/PreferencesHandler.java
index 77bade0fe3..9c32611ce0 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/PreferencesHandler.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/properties/PreferencesHandler.java
@@ -40,6 +40,7 @@
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.menus.UIElement;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.IItemDescriptor;
import org.polarsys.capella.core.commands.preferences.service.PreferencesItemsRegistry;
import org.polarsys.capella.core.preferences.Activator;
@@ -87,7 +88,7 @@ private void registerHandlerActivations(List activations) {
}
protected IEclipsePreferences getPreferences() {
- return InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ return InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
}
private List getRegisteredHandlerActivations(IHandlerService service, String commandId) {
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/AbstractItemDescriptor.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/AbstractItemDescriptor.java
index 9aaa7dac0b..97063712a7 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/AbstractItemDescriptor.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/AbstractItemDescriptor.java
@@ -18,7 +18,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.internalization.l10n.CustomPreferencesMessages;
import org.polarsys.capella.core.commands.preferences.internalization.l10n.CustomPreferencesStatusCodes;
import org.polarsys.capella.core.commands.preferences.model.CategoryPreferences;
@@ -228,7 +228,7 @@ protected void assertNotNull(Object value, String missingItem)
if (value == null) {
CoreException ce = new CoreException( new Status(
IStatus.ERROR,
- Activator.PLUGIN_ID,
+ FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
CustomPreferencesStatusCodes.ITEM_NOT_INITED,Activator.getMessage(ITEM_INCOMPLETE, missingItem),
null));
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/PropertyStore.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/PropertyStore.java
index 9cd2684144..803174f176 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/PropertyStore.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/PropertyStore.java
@@ -28,6 +28,7 @@
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.tools.report.config.registry.ReportManagerRegistry;
import org.polarsys.capella.common.tools.report.util.IReportManagerDefaultComponents;
import org.polarsys.capella.core.preferences.Activator;
@@ -77,12 +78,12 @@ public PropertyStore(IResource _resource, IPreferenceStore _workbenchStore) {
Activator.getDefault().setPropertyStore((IResource) _resource, this);
scope = new ProjectScope((IProject) resource);
- scope.getNode(Activator.PLUGIN_ID).addPreferenceChangeListener(this);
+ scope.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).addPreferenceChangeListener(this);
initilizeGuestListeners();
}
public void dispose() {
- scope.getNode(Activator.PLUGIN_ID).removePreferenceChangeListener(this);
+ scope.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).removePreferenceChangeListener(this);
}
/**
@@ -124,9 +125,9 @@ public void save() throws IOException {
try {
// to bypass other capella modeller preference page
if ((resource instanceof IProject) && !isCanceled) {
- resource.setPersistentProperty(new QualifiedName(Activator.PLUGIN_ID, USEPROJECTSETTINGS), TRUE); // idk if its useful
+ resource.setPersistentProperty(new QualifiedName(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), USEPROJECTSETTINGS), TRUE); // idk if its useful
writeProperties();
- scope.getNode(Activator.PLUGIN_ID).flush();
+ scope.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).flush();
}
} catch (Exception exception) {
@@ -139,7 +140,7 @@ public void save() throws IOException {
*/
private void writeProperties() throws IOException {
for (String name : preferenceNames()) {
- scope.getNode(Activator.PLUGIN_ID).put(name, getString(name));
+ scope.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).put(name, getString(name));
setProperty(name, getString(name));
}
}
@@ -155,8 +156,8 @@ private void writeProperties() throws IOException {
*/
private void setProperty(String name, String value) throws IOException {
try {
- scope.getNode(Activator.PLUGIN_ID).put(name, value);
- resource.setPersistentProperty(new QualifiedName(Activator.PLUGIN_ID, name), value);
+ scope.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).put(name, value);
+ resource.setPersistentProperty(new QualifiedName(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), name), value);
} catch (CoreException e) {
throw new IOException("PropertyStore.Cannot_write_resource_property" + name, e); //$NON-NLS-1$
}
@@ -326,7 +327,7 @@ private synchronized void insertValue(String name) {
* @throws CoreException
*/
private String getProperty(String name) throws CoreException {
- return resource.getPersistentProperty(new QualifiedName(Activator.PLUGIN_ID, name));
+ return resource.getPersistentProperty(new QualifiedName(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), name));
}
/*** Misc ***/
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/ScopedCapellaPreferencesStore.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/ScopedCapellaPreferencesStore.java
index 03d35315d2..83038775ef 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/ScopedCapellaPreferencesStore.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/service/ScopedCapellaPreferencesStore.java
@@ -31,6 +31,7 @@
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.service.prefs.BackingStoreException;
import org.polarsys.capella.common.tools.report.config.registry.ReportManagerRegistry;
import org.polarsys.capella.common.tools.report.util.IReportManagerDefaultComponents;
@@ -68,7 +69,7 @@ private ScopedCapellaPreferencesStore(String pluginId) {
public static ScopedCapellaPreferencesStore getInstance(String pluginID_p) {
if (instance == null) {
// 1953: We share the same preference store. we don't want use the first one loaded.
- instance = new ScopedCapellaPreferencesStore(Activator.PLUGIN_ID);
+ instance = new ScopedCapellaPreferencesStore(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
}
return instance;
}
@@ -88,8 +89,8 @@ public void firePropertyChangeEvent(String name, Object oldValue, Object newValu
protected static void putBoolean(IProject project, String optionName, boolean value) {
String key = project != null ? project.getName() + PREFERENCE_SEPARATOR + optionName : optionName;
- IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
- IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
+ IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
String instanceValue = Platform.getPreferencesService().get(optionName, null,
new IEclipsePreferences[] { instanceNode });
@@ -115,8 +116,8 @@ protected static void putBoolean(IProject project, String optionName, boolean va
protected static void putInt(IProject project, String optionName, int value) {
String key = project != null ? project.getName() + PREFERENCE_SEPARATOR + optionName : optionName;
- IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
- IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
+ IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
String instanceValue = Platform.getPreferencesService().get(optionName, null,
new IEclipsePreferences[] { instanceNode });
@@ -143,8 +144,8 @@ protected static void putString(IProject project, String optionName, String valu
String key = project != null ? project.getName() + PREFERENCE_SEPARATOR + optionName : optionName;
- IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
- IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
+ IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(ScopedCapellaPreferencesStore.class).getSymbolicName());
String instanceValue = Platform.getPreferencesService().get(optionName, null,
new IEclipsePreferences[] { instanceNode });
@@ -360,16 +361,16 @@ public void setValue(String name, boolean value) {
if (PreferencesHelper.hasConfigurationProject(project)) {
IProject configuration = PreferencesHelper.getReferencedProjectConfiguration(project);
if (getDefaultBoolean(name) == value) {
- new ProjectScope(configuration).getNode(Activator.PLUGIN_ID).remove(name);
+ new ProjectScope(configuration).getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).remove(name);
} else {
- new ProjectScope(configuration).getNode(Activator.PLUGIN_ID).putBoolean(name, value);
+ new ProjectScope(configuration).getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).putBoolean(name, value);
}
}
}
if (getDefaultBoolean(name) == value) {
- InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).remove(name);
+ InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).remove(name);
} else {
- InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).putBoolean(name, value);
+ InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).putBoolean(name, value);
}
}
@@ -384,25 +385,25 @@ public void setValue(String name, String value) {
IProject configuration = PreferencesHelper.getReferencedProjectConfiguration(project);
if (getDefaultString(name) == value) {
- new ProjectScope(configuration).getNode(Activator.PLUGIN_ID).remove(name);
+ new ProjectScope(configuration).getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).remove(name);
} else {
- new ProjectScope(configuration).getNode(Activator.PLUGIN_ID).put(name, value);
+ new ProjectScope(configuration).getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).put(name, value);
}
}
}
if (getDefaultString(name) == value) {
- InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).remove(name);
+ InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).remove(name);
} else {
- InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).put(name, value);
+ InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).put(name, value);
}
}
public void saveForExport() {
try {
- IEclipsePreferences defaultPreferences = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
- IEclipsePreferences instancePreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences defaultPreferences = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
+ IEclipsePreferences instancePreferences = InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
Collection instanceKeys = Arrays.asList(instancePreferences.keys());
for (String name: defaultPreferences.keys()) {
if (!instanceKeys.contains(name)) {
@@ -460,7 +461,7 @@ public boolean contains(String name) {
contexts = new IScopeContext[] { InstanceScope.INSTANCE, DefaultScope.INSTANCE };
}
- contains = service.getString(Activator.PLUGIN_ID, key, null, contexts) != null;
+ contains = service.getString(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), key, null, contexts) != null;
return contains;
}
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/CapellaPreferencesService.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/CapellaPreferencesService.java
index 62f89eaf9b..f42c5385db 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/CapellaPreferencesService.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/CapellaPreferencesService.java
@@ -28,10 +28,10 @@
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.validation.preferences.EMFModelValidationPreferences;
import org.eclipse.swt.widgets.Display;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.mdsofa.common.constant.ICommonConstants;
import org.polarsys.capella.common.tools.report.config.registry.ReportManagerRegistry;
import org.polarsys.capella.common.tools.report.util.IReportManagerDefaultComponents;
-import org.polarsys.capella.core.preferences.Activator;
public class CapellaPreferencesService {
@@ -170,7 +170,7 @@ private IEclipsePreferences convertFromProperties(Properties properties) {
}
current.put(key, value);
- InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID).put(key, value);
+ InstanceScope.INSTANCE.getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).put(key, value);
// new DefaultScope().getNode(Activator.PLUGIN_ID).put(key, value);
}
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/PreferencesHelper.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/PreferencesHelper.java
index 88208529a8..a2d3a32bd9 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/PreferencesHelper.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/PreferencesHelper.java
@@ -53,6 +53,7 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
import org.polarsys.capella.common.helpers.EcoreUtil2;
@@ -63,7 +64,6 @@
import org.polarsys.capella.core.data.capellamodeller.Project;
import org.polarsys.capella.core.model.handler.command.CapellaResourceHelper;
import org.polarsys.capella.core.model.handler.helpers.CapellaAdapterHelper;
-import org.polarsys.capella.core.preferences.Activator;
public class PreferencesHelper {
private PreferencesHelper() {
@@ -252,19 +252,19 @@ public static ScopedPreferenceStore getProjectScopeOld(IProject targetProject) {
IScopeContext scope = targetProject != null ? ScopedCapellaPreferencesStore.getProjectScope(targetProject) : null;
try {
if (scope != null) {
- IEclipsePreferences node = scope.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences node = scope.getNode(FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
node.flush();
ScopedCapellaPreferencesStore.getProjectContexts().put(targetProject.getProject(), scope);
- return new ScopedPreferenceStore(scope, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(scope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
} catch (Exception exception) {
StringBuilder loggerMessage = new StringBuilder("Activator.getProjectScope(..) _ "); //$NON-NLS-1$
__logger.error(loggerMessage.toString(), exception);
- return new ScopedPreferenceStore(scope, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(scope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
- return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(InstanceScope.INSTANCE, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
@@ -277,16 +277,16 @@ public static ScopedPreferenceStore getProjectScope(IProject targetProject) {
try {
if (scope != null) {
ScopedCapellaPreferencesStore.getProjectContexts().put(targetProject.getProject(), scope);
- return ScopedCapellaPreferencesStore.getInstance(Activator.PLUGIN_ID);
+ return ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
} catch (Exception exception) {
StringBuilder loggerMessage = new StringBuilder("Activator.getProjectScope(..) _ "); //$NON-NLS-1$
__logger.error(loggerMessage.toString(), exception);
- return new ScopedPreferenceStore(scope, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(scope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
- return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(InstanceScope.INSTANCE, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
@@ -298,19 +298,19 @@ public static ScopedPreferenceStore getDefaultProjectScope(IProject targetProjec
IScopeContext scope = targetProject != null ? ScopedCapellaPreferencesStore.getProjectScope(targetProject) : null;
try {
if (scope != null) {
- IEclipsePreferences node = scope.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences node = scope.getNode(FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
node.flush();
ScopedCapellaPreferencesStore.getProjectContexts().put(targetProject.getProject(), scope);
- return ScopedCapellaPreferencesStore.getInstance(Activator.PLUGIN_ID);
+ return ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
} catch (Exception exception) {
StringBuilder loggerMessage = new StringBuilder("Activator.getProjectScope(..) _ "); //$NON-NLS-1$
__logger.error(loggerMessage.toString(), exception);
- return new ScopedPreferenceStore(scope, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(scope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
- return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(InstanceScope.INSTANCE, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
@@ -322,19 +322,19 @@ public static ScopedPreferenceStore getDefaultProjectScopeOld(IProject targetPro
IScopeContext scope = targetProject != null ? ScopedCapellaPreferencesStore.getProjectScope(targetProject) : null;
try {
if (scope != null) {
- IEclipsePreferences node = scope.getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences node = scope.getNode(FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
node.flush();
ScopedCapellaPreferencesStore.getProjectContexts().put(targetProject.getProject(), scope);
- return new ScopedPreferenceStore(scope, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(scope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
} catch (Exception exception) {
StringBuilder loggerMessage = new StringBuilder("Activator.getProjectScope(..) _ "); //$NON-NLS-1$
__logger.error(loggerMessage.toString(), exception);
- return new ScopedPreferenceStore(scope, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(scope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
- return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
+ return new ScopedPreferenceStore(InstanceScope.INSTANCE, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName());
}
@@ -350,7 +350,7 @@ public static List getAllPreferencesStores() {
if (targetProject.isOpen() && targetProject.isAccessible()
&& (CapellaResourceHelper.isCapellaProject(targetProject))) {
IScopeContext projectScope = ScopedCapellaPreferencesStore.getProjectScope(targetProject);
- scopes.add(new ScopedPreferenceStore(projectScope, Activator.PLUGIN_ID));
+ scopes.add(new ScopedPreferenceStore(projectScope, FrameworkUtil.getBundle(PreferencesHelper.class).getSymbolicName()));
}
} catch (Exception exception) {
StringBuilder loggerMessage = new StringBuilder("PreferencesHelper.getAllStores(..) _ "); //$NON-NLS-1$
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/UserProfileDescriptor.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/UserProfileDescriptor.java
index 785aa2933f..1e3e4fa296 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/UserProfileDescriptor.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/commands/preferences/util/UserProfileDescriptor.java
@@ -13,11 +13,10 @@
package org.polarsys.capella.core.commands.preferences.util;
import org.eclipse.core.runtime.CoreException;
-
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.preferences.ConfigurabilityPreferences;
import org.polarsys.capella.core.commands.preferences.service.AbstractItemDescriptor;
import org.polarsys.capella.core.commands.preferences.service.PreferencesItemsRegistry;
-import org.polarsys.capella.core.preferences.Activator;
import org.polarsys.capella.core.preferences.commands.exceptions.ItemExistsException;
/**
@@ -32,8 +31,8 @@ public class UserProfileDescriptor extends AbstractItemDescriptor implements IUs
public UserProfileDescriptor(String userProfileModeId,String userProfileModeName) {
try {
- assertNotNull(userProfileModeId, Activator.PLUGIN_ID);
- assertNotNull(userProfileModeName, Activator.PLUGIN_ID);
+ assertNotNull(userProfileModeId, getPluginId());
+ assertNotNull(userProfileModeName, getPluginId());
PreferencesItemsRegistry.getInstance().registerUserProfile(this);
@@ -77,7 +76,7 @@ public String getId() {
*/
@Override
public String getPluginId() {
- return Activator.PLUGIN_ID;
+ return FrameworkUtil.getBundle(this.getClass()).getSymbolicName();
}
/**
diff --git a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/preferences/Activator.java b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/preferences/Activator.java
index 9e8167ab6d..08845c3d80 100644
--- a/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/preferences/Activator.java
+++ b/core/plugins/org.polarsys.capella.core.preferences/src/org/polarsys/capella/core/preferences/Activator.java
@@ -42,6 +42,7 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.service.event.Event;
import org.polarsys.capella.core.commands.preferences.internalization.l10n.CustomPreferencesMessages;
import org.polarsys.capella.core.commands.preferences.model.CategoryPreferences;
@@ -89,9 +90,6 @@ public class Activator extends AbstractUIPlugin {
*/
public static final String PREFERENCES_PROVIDERS_EXT_P_NAME = "capellaPreferences"; //$NON-NLS-1$
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.preferences"; //$NON-NLS-1$
-
// The shared instance
private static Activator plugin;
@@ -128,14 +126,14 @@ public void start(BundleContext context) throws Exception {
@Override
public void handleEvent(Event event) {
- ScopedCapellaPreferencesStore.getInstance(Activator.PLUGIN_ID).saveForExport();
+ ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).saveForExport();
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (IProject project : projects) {
if (PreferencesHelper.hasConfigurationProject(project)) {
try {
IProject configProject = PreferencesHelper.getReferencedProjectConfiguration(project);
- new ProjectScope(configProject).getNode(Activator.PLUGIN_ID).flush();
+ new ProjectScope(configProject).getNode(FrameworkUtil.getBundle(this.getClass()).getSymbolicName()).flush();
configProject.refreshLocal(IResource.DEPTH_INFINITE, null);
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (Exception exception) {
@@ -157,7 +155,7 @@ public void handleEvent(Event event) {
public IPreferenceStore getPreferenceStore() {
// Create the preference store lazily.
if (preferenceStore == null) {
- preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
+ preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
}
return preferenceStore;
}
@@ -202,7 +200,7 @@ public void removeExtension(IExtension extension, Object[] objects) {
extensionTracker.registerHandler(extensionHandler, null);
- IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID,
+ IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
Activator.PREFERENCES_PROVIDERS_EXT_P_NAME);
IExtensionTracker extTracker = Activator.getExtensionTracker();
if (extTracker != null) {
@@ -235,7 +233,7 @@ public static IExtensionTracker getExtensionTracker() {
public void loadCategories() {
if (Platform.isRunning()) {
- IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID,
+ IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
Activator.PREFERENCES_PROVIDERS_EXT_P_NAME);
IExtensionTracker extTracker = Activator.getExtensionTracker();
diff --git a/core/plugins/org.polarsys.capella.core.projection.exchanges/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.projection.exchanges/META-INF/MANIFEST.MF
index e7270a50c4..d40d7876bc 100644
--- a/core/plugins/org.polarsys.capella.core.projection.exchanges/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.projection.exchanges/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.projection.exchanges;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.projection.exchanges.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.polarsys.capella.core.tiger,
diff --git a/core/plugins/org.polarsys.capella.core.projection.exchanges/src/org/polarsys/capella/core/projection/exchanges/Activator.java b/core/plugins/org.polarsys.capella.core.projection.exchanges/src/org/polarsys/capella/core/projection/exchanges/Activator.java
deleted file mode 100644
index 0d1cb89b53..0000000000
--- a/core/plugins/org.polarsys.capella.core.projection.exchanges/src/org/polarsys/capella/core/projection/exchanges/Activator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.projection.exchanges;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.projection.exchanges"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- //Empty bloc
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.projection.interfaces/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.projection.interfaces/META-INF/MANIFEST.MF
index dc09139f96..2087f4f6e8 100644
--- a/core/plugins/org.polarsys.capella.core.projection.interfaces/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.projection.interfaces/META-INF/MANIFEST.MF
@@ -12,5 +12,4 @@ Require-Bundle: org.polarsys.capella.core.projection.common,
org.polarsys.capella.core.transition.system.topdown
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.polarsys.capella.core.projection.interfaces.InterfaceGenerationActivator
Bundle-Localization: plugin
diff --git a/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/InterfaceGenerationActivator.java b/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/InterfaceGenerationActivator.java
deleted file mode 100644
index 893426e88a..0000000000
--- a/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/InterfaceGenerationActivator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.projection.interfaces;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class InterfaceGenerationActivator extends Plugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.projection.interfaces"; //$NON-NLS-1$
-
- // The shared instance
- private static InterfaceGenerationActivator plugin;
-
- /**
- * The constructor
- */
- public InterfaceGenerationActivator() {
- //
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static InterfaceGenerationActivator getDefault() {
- return plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/validation/DWF_I_23_GenerateInterfacesValidator.java b/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/validation/DWF_I_23_GenerateInterfacesValidator.java
index 128929e659..6777039823 100644
--- a/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/validation/DWF_I_23_GenerateInterfacesValidator.java
+++ b/core/plugins/org.polarsys.capella.core.projection.interfaces/src/org/polarsys/capella/core/projection/interfaces/validation/DWF_I_23_GenerateInterfacesValidator.java
@@ -20,13 +20,15 @@
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.validation.AbstractModelConstraint;
import org.eclipse.emf.validation.IValidationContext;
import org.eclipse.emf.validation.internal.service.AbstractValidationContext;
import org.eclipse.emf.validation.model.ConstraintStatus;
import org.eclipse.emf.validation.model.IModelConstraint;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.helpers.EObjectLabelProviderHelper;
import org.polarsys.capella.core.data.cs.Interface;
import org.polarsys.capella.core.data.fa.ComponentExchange;
@@ -34,7 +36,6 @@
import org.polarsys.capella.core.data.fa.FunctionalExchange;
import org.polarsys.capella.core.data.information.ExchangeItem;
import org.polarsys.capella.core.projection.interfaces.InterfaceGeneration;
-import org.polarsys.capella.core.projection.interfaces.InterfaceGenerationActivator;
import org.polarsys.capella.core.projection.interfaces.InterfaceGenerationPreferences;
import org.polarsys.capella.core.projection.interfaces.generateInterfaces.InterfaceGenerationResult;
@@ -98,8 +99,8 @@ private Collection getAlreadyCheckedInterfaces(IValidationContext ctx
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
if (!loggedWorkaroundError){
loggedWorkaroundError = true;
- InterfaceGenerationActivator.getDefault().getLog().log(new Status(IStatus.ERROR, InterfaceGenerationActivator.PLUGIN_ID,
- "Cannot use cache for rule DWF_I_23. Some results for this rule may appear multiple times.", e)); //$NON-NLS-1$
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
+ Platform.getLog(bundle).error("Cannot use cache for rule DWF_I_23. Some results for this rule may appear multiple times.", e); //$NON-NLS-1$
}
} finally {
if (f != null) {
diff --git a/core/plugins/org.polarsys.capella.core.projection.scenario/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.projection.scenario/META-INF/MANIFEST.MF
index b0900fa3e3..ecbea42ce1 100644
--- a/core/plugins/org.polarsys.capella.core.projection.scenario/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.projection.scenario/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.projection.scenario;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.projection.scenario.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.polarsys.capella.core.tiger,
diff --git a/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/Activator.java b/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/Activator.java
deleted file mode 100644
index d6d8e18fb0..0000000000
--- a/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/Activator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.projection.scenario;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.projection.df2is"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- //Empty bloc
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/uml2/rules/Rule_StateFragment.java b/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/uml2/rules/Rule_StateFragment.java
index d8217fb0d9..8291f15518 100644
--- a/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/uml2/rules/Rule_StateFragment.java
+++ b/core/plugins/org.polarsys.capella.core.projection.scenario/src/org/polarsys/capella/core/projection/scenario/uml2/rules/Rule_StateFragment.java
@@ -20,11 +20,11 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.data.information.AbstractInstance;
import org.polarsys.capella.core.data.interaction.InteractionPackage;
import org.polarsys.capella.core.data.interaction.StateFragment;
import org.polarsys.capella.core.projection.common.context.IContext;
-import org.polarsys.capella.core.projection.scenario.Activator;
import org.polarsys.capella.core.projection.scenario.common.rules.Rule_CapellaElement;
import org.polarsys.capella.core.projection.scenario.helpers.IScenarioHelper;
import org.polarsys.capella.core.tiger.ITransfo;
@@ -46,7 +46,7 @@ public IStatus transformRequired(EObject element_p, IContext context_p) {
StateFragment source = (StateFragment) element_p;
List relatedElements = IScenarioHelper.getInstance(context_p).getTargetRelatedElements(source, context_p);
if (relatedElements.isEmpty()) {
- return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "State Fragment is not transitioned");
+ return new Status(IStatus.WARNING, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "State Fragment is not transitioned");
}
return super.transformRequired(element_p, context_p);
}
diff --git a/core/plugins/org.polarsys.capella.core.re.project/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.re.project/META-INF/MANIFEST.MF
index 01c76ff909..c7400b47fe 100644
--- a/core/plugins/org.polarsys.capella.core.re.project/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.re.project/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.re.project;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.re.project.ReProjectActivator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.osgi,
org.eclipse.jface,
diff --git a/core/plugins/org.polarsys.capella.core.re.project/src/org/polarsys/capella/core/re/project/ReProjectActivator.java b/core/plugins/org.polarsys.capella.core.re.project/src/org/polarsys/capella/core/re/project/ReProjectActivator.java
deleted file mode 100644
index a7023aeace..0000000000
--- a/core/plugins/org.polarsys.capella.core.re.project/src/org/polarsys/capella/core/re/project/ReProjectActivator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.re.project;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class ReProjectActivator implements BundleActivator {
-
- public static final String PLUGIN_ID = "org.polarsys.capella.core.re.project"; //$NON-NLS-1$
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- ReProjectActivator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- ReProjectActivator.context = null;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/META-INF/MANIFEST.MF
index 1fecd116ba..07e7ab9127 100644
--- a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.re.ui.quickfix;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.re.ui.quickfix.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
@@ -15,5 +14,4 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.polarsys.capella.core.re.ui.quickfix,
- org.polarsys.capella.core.re.ui.quickfix.resolver
+Export-Package: org.polarsys.capella.core.re.ui.quickfix.resolver
diff --git a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/Activator.java b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/Activator.java
deleted file mode 100644
index d9538780ca..0000000000
--- a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/Activator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.re.ui.quickfix;
-
-import org.osgi.framework.BundleContext;
-import org.polarsys.capella.common.ui.services.AbstractUIActivator;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIActivator {
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- // Do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_04_Resolver.java b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_04_Resolver.java
index 7f7cb32664..f5b7023f4e 100644
--- a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_04_Resolver.java
+++ b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_04_Resolver.java
@@ -20,13 +20,13 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.ui.statushandlers.StatusManager;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ef.ExecutionManager;
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand;
import org.polarsys.capella.common.helpers.TransactionHelper;
import org.polarsys.capella.common.re.CatalogElement;
import org.polarsys.capella.common.re.CatalogElementKind;
import org.polarsys.capella.common.re.CatalogElementLink;
-import org.polarsys.capella.core.validation.ui.ide.PluginActivator;
import org.polarsys.capella.core.validation.ui.ide.quickfix.AbstractCapellaMarkerResolution;
public class DCON_04_Resolver extends AbstractCapellaMarkerResolution {
@@ -64,7 +64,7 @@ protected void deleteMarker(IMarker marker) {
marker.delete();
} catch (CoreException exception) {
StatusManager.getManager().handle(
- new Status(IStatus.ERROR, PluginActivator.getDefault().getPluginId(), exception.getMessage(), exception));
+ new Status(IStatus.ERROR, FrameworkUtil.getBundle(AbstractCapellaMarkerResolution.class).getSymbolicName(), exception.getMessage(), exception));
}
}
}
diff --git a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_06_Resolver.java b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_06_Resolver.java
index 96ff75d637..1225fe3ada 100644
--- a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_06_Resolver.java
+++ b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/DCON_06_Resolver.java
@@ -20,12 +20,12 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.ui.statushandlers.StatusManager;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ef.ExecutionManager;
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand;
import org.polarsys.capella.common.helpers.TransactionHelper;
import org.polarsys.capella.common.re.CatalogElement;
import org.polarsys.capella.common.re.CatalogElementKind;
-import org.polarsys.capella.core.validation.ui.ide.PluginActivator;
import org.polarsys.capella.core.validation.ui.ide.quickfix.AbstractCapellaMarkerResolution;
public class DCON_06_Resolver extends AbstractCapellaMarkerResolution {
@@ -60,7 +60,7 @@ protected void deleteMarker(IMarker marker) {
marker.delete();
} catch (CoreException exception) {
StatusManager.getManager().handle(
- new Status(IStatus.ERROR, PluginActivator.getDefault().getPluginId(), exception.getMessage(), exception));
+ new Status(IStatus.ERROR, FrameworkUtil.getBundle(AbstractCapellaMarkerResolution.class).getSymbolicName(), exception.getMessage(), exception));
}
}
}
diff --git a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/I_43_Replace.java b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/I_43_Replace.java
index 0e1677a58e..cee80882ea 100644
--- a/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/I_43_Replace.java
+++ b/core/plugins/org.polarsys.capella.core.re.ui.quickfix/src/org/polarsys/capella/core/re/ui/quickfix/resolver/I_43_Replace.java
@@ -15,16 +15,11 @@
import java.util.List;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.ui.statushandlers.StatusManager;
import org.polarsys.capella.common.ef.ExecutionManager;
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand;
import org.polarsys.capella.common.helpers.TransactionHelper;
import org.polarsys.capella.common.re.CatalogElementLink;
-import org.polarsys.capella.core.validation.ui.ide.PluginActivator;
import org.polarsys.capella.core.validation.ui.ide.quickfix.AbstractCapellaMarkerResolution;
/**
diff --git a/core/plugins/org.polarsys.capella.core.re.ui/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.re.ui/META-INF/MANIFEST.MF
index 1836039dfd..5a5ab5df57 100644
--- a/core/plugins/org.polarsys.capella.core.re.ui/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.re.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.re.ui;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.re.ui.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.polarsys.capella.core.ui.toolkit,
@@ -25,8 +24,7 @@ Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
-Export-Package: org.polarsys.capella.core.re.ui,
- org.polarsys.capella.core.re.ui.copyformat,
+Export-Package: org.polarsys.capella.core.re.ui.copyformat,
org.polarsys.capella.core.re.ui.handlers,
org.polarsys.capella.core.re.ui.propertyTester,
org.polarsys.capella.core.re.ui.renderers,
diff --git a/core/plugins/org.polarsys.capella.core.re.ui/src/org/polarsys/capella/core/re/ui/Activator.java b/core/plugins/org.polarsys.capella.core.re.ui/src/org/polarsys/capella/core/re/ui/Activator.java
deleted file mode 100644
index d0fa129e19..0000000000
--- a/core/plugins/org.polarsys.capella.core.re.ui/src/org/polarsys/capella/core/re/ui/Activator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.re.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.re.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/META-INF/MANIFEST.MF
index 210aba1633..a34dc593b6 100644
--- a/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.re.updateconnections.ui;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.re.updateconnections.ui.UpdateConnectionsUIActivator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.polarsys.capella.common.flexibility.properties,
diff --git a/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/UpdateConnectionsUIActivator.java b/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/UpdateConnectionsUIActivator.java
deleted file mode 100644
index 06fdbd7a07..0000000000
--- a/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/UpdateConnectionsUIActivator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.re.updateconnections.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class UpdateConnectionsUIActivator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.re.updatelinks"; //$NON-NLS-1$
-
- // The shared instance
- private static UpdateConnectionsUIActivator plugin;
-
- /**
- * The constructor
- */
- public UpdateConnectionsUIActivator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static UpdateConnectionsUIActivator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/properties/CatalogElementSelection.java b/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/properties/CatalogElementSelection.java
index 98888c92ca..ebd8a24835 100644
--- a/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/properties/CatalogElementSelection.java
+++ b/core/plugins/org.polarsys.capella.core.re.updateconnections.ui/src/org/polarsys/capella/core/re/updateconnections/ui/properties/CatalogElementSelection.java
@@ -17,13 +17,13 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.flexibility.properties.property.AbstractProperty;
import org.polarsys.capella.common.flexibility.properties.schema.IEditableProperty;
import org.polarsys.capella.common.flexibility.properties.schema.IProperty;
import org.polarsys.capella.common.flexibility.properties.schema.IPropertyContext;
import org.polarsys.capella.common.flexibility.properties.schema.IRestraintProperty;
import org.polarsys.capella.common.re.CatalogElement;
-import org.polarsys.capella.core.re.updateconnections.ui.UpdateConnectionsUIActivator;
/**
* Select one of all available catalog elements.
@@ -76,7 +76,7 @@ public IStatus validate(Object newValue, IPropertyContext context) {
for (IProperty property : context.getProperties().getAllItems()) {
if (property instanceof CatalogElementSelection && !this.equals(property)) {
if (value.equals(context.getCurrentValue(property))) {
- return new Status(IStatus.ERROR, UpdateConnectionsUIActivator.PLUGIN_ID, "Selected RPLs must be different");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Selected RPLs must be different");
}
}
}
diff --git a/core/plugins/org.polarsys.capella.core.re.validation/src/org/polarsys/capella/core/re/validation/design/consistency/DCON_02_Rpl2RecConformanceConstraint.java b/core/plugins/org.polarsys.capella.core.re.validation/src/org/polarsys/capella/core/re/validation/design/consistency/DCON_02_Rpl2RecConformanceConstraint.java
index 10c33b8198..13dfc49a4f 100644
--- a/core/plugins/org.polarsys.capella.core.re.validation/src/org/polarsys/capella/core/re/validation/design/consistency/DCON_02_Rpl2RecConformanceConstraint.java
+++ b/core/plugins/org.polarsys.capella.core.re.validation/src/org/polarsys/capella/core/re/validation/design/consistency/DCON_02_Rpl2RecConformanceConstraint.java
@@ -25,6 +25,7 @@
import org.eclipse.emf.validation.model.ConstraintStatus;
import org.eclipse.emf.validation.service.ConstraintRegistry;
import org.eclipse.emf.validation.service.IConstraintDescriptor;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.helpers.EObjectExt;
import org.polarsys.capella.common.re.Activator;
import org.polarsys.capella.common.re.CatalogElement;
@@ -43,7 +44,7 @@ public IStatus validate(IValidationContext ctx) {
if (catalogElement.getKind() == CatalogElementKind.RPL) {
CatalogElement rec = catalogElement.getOrigin();
if (rec == null || rec.eIsProxy()) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Your RPL is invalid (no REC), please validate your model.");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(Activator.class).getSymbolicName(), "Your RPL is invalid (no REC), please validate your model.");
}
// if rec is valid
return validateRPL(ctx, catalogElement);
diff --git a/core/plugins/org.polarsys.capella.core.re/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.re/META-INF/MANIFEST.MF
index 887579812e..62233dd750 100644
--- a/core/plugins/org.polarsys.capella.core.re/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.re/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.re;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.re.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.commands,
@@ -20,7 +19,6 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package:
- org.polarsys.capella.core.re,
org.polarsys.capella.core.re.activities,
org.polarsys.capella.core.re.commands,
org.polarsys.capella.core.re.delete,
diff --git a/core/plugins/org.polarsys.capella.core.re/src/org/polarsys/capella/core/re/Activator.java b/core/plugins/org.polarsys.capella.core.re/src/org/polarsys/capella/core/re/Activator.java
deleted file mode 100644
index 01e309d5c8..0000000000
--- a/core/plugins/org.polarsys.capella.core.re/src/org/polarsys/capella/core/re/Activator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.re;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.semantic.queries/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.semantic.queries/META-INF/MANIFEST.MF
index 0c21a01aa8..9e2b042fe0 100644
--- a/core/plugins/org.polarsys.capella.core.semantic.queries/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.semantic.queries/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.semantic.queries;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.semantic.queries.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.polarsys.capella.core.model.handler,
org.polarsys.capella.core.model.helpers,
@@ -12,8 +11,7 @@ Require-Bundle: org.polarsys.capella.core.model.handler,
org.eclipse.sirius.table,
org.polarsys.capella.core.sirius.analysis
Bundle-ActivationPolicy: lazy
-Export-Package: org.polarsys.capella.core.semantic.queries,
- org.polarsys.capella.core.semantic.queries.basic.queries,
+Export-Package: org.polarsys.capella.core.semantic.queries.basic.queries,
org.polarsys.capella.core.semantic.queries.basic.queries.utils,
org.polarsys.capella.core.semantic.queries.sirius.annotation,
org.polarsys.capella.core.semantic.queries.sirius.annotation.eoi,
diff --git a/core/plugins/org.polarsys.capella.core.semantic.queries/src/org/polarsys/capella/core/semantic/queries/Activator.java b/core/plugins/org.polarsys.capella.core.semantic.queries/src/org/polarsys/capella/core/semantic/queries/Activator.java
deleted file mode 100644
index 8bdc1158bd..0000000000
--- a/core/plugins/org.polarsys.capella.core.semantic.queries/src/org/polarsys/capella/core/semantic/queries/Activator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.semantic.queries;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.semantic.queries"; //$NON-NLS-1$
-
- /**
- * The constructor
- */
- public Activator() {
- // do nothing
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.sirius.analysis/META-INF/MANIFEST.MF
index e1126b22be..2405f68fb3 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/META-INF/MANIFEST.MF
@@ -53,7 +53,8 @@ Require-Bundle: org.eclipse.core.expressions,
org.apache.batik.transcoder;bundle-version="1.14.0",
org.apache.batik.dom;bundle-version="1.14.0",
org.apache.batik.bridge;bundle-version="1.14.0",
- org.polarsys.kitalpha.sirius.rotativeimage;bundle-version="6.0.0"
+ org.polarsys.kitalpha.sirius.rotativeimage;bundle-version="6.0.0",
+ org.polarsys.capella.core.model.preferences
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CapellaServices.java b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CapellaServices.java
index eadd377771..866d1503f5 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CapellaServices.java
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CapellaServices.java
@@ -183,7 +183,7 @@
import org.polarsys.capella.core.model.helpers.FunctionalChainExt;
import org.polarsys.capella.core.model.helpers.PartExt;
import org.polarsys.capella.core.model.helpers.ScenarioExt;
-import org.polarsys.capella.core.model.preferences.CapellaModelPreferencesPlugin;
+import org.polarsys.capella.core.model.preferences.helpers.PreferencesHelper;
import org.polarsys.capella.core.platform.sirius.ui.commands.CapellaDeleteCommand;
import org.polarsys.capella.core.sirius.analysis.tool.StringUtil;
@@ -2436,7 +2436,7 @@ public boolean isGeneralizable(final EObject context, EObject source, EObject ta
if (source instanceof Component) {
Component sourceComp = (Component) source;
if (!sourceComp.isActor()
- && !CapellaModelPreferencesPlugin.getDefault().isComponentNonActorInheritanceAllowed()) {
+ && !PreferencesHelper.isComponentNonActorInheritanceAllowed()) {
return false;
}
if (target instanceof Component) {
@@ -2547,7 +2547,7 @@ public boolean isLinkedWithInternalControlNode(Pin pin) {
* return the 'Allow Multiple Inheritance' preference value
*/
private boolean isMultipleInheritanceAllowed() {
- return CapellaModelPreferencesPlugin.getDefault().isMultipleInheritanceAllowed();
+ return PreferencesHelper.isMultipleInheritanceAllowed();
}
public boolean isNull(EObject current) {
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CsServices.java b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CsServices.java
index 7b7421a02b..5466aa0685 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CsServices.java
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/CsServices.java
@@ -208,7 +208,7 @@
import org.polarsys.capella.core.model.helpers.PhysicalLinkCategoryExt;
import org.polarsys.capella.core.model.helpers.PortExt;
import org.polarsys.capella.core.model.helpers.SystemEngineeringExt;
-import org.polarsys.capella.core.model.preferences.CapellaModelPreferencesPlugin;
+import org.polarsys.capella.core.model.preferences.helpers.PreferencesHelper;
import org.polarsys.capella.core.model.utils.CapellaLayerCheckingExt;
import org.polarsys.capella.core.sirius.analysis.constants.IFilterNameConstants;
import org.polarsys.capella.core.sirius.analysis.constants.MappingConstantsHelper;
@@ -1634,7 +1634,7 @@ public boolean isGeneralizableForReConnect(final EObject context, EObject newSou
return superTargetsContainsSource;
}
- if (!CapellaModelPreferencesPlugin.getDefault().isMultipleInheritanceAllowed()) {
+ if (!PreferencesHelper.isMultipleInheritanceAllowed()) {
if (CapellaServices.getService().getSuperClassifiers(newSourceClazz, generalization).size() == 1) {
return true;
}
@@ -1656,7 +1656,7 @@ public boolean isGeneralizableForReConnect(final EObject context, EObject newSou
// check to avoid inheritance cycle
boolean existCycle = !CapellaServices.getService().getSuperClassifiers(sourceClass).contains(targetClass)
&& !CapellaServices.getService().getSuperClassifiers(targetClass).contains(sourceClass);
- if (!CapellaModelPreferencesPlugin.getDefault().isMultipleInheritanceAllowed()) {
+ if (!PreferencesHelper.isMultipleInheritanceAllowed()) {
if (existCycle) {
if (CapellaServices.getService().getSuperClassifiers(sourceClass).size() == 1) {
return true;
@@ -1744,7 +1744,7 @@ public boolean isGeneralizableForReConnectOld(final EObject context, EObject sou
}
if (subSourcesConatinsTarget) {
- return CapellaModelPreferencesPlugin.getDefault().isMultipleInheritanceAllowed() && superTargetsContainsSource;
+ return PreferencesHelper.isMultipleInheritanceAllowed() && superTargetsContainsSource;
}
return notExistCycle;
@@ -1763,7 +1763,7 @@ public boolean isGeneralizableForReConnectOld(final EObject context, EObject sou
// check to avoid inheritance cycle
boolean existCycle = !CapellaServices.getService().getSuperClassifiers(sourceClass).contains(targetClass)
&& !CapellaServices.getService().getSuperClassifiers(targetClass).contains(sourceClass);
- if (!CapellaModelPreferencesPlugin.getDefault().isMultipleInheritanceAllowed()) {
+ if (!PreferencesHelper.isMultipleInheritanceAllowed()) {
if (existCycle) {
if (CapellaServices.getService().getSuperClassifiers(sourceClass).size() == 1) {
return true;
@@ -1794,7 +1794,7 @@ public boolean isGeneralizableForReConnectOld(final EObject context, EObject sou
*/
public boolean preGeneralization(EObject generalization, EObject preSource) {
if (preSource instanceof Component && !((Component) preSource).isActor()) {
- return CapellaModelPreferencesPlugin.getDefault().isComponentNonActorInheritanceAllowed();
+ return PreferencesHelper.isComponentNonActorInheritanceAllowed();
}
return true;
}
@@ -1843,7 +1843,7 @@ public boolean canReconnectGeneralization(EObject generalization, EObject subObj
if ((source instanceof Component) && (target instanceof Component)) {
if (!(((Component) source).isActor() && ((Component) target).isActor())
- && !CapellaModelPreferencesPlugin.getDefault().isComponentNonActorInheritanceAllowed()) {
+ && !PreferencesHelper.isComponentNonActorInheritanceAllowed()) {
return false;
}
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/PhysicalServices.java b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/PhysicalServices.java
index 8f61bf39c0..f12cea9c21 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/PhysicalServices.java
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/PhysicalServices.java
@@ -60,7 +60,6 @@
import org.polarsys.capella.core.business.queries.IBusinessQuery;
import org.polarsys.capella.core.business.queries.capellacore.BusinessQueriesProvider;
import org.polarsys.capella.core.commands.preferences.service.ScopedCapellaPreferencesStore;
-import org.polarsys.capella.core.commands.preferences.util.PreferencesHelper;
import org.polarsys.capella.core.data.capellacore.CapellaElement;
import org.polarsys.capella.core.data.cs.AbstractDeploymentLink;
import org.polarsys.capella.core.data.cs.AbstractPathInvolvedElement;
@@ -101,7 +100,7 @@
import org.polarsys.capella.core.model.helpers.graph.PhysicalPathInternalLinksGraph.InternalLinkEdge;
import org.polarsys.capella.core.model.helpers.graph.PhysicalPathInvolvementGraph;
import org.polarsys.capella.core.model.helpers.graph.PhysicalPathInvolvementGraph.InvolvementEdge;
-import org.polarsys.capella.core.model.preferences.CapellaModelPreferencesPlugin;
+import org.polarsys.capella.core.model.preferences.helpers.PreferencesHelper;
import org.polarsys.capella.core.sirius.analysis.cache.DEdgeIconCache;
import org.polarsys.capella.core.sirius.analysis.cache.PhysicalPathCache;
import org.polarsys.capella.core.sirius.analysis.constants.MappingConstantsHelper;
@@ -126,7 +125,7 @@ public static PhysicalServices getService() {
private static final String INVALID_PHYSICAL_PATH_LABEL = "invalid"; //$NON-NLS-1$
public boolean isMultipleDeploymentAllowed() {
- return CapellaModelPreferencesPlugin.getDefault().isMultipleDeploymentAllowed();
+ return PreferencesHelper.isMultipleDeploymentAllowed();
}
/**
@@ -1160,7 +1159,7 @@ public String getPhysicalPathLabel(PhysicalPath path, DDiagram diagram) {
String label = EObjectExt.getText(path);
boolean isComplete = isCompletePhysicalPath(path, diagram);
- IProject project = PreferencesHelper.getProject(path);
+ IProject project = org.polarsys.capella.core.commands.preferences.util.PreferencesHelper.getProject(path);
boolean displayIncompleteLabel = !isComplete && ScopedCapellaPreferencesStore
.getBoolean(DiagramProcessChainPathPreferencePage.NAME_PREF_DISPLAY_INCOMPLETE_IN_PHYSICAL_PATH_LABEL, project);
boolean isValid = PhysicalPathExt.isPhysicalPathValid(path);
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/StateMachineServices.java b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/StateMachineServices.java
index 00e8a0ad43..d647a7c1be 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/StateMachineServices.java
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/StateMachineServices.java
@@ -75,7 +75,7 @@
import org.polarsys.capella.core.model.helpers.ComponentExt;
import org.polarsys.capella.core.model.helpers.StateExt;
import org.polarsys.capella.core.model.helpers.move.MoveHelper;
-import org.polarsys.capella.core.model.preferences.CapellaModelPreferencesPlugin;
+import org.polarsys.capella.core.model.preferences.helpers.PreferencesHelper;
import org.polarsys.capella.core.sirius.analysis.constants.MappingConstantsHelper;
import org.polarsys.capella.core.sirius.analysis.showhide.AbstractShowHide.DiagramContext;
import org.polarsys.capella.core.sirius.analysis.showhide.ShowHideSMStateMode;
@@ -737,7 +737,7 @@ private boolean isUndoublonLink(DSemanticDecorator sourceElement, DSemanticDecor
public boolean canCreateMode(EObject context, EObject containerView) {
Region testedRegion = getRegionFromView(containerView);
if (testedRegion != null) {
- if (!CapellaModelPreferencesPlugin.getDefault().isMixedModeStateAllowed()) {
+ if (!PreferencesHelper.isMixedModeStateAllowed()) {
return MoveHelper.getInstance().canMoveModeState(CapellacommonFactory.eINSTANCE.createMode(), testedRegion);
}
//If there is a State, then can't create a Mode
@@ -809,7 +809,7 @@ private Region getRegionFromView(EObject containerView) {
public boolean canCreateState(EObject context, EObject containerView) {
Region testedRegion = getRegionFromView(containerView);
if (testedRegion != null) {
- if (!CapellaModelPreferencesPlugin.getDefault().isMixedModeStateAllowed()) {
+ if (!PreferencesHelper.isMixedModeStateAllowed()) {
return MoveHelper.getInstance().canMoveModeState(CapellacommonFactory.eINSTANCE.createState(), testedRegion);
}
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/activator/SiriusViewActivator.java b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/activator/SiriusViewActivator.java
index a3f3592ff3..7786e546e4 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/activator/SiriusViewActivator.java
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/activator/SiriusViewActivator.java
@@ -29,6 +29,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.sirius.analysis.helpers.DDiagramHelper;
import org.polarsys.capella.core.sirius.analysis.preferences.DiagramPreferenceInitializer;
import org.polarsys.capella.core.sirius.analysis.preferences.TitleBlockPreferencesInitializer;
@@ -36,7 +37,7 @@
public class SiriusViewActivator extends AbstractUIPlugin {
- public static final String ID = "org.polarsys.capella.core.sirius.analysis"; //$NON-NLS-1$
+ public static final String ID = FrameworkUtil.getBundle(SiriusViewActivator.class).getSymbolicName(); //$NON-NLS-1$
private static SiriusViewActivator instance;
diff --git a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/preferences/TitleBlockPreferencesInitializer.java b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/preferences/TitleBlockPreferencesInitializer.java
index 19de35b955..a5345c2d5a 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/preferences/TitleBlockPreferencesInitializer.java
+++ b/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/preferences/TitleBlockPreferencesInitializer.java
@@ -13,6 +13,7 @@
package org.polarsys.capella.core.sirius.analysis.preferences;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.AbstractPreferencesInitializer;
import org.polarsys.capella.core.commands.preferences.service.ScopedCapellaPreferencesStore;
import org.polarsys.capella.core.platform.sirius.ui.actions.CapellaActionsActivator;
@@ -20,12 +21,12 @@
public class TitleBlockPreferencesInitializer extends AbstractPreferencesInitializer {
public TitleBlockPreferencesInitializer() {
- super(CapellaActionsActivator.PLUGIN_ID);
+ super(FrameworkUtil.getBundle(CapellaActionsActivator.class).getSymbolicName());
}
@Override
public void initializeDefaultPreferences() {
- IPreferenceStore preferenceStore = ScopedCapellaPreferencesStore.getInstance(CapellaActionsActivator.PLUGIN_ID);
+ IPreferenceStore preferenceStore = ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(CapellaActionsActivator.class).getSymbolicName());
preferenceStore.setDefault(TitleBlockPreferencePage.COLUMNS_NUMBER_PREFERENCE_STORE, 2);
preferenceStore.setDefault(TitleBlockPreferencePage.LINES_NUMBER_PREFERENCE_STORE, 2);
preferenceStore.setDefault(TitleBlockPreferencePage.TABLE_CONTENT_PREFERENCE_STORE, TitleBlockPreferencePage.DEFAULT_TABLE);
diff --git a/core/plugins/org.polarsys.capella.core.sirius.ui/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.sirius.ui/META-INF/MANIFEST.MF
index a00a5bfd12..bc14d664d5 100644
--- a/core/plugins/org.polarsys.capella.core.sirius.ui/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.sirius.ui/META-INF/MANIFEST.MF
@@ -49,5 +49,4 @@ Export-Package: org.polarsys.capella.core.sirius.ui,
org.polarsys.capella.core.sirius.ui.wizard
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.polarsys.capella.core.sirius.ui.SiriusUIPlugin
-Bundle-Localization: plugin
diff --git a/core/plugins/org.polarsys.capella.core.tiger/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.tiger/META-INF/MANIFEST.MF
index 3b47295e58..ed459bf756 100644
--- a/core/plugins/org.polarsys.capella.core.tiger/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.tiger/META-INF/MANIFEST.MF
@@ -26,7 +26,6 @@ Export-Package: org.polarsys.capella.core.tiger;
org.polarsys.capella.core.data.la,
org.eclipse.emf.ecore",
org.polarsys.capella.core.tiger.impl
-Bundle-Activator: org.polarsys.capella.core.tiger.Activator
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
Bundle-Localization: plugin
diff --git a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/Activator.java b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/Activator.java
deleted file mode 100644
index e363fc5a77..0000000000
--- a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/Activator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.tiger;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.tiger"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- //
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoEngine.java b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoEngine.java
index 9cbab9b3e2..77896d8975 100644
--- a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoEngine.java
+++ b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoEngine.java
@@ -28,6 +28,7 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.data.helpers.modellingcore.utils.HoldingResourceFilter;
import org.polarsys.capella.common.data.modellingcore.AbstractTrace;
import org.polarsys.capella.common.helpers.EObjectExt;
@@ -39,7 +40,6 @@
import org.polarsys.capella.core.data.capellacommon.GenericTrace;
import org.polarsys.capella.core.data.capellacore.CapellaElement;
import org.polarsys.capella.core.model.handler.helpers.HoldingResourceHelper;
-import org.polarsys.capella.core.tiger.Activator;
import org.polarsys.capella.core.tiger.IFinalizer;
import org.polarsys.capella.core.tiger.ITransfo;
import org.polarsys.capella.core.tiger.ITransfoEngine;
@@ -292,7 +292,7 @@ public void execute(ITransfo transfo) throws TransfoException {
*/
public void preExecute(ITransfo transfo) throws CoreException, Exception {
IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(Activator.PLUGIN_ID);
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
for (final IConfigurationElement element : elements) {
if (TRANSFO_EXTENSION.equals(element.getName())) {
ITransfoEngineExecuteExt extension = (ITransfoEngineExecuteExt) element.createExecutableExtension("class"); //$NON-NLS-1$
@@ -314,7 +314,7 @@ public void postExecute(ITransfo transfo) {
try {
IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(Activator.PLUGIN_ID);
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
for (final IConfigurationElement element : elements) {
if (TRANSFO_EXTENSION.equals(element.getName())) {
ITransfoEngineExecuteExt extension = (ITransfoEngineExecuteExt) element.createExecutableExtension("class"); //$NON-NLS-1$
diff --git a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleBase.java b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleBase.java
index 05f97820fc..7824f6ed06 100644
--- a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleBase.java
+++ b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleBase.java
@@ -24,7 +24,7 @@
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.osgi.framework.Bundle;
-import org.polarsys.capella.core.tiger.Activator;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.tiger.ITransfo;
import org.polarsys.capella.core.tiger.ITransfoRule;
import org.polarsys.capella.core.tiger.ITransfoRuleBase;
@@ -175,7 +175,7 @@ public void loadRule(Class> ruleClass) {
*/
public void loadRules(String rulePkgName, String[] classNames)
throws ClassNotFoundException {
- Bundle bundle = Activator.getDefault().getBundle();
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
for (String className : classNames) {
Class> class_ = bundle.loadClass(rulePkgName + "." + className); //$NON-NLS-1$
loadRule(class_);
diff --git a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleLoader.java b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleLoader.java
index a814f3eb07..996b734596 100644
--- a/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleLoader.java
+++ b/core/plugins/org.polarsys.capella.core.tiger/src/org/polarsys/capella/core/tiger/impl/TransfoRuleLoader.java
@@ -25,9 +25,8 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EClass;
import org.osgi.framework.Bundle;
-
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.mdsofa.common.helper.ExtensionPointHelper;
-import org.polarsys.capella.core.tiger.Activator;
import org.polarsys.capella.core.tiger.IResolver;
/**
@@ -278,7 +277,7 @@ public void loadContext(String contextName) {
*/
private void loadResolvers() {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
- IConfigurationElement[] elementsForPlugin = extensionRegistry.getConfigurationElementsFor(Activator.PLUGIN_ID);
+ IConfigurationElement[] elementsForPlugin = extensionRegistry.getConfigurationElementsFor(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
TreeSet elements = new TreeSet(new Comparator() {
public int compare(IConfigurationElement arg0, IConfigurationElement arg1) {
diff --git a/core/plugins/org.polarsys.capella.core.transition.common.ui/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.transition.common.ui/META-INF/MANIFEST.MF
index aa5d3f99bb..e515f504fd 100644
--- a/core/plugins/org.polarsys.capella.core.transition.common.ui/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.transition.common.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.transition.common.ui;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.transition.common.ui.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -17,9 +16,7 @@ Require-Bundle: org.eclipse.ui,
org.polarsys.capella.core.preferences,
org.polarsys.capella.common.ui
Bundle-ActivationPolicy: lazy
-Export-Package: org.polarsys.capella.core.transition.common.ui,
- org.polarsys.capella.core.transition.common.ui.actions,
- org.polarsys.capella.core.transition.common.ui.commands,
+Export-Package: org.polarsys.capella.core.transition.common.ui.commands,
org.polarsys.capella.core.transition.common.ui.dialogs,
org.polarsys.capella.core.transition.common.ui.handlers.merge,
org.polarsys.capella.core.transition.common.ui.handlers.options,
diff --git a/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/Activator.java b/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/Activator.java
deleted file mode 100644
index a367bbde3f..0000000000
--- a/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/Activator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.transition.common.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.common.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/DiffComparisonViewer.java b/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/DiffComparisonViewer.java
index 937badd9b4..35fd2baf0d 100644
--- a/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/DiffComparisonViewer.java
+++ b/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/DiffComparisonViewer.java
@@ -45,8 +45,8 @@
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ui.toolkit.viewers.menu.ModalContextMenuExtender;
-import org.polarsys.capella.core.transition.common.ui.Activator;
public class DiffComparisonViewer extends ComparisonViewer {
@@ -147,7 +147,7 @@ protected Collection getExpandedElements(EMFDiffNode node) {
}
protected ImageDescriptor getImageDescriptor(String key) {
- ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/ctool16/" + key);
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "icons/ctool16/" + key);
return desc;
}
diff --git a/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/MergeCategoryManager.java b/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/MergeCategoryManager.java
index 71b356fcbb..c1700fa315 100644
--- a/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/MergeCategoryManager.java
+++ b/core/plugins/org.polarsys.capella.core.transition.common.ui/src/org/polarsys/capella/core/transition/common/ui/handlers/merge/MergeCategoryManager.java
@@ -19,8 +19,8 @@
import org.eclipse.emf.diffmerge.ui.viewers.IDifferenceCategory;
import org.eclipse.emf.diffmerge.ui.viewers.IDifferenceCategorySet;
import org.eclipse.emf.diffmerge.ui.viewers.categories.DifferenceCategorySet;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.ScopedCapellaPreferencesStore;
-import org.polarsys.capella.core.preferences.Activator;
import org.polarsys.capella.core.transition.common.constants.ITransitionConstants;
import org.polarsys.capella.core.transition.common.handlers.merge.ICategoryItem;
import org.polarsys.capella.core.transition.common.handlers.merge.ICategorySet;
@@ -111,7 +111,7 @@ public void initializeFromPreferences() {
Object purposeValue = context.get(ITransitionConstants.TRANSPOSER_PURPOSE);
if (purposeValue instanceof String) {
String purpose = (String) purposeValue;
- ScopedCapellaPreferencesStore scps = ScopedCapellaPreferencesStore.getInstance(Activator.PLUGIN_ID);
+ ScopedCapellaPreferencesStore scps = ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
for (IDifferenceCategory category : getCategories()) {
String isActiveKey = getIsActiveKey(purpose, category);
@@ -137,7 +137,7 @@ public void saveToPreferences() {
if (purposeValue instanceof String) {
String purpose = (String) purposeValue;
- ScopedCapellaPreferencesStore scps = ScopedCapellaPreferencesStore.getInstance(Activator.PLUGIN_ID);
+ ScopedCapellaPreferencesStore scps = ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(this.getClass()).getSymbolicName());
for (IDifferenceCategory category : this.getCategories()) {
String isActiveKey = getIsActiveKey(purpose, category);
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram.ui/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.transition.diagram.ui/META-INF/MANIFEST.MF
index 9638733f83..f73fa2a6e8 100644
--- a/core/plugins/org.polarsys.capella.core.transition.diagram.ui/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.transition.diagram.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.transition.diagram.ui;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.transition.diagram.ui.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/Activator.java b/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/Activator.java
deleted file mode 100644
index 0f04440397..0000000000
--- a/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/Activator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.transition.diagram.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.diagram.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- //Do nothing
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/handlers/AbstractRunnableHandler.java b/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/handlers/AbstractRunnableHandler.java
index 27cd0bf730..2355ddfdf4 100644
--- a/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/handlers/AbstractRunnableHandler.java
+++ b/core/plugins/org.polarsys.capella.core.transition.diagram.ui/src/org/polarsys/capella/core/transition/diagram/ui/handlers/AbstractRunnableHandler.java
@@ -18,8 +18,8 @@
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
import org.polarsys.capella.common.ui.services.commands.AbstractUiHandler;
-import org.polarsys.capella.core.transition.diagram.ui.Activator;
/**
*
@@ -51,7 +51,7 @@ protected IRunnableWithProgress createRunnable(ExecutionEvent event_p) {
protected Shell getActiveShell(ExecutionEvent event_p) {
IWorkbenchPart part = (IWorkbenchPart) getVariableValue(event_p, ACTIVE_PART_VARIABLE);
if (part == null) {
- return Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+ return PlatformUI.getWorkbench().getDisplay().getActiveShell();
}
return part.getSite().getShell();
}
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.transition.diagram/META-INF/MANIFEST.MF
index f9c5368951..38a9cb8609 100644
--- a/core/plugins/org.polarsys.capella.core.transition.diagram/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.transition.diagram/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.transition.diagram;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.transition.diagram.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
@@ -22,11 +21,11 @@ Require-Bundle: org.eclipse.core.runtime,
org.polarsys.capella.core.platform.sirius.ui.actions,
org.polarsys.capella.core.projection.common;visibility:=reexport,
org.polarsys.capella.core.sirius.analysis,
- org.polarsys.capella.core.transition.system;visibility:=reexport
+ org.polarsys.capella.core.transition.system;visibility:=reexport,
+ org.eclipse.ui.workbench
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Export-Package: org.polarsys.capella.core.transition.diagram,
- org.polarsys.capella.core.transition.diagram.commands,
+Export-Package: org.polarsys.capella.core.transition.diagram.commands,
org.polarsys.capella.core.transition.diagram.constants,
org.polarsys.capella.core.transition.diagram.handlers,
org.polarsys.capella.core.transition.diagram.helpers
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/Activator.java b/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/Activator.java
deleted file mode 100644
index 7cc217c2c7..0000000000
--- a/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/Activator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.transition.diagram;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.diagram"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/AbstractProcessingCommands.java b/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/AbstractProcessingCommands.java
index 1c37ed9087..e06e2038eb 100644
--- a/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/AbstractProcessingCommands.java
+++ b/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/AbstractProcessingCommands.java
@@ -17,12 +17,12 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.sirius.business.api.session.Session;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ef.ExecutionManager;
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand;
import org.polarsys.capella.common.helpers.TransactionHelper;
import org.polarsys.capella.common.utils.RunnableWithBooleanResult;
import org.polarsys.capella.core.transition.common.context.TransitionContext;
-import org.polarsys.capella.core.transition.diagram.Activator;
import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext;
/**
@@ -63,7 +63,7 @@ public String getName() {
*/
@Override
public void commandRolledBack() {
- result[0] = new Status(IStatus.ERROR, Activator.PLUGIN_ID, getName());
+ result[0] = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), getName());
}
public void run() {
@@ -75,7 +75,7 @@ public void run() {
if (exception_p.getMessage() != null) {
message += ": " + exception_p.getMessage();
}
- result[0] = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exception_p);
+ result[0] = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), message, exception_p);
}
}
});
@@ -85,7 +85,7 @@ public void run() {
if (exception_p.getMessage() != null) {
message += ": " + exception_p.getMessage();
}
- result[0] = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exception_p);
+ result[0] = new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), message, exception_p);
}
return result[0];
}
diff --git a/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/DiagramTransitionRunnable.java b/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/DiagramTransitionRunnable.java
index 931ee1a5f3..ccbe056a91 100644
--- a/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/DiagramTransitionRunnable.java
+++ b/core/plugins/org.polarsys.capella.core.transition.diagram/src/org/polarsys/capella/core/transition/diagram/commands/DiagramTransitionRunnable.java
@@ -12,8 +12,6 @@
*******************************************************************************/
package org.polarsys.capella.core.transition.diagram.commands;
-import static org.polarsys.capella.core.data.helpers.cache.ModelCache.getCache;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -82,6 +80,9 @@
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
import org.eclipse.sirius.viewpoint.description.RepresentationDescription;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.data.modellingcore.AbstractType;
import org.polarsys.capella.common.data.modellingcore.TraceableElement;
import org.polarsys.capella.common.helpers.EObjectExt;
@@ -91,19 +92,15 @@
import org.polarsys.capella.core.data.cs.BlockArchitecture;
import org.polarsys.capella.core.data.cs.Component;
import org.polarsys.capella.core.data.cs.Part;
-import org.polarsys.capella.core.data.pa.PhysicalArchitecture;
import org.polarsys.capella.core.diagram.helpers.DiagramHelper;
import org.polarsys.capella.core.model.handler.helpers.RepresentationHelper;
import org.polarsys.capella.core.model.helpers.BlockArchitectureExt;
-import org.polarsys.capella.core.model.helpers.ComponentExt;
import org.polarsys.capella.core.sirius.analysis.CapellaServices;
import org.polarsys.capella.core.sirius.analysis.DDiagramContents;
import org.polarsys.capella.core.sirius.analysis.DiagramServices;
import org.polarsys.capella.core.sirius.analysis.ShapeUtil;
import org.polarsys.capella.core.sirius.analysis.tool.HashMapSet;
import org.polarsys.capella.core.transition.common.constants.ITransitionConstants;
-import org.polarsys.capella.core.transition.diagram.Activator;
-import org.polarsys.capella.core.transition.diagram.commands.DiagramTransitionRunnable.ExtendedViewRefactorHelper;
import org.polarsys.capella.core.transition.diagram.handlers.DiagramDescriptionHelper;
import org.polarsys.capella.core.transition.diagram.helpers.TraceabilityHelper;
import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext;
@@ -236,20 +233,20 @@ protected IStatus proceedDiagram(final DRepresentation diagram, final IProgressM
final IContext context = getContext();
if (!(diagram instanceof DSemanticDecorator)) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid source diagram");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Invalid source diagram");
}
context.put(SOURCE_DIAGRAM, diagram);
// Retrieve semantic target of diagram
final EObject sourceSemantic = ((DSemanticDecorator) diagram).getTarget();
if ((sourceSemantic == null) || sourceSemantic.eIsProxy()) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Diagram with invalid semantic target");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Diagram with invalid semantic target");
}
// Retrieve the current session
final Session session = DiagramHelper.getService().getSession(diagram);
if (session == null) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot retrieve session from the given diagram");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Cannot retrieve session from the given diagram");
}
context.put(ITransitionConstants.TRANSITION_SOURCE_EDITING_DOMAIN, session.getTransactionalEditingDomain());
@@ -258,7 +255,7 @@ protected IStatus proceedDiagram(final DRepresentation diagram, final IProgressM
// Retrieve the current description
final RepresentationDescription description = DiagramHelper.getService().getDescription(diagram);
if ((description == null) || description.eIsProxy()) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid source diagram (maybe a missing viewpoint)");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Invalid source diagram (maybe a missing viewpoint)");
}
context.put(SOURCE_DESCRIPTION, description);
@@ -353,9 +350,9 @@ public void run() {
DRepresentation targetDiagram = (DRepresentation) getContext().get(TARGET_DIAGRAM);
if (targetDiagram == null) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid target diagram");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Invalid target diagram");
}
- return new Status(IStatus.OK, Activator.PLUGIN_ID, NLS.bind("Diagram initialized - {0}", diagramName));
+ return new Status(IStatus.OK, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), NLS.bind("Diagram initialized - {0}", diagramName));
}
/**
@@ -391,7 +388,7 @@ protected IStatus retrieveTargetDiagram(DRepresentation diagram, Session session
description);
}
if ((allocatingDescription == null) || allocatingDescription.eIsProxy()) {
- return (new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ return (new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
NLS.bind("Diagram ''{0}'' is not yet supported by diagram initialization", EObjectExt.getText(diagram))));
}
context.put(TARGET_DESCRIPTION, allocatingDescription);
@@ -401,7 +398,7 @@ protected IStatus retrieveTargetDiagram(DRepresentation diagram, Session session
targetSemantic = getTargetSemantic(sourceSemantic, description, allocatingDescription);
}
if (targetSemantic == null) {
- return (new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ return (new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),
"No semantic element has been found to put the created diagram"));
}
@@ -414,7 +411,7 @@ protected IStatus retrieveTargetDiagram(DRepresentation diagram, Session session
}
if (targetDiagram == null) {
- return (new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot create the target diagram"));
+ return (new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Cannot create the target diagram"));
}
return Status.OK_STATUS;
}
@@ -423,7 +420,7 @@ protected IStatus retrieveTargetDiagram(DRepresentation diagram, Session session
* @return
*/
protected Shell getShell() {
- return Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+ return PlatformUI.getWorkbench().getDisplay().getActiveShell();
}
/**
@@ -457,7 +454,7 @@ private IStatus rollbackDiagram(final DRepresentation diagram) {
// Retrieve the current session
final Session session = DiagramHelper.getService().getSession(diagram);
if (session == null) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot retrieve session from the given diagram");
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "Cannot retrieve session from the given diagram");
}
IStatus status = runCommand(session, NLS.bind("{0} - {1} (2/2)", getName(), EObjectExt.getText(diagram)),
diff --git a/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/Activator.java b/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/Activator.java
index d25cd8f979..d54730b70d 100644
--- a/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/Activator.java
+++ b/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/Activator.java
@@ -22,9 +22,6 @@
*/
public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.topdown.ui"; //$NON-NLS-1$
-
// The shared instance
private static Activator plugin;
diff --git a/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/preferences/TopDownPreferenceInitializer.java b/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/preferences/TopDownPreferenceInitializer.java
index 9a5e4139c1..bfae2ae1f4 100644
--- a/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/preferences/TopDownPreferenceInitializer.java
+++ b/core/plugins/org.polarsys.capella.core.transition.system.topdown.ui/src/org/polarsys/capella/core/transition/system/topdown/ui/preferences/TopDownPreferenceInitializer.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.polarsys.capella.core.transition.system.topdown.ui.preferences;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.flexibility.properties.loader.PropertiesLoader;
import org.polarsys.capella.common.flexibility.properties.property.IDefaultValueProperty;
import org.polarsys.capella.common.flexibility.properties.property.PropertyContext;
@@ -20,14 +21,13 @@
import org.polarsys.capella.common.flexibility.properties.schema.IPropertyContext;
import org.polarsys.capella.core.commands.preferences.service.AbstractPreferencesInitializer;
import org.polarsys.capella.core.commands.preferences.service.ScopedCapellaPreferencesStore;
-import org.polarsys.capella.core.preferences.Activator;
import org.polarsys.capella.core.transition.system.topdown.constants.ITopDownConstants;
public class TopDownPreferenceInitializer extends AbstractPreferencesInitializer {
/**
*/
public TopDownPreferenceInitializer() {
- super(org.polarsys.capella.core.transition.system.topdown.ui.Activator.PLUGIN_ID);
+ super(FrameworkUtil.getBundle(TopDownPreferenceInitializer.class).getSymbolicName());
}
/**
@@ -42,6 +42,6 @@ public void initializeDefaultPreferences() {
((IDefaultValueProperty) property).initializeDefaultValue(context);
}
}
- ScopedCapellaPreferencesStore.getInstance(Activator.PLUGIN_ID).save();
+ ScopedCapellaPreferencesStore.getInstance(FrameworkUtil.getBundle(org.polarsys.capella.core.preferences.Activator.class).getSymbolicName()).save();
}
}
diff --git a/core/plugins/org.polarsys.capella.core.transition.system.topdown/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.transition.system.topdown/META-INF/MANIFEST.MF
index 8c3ec13a4b..39694715ca 100644
--- a/core/plugins/org.polarsys.capella.core.transition.system.topdown/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.transition.system.topdown/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.transition.system.topdown;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.transition.system.topdown.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -13,8 +12,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.diffmerge.ui
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Export-Package: org.polarsys.capella.core.transition.system.topdown,
- org.polarsys.capella.core.transition.system.topdown.activities,
+Export-Package: org.polarsys.capella.core.transition.system.topdown.activities,
org.polarsys.capella.core.transition.system.topdown.commands,
org.polarsys.capella.core.transition.system.topdown.constants,
org.polarsys.capella.core.transition.system.topdown.handlers.attachment,
diff --git a/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/Activator.java b/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/Activator.java
deleted file mode 100644
index 20cc1e363b..0000000000
--- a/core/plugins/org.polarsys.capella.core.transition.system.topdown/src/org/polarsys/capella/core/transition/system/topdown/Activator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.transition.system.topdown;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.topdown"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.transition.system.ui/src/org/polarsys/capella/core/transition/system/ui/Activator.java b/core/plugins/org.polarsys.capella.core.transition.system.ui/src/org/polarsys/capella/core/transition/system/ui/Activator.java
index cc8725e483..31f6cc9661 100644
--- a/core/plugins/org.polarsys.capella.core.transition.system.ui/src/org/polarsys/capella/core/transition/system/ui/Activator.java
+++ b/core/plugins/org.polarsys.capella.core.transition.system.ui/src/org/polarsys/capella/core/transition/system/ui/Activator.java
@@ -22,9 +22,6 @@
*/
public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.system.ui"; //$NON-NLS-1$
-
// The shared instance
private static Activator plugin;
diff --git a/core/plugins/org.polarsys.capella.core.transition.system/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.transition.system/META-INF/MANIFEST.MF
index 647f71a5a7..29dd3dc368 100644
--- a/core/plugins/org.polarsys.capella.core.transition.system/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.transition.system/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.transition.system;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.transition.system.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -19,8 +18,7 @@ Require-Bundle: org.eclipse.ui,
org.polarsys.capella.common.libraries
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Export-Package: org.polarsys.capella.core.transition.system,
- org.polarsys.capella.core.transition.system.activities,
+Export-Package: org.polarsys.capella.core.transition.system.activities,
org.polarsys.capella.core.transition.system.constants,
org.polarsys.capella.core.transition.system.domain,
org.polarsys.capella.core.transition.system.handlers.attachment,
diff --git a/core/plugins/org.polarsys.capella.core.transition.system/src/org/polarsys/capella/core/transition/system/Activator.java b/core/plugins/org.polarsys.capella.core.transition.system/src/org/polarsys/capella/core/transition/system/Activator.java
deleted file mode 100644
index cdd42bdb12..0000000000
--- a/core/plugins/org.polarsys.capella.core.transition.system/src/org/polarsys/capella/core/transition/system/Activator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-
-package org.polarsys.capella.core.transition.system;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.transition.system"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerActivator.java b/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerActivator.java
index e94926bd6d..2ad5404283 100644
--- a/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerActivator.java
+++ b/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerActivator.java
@@ -15,13 +15,12 @@
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
/**
* The activator class controls the plug-in life cycle.
*/
public class FastLinkerActivator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.ui.fastlinker"; //$NON-NLS-1$
// The shared instance
private static FastLinkerActivator plugin;
/**
@@ -58,8 +57,8 @@ public FastLinkerManager getFastLinkerManager() {
@SuppressWarnings("nls")
protected void initializeImageRegistry(ImageRegistry imageRegistry) {
// Enabled icons.
- imageRegistry.put(IMG_PIN, imageDescriptorFromPlugin(PLUGIN_ID, "icons/elcl16/pin.gif"));
- imageRegistry.put(IMG_CLEAR, imageDescriptorFromPlugin(PLUGIN_ID, "icons/elcl16/clear.gif"));
+ imageRegistry.put(IMG_PIN, imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "icons/elcl16/pin.gif"));
+ imageRegistry.put(IMG_CLEAR, imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "icons/elcl16/clear.gif"));
}
/*
diff --git a/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerManager.java b/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerManager.java
index bcd0050f11..0721a23cbe 100644
--- a/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerManager.java
+++ b/core/plugins/org.polarsys.capella.core.ui.fastlinker/src/org/polarsys/capella/core/ui/fastlinker/FastLinkerManager.java
@@ -27,6 +27,7 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.data.modellingcore.ModelElement;
import org.polarsys.capella.common.tools.report.appenders.reportlogview.LightMarkerRegistry;
import org.polarsys.capella.common.tools.report.appenders.reportlogview.MarkerView;
@@ -276,7 +277,7 @@ public FastLinkerView showFastLinkerView() {
.getDefault()
.getLog()
.log(new Status(IStatus.ERROR,
- FastLinkerActivator.PLUGIN_ID, exception
+ FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), exception
.getLocalizedMessage(), exception));
return null;
}
@@ -423,7 +424,7 @@ public void showCommandExecutedMessage(
MarkerViewPlugin
.getDefault()
.getLog()
- .log(new Status(IStatus.ERROR, MarkerViewPlugin.PLUGIN_ID,
+ .log(new Status(IStatus.ERROR, FrameworkUtil.getBundle(MarkerViewPlugin.class).getSymbolicName(),
exception.getLocalizedMessage(), exception));
}
}
diff --git a/core/plugins/org.polarsys.capella.core.ui.metric/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.ui.metric/META-INF/MANIFEST.MF
index 74f7b26cb6..2f81c88841 100644
--- a/core/plugins/org.polarsys.capella.core.ui.metric/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.ui.metric/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.ui.metric;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.ui.metric.MetricActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: com.google.guava,
diff --git a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/MetricActivator.java b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/MetricActivator.java
deleted file mode 100644
index a25427b8d6..0000000000
--- a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/MetricActivator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.ui.metric;
-
-import org.osgi.framework.BundleContext;
-
-import org.polarsys.capella.common.ui.services.AbstractUIActivator;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class MetricActivator extends AbstractUIActivator {
- /**
- * The singleton instance.
- */
- private static MetricActivator __plugin;
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context_p) throws Exception {
- super.start(context_p);
- __plugin = this;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context_p) throws Exception {
- __plugin = null;
- super.stop(context_p);
- }
-
- /**
- * Returns the singleton instance
- * @return
- */
- public static MetricActivator getDefault() {
- return __plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/MetricAction.java b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/MetricAction.java
index 65852f0732..ebf4684764 100644
--- a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/MetricAction.java
+++ b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/MetricAction.java
@@ -29,6 +29,8 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ef.ExecutionManager;
import org.polarsys.capella.common.ef.ExecutionManagerRegistry;
import org.polarsys.capella.common.mdsofa.common.constant.ICommonConstants;
@@ -46,7 +48,6 @@
import org.polarsys.capella.core.model.handler.helpers.HoldingResourceHelper;
import org.polarsys.capella.core.sirius.ui.helper.SessionHelper;
import org.polarsys.capella.core.ui.metric.IImageKeys;
-import org.polarsys.capella.core.ui.metric.MetricActivator;
import org.polarsys.capella.core.ui.metric.MetricMessages;
import org.polarsys.capella.core.ui.metric.core.DefaultFilter;
import org.polarsys.capella.core.ui.metric.core.Metric;
@@ -61,7 +62,8 @@ public class MetricAction extends BaseSelectionListenerAction {
public MetricAction() {
super(MetricMessages.metricAction_lbl);
- setImageDescriptor(MetricActivator.getDefault().getImageDescriptor(IImageKeys.IMG_METRICS));
+ final String ICONS_PATH = "icons/";
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + IImageKeys.IMG_METRICS));
}
@Override
diff --git a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringOverviewAction.java b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringOverviewAction.java
index eaf4a92ffe..cac78e3e94 100644
--- a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringOverviewAction.java
+++ b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringOverviewAction.java
@@ -25,9 +25,10 @@
import org.eclipse.sirius.viewpoint.ViewpointPackage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.sirius.ui.helper.SessionHelper;
import org.polarsys.capella.core.ui.metric.IImageKeys;
-import org.polarsys.capella.core.ui.metric.MetricActivator;
import org.polarsys.capella.core.ui.metric.MetricMessages;
import org.polarsys.capella.core.ui.metric.dialog.ProgressMonitoringOverviewDialog;
import org.polarsys.capella.core.ui.metric.utils.ProgressMonitoringPropagator;
@@ -38,7 +39,8 @@ public class ProgressMonitoringOverviewAction extends BaseSelectionListenerActio
*/
public ProgressMonitoringOverviewAction() {
super(MetricMessages.progressMonitoring_overviewAction_lbl);
- setImageDescriptor(MetricActivator.getDefault().getImageDescriptor(IImageKeys.IMG_METRICS));
+ final String ICONS_PATH = "icons/";
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + IImageKeys.IMG_METRICS));
}
/**
diff --git a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringSetAction.java b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringSetAction.java
index 9a490b9893..d3d52fc17f 100644
--- a/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringSetAction.java
+++ b/core/plugins/org.polarsys.capella.core.ui.metric/src/org/polarsys/capella/core/ui/metric/actions/ProgressMonitoringSetAction.java
@@ -36,6 +36,8 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand;
import org.polarsys.capella.common.helpers.EcoreUtil2;
import org.polarsys.capella.common.helpers.TransactionHelper;
@@ -43,7 +45,6 @@
import org.polarsys.capella.core.data.capellacore.CapellaElement;
import org.polarsys.capella.core.sirius.ui.helper.SessionHelper;
import org.polarsys.capella.core.ui.metric.IImageKeys;
-import org.polarsys.capella.core.ui.metric.MetricActivator;
import org.polarsys.capella.core.ui.metric.MetricMessages;
import org.polarsys.capella.core.ui.metric.actions.ProgressSetDialog.PropagateChoice;
import org.polarsys.capella.core.ui.metric.utils.ProgressMonitoringPropagator;
@@ -59,7 +60,8 @@ public class ProgressMonitoringSetAction extends BaseSelectionListenerAction {
*/
public ProgressMonitoringSetAction() {
super(MetricMessages.progressMonitoring_setAction_lbl);
- setImageDescriptor(MetricActivator.getDefault().getImageDescriptor(IImageKeys.IMG_PROGRESS_MONITORING));
+ final String ICONS_PATH = "icons/";
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + IImageKeys.IMG_PROGRESS_MONITORING));
}
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/META-INF/MANIFEST.MF
index 2926682276..a28aeb3d97 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/META-INF/MANIFEST.MF
@@ -8,7 +8,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
Require-Bundle: org.eclipse.sirius.diagram.ui,
org.polarsys.capella.core.ui.properties
-Export-Package: org.polarsys.capella.core.ui.properties.descriptions,
- org.polarsys.capella.core.ui.properties.descriptions.fields,
+Export-Package: org.polarsys.capella.core.ui.properties.descriptions.fields,
org.polarsys.capella.core.ui.properties.descriptions.sections
-Bundle-Activator: org.polarsys.capella.core.ui.properties.descriptions.CapellaUIPropertiesDescriptionPlugin
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/src/org/polarsys/capella/core/ui/properties/descriptions/CapellaUIPropertiesDescriptionPlugin.java b/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/src/org/polarsys/capella/core/ui/properties/descriptions/CapellaUIPropertiesDescriptionPlugin.java
deleted file mode 100644
index cc50132665..0000000000
--- a/core/plugins/org.polarsys.capella.core.ui.properties.descriptions/src/org/polarsys/capella/core/ui/properties/descriptions/CapellaUIPropertiesDescriptionPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.ui.properties.descriptions;
-
-import org.osgi.framework.BundleContext;
-import org.polarsys.capella.common.ui.services.AbstractUIActivator;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- * @author Joao Barata
- */
-public class CapellaUIPropertiesDescriptionPlugin extends AbstractUIActivator {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.ui.properties.descriptions"; //$NON-NLS-1$
-
- /**
- * The shared instance
- */
- private static CapellaUIPropertiesDescriptionPlugin __plugin;
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- __plugin = this;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- __plugin = null;
- super.stop(context);
- }
-
- /**
- * @return the shared instance
- */
- public static CapellaUIPropertiesDescriptionPlugin getDefault() {
- return __plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/META-INF/MANIFEST.MF
index 863b168632..2d3c65f832 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/META-INF/MANIFEST.MF
@@ -23,4 +23,3 @@ Export-Package: org.polarsys.capella.core.ui.properties.richtext,
org.polarsys.capella.core.ui.properties.richtext.navigation,
org.polarsys.capella.core.ui.properties.richtext.propertysheet,
org.polarsys.capella.core.ui.properties.richtext.sections
-Bundle-Activator: org.polarsys.capella.core.ui.properties.richtext.CapellaUIPropertiesRichtextPlugin
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaMDERichTextConstants.java b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaMDERichTextConstants.java
index d737f1d30b..acc8544bb7 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaMDERichTextConstants.java
+++ b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaMDERichTextConstants.java
@@ -14,6 +14,7 @@
import java.net.URL;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.kitalpha.richtext.common.util.MDERichTextHelper;
public class CapellaMDERichTextConstants {
@@ -22,14 +23,14 @@ public class CapellaMDERichTextConstants {
public static final String PASTE_AS_LINK_LABEL = "Paste as Link (Ctrl + Shift + V)";
- public static final URL PASTE_AS_LINK_ICON = MDERichTextHelper.getURL(CapellaUIPropertiesRichtextPlugin.PLUGIN_ID,
+ public static final URL PASTE_AS_LINK_ICON = MDERichTextHelper.getURL(FrameworkUtil.getBundle(CapellaMDERichTextConstants.class).getSymbolicName(),
"icons/full/obj16/paste_as_link.gif");
public static final String OPEN_IN_EDITOR_KEY = "OpenInEditor";
public static final String OPEN_IN_EDITOR_LABEL = "Open in Editor";
- public static final URL OPEN_IN_EDITOR_ICON = MDERichTextHelper.getURL(CapellaUIPropertiesRichtextPlugin.PLUGIN_ID,
+ public static final URL OPEN_IN_EDITOR_ICON = MDERichTextHelper.getURL(FrameworkUtil.getBundle(CapellaMDERichTextConstants.class).getSymbolicName(),
"icons/full/obj16/open_in_editor.gif");
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaUIPropertiesRichtextPlugin.java b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaUIPropertiesRichtextPlugin.java
deleted file mode 100644
index 60ce806b05..0000000000
--- a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/CapellaUIPropertiesRichtextPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.ui.properties.richtext;
-
-import org.osgi.framework.BundleContext;
-import org.polarsys.capella.common.ui.services.AbstractUIActivator;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- * @author Joao Barata
- */
-public class CapellaUIPropertiesRichtextPlugin extends AbstractUIActivator {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.ui.properties.richtext"; //$NON-NLS-1$
-
- /**
- * The shared instance
- */
- private static CapellaUIPropertiesRichtextPlugin __plugin;
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- __plugin = this;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- __plugin = null;
- super.stop(context);
- }
-
- /**
- * @return the shared instance
- */
- public static CapellaUIPropertiesRichtextPlugin getDefault() {
- return __plugin;
- }
-}
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/fields/ElementDescriptionGroup.java b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/fields/ElementDescriptionGroup.java
index f25d90bb17..c7e4dce4f1 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/fields/ElementDescriptionGroup.java
+++ b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/fields/ElementDescriptionGroup.java
@@ -34,6 +34,7 @@
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.views.properties.tabbed.ISection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.ef.ExecutionManager;
import org.polarsys.capella.common.ef.command.AbstractReadWriteCommand;
import org.polarsys.capella.common.ef.command.ICommand;
@@ -41,7 +42,6 @@
import org.polarsys.capella.core.model.handler.provider.CapellaReadOnlyHelper;
import org.polarsys.capella.core.model.handler.provider.IReadOnlySectionHandler;
import org.polarsys.capella.core.ui.properties.helpers.NotificationHelper;
-import org.polarsys.capella.core.ui.properties.richtext.CapellaUIPropertiesRichtextPlugin;
import org.polarsys.capella.core.ui.properties.richtext.RichtextManager;
import org.polarsys.kitalpha.richtext.common.intf.MDERichTextWidget;
import org.polarsys.kitalpha.richtext.common.intf.SaveStrategy;
@@ -53,10 +53,10 @@
*/
public abstract class ElementDescriptionGroup {
- private static final String FAMILY_DEFERRED_REFRESH = CapellaUIPropertiesRichtextPlugin.PLUGIN_ID
+ private static final String FAMILY_DEFERRED_REFRESH = FrameworkUtil.getBundle(ElementDescriptionGroup.class).getSymbolicName()
+ ".refreshJobFamily";
- private static final String FAMILY_LOAD_DATA_REFRESH = CapellaUIPropertiesRichtextPlugin.PLUGIN_ID
+ private static final String FAMILY_LOAD_DATA_REFRESH = FrameworkUtil.getBundle(ElementDescriptionGroup.class).getSymbolicName()
+ ".loadDataJobFamily";
/**
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/handlers/OpenInEditorHandler.java b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/handlers/OpenInEditorHandler.java
index 514fead10e..4b2a27ae93 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/handlers/OpenInEditorHandler.java
+++ b/core/plugins/org.polarsys.capella.core.ui.properties.richtext/src/org/polarsys/capella/core/ui/properties/richtext/handlers/OpenInEditorHandler.java
@@ -12,14 +12,14 @@
*******************************************************************************/
package org.polarsys.capella.core.ui.properties.richtext.handlers;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.polarsys.capella.core.ui.properties.richtext.CapellaUIPropertiesRichtextPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.ui.properties.richtext.editor.CapellaMDERichTextEditor;
import org.polarsys.kitalpha.richtext.common.intf.MDERichTextWidget;
import org.polarsys.kitalpha.richtext.nebula.widget.toolbar.MDERichTextToolbarItemHandler;
@@ -39,8 +39,8 @@ public void execute(MDERichTextWidget richText) {
try {
activePage.openEditor(input, CapellaMDERichTextEditor.ID);
} catch (PartInitException e) {
- Status status = new Status(IStatus.ERROR, CapellaUIPropertiesRichtextPlugin.PLUGIN_ID, e.getMessage(), e);
- CapellaUIPropertiesRichtextPlugin.getDefault().getLog().log(status);
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
+ Platform.getLog(bundle).error(e.getMessage(), e);
}
}
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/CapellaUIPropertiesPlugin.java b/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/CapellaUIPropertiesPlugin.java
index 34e3b3d951..dea23982cf 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/CapellaUIPropertiesPlugin.java
+++ b/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/CapellaUIPropertiesPlugin.java
@@ -28,9 +28,6 @@
* The activator class controls the plug-in life cycle
*/
public class CapellaUIPropertiesPlugin extends AbstractUIActivator {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.ui.properties"; //$NON-NLS-1$
/**
* Properties contributor ID.
*/
diff --git a/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/preferences/CapellaUIPropertiesPreferencesInitializer.java b/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/preferences/CapellaUIPropertiesPreferencesInitializer.java
index b323d9629f..b93ebe384f 100644
--- a/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/preferences/CapellaUIPropertiesPreferencesInitializer.java
+++ b/core/plugins/org.polarsys.capella.core.ui.properties/src/org/polarsys/capella/core/ui/properties/preferences/CapellaUIPropertiesPreferencesInitializer.java
@@ -13,9 +13,8 @@
package org.polarsys.capella.core.ui.properties.preferences;
import org.eclipse.core.resources.ProjectScope;
-
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.service.AbstractPreferencesInitializer;
-import org.polarsys.capella.core.ui.properties.CapellaUIPropertiesPlugin;
/**
*/
@@ -25,7 +24,7 @@ public class CapellaUIPropertiesPreferencesInitializer extends AbstractPreferenc
* Default constructor.
*/
public CapellaUIPropertiesPreferencesInitializer() {
- super(CapellaUIPropertiesPlugin.PLUGIN_ID);
+ super(FrameworkUtil.getBundle(CapellaUIPropertiesPreferencesInitializer.class).getSymbolicName());
}
/**
diff --git a/core/plugins/org.polarsys.capella.core.ui.reportlog/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.ui.reportlog/META-INF/MANIFEST.MF
index de5aaaa4c3..9d469c1d78 100644
--- a/core/plugins/org.polarsys.capella.core.ui.reportlog/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.ui.reportlog/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.ui.reportlog;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.ui.reportlog.ReportLogActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
diff --git a/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/InformationViewSessionListener.java b/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/InformationViewSessionListener.java
index 31f11f0e5a..5c50a7dbee 100644
--- a/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/InformationViewSessionListener.java
+++ b/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/InformationViewSessionListener.java
@@ -19,12 +19,14 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.sirius.business.api.session.Session;
import org.eclipse.sirius.business.api.session.SessionListener;
import org.eclipse.sirius.business.api.session.SessionManagerListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.tools.report.appenders.reportlogview.LightMarkerRegistry;
/**
@@ -50,7 +52,8 @@ public void notify(Session updated_p, int notification_p) {
try {
marker.delete();
} catch (CoreException exception) {
- ReportLogActivator.getDefault().log(IStatus.ERROR, exception.getMessage(), exception);
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
+ Platform.getLog(bundle).error(exception.getMessage(), exception);
}
}
}
diff --git a/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/LogDataHandler.java b/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/LogDataHandler.java
index f8cb3b53aa..32595aff4c 100644
--- a/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/LogDataHandler.java
+++ b/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/LogDataHandler.java
@@ -15,11 +15,12 @@
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
public class LogDataHandler extends AbstractHandler {
@@ -42,8 +43,8 @@ public String isValid(String newText) {
d.open();
if (d.getReturnCode() == InputDialog.OK) {
String value = d.getValue();
- IStatus status = new Status(IStatus.INFO, ReportLogActivator.getDefault().getPluginId(), value);
- ReportLogActivator.getDefault().getLog().log(status);
+ Bundle bundle = FrameworkUtil.getBundle(this.getClass());
+ Platform.getLog(bundle).info(value);
}
return null;
}
diff --git a/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/ReportLogActivator.java b/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/ReportLogActivator.java
deleted file mode 100644
index d9a33d38c6..0000000000
--- a/core/plugins/org.polarsys.capella.core.ui.reportlog/src/org/polarsys/capella/core/ui/reportlog/ReportLogActivator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.ui.reportlog;
-
-import org.osgi.framework.BundleContext;
-
-import org.polarsys.capella.common.ui.services.AbstractUIActivator;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ReportLogActivator extends AbstractUIActivator {
- // The shared instance
- private static ReportLogActivator __plugin;
-
- /**
- * The constructor
- */
- public ReportLogActivator() {
- // Do nothing
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- __plugin = this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- __plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- * @return the shared instance
- */
- public static ReportLogActivator getDefault() {
- return __plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.ui.resources/src/org/polarsys/capella/core/ui/resources/CapellaUIResourcesPlugin.java b/core/plugins/org.polarsys.capella.core.ui.resources/src/org/polarsys/capella/core/ui/resources/CapellaUIResourcesPlugin.java
index a0e26f6170..fe32210295 100644
--- a/core/plugins/org.polarsys.capella.core.ui.resources/src/org/polarsys/capella/core/ui/resources/CapellaUIResourcesPlugin.java
+++ b/core/plugins/org.polarsys.capella.core.ui.resources/src/org/polarsys/capella/core/ui/resources/CapellaUIResourcesPlugin.java
@@ -41,9 +41,6 @@
*/
public class CapellaUIResourcesPlugin extends AbstractUIActivator {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.ui.resources"; //$NON-NLS-1$
-
// The shared instance
private static CapellaUIResourcesPlugin __plugin;
diff --git a/core/plugins/org.polarsys.capella.core.ui.search/META-INF/MANIFEST.MF b/core/plugins/org.polarsys.capella.core.ui.search/META-INF/MANIFEST.MF
index f9290c3388..44b4c51fd0 100644
--- a/core/plugins/org.polarsys.capella.core.ui.search/META-INF/MANIFEST.MF
+++ b/core/plugins/org.polarsys.capella.core.ui.search/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.core.ui.search;singleton:=true
Bundle-Version: 6.0.0.qualifier
-Bundle-Activator: org.polarsys.capella.core.ui.search.Activator
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
@@ -21,7 +20,7 @@ Require-Bundle: org.eclipse.search,
org.eclipse.sirius.ext.base,
org.eclipse.gmf.runtime.diagram.ui,
org.polarsys.kitalpha.ad.services,
- org.apache.commons.lang
+ org.apache.commons.lang,
+ org.eclipse.ui.workbench
Export-Package: org.polarsys.capella.core.ui.search
-
diff --git a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/AbstractCapellaHistory.java b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/AbstractCapellaHistory.java
index e9276b933e..13ed6b07fa 100644
--- a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/AbstractCapellaHistory.java
+++ b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/AbstractCapellaHistory.java
@@ -17,6 +17,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.ui.search.searchfor.SearchForItemCache;
import org.polarsys.capella.core.ui.search.searchfor.item.SearchForAttributeItem;
import org.polarsys.capella.core.ui.search.searchfor.item.SearchForClassItem;
@@ -121,7 +123,7 @@ public void appendSearchSettings(CapellaSearchSettings capellaSearchSettings) {
}
private IDialogSettings getDialogSettingsForCapellaSearch() {
- IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
+ IDialogSettings dialogSettings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(this.getClass())).getDialogSettings();
IDialogSettings section = dialogSettings.getSection(SECTION_SEARCH);
if (section == null) {
section = dialogSettings.addNewSection(SECTION_SEARCH);
diff --git a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/Activator.java b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/Activator.java
deleted file mode 100644
index 832a7c3655..0000000000
--- a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/Activator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2020 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.core.ui.search;
-
-import org.eclipse.sirius.common.ui.tools.api.plugin.AbstractUIActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator extends AbstractUIActivator {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.polarsys.capella.core.ui.search";
-
- // The shared instance
- private static Activator plugin = new Activator();
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- }
-
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaReplaceQuery.java b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaReplaceQuery.java
index 94faac6421..dc66f70498 100644
--- a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaReplaceQuery.java
+++ b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaReplaceQuery.java
@@ -23,91 +23,93 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.ui.search.match.SearchMatch;
public class CapellaReplaceQuery {
- private final CapellaSearchSettings capellaSearchSettings;
+ private final CapellaSearchSettings capellaSearchSettings;
- Set replacedElements = new HashSet<>();
- Set replacedProjects = new HashSet<>();
- int replacedOccurrenceCount = 0;
+ Set replacedElements = new HashSet<>();
- public CapellaReplaceQuery(CapellaSearchSettings capellaSearchSettings) {
- this.capellaSearchSettings = capellaSearchSettings;
- }
+ Set replacedProjects = new HashSet<>();
- public IStatus run(IProgressMonitor monitor, Set allMatches, String replacement) {
- replacedElements = new HashSet<>();
- replacedProjects = new HashSet<>();
- replacedOccurrenceCount = 0;
- if (replacement == null) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- CapellaSearchConstants.CapellaReplaceQuery_Validation_Replacement_Null);
+ int replacedOccurrenceCount = 0;
+
+ public CapellaReplaceQuery(CapellaSearchSettings capellaSearchSettings) {
+ this.capellaSearchSettings = capellaSearchSettings;
}
- try {
- Pattern searchPattern = capellaSearchSettings.createPattern();
- Set matches = getMinimalSearchMatches(allMatches);
-
- int countTotalOccurrences = matches.size();
- SubMonitor subMonitor = SubMonitor.convert(monitor, countTotalOccurrences);
- subMonitor.setTaskName(String.format(CapellaSearchConstants.ReplaceJob_Title, replacement));
-
- for (SearchMatch match : matches) {
- int countOccurrences = 1;
- String projectName = match.getProject().getName();
- subMonitor.subTask(String.format(CapellaSearchConstants.ReplaceJob_SubTitle, countOccurrences, projectName));
- replace(match, searchPattern, replacement);
- subMonitor.split(countOccurrences);
-
- }
- return Status.OK_STATUS;
- } catch (Exception e) {
- String message = e.getMessage();
- if (e instanceof PatternSyntaxException) {
- message = String.format(CapellaSearchConstants.CapellaSearchQuery_Search_Pattern_Not_Validated_Message,
- ((PatternSyntaxException) e).getPattern(), ((PatternSyntaxException) e).getDescription());
- }
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, message);
+
+ public IStatus run(IProgressMonitor monitor, Set allMatches, String replacement) {
+ replacedElements = new HashSet<>();
+ replacedProjects = new HashSet<>();
+ replacedOccurrenceCount = 0;
+ if (replacement == null) {
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), CapellaSearchConstants.CapellaReplaceQuery_Validation_Replacement_Null);
+ }
+ try {
+ Pattern searchPattern = capellaSearchSettings.createPattern();
+ Set matches = getMinimalSearchMatches(allMatches);
+
+ int countTotalOccurrences = matches.size();
+ SubMonitor subMonitor = SubMonitor.convert(monitor, countTotalOccurrences);
+ subMonitor.setTaskName(String.format(CapellaSearchConstants.ReplaceJob_Title, replacement));
+
+ for (SearchMatch match : matches) {
+ int countOccurrences = 1;
+ String projectName = match.getProject().getName();
+ subMonitor.subTask(String.format(CapellaSearchConstants.ReplaceJob_SubTitle, countOccurrences, projectName));
+ replace(match, searchPattern, replacement);
+ subMonitor.split(countOccurrences);
+
+ }
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ String message = e.getMessage();
+ if (e instanceof PatternSyntaxException) {
+ message = String.format(CapellaSearchConstants.CapellaSearchQuery_Search_Pattern_Not_Validated_Message, ((PatternSyntaxException) e).getPattern(),
+ ((PatternSyntaxException) e).getDescription());
+ }
+ return new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), message);
+ }
}
- }
-
- public void replace(SearchMatch capellaMatch, Pattern searchPattern, String replacement) {
- boolean replaced = capellaMatch.replace(searchPattern, replacement);
- if (replaced) {
- replacedProjects.add(capellaMatch.getProject());
- replacedElements.add((EObject) capellaMatch.getElement());
- replacedOccurrenceCount += capellaMatch.getChildren().isEmpty() ? 1 : capellaMatch.getChildren().size();
+
+ public void replace(SearchMatch capellaMatch, Pattern searchPattern, String replacement) {
+ boolean replaced = capellaMatch.replace(searchPattern, replacement);
+ if (replaced) {
+ replacedProjects.add(capellaMatch.getProject());
+ replacedElements.add((EObject) capellaMatch.getElement());
+ replacedOccurrenceCount += capellaMatch.getChildren().isEmpty() ? 1 : capellaMatch.getChildren().size();
+ }
}
- }
-
- public int getReplacedOccurrenceCount() {
- return replacedOccurrenceCount;
- }
-
- public int getReplacedElementCount() {
- return replacedElements.size();
- }
-
- public int getReplacedProjectCount() {
- return replacedProjects.size();
- }
-
- /**
- * Returns the minimal search matches required to fully perform all the replacements. The original matches might
- * contain both parent and children matches, but replacing in the parent already replaced in the children matches.
- *
- * @param allMatches
- * all the matches.
- * @return the minimal search matches required to fully perform all the replacements.
- */
- private Set getMinimalSearchMatches(Set allMatches) {
- Set minimalMatches = new HashSet<>(allMatches);
-
- for (SearchMatch originalMatch : allMatches) {
- minimalMatches.removeAll(originalMatch.getChildren());
+
+ public int getReplacedOccurrenceCount() {
+ return replacedOccurrenceCount;
}
- return minimalMatches;
- }
+ public int getReplacedElementCount() {
+ return replacedElements.size();
+ }
+
+ public int getReplacedProjectCount() {
+ return replacedProjects.size();
+ }
+
+ /**
+ * Returns the minimal search matches required to fully perform all the replacements. The original matches might
+ * contain both parent and children matches, but replacing in the parent already replaced in the children matches.
+ *
+ * @param allMatches
+ * all the matches.
+ * @return the minimal search matches required to fully perform all the replacements.
+ */
+ private Set getMinimalSearchMatches(Set allMatches) {
+ Set minimalMatches = new HashSet<>(allMatches);
+
+ for (SearchMatch originalMatch : allMatches) {
+ minimalMatches.removeAll(originalMatch.getChildren());
+ }
+
+ return minimalMatches;
+ }
}
diff --git a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaSearchQuery.java b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaSearchQuery.java
index 835523fbf1..9bcc9fef15 100644
--- a/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaSearchQuery.java
+++ b/core/plugins/org.polarsys.capella.core.ui.search/src/org/polarsys/capella/core/ui/search/CapellaSearchQuery.java
@@ -38,6 +38,7 @@
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.viewpoint.DRepresentation;
import org.eclipse.sirius.viewpoint.DRepresentationDescriptor;
+import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.commands.preferences.util.PreferencesHelper;
import org.polarsys.capella.core.platform.sirius.ui.navigator.viewer.CapellaNavigatorContentProvider;
import org.polarsys.capella.core.ui.search.match.LineSearchMatchChild;
@@ -50,233 +51,231 @@
public class CapellaSearchQuery implements ISearchQuery {
- private final CapellaSearchResult capellaSearchResult = new CapellaSearchResult(this);
- private final CapellaSearchSettings capellaSearchSettings;
-
- private final ITreeContentProvider contentProvider = new CapellaNavigatorContentProvider() {
- // Extend the search scope to include note from diagram
- @Override
- public Object[] getChildren(Object element) {
- if (element instanceof DRepresentationDescriptor
- && ((DRepresentationDescriptor) element).isLoadedRepresentation()) {
- DRepresentation representation = ((DRepresentationDescriptor) element).getRepresentation();
- if (representation instanceof DDiagram) {
- List notes = new ArrayList<>();
- DDiagramGraphicalQuery query = new DDiagramGraphicalQuery((DDiagram) representation);
- Option gmfDiagram = query.getAssociatedGMFDiagram();
- if (gmfDiagram.some()) {
- for (Object child : gmfDiagram.get().getChildren()) {
- if (child instanceof Shape && ViewType.NOTE.equals(((Shape) child).getType())) {
- notes.add((Shape) child);
- }
+ private final CapellaSearchResult capellaSearchResult = new CapellaSearchResult(this);
+
+ private final CapellaSearchSettings capellaSearchSettings;
+
+ private final ITreeContentProvider contentProvider = new CapellaNavigatorContentProvider() {
+ // Extend the search scope to include note from diagram
+ @Override
+ public Object[] getChildren(Object element) {
+ if (element instanceof DRepresentationDescriptor && ((DRepresentationDescriptor) element).isLoadedRepresentation()) {
+ DRepresentation representation = ((DRepresentationDescriptor) element).getRepresentation();
+ if (representation instanceof DDiagram) {
+ List notes = new ArrayList<>();
+ DDiagramGraphicalQuery query = new DDiagramGraphicalQuery((DDiagram) representation);
+ Option gmfDiagram = query.getAssociatedGMFDiagram();
+ if (gmfDiagram.some()) {
+ for (Object child : gmfDiagram.get().getChildren()) {
+ if (child instanceof Shape && ViewType.NOTE.equals(((Shape) child).getType())) {
+ notes.add((Shape) child);
+ }
+ }
+ }
+ return notes.toArray();
+ }
}
- }
- return notes.toArray();
+ return super.getChildren(element);
}
- }
- return super.getChildren(element);
+ };
+
+ public CapellaSearchQuery(CapellaSearchSettings capellaSearchSettings) {
+ this.capellaSearchSettings = capellaSearchSettings;
}
- };
-
- public CapellaSearchQuery(CapellaSearchSettings capellaSearchSettings) {
- this.capellaSearchSettings = capellaSearchSettings;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- capellaSearchResult.removeAll();
- try {
- Pattern pattern = capellaSearchSettings.createPattern();
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- Set