Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2013-06-26 08:37:05 +0000
committerptessier2013-06-26 08:37:05 +0000
commit241d3abc26483e3643db54b1d5d1e3ab26cf1d3c (patch)
treec96855ee4707e9d65f3653d458931d5ed981b7c4 /extraplugins/adl4eclipse
parent4b9862ac3fd556136b3b5c4ee3a19f7712fdfc50 (diff)
downloadorg.eclipse.papyrus-241d3abc26483e3643db54b1d5d1e3ab26cf1d3c.tar.gz
org.eclipse.papyrus-241d3abc26483e3643db54b1d5d1e3ab26cf1d3c.tar.xz
org.eclipse.papyrus-241d3abc26483e3643db54b1d5d1e3ab26cf1d3c.zip
401703: Create adl4eclipse profile
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401703
Diffstat (limited to 'extraplugins/adl4eclipse')
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/ArchitectureSnapshotDesigner.java391
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/CompleteFeatureArchitectureSnapshotDesigner.java33
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleDesignerRegistry.java36
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/BundleLabelProvider.java5
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/FeatureDescriptionDesigner.java50
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java7
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IPluginModelDescriptionDesigner.java82
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/LoadedBundleDescriptionDesigner.java8
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java50
-rw-r--r--extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/WorkspaceBundleDescriptionDesigner.java11
10 files changed, 486 insertions, 187 deletions
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 efe620f1732..9cd78ace9cd 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
@@ -23,6 +23,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
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;
@@ -31,10 +32,12 @@ 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.uml2.uml.Component;
import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.Package;
@@ -45,16 +48,15 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.VersionRange;
-//CreateFeatureProjectOperation
-//PDECore.getDefault().getFeatureModelManager()
/**
* this purpose of this class is to provide mechanism to import bundle into model
*
*/
public abstract class ArchitectureSnapshotDesigner{
- protected HashMap<String, Component> createdBundleIndex=null;
+ protected HashMap<String, Component> createdBundleIDIndex=null;
protected HashMap<String, Object> bundlesIndex=null;
+ protected HashMap<String, Component> createdFeatureIndex=null;
protected HashMap<String, Object> featureIndex=null;
protected BundleDesignerRegistry bundleDesignerRegistry=null;
protected int dependenciesN=0;
@@ -67,12 +69,13 @@ public abstract class ArchitectureSnapshotDesigner{
*/
protected Package rootPackage;
+ private Bundle systemBundle;
private ArchitectureSnapshotDesigner (Package rootPackage) {
this.rootPackage=rootPackage;
- createdBundleIndex= new HashMap<String, Component>();
- featureIndex= new HashMap<String, Object>();
+ createdBundleIDIndex= new HashMap<String, Component>();
bundleDesignerRegistry= new BundleDesignerRegistry();
+ createdFeatureIndex= new HashMap<String, Component>();
}
/**
@@ -96,14 +99,10 @@ public abstract class ArchitectureSnapshotDesigner{
* @return bundles loaded in the platform
*/
public static ArrayList<Bundle> getLoadedBundles() {
- final ArrayList<Bundle> bundlesList = new ArrayList<Bundle>();
- BundleContext context = Activator.getDefault().getBundleContext();
- org.osgi.framework.Bundle[] bundles = context.getBundles();
- for(int i = 0; i < bundles.length; i++) {
- bundlesList.add(bundles[i]);
- }
-
- return bundlesList;
+ ArrayList<Bundle> pluginList= new ArrayList<Bundle>();
+ Bundle[] bundleArray=PDECore.getDefault().getBundleContext().getBundles();
+ pluginList.addAll(Arrays.asList(bundleArray));
+ return pluginList;
}
/**
@@ -164,159 +163,261 @@ public abstract class ArchitectureSnapshotDesigner{
Object bundleProject = (Object)bundleProjectsIterator.next();
modelBundle(pluginPackage, bundleProject);
}
- System.out.println("created bundles numbers: "+createdBundleIndex.keySet().size());
- System.out.println("dependenciess: "+dependenciesN);
+ System.out.println("created bundles numbers: "+createdFeatureIndex.keySet().size());
+ System.out.println("dependencies: "+dependenciesN);
}
-// protected void modelWorkspaceFeatures(Package pluginPackage, boolean createAll){
-// // IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
-// IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getWorkspaceModels();
-// for(int i = 0; i < featureModels.length; i++) {
-// modelAFeature(pluginPackage,featureModels[i], createAll);
-// }
-//
-// }
-
-// protected void modelPlatformFeatures(Package pluginPackage, boolean createAll){
-// // IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
-// IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
-// for(int i = 0; i < featureModels.length; i++) {
-// modelAFeature(pluginPackage,featureModels[i], createAll);
-// }
-//
-// }
-// protected void modelAFeature(Package pluginPackage, IFeatureModel featureModel, boolean createAll){
-//
-// Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
-// bundleComponent.setName(featureModel.getFeature().getId());
-// pluginPackage.getPackagedElements().add(bundleComponent);
-// Stereotype featureStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.FEATURE_STEREOTYPE);
-// bundleComponent.applyStereotype(featureStereotype);
-// bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_ID_ATT,featureModel.getFeature().getId());
-// bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_VERSION_ATT,featureModel.getFeature().getVersion());
-// //bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_COPYRIGHT_ATT,featureModel.getFeature().getVersion());
-// //bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_DESCRIPTION_ATT,featureModel.getFeature().get);
-// bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_IMAGE_ATT,featureModel.getFeature().getImageName());
-// bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_LABEL_ATT,featureModel.getFeature().getLabel());
-// bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_LICENSE_ATT,featureModel.getFeature().getLicenseFeatureID());
-// bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_PROVIDER_ATT,featureModel.getFeature().getProviderName());
-// //bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_URL_ATT,featureModel.getFeature().getURL());
-//
-// }
+ // protected void modelWorkspaceFeatures(Package pluginPackage, boolean createAll){
+ // // IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
+ // IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getWorkspaceModels();
+ // for(int i = 0; i < featureModels.length; i++) {
+ // modelAFeature(pluginPackage,featureModels[i], createAll);
+ // }
+ //
+ // }
+
+ // protected void modelPlatformFeatures(Package pluginPackage, boolean createAll){
+ // // IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
+ // IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
+ // for(int i = 0; i < featureModels.length; i++) {
+ // modelAFeature(pluginPackage,featureModels[i], createAll);
+ // }
+ //
+ // }
+ // protected void modelAFeature(Package pluginPackage, IFeatureModel featureModel, boolean createAll){
+ //
+ // Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
+ // bundleComponent.setName(featureModel.getFeature().getId());
+ // pluginPackage.getPackagedElements().add(bundleComponent);
+ // Stereotype featureStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.FEATURE_STEREOTYPE);
+ // bundleComponent.applyStereotype(featureStereotype);
+ // bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_ID_ATT,featureModel.getFeature().getId());
+ // bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_VERSION_ATT,featureModel.getFeature().getVersion());
+ // //bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_COPYRIGHT_ATT,featureModel.getFeature().getVersion());
+ // //bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_DESCRIPTION_ATT,featureModel.getFeature().get);
+ // bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_IMAGE_ATT,featureModel.getFeature().getImageName());
+ // bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_LABEL_ATT,featureModel.getFeature().getLabel());
+ // bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_LICENSE_ATT,featureModel.getFeature().getLicenseFeatureID());
+ // bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_PROVIDER_ATT,featureModel.getFeature().getProviderName());
+ // //bundleComponent.setValue(featureStereotype, IADL4ECLIPSE_Stereotype.FEATURE_URL_ATT,featureModel.getFeature().getURL());
+ //
+ // }
+
+
+ protected void modelPseudoBundle(Package pluginPackage, String ID) {
+ Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
+ System.out.println("PS-->"+ID);
+ bundleComponent.setName(ID);
+ pluginPackage.getPackagedElements().add(bundleComponent);
+ createdFeatureIndex.put(ID, bundleComponent);
+ }
+ /**
+ * Model a bundle into the plugins packages:
+ * <UL>
+ * <LI> model the bundle as a stereotyped UML component
+ * <LI>add links to required bundle
+ * <LI> fill information about exported packages
+ * </UL>
+ *
+ *
+ * @param pluginPackage
+ * @param bundleProjectsIterator
+ */
+ protected void modelBundle(Package pluginPackage, Object bundleProject) {
+
+ if(bundleProject instanceof IFeatureModel){
+ if(!(createdFeatureIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject)))){
+ Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
+ System.out.println("F-->"+bundleDesignerRegistry.getSymbolicName(bundleProject));
+ bundleComponent.setName(bundleDesignerRegistry.getSymbolicName(bundleProject));
+ pluginPackage.getPackagedElements().add(bundleComponent);
+ Stereotype pluginStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.FEATURE_STEREOTYPE);
+ bundleComponent.applyStereotype(pluginStereotype);
+ //add in the index of bundles
+ if( bundleDesignerRegistry.getSymbolicName(bundleProject)!=null){
+ createdFeatureIndex.put(bundleDesignerRegistry.getSymbolicName(bundleProject), bundleComponent);
+ }
+ else{
+ System.err.println("bundle symbolic name is null");
+ }
+ fillRequiredBundle(bundleComponent, bundleProject, pluginPackage);
-/**
- * Model a bundle into the plugins packages:
- * <UL>
- * <LI> model the bundle as a stereotyped UML component
- * <LI>add links to required bundle
- * <LI> fill information about exported packages
- * </UL>
- *
- *
- * @param pluginPackage
- * @param bundleProjectsIterator
- */
-protected void modelBundle(Package pluginPackage, Object bundleProject) {
+ //bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject);
+ //bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject);
+ }
- if(!createdBundleIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject))){
- Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
- System.out.println("-->"+bundleDesignerRegistry.getSymbolicName(bundleProject));
- bundleComponent.setName(bundleDesignerRegistry.getSymbolicName(bundleProject));
- pluginPackage.getPackagedElements().add(bundleComponent);
- Stereotype pluginStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE);
- bundleComponent.applyStereotype(pluginStereotype);
- //add in the index of bundles
- createdBundleIndex.put(bundleDesignerRegistry.getSymbolicName(bundleProject), bundleComponent);
- fillRequiredBundle(bundleComponent, bundleProject, pluginPackage);
- bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject);
- bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject);
+ }else{
+
+ if(!(createdFeatureIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject)))){
+ Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
+
+ System.out.println("P-->"+bundleDesignerRegistry.getSymbolicName(bundleProject));
+ bundleComponent.setName(bundleDesignerRegistry.getSymbolicName(bundleProject));
+ pluginPackage.getPackagedElements().add(bundleComponent);
+ Stereotype pluginStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.PLUGIN_STEREOTYPE);
+ bundleComponent.applyStereotype(pluginStereotype);
+ //add in the index of bundles
+ if("org.eclipse.osgi".equals(bundleDesignerRegistry.getSymbolicName(bundleProject))){
+ createdFeatureIndex.put(org.osgi.framework.Constants.SYSTEM_BUNDLE_SYMBOLICNAME, bundleComponent);
+ }
+ if( bundleDesignerRegistry.getSymbolicName(bundleProject)!=null){
+ createdFeatureIndex.put(bundleDesignerRegistry.getSymbolicName(bundleProject), bundleComponent);
+ }
+ else{
+ System.err.println("bundle symbolic name is null");
+ }
+ fillRequiredBundle(bundleComponent, bundleProject, pluginPackage);
+ bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject);
+ bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject);
+ }
+ }
}
-}
-/**
- * Ensure that the profile ADL4 eclipse has been applied
- */
-protected void initModel(){
- RegisteredProfile registeredProfile=RegisteredProfile.getRegisteredProfile("ADL4Eclipse");
- if(registeredProfile!=null){
- URI modelUri = registeredProfile.uri;
- final Resource modelResource = Util.getResourceSet(rootPackage).getResource(modelUri, true);
- Profile adl4eclipseprofile=(Profile) modelResource.getContents().get(0);
- PackageUtil.applyProfile(rootPackage, adl4eclipseprofile, false);
+ /**
+ * Ensure that the profile ADL4 eclipse has been applied
+ */
+ protected void initModel(){
+ RegisteredProfile registeredProfile=RegisteredProfile.getRegisteredProfile("ADL4Eclipse");
+ if(registeredProfile!=null){
+ URI modelUri = registeredProfile.uri;
+ final Resource modelResource = Util.getResourceSet(rootPackage).getResource(modelUri, true);
+ Profile adl4eclipseprofile=(Profile) modelResource.getContents().get(0);
+ PackageUtil.applyProfile(rootPackage, adl4eclipseprofile, false);
+ }
}
-}
-protected Object getBundle(String name){
- if(bundlesIndex==null){
- bundlesIndex= new HashMap<String, Object>();
- //loaded bundle
- BundleContext context = Activator.getDefault().getBundleContext();
- org.osgi.framework.Bundle[] bundles = context.getBundles();
- for(int i = 0; i < bundles.length; i++) {
- bundlesIndex.put(bundleDesignerRegistry.getSymbolicName(bundles[i]), bundles[i]);
+ protected Object getfeature(String name){
+ if(featureIndex==null){
+ featureIndex= new HashMap<String, Object>();
+ IFeatureModel[] featureModels=PDECore.getDefault().getFeatureModelManager().getModels();
+ for(int i = 0; i < featureModels.length; i++) {
+ System.out.println("feature known: "+bundleDesignerRegistry.getSymbolicName(featureModels[i]));
+ featureIndex.put(bundleDesignerRegistry.getSymbolicName(featureModels[i]), featureModels[i]);
+ }
}
- IProject[] project=ResourcesPlugin.getWorkspace().getRoot().getProjects();
- //bundle Workspace
- ServiceReference<?> ref = context.getServiceReference(IBundleProjectService.class.getName());
- IBundleProjectService BundleProjectservice = (IBundleProjectService)context.getService(ref);
- for(int i = 0; i < project.length; i++) {
- try {
- if((project[i].getNature(IBundleProjectDescription.PLUGIN_NATURE))!=null){
- IBundleProjectDescription bundleDescription=BundleProjectservice.getDescription(project[i]);
- bundlesIndex.put(bundleDesignerRegistry.getSymbolicName(bundleDescription), bundleDescription);
+ return featureIndex.get(name);
+ }
+
+ protected Object getBundle(String name){
+
+ if(bundlesIndex==null){
+ bundlesIndex= new HashMap<String, Object>();
+ //loaded bundle
+ BundleContext context = Activator.getDefault().getBundleContext();
+ systemBundle = context.getBundle(0);
+ bundlesIndex.put(org.osgi.framework.Constants.SYSTEM_BUNDLE_SYMBOLICNAME, systemBundle);
+ bundlesIndex.put(bundleDesignerRegistry.getSymbolicName( systemBundle), systemBundle);
+ System.out.println(bundleDesignerRegistry.getName( systemBundle)+ " "+bundleDesignerRegistry.getSymbolicName( systemBundle));
+ org.osgi.framework.Bundle[] bundles = context.getBundles();
+
+ for(int i = 0; i < bundles.length; i++) {
+ if( bundleDesignerRegistry.getSymbolicName(bundles[i])!=null){
+ bundlesIndex.put(bundleDesignerRegistry.getSymbolicName(bundles[i]), bundles[i]);
+ }
+ else{
+ System.err.println("Bundle has a symbolic name null!");
+ }
+ if( bundleDesignerRegistry.getName(bundles[i])!=null){
+ bundlesIndex.put(bundleDesignerRegistry.getName(bundles[i]), bundles[i]);
+ }
+ else{
+ System.err.println("Bundle has a name null!");
+ }
+ }
+ IProject[] project=ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ //bundle Workspace
+ ServiceReference<?> ref = context.getServiceReference(IBundleProjectService.class.getName());
+ IBundleProjectService BundleProjectservice = (IBundleProjectService)context.getService(ref);
+ for(int i = 0; i < project.length; i++) {
+ 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);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
}
- } catch (CoreException e) {
- e.printStackTrace();
}
+
}
+
+
+ return bundlesIndex.get(name);
+
}
+ /**
+ * Model the required bundle. if it not exist the bundle is modeling.
+ * It create a stereotyped dependency to the required element
+ * @param bundleComponent the description of the bundle
+ * @param bundleProject
+ */
+ protected void fillRequiredBundle(Component bundleComponent,Object bundleProject,Package library ) {
+ ArrayList<ReferencedOSGIElement> requiredBundleNameList=bundleDesignerRegistry.getRequiredBundle(bundleComponent, bundleProject);
+ Iterator<ReferencedOSGIElement> bundleNameIterator= requiredBundleNameList.iterator();
+ while(bundleNameIterator.hasNext()) {
+ dependenciesN++;
+ ReferencedOSGIElement bundleRef = (ReferencedOSGIElement)bundleNameIterator.next();
+ Component requiredComponent=null;
+ Object foundBundle=getBundle(bundleRef.getSymbolicName() );
+
+ if(bundleRef.isOptional()||foundBundle!=null){
+ if (foundBundle!=null){
+ if((!(createdFeatureIndex.containsKey(bundleRef.getSymbolicName())))&&(!(createdFeatureIndex.containsKey(bundleRef.getSymbolicName())))) {
+ modelBundle(library,foundBundle);
+ }
+ }
+ else {
+ modelPseudoBundle(library,bundleRef.getSymbolicName());
+ }
+ requiredComponent=createdFeatureIndex.get(bundleRef.getSymbolicName());
+ Dependency dependency=UMLFactory.eINSTANCE.createDependency();
+ dependency.setName(requiredComponent.getName());
+ //bundleComponent.getNearestPackage().getPackagedElements().add(dependency);
+ bundleComponent.getPackagedElements().add(dependency);
+ dependency.getClients().add(bundleComponent);
+ dependency.getSuppliers().add(requiredComponent);
+ Stereotype bRef_stereotype= dependency.getApplicableStereotype(IOSGIStereotype.BUNDLEREFERENCE_);
+ dependency.applyStereotype(bRef_stereotype);
+ VersionRange versionRange=bundleRef.getVersion();
+ if( versionRange!=null){
+ if( versionRange.getRight()==null){
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, versionRange.getLeft().toString());
+ System.out.println(" "+versionRange.getLeft());
+ }
+ else{
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_FLOOR_ATT, versionRange.getLeft().toString());
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_CEILING_ATT, versionRange.getRight().toString());
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_INCLUDEFLOOR_ATT, versionRange.getRightType()==VersionRange.LEFT_OPEN);
+ dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_INCLUDECEILING_ATT, versionRange.getRightType()==VersionRange.RIGHT_OPEN);
+ System.out.println(" "+versionRange.getRight()+" "+versionRange.getLeft());
+ }
+ }
- return bundlesIndex.get(name);
+ }
-}
-/**
- * Model the required bundle. if it not exist the bundle is modeling.
- * It create a stereotyped dependency to the required element
- * @param bundleComponent the description of the bundle
- * @param bundleProject
- */
-protected void fillRequiredBundle(Component bundleComponent,Object bundleProject,Package library ) {
- ArrayList<ReferencedOSGIElement> requiredBundleNameList=bundleDesignerRegistry.getRequiredBundle(bundleComponent, bundleProject);
- Iterator<ReferencedOSGIElement> bundleNameIterator= requiredBundleNameList.iterator();
- while(bundleNameIterator.hasNext()) {
- dependenciesN++;
- ReferencedOSGIElement bundleRef = (ReferencedOSGIElement)bundleNameIterator.next();
- if(!(createdBundleIndex.containsKey(bundleRef.getSymbolicName()))){
- modelBundle(library, getBundle(bundleRef.getSymbolicName()));
- }
- Component requiredComponent=createdBundleIndex.get(bundleRef.getSymbolicName());
- Dependency dependency=UMLFactory.eINSTANCE.createDependency();
- dependency.setName(requiredComponent.getName());
- bundleComponent.getPackagedElements().add(dependency);
- dependency.getClients().add(bundleComponent);
- dependency.getSuppliers().add(requiredComponent);
- Stereotype bRef_stereotype= dependency.getApplicableStereotype(IOSGIStereotype.BUNDLEREFERENCE_);
- dependency.applyStereotype(bRef_stereotype);
- VersionRange versionRange=bundleRef.getVersion();
- if( versionRange!=null){
- if( versionRange.getRight()==null){
- dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_ATLEAST_ATT, versionRange.getLeft().toString());
- System.out.println(" "+versionRange.getLeft());
- }
- else{
- dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_FLOOR_ATT, versionRange.getLeft().toString());
- dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_CEILING_ATT, versionRange.getRight().toString());
- dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_INCLUDEFLOOR_ATT, versionRange.getRightType()==VersionRange.LEFT_OPEN);
- dependency.setValue(bRef_stereotype, IOSGIStereotype.VERSIONRANGE_INCLUDECEILING_ATT, versionRange.getRightType()==VersionRange.RIGHT_OPEN);
- System.out.println(" "+versionRange.getRight()+" "+versionRange.getLeft());
- }
+ else if ((!bundleRef.isOptional())&&foundBundle==null){
+ System.err.println("pb: impossible to find the get the bundle dependency "+ bundleRef.getSymbolicName()+ " for "+bundleDesignerRegistry.getSymbolicName(bundleProject));
+ System.err.println("Memory\n"+ this);}
}
}
-}
+ @Override
+ public String toString() {
+ String out= "loaded bundles:\n";
+ for(Iterator<String> iterator = bundlesIndex.keySet().iterator(); iterator.hasNext();) {
+ String id = (String)iterator.next();
+ out=out+"\n"+id;
+ }
+ out=out+ "\ncreated bundles:\n";
+ for(Iterator<String> iterator = createdFeatureIndex.keySet().iterator(); iterator.hasNext();) {
+ String id = (String)iterator.next();
+ out=out+"\n"+id;
+ }
+ return out;
+ }
}
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 f5c413b5b11..ac3528e6f7e 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
@@ -15,11 +15,7 @@ package org.eclipse.papyrus.adltool.designer;
import java.util.ArrayList;
-import org.eclipse.papyrus.adl4eclipse.org.IADL4ECLIPSE_Stereotype;
-import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLFactory;
/**
* designer to construct the architecture of feature from the workspace and platform
@@ -35,32 +31,5 @@ public class CompleteFeatureArchitectureSnapshotDesigner extends ArchitectureSna
initModel();
modelBundles(rootPackage);
}
- /**
- * Model a bundle into the plugins packages:
- * <UL>
- * <LI> model the bundle as a stereotyped UML component
- * <LI>add links to required bundle
- * <LI> fill information about exported packages
- * </UL>
- *
- *
- * @param pluginPackage
- * @param bundleProjectsIterator
- */
- protected void modelBundle(Package pluginPackage, Object bundleProject) {
-
- if(!createdBundleIndex.containsKey(bundleDesignerRegistry.getSymbolicName(bundleProject))){
- Component bundleComponent= UMLFactory.eINSTANCE.createComponent();
- System.out.println("-->"+bundleDesignerRegistry.getSymbolicName(bundleProject));
- bundleComponent.setName(bundleDesignerRegistry.getSymbolicName(bundleProject));
- pluginPackage.getPackagedElements().add(bundleComponent);
- Stereotype pluginStereotype=bundleComponent.getApplicableStereotype(IADL4ECLIPSE_Stereotype.FEATURE_STEREOTYPE);
- bundleComponent.applyStereotype(pluginStereotype);
- //add in the index of bundles
- createdBundleIndex.put(bundleDesignerRegistry.getSymbolicName(bundleProject), bundleComponent);
- fillRequiredBundle(bundleComponent, bundleProject, pluginPackage);
- //bundleDesignerRegistry.fillPluginProperties(bundleComponent, bundleProject);
- //bundleDesignerRegistry.fillExportedPackages(bundleComponent, bundleProject);
- }
- }
+
}
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 d82f53cc44c..e110c2ae508 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,6 +15,7 @@ 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;
@@ -29,12 +30,14 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{
protected WorkspaceBundleDescriptionDesigner workspaceBundleDescriptionDesigner;
protected LoadedBundleDescriptionDesigner loadedBundleDescriptionDesigner;
protected FeatureDescriptionDesigner featureDescriptionDesigner;
+ protected IPluginModelDescriptionDesigner IpluginModelDescriptionDesigner;
public BundleDesignerRegistry() {
workspaceBundleDescriptionDesigner= new WorkspaceBundleDescriptionDesigner();
loadedBundleDescriptionDesigner= new LoadedBundleDescriptionDesigner();
featureDescriptionDesigner =new FeatureDescriptionDesigner();
+ IpluginModelDescriptionDesigner=new IPluginModelDescriptionDesigner();
}
/**
@@ -56,6 +59,9 @@ 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;
}
@@ -77,6 +83,9 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{
else if(bundleProject instanceof IFeatureModel){
featureDescriptionDesigner.fillPluginProperties(bundleComponent, bundleProject);
}
+ else if(bundleProject instanceof IPluginModelBase){
+ IpluginModelDescriptionDesigner.fillPluginProperties(bundleComponent, bundleProject);
+ }
}
/**
@@ -97,6 +106,9 @@ 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;
}
@@ -118,6 +130,9 @@ public class BundleDesignerRegistry implements IBundleDescriptionDesigner{
else if(bundleProject instanceof IFeatureModel){
featureDescriptionDesigner.fillExportedPackages(bundleComponent, bundleProject);
}
+ else if(bundleProject instanceof IPluginModelBase){
+ IpluginModelDescriptionDesigner.fillExportedPackages(bundleComponent, bundleProject);
+ }
}
/**
@@ -139,6 +154,27 @@ 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<ReferencedOSGIElement>();
}
+
+ public String getName(Object bundleProject) {
+ if(bundleProject instanceof IBundleProjectDescription){
+ return workspaceBundleDescriptionDesigner.getName(bundleProject);
+
+ }
+ else if(bundleProject instanceof Bundle){
+ return loadedBundleDescriptionDesigner.getName(bundleProject);
+ }
+ 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 4f39509bc1f..afd7059d78b 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
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.adltool.designer.bundle;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.LabelProvider;
+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.swt.graphics.Image;
@@ -42,6 +43,10 @@ public class BundleLabelProvider extends LabelProvider {
return getImage("img/bundle_obj.gif");
}
+ else if(bundleProject instanceof IPluginModelBase){
+ return getImage("img/bundle_obj.gif");
+ }
+
return super.getImage(bundleProject);
}
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 8ca8939fe4f..bd865072f23 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,8 +2,13 @@ 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;
public class FeatureDescriptionDesigner extends AbstractBundleDescriptionDesigner {
@@ -17,17 +22,44 @@ public class FeatureDescriptionDesigner extends AbstractBundleDescriptionDesigne
public void fillExportedPackages(Component bundleComponent, Object bundleProject) {
// TODO Auto-generated method stub
-
+
}
+ /**
+ *
+ * @see org.eclipse.papyrus.adltool.designer.bundle.IBundleDescriptionDesigner#getRequiredBundle(org.eclipse.uml2.uml.Component, java.lang.Object)
+ *
+ * @param bundleComponent
+ * @param bundleProject
+ * @return
+ */
public ArrayList<ReferencedOSGIElement> getRequiredBundle(Component bundleComponent, Object bundleProject) {
- // TODO Auto-generated method stub
- return null;
- }
+ ArrayList<ReferencedOSGIElement> bundleListName=new ArrayList<ReferencedOSGIElement>();
+ if( bundleProject instanceof IFeatureModel){
+ IFeatureModel currentFeatureModel=(IFeatureModel)bundleProject;
+ IFeatureImport[] imports=currentFeatureModel.getFeature().getImports();
- @Override
- public String getBundleValue(Object bundleProject, String key) {
- // TODO Auto-generated method stub
- return null;
+ for(int i = 0; i < imports.length; i++) {
+
+ ReferencedOSGIElement newRefElement= new ReferencedOSGIElement(null,imports[i].getId());
+ if( imports[i].getType()==1){
+ newRefElement.setKindRef(ReferencedOSGIElement.FEATURE);
+ }
+ bundleListName.add(newRefElement);
+ }
+ }
+
+ return bundleListName;
+ }
+
+ @Override
+ public String getBundleValue(Object bundleProject, String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getName(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/IBundleDescriptionDesigner.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IBundleDescriptionDesigner.java
index 677e9eb3f72..17ffda880f0 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
@@ -53,6 +53,13 @@ public interface IBundleDescriptionDesigner {
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
* @param bundleProject the bundle JAVA object
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
new file mode 100644
index 00000000000..ffebf519bd9
--- /dev/null
+++ b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/IPluginModelDescriptionDesigner.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * 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<ReferencedOSGIElement> 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 a0876921e9d..f992f53a1bc 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
@@ -114,6 +114,11 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe
if( manisfests[i].getAttribute(Constants.BUNDLE_VERSION.toLowerCase())!=null){
VersionRange version= new VersionRange( manisfests[i].getAttribute(Constants.BUNDLE_VERSION.toLowerCase()));
newRefElement.setVersion(version);
+ if (manisfests[i].getDirective(Constants.RESOLUTION_DIRECTIVE)!=null){
+ if( (manisfests[i].getDirective(Constants.RESOLUTION_DIRECTIVE).equals(Constants.RESOLUTION_OPTIONAL))){
+ newRefElement.setOptional(true);
+ }
+ }
}
bundleListName.add(newRefElement);
@@ -140,4 +145,7 @@ public class LoadedBundleDescriptionDesigner extends AbstractBundleDescriptionDe
return null;
}
+ 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/bundle/ReferencedOSGIElement.java b/extraplugins/adl4eclipse/org.eclipse.papyrus.adl4eclipsetool/src/org/eclipse/papyrus/adltool/designer/bundle/ReferencedOSGIElement.java
index 38eec1e5c32..453940af9fc 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,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.adltool.designer.bundle;
+import org.eclipse.pde.core.IModel;
import org.osgi.framework.VersionRange;
/**
@@ -24,6 +25,53 @@ public class ReferencedOSGIElement {
private VersionRange version=null;
private String symbolicName= null;
+ private String kindRef="";
+ private IModel modelRef=null;
+ private boolean optional= false;
+
+
+
+
+ public boolean isOptional() {
+ return optional;
+ }
+
+
+
+
+
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+
+
+
+ public IModel getModelRef() {
+ return modelRef;
+ }
+
+
+
+
+ public void setModelRef(IModel modelRef) {
+ this.modelRef = modelRef;
+ }
+
+
+
+ public String getKindRef() {
+ return kindRef;
+ }
+
+
+
+ public void setKindRef(String kindRef) {
+ this.kindRef = kindRef;
+ }
+
+ public static String FEATURE="feature";
+ public static String PLUGIN="plugin";
/**
* Constructor.
@@ -35,8 +83,10 @@ public class ReferencedOSGIElement {
super();
this.version = version;
this.symbolicName = symbolicName;
+ this.kindRef=PLUGIN;
}
+
/**
* @return the version
*/
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 8348e041a6e..601651dd68b 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
@@ -103,11 +103,14 @@ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptio
}
}
}
-
+
public ArrayList<ReferencedOSGIElement> getRequiredBundle(Component bundleComponent, Object bundleProject) {
ArrayList<ReferencedOSGIElement> bundleRefList=new ArrayList<ReferencedOSGIElement>();
if(bundleProject instanceof IBundleProjectDescription){
IRequiredBundleDescription[] requiredBundleDescriptions=((IBundleProjectDescription)bundleProject).getRequiredBundles();
+ if(requiredBundleDescriptions==null){
+ return bundleRefList;
+ }
for(int i = 0; i < requiredBundleDescriptions.length; i++) {
ReferencedOSGIElement newrefElement= new ReferencedOSGIElement(null,requiredBundleDescriptions[i].getName());
bundleRefList.add(newrefElement);
@@ -121,4 +124,10 @@ public class WorkspaceBundleDescriptionDesigner extends AbstractBundleDescriptio
}
return null;
}
+
+ public String getName(Object bundleProject) {
+ return this.getBundleValue(bundleProject, org.osgi.framework.Constants.BUNDLE_NAME);
+ }
+
+
}

Back to the top