Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-01-13 09:07:28 -0500
committercletavernie2012-01-13 09:07:28 -0500
commitc4b801688a71f6422529f3e4e12b52bd6836b45d (patch)
treeb3c90b622086407040f508b0d38f026bb0b350c5 /plugins
parent9841d7da3c6c5bd2e0b78dc711b0443340abe10c (diff)
downloadorg.eclipse.papyrus-c4b801688a71f6422529f3e4e12b52bd6836b45d.tar.gz
org.eclipse.papyrus-c4b801688a71f6422529f3e4e12b52bd6836b45d.tar.xz
org.eclipse.papyrus-c4b801688a71f6422529f3e4e12b52bd6836b45d.zip
359794: [UML - Tools] Content/Label providers
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359794
Diffstat (limited to 'plugins')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/META-INF/MANIFEST.MF3
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/src/org/eclipse/papyrus/customization/properties/model/xwt/resource/XWTResource.java4
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java3
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java42
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java17
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java29
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java86
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF1
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java108
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java26
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java3
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java3
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java7
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.properties/src/org/eclipse/papyrus/infra/table/properties/provider/CustomizationContentProvider.java4
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/AbstractFilteredContentProvider.java2
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/HierarchicToFlatContentProvider.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java1
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java4
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java2
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java2
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java4
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java14
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java10
23 files changed, 232 insertions, 150 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/META-INF/MANIFEST.MF b/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/META-INF/MANIFEST.MF
index 087016a33f4..624751e2ea8 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/META-INF/MANIFEST.MF
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/META-INF/MANIFEST.MF
@@ -8,7 +8,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.views.properties.model;bundle-version="0.9.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.9.0",
org.eclipse.wst.xml.core;bundle-version="1.1.600",
- org.eclipse.core.resources;bundle-version="3.7.100"
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.eclipse.e4.xwt.tools.ui;bundle-version="0.9.0"
Export-Package: org.eclipse.papyrus.customization.properties.model.xwt.resource
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/src/org/eclipse/papyrus/customization/properties/model/xwt/resource/XWTResource.java b/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/src/org/eclipse/papyrus/customization/properties/model/xwt/resource/XWTResource.java
index 2ec3bb2465b..79640834d13 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/src/org/eclipse/papyrus/customization/properties/model/xwt/resource/XWTResource.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.model.xwt/src/org/eclipse/papyrus/customization/properties/model/xwt/resource/XWTResource.java
@@ -120,6 +120,10 @@ public class XWTResource extends ResourceImpl {
@Override
protected void doSave(OutputStream outputStream, Map<?, ?> options) throws IOException {
try {
+ if(getContents().isEmpty()) {
+ Activator.log.warn("Cannot save an Empty XWT resource : " + getURI());
+ return;
+ }
Root root = uiSectionToXML((CompositeWidget)getContents().get(0));
xmlResource.getContents().clear();
xmlResource.getContents().add(root);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
index f4c55236488..a20e788320e 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
@@ -258,6 +258,9 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
//The outputstream cannot be formatted. If format is true, this is
//the real file (and not the preview file) that will be formatted
options.put(XWTResource.OPTION_FORMAT, false);
+ if(section.getWidget() == null || section.getWidget().eResource() == null) {
+ return null;
+ }
section.getWidget().eResource().save(os, options);
return xwtFile.toURI().toURL();
} catch (IOException ex) {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
index a41e350993e..685627330ff 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.customization.properties.providers.ConstraintDescriptorContentProvider;
import org.eclipse.papyrus.customization.properties.providers.ContextLabelProvider;
import org.eclipse.papyrus.customization.properties.providers.DataContextElementContentProvider;
@@ -29,10 +30,16 @@ import org.eclipse.papyrus.customization.properties.providers.PropertyEditorType
import org.eclipse.papyrus.customization.properties.providers.TabContentProvider;
import org.eclipse.papyrus.infra.constraints.ConstraintsPackage;
import org.eclipse.papyrus.infra.constraints.providers.ConstraintTypeContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
+import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.contexts.ContextsPackage;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
@@ -42,8 +49,8 @@ import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElement;
import org.eclipse.papyrus.views.properties.modelelement.DataSource;
import org.eclipse.papyrus.views.properties.modelelement.EMFModelElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
import org.eclipse.papyrus.views.properties.ui.PropertyEditor;
-import org.eclipse.papyrus.views.properties.ui.UiPackage;
/**
* A {@link ModelElement} for customization specific properties
@@ -83,6 +90,7 @@ public class CustomizationModelElement extends AbstractModelElement {
providers.put(EnvironmentPackage.eINSTANCE.getStandardWidgetType(), new EnvironmentContentProvider(EnvironmentPackage.eINSTANCE.getEnvironment_WidgetTypes()));
providers.put(EnvironmentPackage.eINSTANCE.getLayoutType(), new EnvironmentContentProvider(EnvironmentPackage.eINSTANCE.getEnvironment_LayoutTypes()));
providers.put(EnvironmentPackage.eINSTANCE.getModelElementFactoryDescriptor(), new EnvironmentContentProvider(EnvironmentPackage.eINSTANCE.getEnvironment_ModelElementFactories()));
+ providers.put(EnvironmentPackage.eINSTANCE.getPropertyEditorType(), new EnvironmentContentProvider(EnvironmentPackage.eINSTANCE.getEnvironment_PropertyEditorTypes()));
providers.put(org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage.eINSTANCE.getConstraintType(), new ConstraintTypeContentProvider());
}
@@ -103,6 +111,32 @@ public class CustomizationModelElement extends AbstractModelElement {
return EmptyContentProvider.instance;
}
+ IStaticContentProvider provider = findProvider(feature);
+
+ if(provider == null) {
+ return delegate.getContentProvider(propertyPath);
+ }
+
+ if(provider instanceof ITreeContentProvider) {
+ IStrategyBasedContentProvider strategyProvider = getStrategyProvider((ITreeContentProvider)provider);
+
+ if(feature.getEType() == EnvironmentPackage.eINSTANCE.getPropertyEditorType()) {
+ return new PropertyEditorTypeContentProvider(strategyProvider, (PropertyEditor)delegate.getSource());
+ } else {
+ return new EMFGraphicalContentProvider(strategyProvider, ConfigurationManager.instance.getResourceSet(), "history_" + feature.getName());
+ }
+ }
+ return provider;
+ }
+
+ protected IStrategyBasedContentProvider getStrategyProvider(ITreeContentProvider provider) {
+ TreeBrowseStrategy browseStrategy = new ProviderBasedBrowseStrategy(provider);
+ TreeBrowseStrategy revealStrategy = new ContainmentBrowseStrategy(provider);
+
+ return new StrategyBasedContentProvider(browseStrategy, revealStrategy);
+ }
+
+ protected IStaticContentProvider findProvider(EStructuralFeature feature) {
EClassifier classifier = feature.getEType();
if(providers.containsKey(classifier)) {
return providers.get(classifier);
@@ -118,11 +152,9 @@ public class CustomizationModelElement extends AbstractModelElement {
return new DataContextElementContentProvider((DataContextElement)delegate.getSource());
} else if(classifier == ContextsPackage.eINSTANCE.getContext()) {
return new DependencyContentProvider((Context)delegate.getSource());
- } else if(feature == UiPackage.eINSTANCE.getPropertyEditor_WidgetType()) {
- return new PropertyEditorTypeContentProvider((PropertyEditor)delegate.getSource());
- } else {
- return delegate.getContentProvider(propertyPath);
}
+
+ return null;
}
private boolean isDataContextElement(EClassifier classifier) {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java
index 34335d381cc..b905edac67b 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java
@@ -17,7 +17,8 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.papyrus.infra.widgets.providers.AbstractFilteredContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
+import org.eclipse.papyrus.infra.tools.util.ListHelper;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.util.PropertiesUtil;
@@ -30,7 +31,7 @@ import org.eclipse.papyrus.views.properties.util.PropertiesUtil;
* @author Camille Letavernier
*
*/
-public abstract class AbstractContextualContentProvider extends AbstractFilteredContentProvider implements IStaticContentProvider {
+public abstract class AbstractContextualContentProvider extends SemanticEMFContentProvider implements IStaticContentProvider {
/**
* The list of available contexts in the current model
@@ -38,11 +39,6 @@ public abstract class AbstractContextualContentProvider extends AbstractFiltered
protected Collection<Context> contexts;
/**
- * The EObject used to retrieve the available contexts
- */
- protected EObject source;
-
- /**
*
* Constructor.
*
@@ -50,12 +46,11 @@ public abstract class AbstractContextualContentProvider extends AbstractFiltered
* The EObject used to retrieve the available contexts
*/
protected AbstractContextualContentProvider(EObject source) {
- contexts = findContexts(source);
- this.source = source;
- showIfHasVisibleParent = true;
+ super(findContexts(source).toArray(new Context[0]));
+ contexts = ListHelper.asList((Context[])roots);
}
- private List<Context> findContexts(EObject source) {
+ private static List<Context> findContexts(EObject source) {
List<Context> contexts = new LinkedList<Context>();
Context rootContext = null;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java
index e070c7ab8d9..65a4255405b 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java
@@ -14,8 +14,11 @@ package org.eclipse.papyrus.customization.properties.providers;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.widgets.providers.AbstractFilteredContentProvider;
+import org.eclipse.papyrus.customization.properties.Activator;
+import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.views.properties.environment.Environment;
import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
@@ -25,9 +28,7 @@ import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
*
* @author Camille Letavernier
*/
-public class EnvironmentContentProvider extends AbstractFilteredContentProvider implements IStaticContentProvider {
-
- private Object[] contents;
+public class EnvironmentContentProvider extends SemanticEMFContentProvider implements IStaticContentProvider {
/**
* Constructor.
@@ -37,20 +38,20 @@ public class EnvironmentContentProvider extends AbstractFilteredContentProvider
* different environments.
*/
public EnvironmentContentProvider(EStructuralFeature feature) {
+ super(null, feature, getRoots(feature));
+ }
+
+ private static EObject[] getRoots(EStructuralFeature feature) {
+ if(!(feature.getEType() instanceof EClass)) {
+ Activator.log.warn("The feature " + feature + " cannot be handled by this content provider");
+ return new EObject[0];
+ }
+
List<Object> allObjects = new LinkedList<Object>();
for(Environment environment : ConfigurationManager.instance.getPropertiesRoot().getEnvironments()) {
allObjects.addAll((List<?>)environment.eGet(feature));
}
- contents = allObjects.toArray();
- showIfHasVisibleParent = true;
- }
-
- public Object[] getElements() {
- return contents;
- }
-
- public Object[] getElements(Object inputElement) {
- return getElements();
+ return allObjects.toArray(new EObject[0]);
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java
index d2981380573..5e0e2b024cb 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java
@@ -1,35 +1,35 @@
package org.eclipse.papyrus.customization.properties.providers;
-import java.util.LinkedList;
-import java.util.List;
-
+import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.BooleanToggle;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
-import org.eclipse.papyrus.infra.widgets.providers.IGraphicalContentProvider;
-import org.eclipse.papyrus.views.properties.environment.EnvironmentPackage;
+import org.eclipse.papyrus.infra.widgets.providers.AbstractTreeFilter;
import org.eclipse.papyrus.views.properties.environment.PropertyEditorType;
-import org.eclipse.papyrus.views.properties.environment.Type;
import org.eclipse.papyrus.views.properties.ui.PropertyEditor;
import org.eclipse.papyrus.views.properties.widgets.layout.PropertiesLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-public class PropertyEditorTypeContentProvider extends EnvironmentContentProvider implements IGraphicalContentProvider, ICommitListener {
+public class PropertyEditorTypeContentProvider extends EMFGraphicalContentProvider implements ICommitListener {
private PropertyEditor source;
- private Viewer viewer;
-
- private boolean filter = true;
-
private BooleanToggle filterButton;
- public PropertyEditorTypeContentProvider(PropertyEditor source) {
- super(EnvironmentPackage.eINSTANCE.getEnvironment_PropertyEditorTypes());
+ private PropertyEditorTypeViewerFilter currentFilter;
+
+ public PropertyEditorTypeContentProvider(IStructuredContentProvider semanticProvider, PropertyEditor source) {
+ super(semanticProvider, source.eResource().getResourceSet(), getHistoryId(source));
this.source = source;
+ this.currentFilter = new PropertyEditorTypeViewerFilter();
+ }
+
+ private static String getHistoryId(PropertyEditor source) {
+ return "history_propertyEditorType_" + source.eResource().getURI();
}
@Override
@@ -39,37 +39,59 @@ public class PropertyEditorTypeContentProvider extends EnvironmentContentProvide
filterButton = new BooleanToggle(self);
filterButton.setText("Filter");
- filterButton.setValue(this.filter);
+ filterButton.setValue(currentFilter.getFilter());
filterButton.addCommitListener(this);
super.createBefore(self);
}
@Override
- public Object[] getElements() {
- Object[] elements = super.getElements();
- if(!filter || source.getProperty() == null) {
- return elements;
- }
-
- Type type = source.getProperty().getType();
- boolean isPropertyMultiple = source.getProperty().getMultiplicity() != 1;
- List<Object> filteredElements = new LinkedList<Object>();
- for(Object element : elements) {
- PropertyEditorType editorType = (PropertyEditorType)element;
- boolean isElementMultiple = editorType.getMultiplicity() != 1;
- if(editorType.getType() == type && isPropertyMultiple == isElementMultiple) {
- filteredElements.add(element);
- }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if(super.viewer != null) {
+ super.viewer.removeFilter(currentFilter);
}
-
- return filteredElements.toArray();
+ super.inputChanged(viewer, oldInput, newInput);
+ super.viewer.addFilter(currentFilter);
}
+ @Override
public void commit(AbstractEditor editor) {
- filter = filterButton.getValue();
+ currentFilter.setFilter(filterButton.getValue());
if(super.viewer != null) {
super.viewer.refresh();
}
}
+ private class PropertyEditorTypeViewerFilter extends AbstractTreeFilter {
+
+ private boolean filter = true;
+
+ @Override
+ public boolean isVisible(Viewer viewer, Object parentElement, Object element) {
+ if(!filter) {
+ return true;
+ }
+
+ Object adaptedValue = getAdaptedValue(element);
+ if(adaptedValue instanceof PropertyEditorType) {
+ PropertyEditorType editorType = (PropertyEditorType)adaptedValue;
+ if(source.getProperty() == null) {
+ return true;
+ }
+ return editorType.getType() == source.getProperty().getType();
+ }
+
+ return false;
+ }
+
+ public boolean getFilter() {
+ return filter;
+ }
+
+ public void setFilter(boolean filter) {
+ this.filter = filter;
+ clearCache();
+ }
+
+ }
+
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
index 2f8f79371fa..a0daea9223a 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.editor/META-INF/MANIFEST.MF
@@ -21,3 +21,4 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.transaction;bundle-version="1.4.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
+Eclipse-BuddyPolicy: dependent
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
index c91107c5e55..04ce3c10391 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
@@ -11,33 +11,29 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.providers;
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.IItemPropertySource;
-import org.eclipse.papyrus.infra.emf.Activator;
-import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
+import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
+import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
+import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
/**
- * A Content provider for EMF references
+ * A global Content provider for EMF
*
* @author Camille Letavernier
- * @deprecated Use the new ContentProvider tools
*/
-@Deprecated
-public class EMFContentProvider extends AbstractStaticContentProvider {
-
- private EObject eObject;
-
- private EStructuralFeature feature;
-
- private AdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+public class EMFContentProvider extends EncapsulatedContentProvider {
/**
*
@@ -47,43 +43,63 @@ public class EMFContentProvider extends AbstractStaticContentProvider {
* The feature representing the reference for which we want to retrieve possible values
* @param eObject
*/
- public EMFContentProvider(EObject eObject, EStructuralFeature feature) {
- this.feature = feature;
- this.eObject = eObject;
+ public EMFContentProvider(EObject editedEObject, EStructuralFeature feature) {
+ IStructuredContentProvider provider = getSemanticProvider(editedEObject, feature);
+
+ encapsulated = encapsulateProvider(provider, editedEObject, feature);
}
- public Object[] getElements() {
- if(eObject == null || feature == null) {
- return new Object[0];
+ /**
+ * Returns the content provider associated to feature being edited
+ *
+ * @param editedEObject
+ * The object being edited
+ * @param feature
+ * The object's feature being edited
+ * @return
+ * A content provider returning all the values valid for the given feature
+ */
+ protected IStructuredContentProvider getSemanticProvider(EObject editedEObject, EStructuralFeature feature) {
+ EClassifier type = feature.getEType();
+ if(type instanceof EEnum) {
+ return new EMFEnumeratorContentProvider(feature);
+ } else if(type instanceof EClass) {
+ return new SemanticEMFContentProvider(editedEObject, feature);
}
- EClass eClass = eObject.eClass();
- if(eClass == null) {
- Activator.log.debug("problems during initialization, looking for availables values"); //$NON-NLS-1$
- return new Object[0];
- }
+ return EmptyContentProvider.instance;
+ }
- if(!(feature instanceof EReference)) {
- Activator.log.debug("feature is not a reference, looking for availables values: " + feature);//$NON-NLS-1$
- return new Object[0];
- }
+ /**
+ * Encapsulates the given content provider in a higher-level content provider
+ * The returned provider uses two different strategies to display and search
+ * elements, and adds a pattern filter and an History
+ *
+ * @param provider
+ * The ContentProvider to encapsulate
+ * @return
+ */
+ protected EMFGraphicalContentProvider encapsulateProvider(IStructuredContentProvider provider, EObject editedEObject, EStructuralFeature feature) {
+ String historyId = HistoryUtil.getHistoryID(editedEObject, feature);
- IItemPropertySource itemPropertySource = (IItemPropertySource)factory.adapt(eObject, IItemPropertySource.class);
- if(itemPropertySource == null) {
- Activator.log.debug("impossible to find item Property source for " + eObject);//$NON-NLS-1$
- return new Object[0];
- }
- IItemPropertyDescriptor itemPropertyDescriptor = itemPropertySource.getPropertyDescriptor(eObject, feature);
- if(itemPropertyDescriptor == null) {
- Activator.log.debug("impossible to find item Property descriptor for " + eObject + " and " + feature);//$NON-NLS-1$ //$NON-NLS-2$
- return new Object[0];
+ IStructuredContentProvider contentProvider;
+
+ if(provider instanceof ITreeContentProvider) {
+ contentProvider = getStrategyProvider((ITreeContentProvider)provider);
+ } else {
+ contentProvider = provider;
}
- Collection<?> values = itemPropertyDescriptor.getChoiceOfValues(eObject);
+ EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(contentProvider, editedEObject.eResource().getResourceSet(), historyId);
+
+ return graphicalProvider;
+ }
- values.remove(null); //Removes null values from the collection
+ protected IStrategyBasedContentProvider getStrategyProvider(ITreeContentProvider provider) {
+ TreeBrowseStrategy browseStrategy = new ProviderBasedBrowseStrategy(provider);
+ TreeBrowseStrategy revealStrategy = new ContainmentBrowseStrategy(provider);
- return values.toArray();
+ return new StrategyBasedContentProvider(browseStrategy, revealStrategy);
}
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
index ddfc7a43cbe..89409fa01cd 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -35,11 +36,6 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.ModelUtils;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
@@ -56,9 +52,9 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Table;
/**
- * this is a content provider based on the model explorer on which we can filter wanted meta-classes
- * It can only filter if wantedMetaclass and metaclassNotWanted are Eclass
+ * This providers adds a text-filter and an History to EMF-based content providers
*/
+//TODO : Extend (Abstract)FilteredContentProvider
public class EMFGraphicalContentProvider extends EncapsulatedContentProvider implements ISelectionChangedListener {
private static final String DIALOG_SETTINGS = EMFGraphicalContentProvider.class.getName();
@@ -87,6 +83,8 @@ public class EMFGraphicalContentProvider extends EncapsulatedContentProvider imp
protected StructuredViewer viewer;
+ protected ResourceSet resourceSet;
+
private static final int HISTORY_MAX_SIZE = 5;
private String currentFilterPattern = ""; //$NON-NLS-1$
@@ -98,9 +96,10 @@ public class EMFGraphicalContentProvider extends EncapsulatedContentProvider imp
/**
* the constructor
*/
- public EMFGraphicalContentProvider(IStructuredContentProvider semanticProvider, String historyId) {
+ public EMFGraphicalContentProvider(IStructuredContentProvider semanticProvider, ResourceSet resourceSet, String historyId) {
super(semanticProvider);
this.historyId = historyId;
+ this.resourceSet = resourceSet;
}
/**
@@ -235,16 +234,7 @@ public class EMFGraphicalContentProvider extends EncapsulatedContentProvider imp
* Inits the History
*/
protected void initSelectionHistory() {
- // read the history in the preferences
- ServicesRegistry servicesRegistry = EditorUtils.getServiceRegistry();
- ModelSet modelSet = null;
selectionHistory = new ArrayList<EObject>(HISTORY_MAX_SIZE + 1);
- try {
- modelSet = ModelUtils.getModelSetChecked(servicesRegistry);
- } catch (ServiceException e) {
- Activator.log.error(e);
- return;
- }
IDialogSettings historySettings = getDialogSettings().getSection(HISTORY_SETTINGS);
if(historySettings != null) {
@@ -253,7 +243,7 @@ public class EMFGraphicalContentProvider extends EncapsulatedContentProvider imp
if(uriHistory != null) {
for(String uri : uriHistory) {
try {
- EObject object = modelSet.getEObject(URI.createURI(uri), true);
+ EObject object = resourceSet.getEObject(URI.createURI(uri), true);
if(object != null && !selectionHistory.contains(object)) {
selectionHistory.add(object);
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
index 87f1b2551fa..db3bbf78646 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
@@ -29,7 +29,10 @@ import org.eclipse.papyrus.infra.emf.Activator;
/**
* the content provider that inherits of modisco properties
+ *
+ * @deprecated Use SemanticUMLContentProvider instead
*/
+@Deprecated
public class MoDiscoContentProvider extends CustomizableModelContentProvider {
/** The ModelSet containing all the models. This is the initial input. */
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
index db880ed8386..8de88a60d54 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ModelContentProvider.java
@@ -37,7 +37,10 @@ import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
/**
* This is a modisco content provider on which we can parameter the root element
+ *
+ * @deprecated Use SemanticUMLContentProvider instead
*/
+@Deprecated
public class ModelContentProvider extends MoDiscoContentProvider implements IStaticContentProvider, IAdaptableContentProvider {
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
index 24d5b1865dc..e270e4d31f8 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
@@ -13,6 +13,7 @@ package org.eclipse.papyrus.infra.emf.utils;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
@@ -33,11 +34,11 @@ public class ProviderHelper {
* The ContentProvider to encapsulate
* @return
*/
- public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, String historyId) {
+ public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, ResourceSet resourceSet, String historyId) {
TreeBrowseStrategy browseStrategy = new ProviderBasedBrowseStrategy(provider);
TreeBrowseStrategy revealStrategy = new ContainmentBrowseStrategy(provider);
IStructuredContentProvider strategyProvider = new StrategyBasedContentProvider(browseStrategy, revealStrategy);
- EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(strategyProvider, historyId);
+ EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(strategyProvider, resourceSet, historyId);
return graphicalProvider;
}
@@ -52,6 +53,6 @@ public class ProviderHelper {
* @return
*/
public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, EObject editedEObject, EStructuralFeature feature) {
- return encapsulateProvider(provider, HistoryUtil.getHistoryID(editedEObject, feature));
+ return encapsulateProvider(provider, editedEObject.eResource().getResourceSet(), HistoryUtil.getHistoryID(editedEObject, feature));
}
}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.properties/src/org/eclipse/papyrus/infra/table/properties/provider/CustomizationContentProvider.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.properties/src/org/eclipse/papyrus/infra/table/properties/provider/CustomizationContentProvider.java
index f284e2fa9f4..e5f2e99fc0b 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.properties/src/org/eclipse/papyrus/infra/table/properties/provider/CustomizationContentProvider.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.properties/src/org/eclipse/papyrus/infra/table/properties/provider/CustomizationContentProvider.java
@@ -21,7 +21,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.TableInstance2;
-import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
+import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.table.properties.modelelement.PapyrusTableModelElement;
/**
@@ -29,7 +29,7 @@ import org.eclipse.papyrus.infra.table.properties.modelelement.PapyrusTableModel
* The content provider for the MetamodelView
*
*/
-public class CustomizationContentProvider extends EMFContentProvider {
+public class CustomizationContentProvider extends SemanticEMFContentProvider {
/**
* the table instance
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/AbstractFilteredContentProvider.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/AbstractFilteredContentProvider.java
index 632cbc9ba6d..ed8c9c553b6 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/AbstractFilteredContentProvider.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/AbstractFilteredContentProvider.java
@@ -40,6 +40,7 @@ import org.eclipse.swt.widgets.Composite;
*
* @author Camille Letavernier
*/
+//TODO : Encapsulate a IStructuredContentProvider and make this class concrete
public abstract class AbstractFilteredContentProvider implements IGraphicalContentProvider {
protected StructuredViewer viewer;
@@ -71,6 +72,7 @@ public abstract class AbstractFilteredContentProvider implements IGraphicalConte
public void createBefore(Composite parent) {
filterPattern = new StringEditor(parent, SWT.NONE, "Filter : "); //$NON-NLS-1$
+ filterPattern.setValidateOnDelay(true);
filterPattern.setValue(BASE_PATTERN);
filter = getViewerFilter();
filterPattern.addCommitListener(new ICommitListener() {
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/HierarchicToFlatContentProvider.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/HierarchicToFlatContentProvider.java
index 01b9cbaa3b4..9ab214b57dc 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/HierarchicToFlatContentProvider.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/providers/HierarchicToFlatContentProvider.java
@@ -65,7 +65,12 @@ public class HierarchicToFlatContentProvider extends TreeToFlatContentProvider {
return;
}
- for(Object child : contentProvider.getChildren(parent)) {
+ Object[] children = contentProvider.getChildren(parent);
+ if(children == null) {
+ return;
+ }
+
+ for(Object child : children) {
Object childValue = getValue(child);
if(result.contains(childValue)) {
continue; //Avoid infinite recursion
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
index 612e726b36f..4aa343400a2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
@@ -30,6 +30,7 @@ import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
* this content provider is used to display diagrams and their contents
*
*/
+//TODO : This ContentProvider should extend SemanticUMLContentProvider
public class DiagramContentProvider extends MoDiscoContentProvider {
@Override
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
index dc559cb4ba4..1fb2e43d7ff 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
@@ -27,7 +27,9 @@ import org.eclipse.uml2.uml.util.UMLUtil;
/**
* this is a specific content provider used to not display UML stereotype applications
*
+ * @deprecated Use {@link org.eclipse.papyrus.uml.tools.providers.UMLContentProvider} instead
*/
+@Deprecated
public class UMLContentProvider extends MoDiscoContentProvider {
@@ -51,7 +53,7 @@ public class UMLContentProvider extends MoDiscoContentProvider {
ArrayList<EObject> result = new ArrayList<EObject>();
Iterator<EObject> iterator = contents.iterator();
while(iterator.hasNext()) {
- EObject eObject = (EObject)iterator.next();
+ EObject eObject = iterator.next();
//functionality that comes from UML2 plugins
if(UMLUtil.getStereotype(eObject) == null) {
result.add(eObject);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
index e5be4b6a3be..804d3f18456 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLModelElement.java
@@ -217,7 +217,7 @@ public class UMLModelElement extends EMFModelElement {
factory.setReferenceLabelProvider(new EMFLabelProvider());
ITreeContentProvider contentProvider = new UMLContainerContentProvider(source, reference);
- EMFGraphicalContentProvider provider = ProviderHelper.encapsulateProvider(contentProvider, HistoryUtil.getHistoryID(source, feature, "container"));
+ EMFGraphicalContentProvider provider = ProviderHelper.encapsulateProvider(contentProvider, source.eResource().getResourceSet(), HistoryUtil.getHistoryID(source, feature, "container"));
factory.setContainerContentProvider(provider);
factory.setReferenceContentProvider(new FeatureContentProvider(type));
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
index 633a99917b9..095f707f500 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
@@ -46,7 +46,7 @@ public class UMLProviderHelper {
contentProvider = provider;
}
- EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(contentProvider, historyId);
+ EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(contentProvider, editedEObject.eResource().getResourceSet(), historyId);
return graphicalProvider;
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java
index c3e95054c93..cc6adff3b7b 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/AbstractModelElement.java
@@ -109,7 +109,9 @@ public abstract class AbstractModelElement implements ModelElement {
public final IObservable getObservable(String propertyPath) {
if(!observables.containsKey(propertyPath)) {
IObservable observable = doGetObservable(propertyPath);
- observables.put(propertyPath, observable);
+ if(observable != null) {
+ observables.put(propertyPath, observable);
+ }
}
return observables.get(propertyPath);
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
index 6ba799635b0..d233e84b95d 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/modelelement/EMFModelElement.java
@@ -19,7 +19,6 @@ import org.eclipse.emf.databinding.FeaturePath;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -28,11 +27,9 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableList;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableValue;
import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.EMFEnumeratorContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
-import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.views.properties.Activator;
import org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory;
@@ -190,17 +187,8 @@ public class EMFModelElement extends AbstractModelElement {
public IStaticContentProvider getContentProvider(String propertyPath) {
FeaturePath featurePath = getFeaturePath(propertyPath);
EStructuralFeature feature = getFeature(featurePath);
- if(feature == null) {
- return EmptyContentProvider.instance;
- }
- EClassifier type = feature.getEType();
- if(type instanceof EEnum) {
- return new EMFEnumeratorContentProvider(feature);
- } else if(type instanceof EClass) {
- return new EMFContentProvider(getSource(featurePath), feature);
- }
- return EmptyContentProvider.instance;
+ return new EMFContentProvider(getSource(featurePath), feature);
}
@Override
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java
index c33ae894318..f12b4d02e38 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java
@@ -669,4 +669,14 @@ public class ConfigurationManager {
return conflicts.values();
}
+
+ /**
+ * Returns the ResourceSet associated to the ConfigurationManager,
+ * ie. the ResourceSet containing all Environments and Contexts
+ *
+ * @return
+ */
+ public ResourceSet getResourceSet() {
+ return resourceSet;
+ }
}

Back to the top