Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-01-28 12:06:56 -0500
committercletavernie2013-01-28 12:06:56 -0500
commit461f77946d4ea57751098430866bb97ec2c8be12 (patch)
tree347b5755e62a01f621b77600d0a72449e7bbd278
parenta8713597304c425708605fa5cef9488de63ef233 (diff)
downloadorg.eclipse.papyrus-461f77946d4ea57751098430866bb97ec2c8be12.tar.gz
org.eclipse.papyrus-461f77946d4ea57751098430866bb97ec2c8be12.tar.xz
org.eclipse.papyrus-461f77946d4ea57751098430866bb97ec2c8be12.zip
399269: [Properties view - OCL for Papyrus] necessary to delete the class constrainedElement to get the features in the panel tree options
https://bugs.eclipse.org/bugs/show_bug.cgi?id=399269
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/ConstrainedElementContentProvider.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/ConstrainedElementContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/ConstrainedElementContentProvider.java
new file mode 100644
index 00000000000..738bedc9b5f
--- /dev/null
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/ConstrainedElementContentProvider.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.tools.providers;
+
+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;
+import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
+import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
+
+
+public class ConstrainedElementContentProvider extends UMLContentProvider {
+
+ public ConstrainedElementContentProvider(EObject source, EStructuralFeature feature) {
+ super(source, feature);
+
+ IStructuredContentProvider semanticProvider = getSemanticProvider(source, feature, stereotype);
+ encapsulated = encapsulateProvider(semanticProvider, eObject, feature, root);
+ }
+
+ public static EMFGraphicalContentProvider encapsulateProvider(IStructuredContentProvider provider, EObject editedEObject, EStructuralFeature feature, ResourceSet root) {
+ String historyId;
+ if(editedEObject != null && feature != null) {
+ historyId = HistoryUtil.getHistoryID(editedEObject, feature);
+ } else {
+ historyId = "DefaultHistory";
+ }
+
+ IStructuredContentProvider contentProvider;
+
+ if(provider instanceof ITreeContentProvider) {
+ contentProvider = getStrategyProvider((ITreeContentProvider)provider);
+ } else {
+ contentProvider = provider;
+ }
+
+ EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(contentProvider, root, historyId);
+
+ return graphicalProvider;
+ }
+
+ public static IStrategyBasedContentProvider getStrategyProvider(ITreeContentProvider provider) {
+ TreeBrowseStrategy browseStrategy = new UMLContainmentBrowseStrategy(provider);
+ TreeBrowseStrategy revealStrategy = new UMLContainmentBrowseStrategy(provider);
+
+ return new StrategyBasedContentProvider(browseStrategy, revealStrategy);
+ }
+}

Back to the top