Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Cuccuru2015-06-09 09:03:10 -0400
committerArnaud Cuccuru2015-06-09 09:03:37 -0400
commitd4d514bb3b88ee701346c371838191d8ab945ed4 (patch)
treeee2982c8a9f16699a430eba52ab144d7209f1ffd /extraplugins/alf/ui
parent9e55f58f5eb9631b1674320245edeb746e993bca (diff)
parent3395c8b11f6d11b9a9a0006d6d72ab4026e7120b (diff)
downloadorg.eclipse.papyrus-d4d514bb3b88ee701346c371838191d8ab945ed4.tar.gz
org.eclipse.papyrus-d4d514bb3b88ee701346c371838191d8ab945ed4.tar.xz
org.eclipse.papyrus-d4d514bb3b88ee701346c371838191d8ab945ed4.zip
Merge branch 'master' into bugs/462954-alf
Change-Id: Ic42952adfd3ec4b1b32db5d3f4bf3613e5902296 Signed-off-by: Arnaud Cuccuru <arnaud.cuccuru@cea.fr>
Diffstat (limited to 'extraplugins/alf/ui')
-rw-r--r--extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/META-INF/MANIFEST.MF10
-rw-r--r--extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java95
2 files changed, 48 insertions, 57 deletions
diff --git a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/META-INF/MANIFEST.MF b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/META-INF/MANIFEST.MF
index 3c62be446a9..4ae01be3d59 100644
--- a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/META-INF/MANIFEST.MF
+++ b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/META-INF/MANIFEST.MF
@@ -3,10 +3,6 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.105.0",
org.eclipse.ui.forms;bundle-version="3.6.0",
org.eclipse.ui.views.properties.tabbed;bundle-version="3.6.0",
org.eclipse.emf.ecore;bundle-version="2.9.0",
- org.eclipse.gmf.runtime.common.core;bundle-version="1.7.0",
- org.eclipse.gmf.runtime.common.ui.services;bundle-version="1.7.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.7.0",
- org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.7.0",
org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.1.0",
@@ -24,7 +20,11 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.105.0",
org.eclipse.papyrus.uml.alf.transaction;bundle-version="0.7.0",
org.eclipse.papyrus.uml.alf.text;bundle-version="0.7.0",
org.eclipse.compare,
- org.eclipse.papyrus.uml.alf.preferences;bundle-version="0.7.0"
+ org.eclipse.papyrus.uml.alf.preferences;bundle-version="0.7.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
+ org.eclipse.emf.edit;bundle-version="2.11.0",
+ org.eclipse.core.runtime;bundle-version="3.11.0",
+ org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.7.0"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.7.0.qualifier
diff --git a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java
index 2d26942bbfa..d2a887c3d46 100644
--- a/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java
+++ b/extraplugins/alf/ui/org.eclipse.papyrus.uml.alf.properties.xtext/src/org/eclipse/papyrus/uml/alf/properties/xtext/sheet/AlfEditorPropertySectionFilter.java
@@ -1,38 +1,36 @@
/*****************************************************************************
* Copyright (c) 2014 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:
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.alf.properties.xtext.sheet;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.jface.viewers.IFilter;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.uml.alf.preferences.AlfIntegrationPreferencesUtil;
import org.eclipse.papyrus.uml.alf.transaction.observation.listener.filter.FUMLScopeUtil;
+import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.papyrus.uml.alf.preferences.AlfIntegrationPreferencesUtil;
/**
* This class constrains the availability of the embedded ALF editor.
- *
+ *
* The ALF editor must only be available when:
- * 1. The selection is a Class (not composite)
- * 2. The selection is an Association
- * 3. The selection is a Signal
- * 4. The selection is a Datatype
- * 5. The selection is an Enumeration
- * 6. The selection is a Package
- * 7. The selection is an Activity
+ * 1. The selection is a Class (not composite)
+ * 2. The selection is an Association
+ * 3. The selection is a Signal
+ * 4. The selection is a Datatype
+ * 5. The selection is an Enumeration
+ * 6. The selection is a Package
+ * 7. The selection is an Activity
*/
public class AlfEditorPropertySectionFilter implements IFilter {
@@ -40,80 +38,73 @@ public class AlfEditorPropertySectionFilter implements IFilter {
* @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
*
* @param toTest
- *
+ *
* @return accepted
*/
+ @Override
public boolean select(Object toTest) {
Element element = this.resolveSemanticElement(toTest);
boolean accepted = false;
- if(element!=null &&
- AlfIntegrationPreferencesUtil.isAlfSupportEnabled()){
+ if (element != null &&
+ AlfIntegrationPreferencesUtil.isAlfSupportEnabled()) {
accepted = this.isValidInput(element);
}
return accepted;
}
-
+
/**
* Check the given input and returns true if it is a valid input for the embedded ALF editor
- * false otherwise
- *
+ * false otherwise
+ *
* @param element
- * an input element for ALF embedded editor
- *
+ * an input element for ALF embedded editor
+ *
* @return true if element is accepted as an input false otherwise
*/
- private boolean isValidInput(Element element){
- /*1. First constraint: the element must be modifiable (i.e. not read only)*/
- if(!this.isModifiable(element)){
+ private boolean isValidInput(Element element) {
+ /* 1. First constraint: the element must be modifiable (i.e. not read only) */
+ if (!this.isModifiable(element)) {
return false;
}
- /*2. It should be in the scope supported by the ALF editor*/
- if(FUMLScopeUtil.isClass(element)){
+ /* 2. It should be in the scope supported by the ALF editor */
+ if (FUMLScopeUtil.isClass(element)) {
return true;
- }else if(FUMLScopeUtil.isPackage(element)){
+ } else if (FUMLScopeUtil.isPackage(element)) {
return true;
- }else if(FUMLScopeUtil.isSignal(element)){
+ } else if (FUMLScopeUtil.isSignal(element)) {
return true;
- }else if(FUMLScopeUtil.isEnumeration(element)){
+ } else if (FUMLScopeUtil.isEnumeration(element)) {
return true;
- }else if(FUMLScopeUtil.isDataType(element)){
+ } else if (FUMLScopeUtil.isDataType(element)) {
return true;
- }else if(FUMLScopeUtil.isAssociation(element)){
+ } else if (FUMLScopeUtil.isAssociation(element)) {
return true;
- }else if(FUMLScopeUtil.isActivity(element)){
+ } else if (FUMLScopeUtil.isActivity(element)) {
return true;
- }else if(FUMLScopeUtil.isOperationWithImplementation(element)){
+ } else if (FUMLScopeUtil.isOperationWithImplementation(element)) {
return true;
}
return false;
}
-
- private boolean isModifiable(Element element){
+
+ private boolean isModifiable(Element element) {
Resource resource = element.eResource();
- if(resource != null ){
+ if (resource != null) {
return !EMFHelper.isReadOnly(element);
}
return false;
}
-
+
/**
* From a selection this methods tries to extract the underlying model element
- *
+ *
* @param selectedElement
- * an object selected in the view (e.g., a class in a diagram)
- *
+ * an object selected in the view (e.g., a class in a diagram)
+ *
* @return semanticElement
- * the model element that is under the graphical element (may be null)
+ * the model element that is under the graphical element (may be null)
*/
- private Element resolveSemanticElement(Object selectedElement){
- Element semanticElement = null;
- if (selectedElement instanceof IAdaptable) {
- semanticElement = (Element) ((IAdaptable) selectedElement).getAdapter(EObject.class);
- }
- else if (selectedElement instanceof GraphicalEditPart) {
- GraphicalEditPart part = (GraphicalEditPart) selectedElement;
- semanticElement = (Element)part.resolveSemanticElement();
- }
- return semanticElement;
+ private Element resolveSemanticElement(Object selectedElement) {
+ return UMLUtil.resolveUMLElement(selectedElement);
}
} \ No newline at end of file

Back to the top