From 3665926f4bf365e1c9acdbaf23841ed395c82e54 Mon Sep 17 00:00:00 2001 From: Patrick Tessier Date: Fri, 30 Aug 2013 15:31:17 +0200 Subject: 401703: Create adl4eclipse profile https://bugs.eclipse.org/bugs/show_bug.cgi?id=401703 now retro engineering of plugin with feature is complete extension points are represented by ports --- .../eclipse/papyrus/adl4eclipse/org/Activator.java | 2 +- .../adl4eclipse/org/IADL4ECLIPSE_Stereotype.java | 1 + .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 25 +++- .../assistant/SimpleFeatureImport.java | 59 ++++++++ .../assistant/SimplePluginImport.java | 148 +++++++++++++++++++++ .../papyrus/adltool/assistant/Activator.java | 2 +- .../ModelCompleteFeatureArchitectureHandler.java | 11 +- .../ModelCompletePluginArchitectureHandler.java | 17 ++- ...delFeatureArchitectureFromWorkspaceHandler.java | 14 +- ...odelPluginArchitectureFromWorkspaceHandler.java | 15 ++- .../META-INF/MANIFEST.MF | 5 +- .../src/org/eclipse/papyrus/adltool/Activator.java | 2 +- ...ompleteFeaturesArchitectureSnapshotCommand.java | 8 ++ ...CompletePluginsArchitectureSnapshotCommand.java | 8 ++ .../SimpleFeaturesArchitectureSnapshotCommand.java | 11 +- .../SimplePluginsArchitectureSnapshotCommand.java | 8 ++ .../designer/ArchitectureSnapshotDesigner.java | 119 +++++++++++++++-- .../CompleteArchitectureSnapshotDesigner.java | 8 +- ...ompleteFeatureArchitectureSnapshotDesigner.java | 7 + .../SimpleArchitectureSnapshotDesigner.java | 34 ++--- .../SimpleFeatureArchitectureSnapshotDesigner.java | 8 ++ .../bundle/AbstractBundleDescriptionDesigner.java | 22 +-- .../designer/bundle/BundleDesignerRegistry.java | 33 ++--- .../designer/bundle/BundleLabelProvider.java | 10 +- .../bundle/FeatureDescriptionDesigner.java | 13 +- .../bundle/IBundleDescriptionDesigner.java | 31 ++++- .../bundle/IPluginModelDescriptionDesigner.java | 82 ------------ .../bundle/LoadedBundleDescriptionDesigner.java | 14 +- .../designer/bundle/ReferencedOSGIElement.java | 64 +++++---- .../bundle/WorkspaceBundleDescriptionDesigner.java | 29 +++- .../designer/wizard/BundleSelectionPage.java | 15 ++- .../designer/wizard/FeatureArchitectureWizard.java | 8 +- .../designer/wizard/PluginArchitectureWizard.java | 22 ++- 34 files changed, 612 insertions(+), 246 deletions(-) create mode 100644 extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimpleFeatureImport.java create mode 100644 extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimplePluginImport.java delete mode 100644 extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IPluginModelDescriptionDesigner.java (limited to 'extraplugins/adl4eclipse') diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/Activator.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/Activator.java index e99c3653f32..30678fe13b1 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/Activator.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/Activator.java @@ -21,7 +21,7 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - // The plug-in ID + /** The plug-in ID**/ public static final String PLUGIN_ID = "org.eclipse.papyrus.adl4eclipse.org"; //$NON-NLS-1$ // The shared instance diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/IADL4ECLIPSE_Stereotype.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/IADL4ECLIPSE_Stereotype.java index 9995c68ba32..db4e40ed21a 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/IADL4ECLIPSE_Stereotype.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipse.profile/src/org/eclipse/papyrus/adl4eclipse/org/IADL4ECLIPSE_Stereotype.java @@ -13,6 +13,7 @@ *****************************************************************************/ package org.eclipse.papyrus.adl4eclipse.org; +/** set of constant to manipulate stereotype**/ public interface IADL4ECLIPSE_Stereotype { /** Qualified name of the stereotype Plugin */ public static final String PLUGIN_STEREOTYPE = "ADL4Eclipse::Plugin"; diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF index ec651e394c2..8f76750ea2e 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/META-INF/MANIFEST.MF @@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core;bundle-version="0.10.1", org.eclipse.uml2.uml, org.eclipse.papyrus.infra.emf;bundle-version="0.10.1", - org.eclipse.papyrus.adl4eclipsetool;bundle-version="0.10.1" + org.eclipse.papyrus.adl4eclipsetool;bundle-version="0.10.1", + org.eclipse.pde.core;bundle-version="3.9.0" Export-Package: org.eclipse.papyrus.adltool.assistant Bundle-Vendor: %providerName Bundle-Version: 0.10.1.qualifier diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml index 2f76edd5d0b..3ba9bd4b24c 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/plugin.xml @@ -1,7 +1,7 @@ - - + + + + + + + + + diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimpleFeatureImport.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimpleFeatureImport.java new file mode 100644 index 00000000000..f1115cd0926 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimpleFeatureImport.java @@ -0,0 +1,59 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.adl4eclipsetool.assistant; + +import java.util.ArrayList; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.papyrus.adltool.command.SimpleFeaturesArchitectureSnapshotCommand; +import org.eclipse.papyrus.adltool.designer.ArchitectureSnapshotDesigner; +import org.eclipse.papyrus.adltool.designer.wizard.BundleSelectionPage; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Package; + +/** + * this class is used to do the retro engineering from workspace plug-in. It adds only in the platform dependencies. + * + */ +public class SimpleFeatureImport extends SimplePluginImport{ + @Override + public void addPages() { + //look for all plug-ins from the workspace + ArrayList bundleList= new ArrayList(); + bundleList.addAll(ArchitectureSnapshotDesigner.getWorkspaceFeature()); + bundleSelectionPage = new BundleSelectionPage(bundleList); + addPage(bundleSelectionPage); + } + + + @Override + public boolean performFinish() { + + // one bundle must be selected + if(getSelectedBundle().size()>0){ + // get the domain in order to launch the command + TransactionalEditingDomain dom = modelSet.getTransactionalEditingDomain(); + ArrayList selection=getSelectionSet(); + + if( (selection.size()==1) &&(selection.get(0)instanceof Package)){ + //launch the simple retro engineering + SimpleFeaturesArchitectureSnapshotCommand comd= new SimpleFeaturesArchitectureSnapshotCommand(dom, (Package)selection.get(0), getSelectedBundle()); + dom.getCommandStack().execute(comd); + } + return true; + } + return false; + } + +} diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimplePluginImport.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimplePluginImport.java new file mode 100644 index 00000000000..36ca3d8fc73 --- /dev/null +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adl4eclipsetool/assistant/SimplePluginImport.java @@ -0,0 +1,148 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.adl4eclipsetool.assistant; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.papyrus.adltool.command.SimplePluginsArchitectureSnapshotCommand; +import org.eclipse.papyrus.adltool.designer.ArchitectureSnapshotDesigner; +import org.eclipse.papyrus.adltool.designer.wizard.BundleSelectionPage; +import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForSelection; +import org.eclipse.ui.IImportWizard; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Package; + +/** + * this class is used to do the retro engineering from workspaceplugin. It adds only in the platform dependencies. + * + */ +public class SimplePluginImport extends Wizard implements IImportWizard { + + protected BundleSelectionPage bundleSelectionPage; + protected TransactionalEditingDomain transactionalEditingDomain=null; + protected PapyrusMultiDiagramEditor papyrusEditor; + protected ModelSet modelSet; + + /** + * + * Constructor. + * + */ + public SimplePluginImport() { + super(); + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + //look for all plugins from the workspace + ArrayList bundleList= new ArrayList(); + bundleList.addAll(ArchitectureSnapshotDesigner.getWorkspaceBundle()); + bundleSelectionPage = new BundleSelectionPage(bundleList); + addPage(bundleSelectionPage); + } + + /** + * + * @return the list of selected bundle from the page + */ + public ArrayList getSelectedBundle(){ + return bundleSelectionPage.getResult(); + } + @Override + public boolean performFinish() { + + // one bundle must be selected + if(getSelectedBundle().size()>0){ + // get the domain in order to launche the command + TransactionalEditingDomain dom = modelSet.getTransactionalEditingDomain(); + ArrayList selection=getSelectionSet(); + + if( (selection.size()==1) &&(selection.get(0)instanceof Package)){ + //launch the simple retro engineering + SimplePluginsArchitectureSnapshotCommand comd= new SimplePluginsArchitectureSnapshotCommand(dom, (Package)selection.get(0),getSelectedBundle()); + dom.getCommandStack().execute(comd); + } + return true; + } + return false; + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + + //get the service registry of papyrus from the selection + ServicesRegistry registry=null; + try { + registry = ServiceUtilsForSelection.getInstance().getServiceRegistry(selection); + } catch (ServiceException e1) { + e1.printStackTrace(); + } + try { + modelSet = registry.getService(ModelSet.class); + } catch (ServiceException e) { + e.printStackTrace(); + } + + } + + /** + * getSelected element in the diagram or in the model explorer + * @return Element or null + */ + protected ArrayList getSelectionSet(){ + ArrayList selectedSet =new ArrayList(); + ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); + ISelection selection = selectionService.getSelection(); + + + if(selection instanceof IStructuredSelection) { + @SuppressWarnings("rawtypes") + Iterator selectedobjectIteractor = ((IStructuredSelection)selection).iterator(); + while (selectedobjectIteractor.hasNext()) { + Object currentSelection = selectedobjectIteractor.next(); + if(currentSelection instanceof GraphicalEditPart) { + Object graphicalElement = ((GraphicalEditPart)currentSelection).getModel(); + if((graphicalElement instanceof View) && ((View)graphicalElement).getElement() instanceof org.eclipse.uml2.uml.Element) { + selectedSet.add( (org.eclipse.uml2.uml.Element)((View)graphicalElement).getElement()); + } + } + else if(currentSelection instanceof IAdaptable) { + EObject selectedEObject = (EObject)((IAdaptable)currentSelection).getAdapter(EObject.class); + if (selectedEObject instanceof org.eclipse.uml2.uml.Element){ + selectedSet.add((Element)selectedEObject); + } + } + } + + } + return selectedSet; + } + +} diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java index 8846e4faaf4..24150f65ff0 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/Activator.java @@ -22,7 +22,7 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin implements IStartup{ - // The plug-in ID + /** The plug-in ID**/ public static final String PLUGIN_ID = "org.eclipse.papyrus.adl4eclipsetool.assistant"; //$NON-NLS-1$ // The shared instance diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompleteFeatureArchitectureHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompleteFeatureArchitectureHandler.java index 0d8d5521c7e..064a5aeee91 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompleteFeatureArchitectureHandler.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompleteFeatureArchitectureHandler.java @@ -31,10 +31,15 @@ import org.eclipse.uml2.uml.Package; /** * this handler is used to generate the feature and plugin architecture from workspace - * + *@deprecated */ public class ModelCompleteFeatureArchitectureHandler extends ADLToolAbstractHandler { + /** + * + * Constructor. + * + */ public ModelCompleteFeatureArchitectureHandler() { } @@ -67,9 +72,7 @@ public class ModelCompleteFeatureArchitectureHandler extends ADLToolAbstractHand } /** * - * @see org.eclipse.core.commands.AbstractHandler#isEnabled() - * - * @return + * {@inheritDoc} */ @Override public boolean isEnabled() { diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompletePluginArchitectureHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompletePluginArchitectureHandler.java index dbc46fb4c53..ad7dd71c1d8 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompletePluginArchitectureHandler.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelCompletePluginArchitectureHandler.java @@ -29,10 +29,17 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Package; - +/** + *@deprecated + * + */ public class ModelCompletePluginArchitectureHandler extends ADLToolAbstractHandler { - + /** + * + * Constructor. + * + */ public ModelCompletePluginArchitectureHandler() { } @@ -59,14 +66,12 @@ public class ModelCompletePluginArchitectureHandler extends ADLToolAbstractHandl dom.getCommandStack().execute(comd); } } - + return null; } /** * - * @see org.eclipse.core.commands.AbstractHandler#isEnabled() - * - * @return + *{@inheritDoc} */ @Override public boolean isEnabled() { diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelFeatureArchitectureFromWorkspaceHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelFeatureArchitectureFromWorkspaceHandler.java index 012376f3fb7..ca1a5bd7084 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelFeatureArchitectureFromWorkspaceHandler.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelFeatureArchitectureFromWorkspaceHandler.java @@ -31,10 +31,15 @@ import org.eclipse.uml2.uml.Package; /** * this handler is used to generate the feature and plugin architecture from workspace - * + *@deprecated */ public class ModelFeatureArchitectureFromWorkspaceHandler extends ADLToolAbstractHandler { - + + /** + * + * Constructor. + * + */ public ModelFeatureArchitectureFromWorkspaceHandler() { } @@ -66,10 +71,7 @@ public class ModelFeatureArchitectureFromWorkspaceHandler extends ADLToolAbstrac return null; } /** - * - * @see org.eclipse.core.commands.AbstractHandler#isEnabled() - * - * @return + * {@inheritDoc} */ @Override public boolean isEnabled() { diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelPluginArchitectureFromWorkspaceHandler.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelPluginArchitectureFromWorkspaceHandler.java index 2f870f942fc..12a400d75c3 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelPluginArchitectureFromWorkspaceHandler.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool.assistant/src/org/eclipse/papyrus/adltool/assistant/ModelPluginArchitectureFromWorkspaceHandler.java @@ -31,10 +31,14 @@ import org.eclipse.uml2.uml.Package; /** * this handler is used to generate the architecture from workspace - * + *@deprecated */ public class ModelPluginArchitectureFromWorkspaceHandler extends ADLToolAbstractHandler { - + /** + * + * Constructor. + * + */ public ModelPluginArchitectureFromWorkspaceHandler() { } @@ -62,14 +66,11 @@ public class ModelPluginArchitectureFromWorkspaceHandler extends ADLToolAbstract } } - + return null; } /** - * - * @see org.eclipse.core.commands.AbstractHandler#isEnabled() - * - * @return + * {@inheritDoc} */ @Override public boolean isEnabled() { diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF index ce1321198ec..8c62651a37a 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/META-INF/MANIFEST.MF @@ -1,5 +1,8 @@ Manifest-Version: 1.0 -Export-Package: org.eclipse.papyrus.adltool.command, +Export-Package: org.eclipse.papyrus.adltool, + org.eclipse.papyrus.adltool.command, + org.eclipse.papyrus.adltool.designer, + org.eclipse.papyrus.adltool.designer.bundle, org.eclipse.papyrus.adltool.designer.wizard Bundle-ActivationPolicy: lazy Bundle-Name: %pluginName diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java index 817231de3dd..bdec1845685 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/Activator.java @@ -21,7 +21,7 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - // The plug-in ID + /** The plug-in ID**/ public static final String PLUGIN_ID = "org.eclipse.papyrus.adl4eclipsetool"; //$NON-NLS-1$ // The shared instance diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteFeaturesArchitectureSnapshotCommand.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteFeaturesArchitectureSnapshotCommand.java index 8001b072cab..ab8eb2f0697 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteFeaturesArchitectureSnapshotCommand.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompleteFeaturesArchitectureSnapshotCommand.java @@ -30,6 +30,14 @@ public class CompleteFeaturesArchitectureSnapshotCommand extends RecordingComman protected Package rootPackage; protected ArrayList bundleList=null; + /** + * + * Constructor. + * + * @param domain the domain mandatory to launch the command + * @param rootPackage the root package in which the sub-packages will be created + * @param bundleList the list of bundle for the retro engineering + */ public CompleteFeaturesArchitectureSnapshotCommand(TransactionalEditingDomain domain,Package rootPackage, ArrayList bundleList) { super(domain,"Import Bundles", "Model Feature architecture from current workspace"); this.rootPackage=rootPackage; diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompletePluginsArchitectureSnapshotCommand.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompletePluginsArchitectureSnapshotCommand.java index e175b651f7d..895e6bd4470 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompletePluginsArchitectureSnapshotCommand.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/CompletePluginsArchitectureSnapshotCommand.java @@ -29,6 +29,14 @@ public class CompletePluginsArchitectureSnapshotCommand extends RecordingCommand protected ArrayList bundleList=null; protected Package rootPackage; + /** + * + * Constructor. + * + * @param domain the domain mandatory to launch the command + * @param rootPackage the root package in which the sub-packages will be created + * @param bundleList the list of bundle for the retro engineering + */ public CompletePluginsArchitectureSnapshotCommand(TransactionalEditingDomain domain,Package rootPackage, ArrayList bundleList) { super(domain,"Import Bundles", "Model architecture from current workspace"); this.rootPackage=rootPackage; diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleFeaturesArchitectureSnapshotCommand.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleFeaturesArchitectureSnapshotCommand.java index c21c5541bea..2597fbe86c8 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleFeaturesArchitectureSnapshotCommand.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimpleFeaturesArchitectureSnapshotCommand.java @@ -29,7 +29,16 @@ public class SimpleFeaturesArchitectureSnapshotCommand extends RecordingCommand protected Package rootPackage; protected ArrayList bundleList=null; - + + + /** + * Use to create the structure of features from plugin and feature in eclipse + * Constructor. + * + * @param domain the editing domain + * @param rootPackage the package root + * @param bundleList the list of feature that will be retro-engineered + */ public SimpleFeaturesArchitectureSnapshotCommand(TransactionalEditingDomain domain,Package rootPackage, ArrayList bundleList) { super(domain,"Import Bundles", "Model Feature architecture from current workspace"); this.rootPackage=rootPackage; diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimplePluginsArchitectureSnapshotCommand.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimplePluginsArchitectureSnapshotCommand.java index 0ece183e722..8e2113862e1 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimplePluginsArchitectureSnapshotCommand.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/command/SimplePluginsArchitectureSnapshotCommand.java @@ -30,6 +30,14 @@ public class SimplePluginsArchitectureSnapshotCommand extends RecordingCommand { protected Package rootPackage; protected ArrayList bundleList=null; + /** + * + * Constructor. + * + * @param domain the domain mandatory to launch the command + * @param rootPackage the root package in which the sub-packages will be created + * @param bundleList the list of bundle for the retro engineering + */ public SimplePluginsArchitectureSnapshotCommand(TransactionalEditingDomain domain,Package rootPackage, ArrayList bundleList) { super(domain,"Import Bundles", "Model architecture from current workspace"); this.rootPackage=rootPackage; diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java index 9cd78ace9cd..9130528b00d 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java @@ -21,9 +21,11 @@ import java.util.Iterator; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.osgi.service.environment.Constants; import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype; import org.eclipse.papyrus.adltool.Activator; import org.eclipse.papyrus.adltool.designer.bundle.BundleDesignerRegistry; @@ -32,15 +34,15 @@ import org.eclipse.papyrus.osgi.profile.IOSGIStereotype; import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile; import org.eclipse.papyrus.uml.extensionpoints.utils.Util; import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.core.project.IBundleProjectDescription; import org.eclipse.pde.core.project.IBundleProjectService; import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.ifeature.IFeatureModel; -import org.eclipse.pde.internal.core.natures.PDE; +import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; import org.eclipse.uml2.uml.Component; import org.eclipse.uml2.uml.Dependency; import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.Port; import org.eclipse.uml2.uml.Profile; import org.eclipse.uml2.uml.Stereotype; import org.eclipse.uml2.uml.UMLFactory; @@ -53,14 +55,15 @@ import org.osgi.framework.VersionRange; * this purpose of this class is to provide mechanism to import bundle into model * */ +@SuppressWarnings("restriction") public abstract class ArchitectureSnapshotDesigner{ - protected HashMap createdBundleIDIndex=null; protected HashMap bundlesIndex=null; protected HashMap createdFeatureIndex=null; protected HashMap featureIndex=null; protected BundleDesignerRegistry bundleDesignerRegistry=null; protected int dependenciesN=0; protected ArrayListbundleInitialList=null; + protected int dependencyLevelMax=15; @@ -73,7 +76,6 @@ public abstract class ArchitectureSnapshotDesigner{ private ArchitectureSnapshotDesigner (Package rootPackage) { this.rootPackage=rootPackage; - createdBundleIDIndex= new HashMap(); bundleDesignerRegistry= new BundleDesignerRegistry(); createdFeatureIndex= new HashMap(); @@ -92,7 +94,9 @@ public abstract class ArchitectureSnapshotDesigner{ } - + /** + * this method is used to launch the import of bundle into models + */ public abstract void runImportBundles(); /** * @@ -161,7 +165,7 @@ public abstract class ArchitectureSnapshotDesigner{ Iterator bundleProjectsIterator= bundleProjects.iterator(); while(bundleProjectsIterator.hasNext()) { Object bundleProject = (Object)bundleProjectsIterator.next(); - modelBundle(pluginPackage, bundleProject); + modelBundle(pluginPackage, bundleProject,0); } System.out.println("created bundles numbers: "+createdFeatureIndex.keySet().size()); System.out.println("dependencies: "+dependenciesN); @@ -226,7 +230,7 @@ public abstract class ArchitectureSnapshotDesigner{ * @param pluginPackage * @param bundleProjectsIterator */ - protected void modelBundle(Package pluginPackage, Object bundleProject) { + protected void modelBundle(Package pluginPackage, Object bundleProject, int currentLevel) { if(bundleProject instanceof IFeatureModel){ if(!(createdFeatureIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject)))){ @@ -243,7 +247,8 @@ public abstract class ArchitectureSnapshotDesigner{ else{ System.err.println("bundle symbolic name is null"); } - fillRequiredBundle(bundleComponent, bundleProject, pluginPackage); + fillRequiredBundle(bundleComponent, bundleProject, pluginPackage, currentLevel); + fillReferencedPlugins(pluginPackage,(IFeatureModel) bundleProject, currentLevel, bundleComponent); //bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject); //bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject); @@ -252,9 +257,12 @@ public abstract class ArchitectureSnapshotDesigner{ }else{ if(!(createdFeatureIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject)))){ + + Component bundleComponent= UMLFactory.eINSTANCE.createComponent(); - System.out.println("P-->"+bundleDesignerRegistry.getSymbolicName(bundleProject)); + System.out.println("P ("+currentLevel+")-->"+bundleDesignerRegistry.getSymbolicName(bundleProject)); + bundleComponent.setName(bundleDesignerRegistry.getSymbolicName(bundleProject)); pluginPackage.getPackagedElements().add(bundleComponent); Stereotype pluginStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE); @@ -269,9 +277,89 @@ public abstract class ArchitectureSnapshotDesigner{ else{ System.err.println("bundle symbolic name is null"); } - fillRequiredBundle(bundleComponent, bundleProject, pluginPackage); + fillRequiredBundle(bundleComponent, bundleProject, pluginPackage,currentLevel ); bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject); bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject); + modelExtensions(bundleComponent,bundleProject, currentLevel); + } + } + } + protected void modelExtensions(Component bundleComponent,Object bundleProject, int currentLevel) { + if(currentLevel>=dependencyLevelMax){ + return; + } + + //list all extensions use and declaration + IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); + IExtension[] extensions= extensionRegistry.getExtensions(bundleDesignerRegistry.getSymbolicName(bundleProject)); + System.out.println("nb extension "+extensions.length); + + + for(int i = 0; i < extensions.length; i++) { + //use or declaration create it! + Port clientPort=bundleComponent.createOwnedPort(extensions[i].getExtensionPointUniqueIdentifier(), null); + String ownerID=extensionRegistry.getExtensionPoint(extensions[i].getExtensionPointUniqueIdentifier()).getNamespaceIdentifier(); + System.out.println("---------> "+extensions[i].getExtensionPointUniqueIdentifier()+" FROM "+ownerID ); + + //look for the plugin that declare the extension point + Object foundBundle=getBundle(ownerID ); + if (foundBundle!=null){ + if(!(createdFeatureIndex.containsKey(ownerID))) { + modelBundle(bundleComponent.getNearestPackage(),foundBundle, currentLevel+1); + } + } + else { + modelPseudoBundle(bundleComponent.getNearestPackage(),ownerID); + } + + Component componentOwner=createdFeatureIndex.get(ownerID); + // if the declaration of the bundle is the same bundle , this is a declaration so no link to create + if(!componentOwner.equals(bundleComponent)){ + Port supplierPort= componentOwner.getOwnedPort(extensions[i].getExtensionPointUniqueIdentifier(), null); + if(supplierPort==null ){ + supplierPort=componentOwner.createOwnedPort(extensions[i].getExtensionPointUniqueIdentifier(), null); + } + modelRelationExtensionBased(bundleComponent, extensions[i], clientPort, supplierPort); + } + } + } + + /** + * create a model element between 2 elements that represents relation between two extension point + * @param bundleComponent the component that use extension + * @param extension the extension point + * @param clientPort the port that represent the use to the extension point + * @param supplierPort the port that represent the declaration of this extension point + */ + protected void modelRelationExtensionBased(Component bundleComponent, IExtension extension, Port clientPort, Port supplierPort) { + Dependency dependency=UMLFactory.eINSTANCE.createDependency(); + dependency.setName(extension.getExtensionPointUniqueIdentifier()); + bundleComponent.getNearestPackage().getPackagedElements().add(dependency); + //bundleComponent.getPackagedElements().add(dependency); + dependency.getClients().add(clientPort); + dependency.getSuppliers().add(supplierPort); + } + + /** + * fill the list of referenced plug-ins of a feature. for each plug-in a property will be created + * @param pluginPackage the package that will contain plug-ins + * @param bundleProject the bundle project that represents a feature + * @param currentLevel the current level about dependency depth + * @param bundleComponent model in UML that correspond to the bundle project + */ + protected void fillReferencedPlugins(Package pluginPackage, IFeatureModel bundleProject, int currentLevel, Component bundleComponent) { + IFeaturePlugin[] pluginsList=bundleProject.getFeature().getPlugins(); + for(int i = 0; i < pluginsList.length; i++) { + System.out.println("+-> P from F ("+currentLevel+")" +pluginsList[i].getId() ); + Object foundBundle=getBundle(pluginsList[i].getId() ); + if( foundBundle==null){ + System.err.println("Cannot find the plugin : "+pluginsList[i].getId() ); + System.err.println("Memory\n"+ this); + } + else{ + modelBundle(pluginPackage, foundBundle, currentLevel); + Component createdBundle=createdFeatureIndex.get(pluginsList[i].getId()); + bundleComponent.createOwnedAttribute(pluginsList[i].getId(), createdBundle); } } } @@ -335,7 +423,7 @@ public abstract class ArchitectureSnapshotDesigner{ try { if((project[i].getNature(IBundleProjectDescription.PLUGIN_NATURE))!=null){ IBundleProjectDescription bundleDescription=BundleProjectservice.getDescription(project[i]); - bundlesIndex.put(bundleDesignerRegistry.getBundleValue(project[i], org.osgi.framework.Constants.BUNDLE_NAME), bundleDescription); + bundlesIndex.put(bundleDesignerRegistry.getBundleValue(bundleDescription, org.osgi.framework.Constants.BUNDLE_NAME), bundleDescription); } } catch (CoreException e) { e.printStackTrace(); @@ -355,9 +443,12 @@ public abstract class ArchitectureSnapshotDesigner{ * @param bundleComponent the description of the bundle * @param bundleProject */ - protected void fillRequiredBundle(Component bundleComponent,Object bundleProject,Package library ) { + protected void fillRequiredBundle(Component bundleComponent,Object bundleProject,Package library, int currentLevel ) { ArrayList requiredBundleNameList=bundleDesignerRegistry.getRequiredBundle(bundleComponent, bundleProject); Iterator bundleNameIterator= requiredBundleNameList.iterator(); + if(currentLevel>=dependencyLevelMax){ + return; + } while(bundleNameIterator.hasNext()) { dependenciesN++; ReferencedOSGIElement bundleRef = (ReferencedOSGIElement)bundleNameIterator.next(); @@ -367,7 +458,7 @@ public abstract class ArchitectureSnapshotDesigner{ if(bundleRef.isOptional()||foundBundle!=null){ if (foundBundle!=null){ if((!(createdFeatureIndex.containsKey(bundleRef.getSymbolicName())))&&(!(createdFeatureIndex.containsKey(bundleRef.getSymbolicName())))) { - modelBundle(library,foundBundle); + modelBundle(library,foundBundle, currentLevel+1); } } else { diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java index 1d9a0ee5f50..ad342151c70 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteArchitectureSnapshotDesigner.java @@ -24,7 +24,13 @@ import org.eclipse.uml2.uml.Package; public class CompleteArchitectureSnapshotDesigner extends ArchitectureSnapshotDesigner { - + /** + * + * Constructor. + * + * @param rootPackage + * @param bundleInitialList + */ public CompleteArchitectureSnapshotDesigner(Package rootPackage, ArrayListbundleInitialList) { super(rootPackage, bundleInitialList); } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteFeatureArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteFeatureArchitectureSnapshotDesigner.java index ac3528e6f7e..c4c32ac7040 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteFeatureArchitectureSnapshotDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteFeatureArchitectureSnapshotDesigner.java @@ -23,6 +23,13 @@ import org.eclipse.uml2.uml.Package; */ public class CompleteFeatureArchitectureSnapshotDesigner extends ArchitectureSnapshotDesigner { + /** + * + * Constructor. + * + * @param rootPackage + * @param bundleInitialList + */ public CompleteFeatureArchitectureSnapshotDesigner(Package rootPackage, ArrayList bundleInitialList) { super(rootPackage, bundleInitialList); } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java index e1b1eddf297..6c26991c524 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleArchitectureSnapshotDesigner.java @@ -16,7 +16,6 @@ package org.eclipse.papyrus.adltool.designer; import java.util.ArrayList; import org.eclipse.uml2.uml.Package; -import org.osgi.framework.Bundle; /** @@ -25,38 +24,25 @@ import org.osgi.framework.Bundle; */ public class SimpleArchitectureSnapshotDesigner extends ArchitectureSnapshotDesigner { - protected Package architecture; - protected Package platform; - protected Package architecturefeature; - protected Package platformfeature; - + /** + * + * Constructor. + * + * @param rootPackage the root package where the sub-packages "Architecture" and "platform" will be created + * @param bundleInitialList the list of bundle that will be retro engineered. + */ public SimpleArchitectureSnapshotDesigner(Package rootPackage, ArrayListbundleInitialList) { super(rootPackage, bundleInitialList); - } - - @Override - protected void initModel() { - super.initModel(); - architecture=rootPackage.createNestedPackage("Architecture"); - platform=rootPackage.createNestedPackage("Platform"); - + // the simple user cannot choose the level of dependency it has only the level 1 + dependencyLevelMax=1; } @Override public void runImportBundles() { initModel(); - modelBundles(architecture); + modelBundles(rootPackage); } - @Override - protected void modelBundle(Package pluginPackage, Object bundleProject) { - if (bundleProject instanceof Bundle){ - super.modelBundle(platform, bundleProject); - } - else{ - super.modelBundle(architecture, bundleProject); - } - } } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleFeatureArchitectureSnapshotDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleFeatureArchitectureSnapshotDesigner.java index 1bedd942c28..8821203a151 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleFeatureArchitectureSnapshotDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/SimpleFeatureArchitectureSnapshotDesigner.java @@ -29,8 +29,16 @@ public class SimpleFeatureArchitectureSnapshotDesigner extends CompleteFeatureAr protected Package architecturefeature; protected Package platformfeature; + /** + * + * Constructor. + * + * @param rootPackage the root package where the sub-packages "Architecture" and "platform" will be created + * @param bundleInitialList the list of feature that will be retro engineered. + */ public SimpleFeatureArchitectureSnapshotDesigner(Package rootPackage, ArrayList bundleInitialList) { super(rootPackage, bundleInitialList); + this.dependencyLevelMax=1; } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java index 6a35616e7c4..4de4206bcc9 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/AbstractBundleDescriptionDesigner.java @@ -13,7 +13,7 @@ *****************************************************************************/ package org.eclipse.papyrus.adltool.designer.bundle; -import java.util.ArrayList; +import java.util.Collections; import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype; import org.eclipse.papyrus.osgi.profile.IOSGIStereotype; @@ -22,13 +22,18 @@ import org.eclipse.uml2.uml.Stereotype; import org.osgi.framework.Constants; +/** + * this abstract class is used to construct model from bundle in the workspace or from the platform + * + */ + public abstract class AbstractBundleDescriptionDesigner implements IBundleDescriptionDesigner { /** * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getBundleValue(java.lang.Object, java.lang.String) * * @param bundleProject * @param key - * @return + * @return the value that corresponds to the key */ public abstract String getBundleValue( Object bundleProject, String key); @@ -111,6 +116,7 @@ public abstract class AbstractBundleDescriptionDesigner implements IBundleDescri //String activator=getBundleValue( bundleProject, Constants.BUNDLE_NATIVECODE_PROCESSOR); //BUNDLE_REQUIREDEXECUTIONENVIRONMENT + @SuppressWarnings("deprecation") String requiredExecutionEnv=getBundleValue( bundleProject, Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT); bundleComponent.setValue(pluginStereotype, IOSGIStereotype.BUNDLE_REQUIREDEXECUTIONENVIRONMENT_ATT, requiredExecutionEnv); //BUNDLE_SYMBOLICNAME @@ -139,30 +145,30 @@ public abstract class AbstractBundleDescriptionDesigner implements IBundleDescri if( lazystartExpression.contains(";")){ String lazyStartString= lazystartExpression.substring(0, lazystartExpression.indexOf(";")); lazyStartValue= Boolean.valueOf(lazyStartString); - String lazyStartException= lazystartExpression.substring(lazystartExpression.indexOf(";")); + //String lazyStartException= lazystartExpression.substring(lazystartExpression.indexOf(";")); //TODO: lazystartExpression //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT,lazyStartException ); } else{ lazyStartValue= Boolean.valueOf(lazystartExpression); bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTART_ATT,lazyStartValue ); - bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT,new ArrayList() ); + bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT,Collections.EMPTY_LIST ); } }else{ bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTART_ATT,null ); - bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT, new ArrayList() ); + bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_LAZYSTARTEXCEPTION_ATT, Collections.EMPTY_LIST ); } //IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT - String buddypolicy=getBundleValue( bundleProject, ECLIPSE_BUDDY_LOADER); + //String buddypolicy=getBundleValue( bundleProject, ECLIPSE_BUDDY_LOADER); //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy); //IADL4ECLIPSE_Stereotype.PLUGIN_BUNDLESHAPE_ATT - String bundleShape=getBundleValue( bundleProject, ECLIPSE_BUNDLE_SHAPE); + //String bundleShape=getBundleValue( bundleProject, ECLIPSE_BUNDLE_SHAPE); //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_BUDDYPOLICY_ATT, buddypolicy); //IADL4ECLIPSE_Stereotype.PLUGIN_CAPABILITY_ATT - String capability=getBundleValue( bundleProject, ECLIPSE_GENERICCAPABILITY); + //String capability=getBundleValue( bundleProject, ECLIPSE_GENERICCAPABILITY); //bundleComponent.setValue(pluginStereotype, IADL4ECLIPSE_Stereotype.PLUGIN_CAPABILITY_ATT, capability); //IADL4ECLIPSE_Stereotype.PLUGIN_EXTENSIBLEAPI_ATT //String buddypolicy=getBundleValue( bundleProject, BUDDY_LOADER); diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java index e110c2ae508..214a50c562d 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java @@ -15,7 +15,6 @@ package org.eclipse.papyrus.adltool.designer.bundle; import java.util.ArrayList; -import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.core.project.IBundleProjectDescription; import org.eclipse.pde.internal.core.ifeature.IFeatureModel; import org.eclipse.uml2.uml.Component; @@ -26,18 +25,22 @@ import org.osgi.framework.Bundle; * this registry redirect the job to a good implementation. * */ +@SuppressWarnings("restriction") public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ protected WorkspaceBundleDescriptionDesigner workspaceBundleDescriptionDesigner; protected LoadedBundleDescriptionDesigner loadedBundleDescriptionDesigner; protected FeatureDescriptionDesigner featureDescriptionDesigner; - protected IPluginModelDescriptionDesigner IpluginModelDescriptionDesigner; + /** + * create the registry + * Constructor. + * + */ public BundleDesignerRegistry() { workspaceBundleDescriptionDesigner= new WorkspaceBundleDescriptionDesigner(); loadedBundleDescriptionDesigner= new LoadedBundleDescriptionDesigner(); featureDescriptionDesigner =new FeatureDescriptionDesigner(); - IpluginModelDescriptionDesigner=new IPluginModelDescriptionDesigner(); } /** @@ -46,7 +49,7 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ * * @param bundleProject * @param key - * @return + * @return the value that correspond to the key */ public String getBundleValue(Object bundleProject, String key) { if(bundleProject instanceof IBundleProjectDescription){ @@ -59,9 +62,6 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ else if(bundleProject instanceof IFeatureModel){ return featureDescriptionDesigner.getBundleValue(bundleProject, key); } - else if(bundleProject instanceof IPluginModelBase){ - IpluginModelDescriptionDesigner.getBundleValue(bundleProject, key); - } return null; } @@ -83,9 +83,6 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ else if(bundleProject instanceof IFeatureModel){ featureDescriptionDesigner.fillPluginProperties(bundleComponent, bundleProject); } - else if(bundleProject instanceof IPluginModelBase){ - IpluginModelDescriptionDesigner.fillPluginProperties(bundleComponent, bundleProject); - } } /** @@ -93,7 +90,7 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getSymbolicName(java.lang.Object) * * @param bundleProject - * @return + * @return a string that correspond to the symbolic name */ public String getSymbolicName(Object bundleProject) { if(bundleProject instanceof IBundleProjectDescription){ @@ -106,9 +103,6 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ else if(bundleProject instanceof IFeatureModel){ return featureDescriptionDesigner.getSymbolicName(bundleProject); } - else if(bundleProject instanceof IPluginModelBase){ - return IpluginModelDescriptionDesigner.getSymbolicName( bundleProject); - } return null; } @@ -130,9 +124,6 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ else if(bundleProject instanceof IFeatureModel){ featureDescriptionDesigner.fillExportedPackages(bundleComponent, bundleProject); } - else if(bundleProject instanceof IPluginModelBase){ - IpluginModelDescriptionDesigner.fillExportedPackages(bundleComponent, bundleProject); - } } /** @@ -141,7 +132,7 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ * * @param bundleComponent * @param bundleProject - * @return + * @return the list of required Bundle */ public ArrayList getRequiredBundle(Component bundleComponent, Object bundleProject) { if(bundleProject instanceof IBundleProjectDescription){ @@ -154,9 +145,6 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ else if(bundleProject instanceof IFeatureModel){ return featureDescriptionDesigner.getRequiredBundle(bundleComponent, bundleProject); } - else if(bundleProject instanceof IPluginModelBase){ - return IpluginModelDescriptionDesigner.getRequiredBundle(bundleComponent, bundleProject); - } return new ArrayList(); } @@ -172,9 +160,6 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{ else if(bundleProject instanceof IFeatureModel){ return featureDescriptionDesigner.getName(bundleProject); } - else if(bundleProject instanceof IPluginModelBase){ - return IpluginModelDescriptionDesigner.getName( bundleProject); - } return null; } } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java index afd7059d78b..4bac7d338b1 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java @@ -23,10 +23,18 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.Bundle; - +/** + * this class is a label provider to display in a GUI a list of bundle + */ +@SuppressWarnings("restriction") public class BundleLabelProvider extends LabelProvider { BundleDesignerRegistry bundleDesignerRegistry; + /** + * + * Constructor. + * + */ public BundleLabelProvider() { bundleDesignerRegistry= new BundleDesignerRegistry(); } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/FeatureDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/FeatureDescriptionDesigner.java index bd865072f23..9e9bb8610b2 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/FeatureDescriptionDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/FeatureDescriptionDesigner.java @@ -2,15 +2,16 @@ package org.eclipse.papyrus.adltool.designer.bundle; import java.util.ArrayList; -import org.eclipse.osgi.util.ManifestElement; import org.eclipse.pde.internal.core.ifeature.IFeatureImport; import org.eclipse.pde.internal.core.ifeature.IFeatureModel; import org.eclipse.uml2.uml.Component; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.osgi.framework.VersionRange; +/** + * this class is used to extract information from an eclipse feature + * + */ +@SuppressWarnings("restriction") public class FeatureDescriptionDesigner extends AbstractBundleDescriptionDesigner { public String getSymbolicName(Object bundleProject) { @@ -21,7 +22,6 @@ public class FeatureDescriptionDesigner extends AbstractBundleDescriptionDesigne } public void fillExportedPackages(Component bundleComponent, Object bundleProject) { - // TODO Auto-generated method stub } @@ -31,14 +31,13 @@ public class FeatureDescriptionDesigner extends AbstractBundleDescriptionDesigne * * @param bundleComponent * @param bundleProject - * @return + * @return the list of required Bundle */ public ArrayList getRequiredBundle(Component bundleComponent, Object bundleProject) { ArrayList bundleListName=new ArrayList(); if( bundleProject instanceof IFeatureModel){ IFeatureModel currentFeatureModel=(IFeatureModel)bundleProject; IFeatureImport[] imports=currentFeatureModel.getFeature().getImports(); - for(int i = 0; i < imports.length; i++) { ReferencedOSGIElement newRefElement= new ReferencedOSGIElement(null,imports[i].getId()); diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java index 17ffda880f0..b7d7a9d41a2 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java @@ -23,20 +23,47 @@ import org.eclipse.uml2.uml.Component; */ public interface IBundleDescriptionDesigner { + /** + * constant for the attribute BuddyPolicy of a bundle + */ public final static String ECLIPSE_BUDDY_LOADER = "Eclipse-BuddyPolicy"; //$NON-NLS-1$ + /** + * constant for the attribute BundleShape of a bundle + */ public final static String ECLIPSE_BUNDLE_SHAPE = "Eclipse-BundleShape"; + /** + * constant for the attribute GenericCapability of a bundle + */ public final static String ECLIPSE_GENERICCAPABILITY = "Eclipse-GenericCapability"; + /** + * constant for the attribute GenericRequire of a bundle + */ public final static String ECLIPSE_GENERICREQUIRE = "Eclipse-GenericRequire"; + /** + * constant for the attribute BuddyPolicy of a bundle + */ public final static String ECLIPSE_LAZYSTART = "Eclipse-LazyStart"; + /** + * constant for the attribute PlatformFilter of a bundle + */ public final static String ECLIPSE_PLATFORMFILTER = "Eclipse-PlatformFilter"; + /** + * constant for the attribute RegisterBuddy of a bundle + */ public final static String ECLIPSE_REGISTERBUDDY = "Eclipse-RegisterBuddy"; + /** + * + * @param bundleProject + * @param key + * @return the value that correspond to the key + */ public String getBundleValue(Object bundleProject, String key); /** @@ -51,14 +78,14 @@ public interface IBundleDescriptionDesigner { * @return the symbolic name */ public String getSymbolicName(Object bundleProject); - + /** * get the name from the JAVA object that represent the bundle * @param bundleProject * @return the name */ public String getName(Object bundleProject); - + /** * create packages that are exported to other plugins * @param bundleComponent the UML representation of the bundle diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IPluginModelDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IPluginModelDescriptionDesigner.java deleted file mode 100644 index ffebf519bd9..00000000000 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IPluginModelDescriptionDesigner.java +++ /dev/null @@ -1,82 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.adltool.designer.bundle; - -import java.util.ArrayList; - -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.eclipse.papyrus.adltool.Activator; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.uml2.uml.Component; -import org.osgi.framework.Bundle; - -/** - * @deprecated - * - */ -public class IPluginModelDescriptionDesigner extends AbstractBundleDescriptionDesigner { - - public String getSymbolicName(Object bundleProject) { - if(bundleProject instanceof IPluginModelBase){ - return ((IPluginModelBase)bundleProject).getPluginBase().getId(); - } - return null; - } - - public void fillExportedPackages(Component bundleComponent, Object bundleProject) { - // TODO Auto-generated method stub - - } - @Override - public void fillPluginProperties(Component bundleComponent, Object bundleProject) { - if( bundleProject instanceof IPluginModelBase){ - IPluginModelBase tmpIPluginModelBase= (IPluginModelBase)bundleProject; - BundleDescription tmpBundleDescription= tmpIPluginModelBase.getBundleDescription(); - fillPluginProperties(bundleComponent,tmpBundleDescription); - - } - - } - - public void fillPluginProperties(Component bundleComponent,BundleDescription bundleDesc ){ - - } - - @Override - public String getBundleValue(Object bundleProject, String key) { - if( bundleProject instanceof IPluginModelBase){ - IPluginModelBase tmpIPluginModelBase= (IPluginModelBase)bundleProject; - BundleDescription tmpBundleDescription= tmpIPluginModelBase.getBundleDescription(); - - Bundle tmpBundle=Activator.getDefault().getBundleContext().getBundle(tmpBundleDescription.getBundleId()); - if(tmpBundle==null ){ - System.err.println("pb for "+tmpBundleDescription.getSymbolicName()); - return null; - } - return tmpBundle.getHeaders().get(key); - } - return null; - } - - public String getName(Object bundleProject) { - // TODO Auto-generated method stub - return null; - } - - public ArrayList getRequiredBundle(Component bundleComponent, Object bundleProject) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java index f992f53a1bc..16002bd0ea7 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java @@ -40,7 +40,7 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe * * @param bundleProject * @param key - * @return + * @return the value that correspond to the key */ public String getBundleValue(Object bundleProject, String key) { if(bundleProject instanceof Bundle){ @@ -67,7 +67,7 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe Package UMLPackage=UMLFactory.eINSTANCE.createPackage(); UMLPackage.setName(manisfests[i].getValue()); bundleComponent.getPackagedElements().add(UMLPackage); - + Stereotype exportedPackageStereotype=UMLPackage.getApplicableStereotype(IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_STEREOTYPE); UMLPackage.applyStereotype(exportedPackageStereotype); if((manisfests[i].getDirective("x-internal"))!=null){ @@ -78,12 +78,12 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe if((manisfests[i].getDirective("x-friends"))!=null){ //TODO: xfriends } - + if( manisfests[i].getAttribute("version")!=null){ VersionRange version= new VersionRange( manisfests[i].getAttribute("version")); newRefElement.setVersion(version); UMLPackage.setValue(exportedPackageStereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, version.toString()); - + } exportedPackages.add(UMLPackage.getStereotypeApplication(exportedPackageStereotype)); } @@ -101,7 +101,7 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe * * @param bundleComponent * @param bundleProject - * @return + * @return the list of required bundle */ public ArrayList getRequiredBundle(Component bundleComponent, Object bundleProject) { ArrayList bundleListName=new ArrayList(); @@ -121,7 +121,7 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe } } bundleListName.add(newRefElement); - + } } } catch (BundleException e) { @@ -135,7 +135,7 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getSymbolicName(java.lang.Object) * * @param bundleProject - * @return + * @return a string for the symbolic name */ public String getSymbolicName(Object bundleProject) { diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java index 453940af9fc..ee16f709aae 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java @@ -13,7 +13,6 @@ *****************************************************************************/ package org.eclipse.papyrus.adltool.designer.bundle; -import org.eclipse.pde.core.IModel; import org.osgi.framework.VersionRange; /** @@ -22,57 +21,54 @@ import org.osgi.framework.VersionRange; * */ public class ReferencedOSGIElement { - + private VersionRange version=null; private String symbolicName= null; private String kindRef=""; - private IModel modelRef=null; private boolean optional= false; - - - - + + /** + * a reference may be optional + * @return true if the the reference is optional + */ public boolean isOptional() { return optional; } + /** + * set the reference as optional + * @param optional a boolean + */ - - - public void setOptional(boolean optional) { this.optional = optional; } - - - - public IModel getModelRef() { - return modelRef; - } - - - - - public void setModelRef(IModel modelRef) { - this.modelRef = modelRef; - } - - + /** + * + * @return get the model ref as dependency to a feature or plug-in + */ public String getKindRef() { return kindRef; } - - + /** + * set the model ref as dependency to a feature or plug-in + * @param kindRef a string see FEATURE ou PLUGIN constant + */ public void setKindRef(String kindRef) { this.kindRef = kindRef; } - + /** + * the type of ref for a feature + */ public static String FEATURE="feature"; + /** + * the type of ref for a plug-in + */ public static String PLUGIN="plugin"; - + /** * Constructor. * @@ -86,33 +82,33 @@ public class ReferencedOSGIElement { this.kindRef=PLUGIN; } - + /** * @return the version */ public VersionRange getVersion() { return version; } - + /** * @param version the version to set */ public void setVersion(VersionRange version) { this.version = version; } - + /** * @return the symbolicName */ public String getSymbolicName() { return symbolicName; } - + /** * @param symbolicName the symbolicName to set */ public void setSymbolicName(String symbolicName) { this.symbolicName = symbolicName; } - + } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java index 601651dd68b..f6f29ae8fa1 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java @@ -31,10 +31,20 @@ import org.eclipse.uml2.uml.Stereotype; import org.eclipse.uml2.uml.UMLFactory; import org.osgi.framework.Constants; - +/** + * class used to obtain information about bundle that is a project in the workspace + */ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptionDesigner { + /** + * + * @see org.eclipse.papyrus.adltool.designer.bundle.AbstractBundleDescriptionDesigner#getBundleValue(java.lang.Object, java.lang.String) + * + * @param bundleProject + * @param key + * @return the value that corresponds to the key + */ public String getBundleValue(Object bundleProject, String key){ String valueFromDescription=null; if(bundleProject instanceof IBundleProjectDescription){ @@ -92,7 +102,6 @@ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptio Stereotype exportedPackageStereotype=UMLPackage.getApplicableStereotype(IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_STEREOTYPE); UMLPackage.applyStereotype(exportedPackageStereotype); UMLPackage.setValue(exportedPackageStereotype, IADL4ECLIPSE_Stereotype.ECLIPSEEXPORTEDPACKAGE_ISINTERNAL_ATT, !packageExportDescription[i].isApi()); - //TODO:friends if(packageExportDescription[i].getVersion()!=null){ UMLPackage.setValue(exportedPackageStereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, packageExportDescription[i].getVersion().toString()); } @@ -103,7 +112,10 @@ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptio } } } - + /** + * + * {@inheritDoc} + */ public ArrayList getRequiredBundle(Component bundleComponent, Object bundleProject) { ArrayList bundleRefList=new ArrayList(); if(bundleProject instanceof IBundleProjectDescription){ @@ -118,6 +130,11 @@ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptio } return bundleRefList; } + + /** + * + * {@inheritDoc} + */ public String getSymbolicName(Object bundleProject) { if(bundleProject instanceof IBundleProjectDescription){ return ((IBundleProjectDescription) bundleProject).getSymbolicName(); @@ -125,9 +142,13 @@ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptio return null; } + /** + * + * {@inheritDoc} + */ public String getName(Object bundleProject) { return this.getBundleValue(bundleProject, org.osgi.framework.Constants.BUNDLE_NAME); } - + } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java index b0f2fda31a0..ab3ec19d96f 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/BundleSelectionPage.java @@ -17,7 +17,6 @@ package org.eclipse.papyrus.adltool.designer.wizard; import java.util.ArrayList; import java.util.Iterator; -import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.papyrus.adltool.designer.bundle.BundleLabelProvider; import org.eclipse.swt.SWT; @@ -31,9 +30,11 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.uml2.uml.Profile; - +/** + * aGUI in order to select a set of bundle from a list + * + */ public class BundleSelectionPage extends WizardPage { /** * the graphical tree @@ -45,6 +46,12 @@ public class BundleSelectionPage extends WizardPage { private Composite comp; + /** + * + * Constructor. + * + * @param bundleList the list of bundle to display + */ public BundleSelectionPage(ArrayList bundleList) { super("BundleSelection"); setTitle("Bundle Selection"); @@ -155,7 +162,7 @@ public class BundleSelectionPage extends WizardPage { /** * Returns the elements to import. * - * @return + * @return the set of selected bundle */ public ArrayList getResult() { return selectedBundleList; diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/FeatureArchitectureWizard.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/FeatureArchitectureWizard.java index 1b6d01646a9..3fab9177cba 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/FeatureArchitectureWizard.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/FeatureArchitectureWizard.java @@ -20,10 +20,16 @@ import org.eclipse.papyrus.adltool.designer.ArchitectureSnapshotDesigner; /** * this wizard is used to display feature from workspace and the platform - * + *@deprecated */ public class FeatureArchitectureWizard extends PluginArchitectureWizard { + /** + * + * Constructor. + * + * @param onlyWorkspace + */ public FeatureArchitectureWizard(boolean onlyWorkspace) { super(onlyWorkspace); } diff --git a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/PluginArchitectureWizard.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/PluginArchitectureWizard.java index 0e31f5dde22..cdb355fb92c 100644 --- a/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/PluginArchitectureWizard.java +++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/wizard/PluginArchitectureWizard.java @@ -17,19 +17,28 @@ package org.eclipse.papyrus.adltool.designer.wizard; import java.util.ArrayList; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.papyrus.adltool.designer.ArchitectureSnapshotDesigner; +import org.eclipse.ui.IImportWizard; +import org.eclipse.ui.IWorkbench; /** * this wizard is used to display plugin from workspace and the platform - * + *@deprecated */ -public class PluginArchitectureWizard extends Wizard { +public class PluginArchitectureWizard extends Wizard implements IImportWizard{ protected BundleSelectionPage bundleSelectionPage; protected boolean onlyWorkspace=true; + /** + * + * Constructor. + * + * @param onlyWorkspace + */ public PluginArchitectureWizard(boolean onlyWorkspace) { super(); setNeedsProgressMonitor(true); @@ -48,6 +57,10 @@ public class PluginArchitectureWizard extends Wizard { addPage(bundleSelectionPage); } + /** + * + * @return the list of selected bundle + */ public ArrayList getSelectedBundle(){ return bundleSelectionPage.getResult(); } @@ -59,4 +72,9 @@ public class PluginArchitectureWizard extends Wizard { } return false; } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + // TODO Auto-generated method stub + + } } -- cgit v1.2.3