Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl')
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/StereotypeApplicationWithVSLUiModule.java32
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java176
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java145
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java301
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLDescriptionLabelProvider.java37
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLLabelProvider.java44
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/outline/StereotypeApplicationWithVSLOutlineTreeProvider.java14
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/quickfix/StereotypeApplicationWithVSLQuickfixProvider.java32
8 files changed, 0 insertions, 781 deletions
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/StereotypeApplicationWithVSLUiModule.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/StereotypeApplicationWithVSLUiModule.java
deleted file mode 100644
index 26462bc6020..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/StereotypeApplicationWithVSLUiModule.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui;
-
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.papyrus.marte.vsl.ui.contentassist.VSLContentAssistProcessor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Use this class to register components to be used within the IDE.
- */
-public class StereotypeApplicationWithVSLUiModule extends org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.AbstractStereotypeApplicationWithVSLUiModule {
- public StereotypeApplicationWithVSLUiModule(AbstractUIPlugin plugin) {
- super(plugin);
- }
-
- @Override
- public Class<? extends IContentAssistProcessor> bindIContentAssistProcessor() {
- return VSLContentAssistProcessor.class;
- }
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java
deleted file mode 100644
index 92630ae142d..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.contentassist;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationRule;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.TagSpecificationRule;
-import org.eclipse.papyrus.marte.vsl.ui.contentassist.VSLProposalUtils;
-import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.TypedElement;
-import org.eclipse.xtext.Assignment;
-import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
-import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
-
-/**
- * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
- */
-public class StereotypeApplicationWithVSLProposalProvider extends AbstractStereotypeApplicationWithVSLProposalProvider {
-
- @Override
- public void completeTagSpecificationRule_Property(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- List<NamedElement> visibleProperties = getVisibleProperties(model);
- visibleProperties = this.sortByKindAndName(visibleProperties);
- for (EObject o : visibleProperties) {
- NamedElement namedElement = (NamedElement) o;
- if (namedElement.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
- String completionString = context.getPrefix() + namedElement.getName().substring(context.getPrefix().length()) + " = ";
- String displayString = namedElement.getName();
- if (namedElement instanceof TypedElement) {
- TypedElement typedElement = (TypedElement) namedElement;
- displayString += typedElement.getType() != null ? " : " + typedElement.getType().getName() : "";
- }
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(namedElement, completionString, displayString, context);
- acceptor.accept(completionProposal);
- }
- }
- }
-
- private List<NamedElement> getVisibleProperties(EObject rule) {
- List<NamedElement> visibleProperties = new ArrayList<NamedElement>();
- // first retrieves the context stereotype
- EObject context = rule;
- while (context != null && !(context instanceof StereotypeApplicationRule)) {
- context = context.eContainer();
- }
- if (context != null) {
- // retrieves the stereotype which is applied
- StereotypeApplicationRule stAppRule = (StereotypeApplicationRule) context;
- if (stAppRule.getStereotype() != null) {
- // add all the available properties for this stereotype
- visibleProperties.addAll(stAppRule.getStereotype().getAllAttributes());
- // removes derived properties or those which name starts with "base_"
- List<Property> filteredList = new ArrayList<Property>(stAppRule.getStereotype().getAllAttributes());
- for (Property p : filteredList) {
- if (p.getName() == null || p.getName().startsWith("base_") || p.isDerived()) {
- visibleProperties.remove(p);
- }
- }
- // removes the ones which have already been used
- if (stAppRule.getTagSpecification() != null) {
- for (TagSpecificationRule tag : stAppRule.getTagSpecification()) {
- if (tag.getProperty() != null && visibleProperties.contains(tag.getProperty())) {
- visibleProperties.remove(tag.getProperty());
- }
- }
- }
- }
- }
- return visibleProperties;
- }
-
- @Override
- public void completeExpressionValueRule_Expression(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- if (model.eContainer() == null || !(model.eContainer() instanceof TagSpecificationRule)) {
- return;
- }
- TagSpecificationRule tagSpecificationRule = (TagSpecificationRule) model.eContainer();
-
- if (tagSpecificationRule.getProperty() == null || tagSpecificationRule.getProperty().getType() == null) {
- return;
- }
-
- Property p = tagSpecificationRule.getProperty();
-
- Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier) p.getType(), p);
-
- // List<String> allProposals = ProposalUtils.buildProposalForType((Classifier)p.getType()) ;
- for (String s : allProposals.keySet()) {
- String completionString = s.substring(context.getPrefix().length());
- String displayString = s;
- ICompletionProposal completionProposal = null;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length());
- displayString = s;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
- acceptor.accept(completionProposal);
- } else {
- if (!s.contains("|")) {
- displayString = s;
- completionString = s;
- } else {
- completionString = s.substring(0, s.indexOf("|"));
- displayString = s.substring(s.indexOf("|") + 1);
- }
- if (displayString.contains(context.getPrefix())) {
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement) allProposals.get(s), completionString, displayString, context);
- acceptor.accept(completionProposal);
- }
- }
- }
- // super.completeExpressionValueRule_Expression(model, assignment, context,
- // acceptor);
- }
-
- /* *************************************************
- *
- * Private utility method for sorting a list of NamedElement by kind and name
- *
- * ************************************************
- */
-
- protected List<NamedElement> sortByKindAndName(List<NamedElement> list) {
- List<NamedElement> sortedList = new ArrayList<NamedElement>();
- HashMap<EClass, List<NamedElement>> namedElementGroups = new HashMap<EClass, List<NamedElement>>();
-
- for (NamedElement n : list) {
- if (!namedElementGroups.containsKey(n.eClass())) {
- List<NamedElement> group = new ArrayList<NamedElement>();
- group.add(n);
- namedElementGroups.put(n.eClass(), group);
- } else {
- List<NamedElement> group = namedElementGroups.get(n.eClass());
- boolean inserted = false;
- for (int i = 0; inserted == false && i < group.size(); i++) {
- if (group.get(i).getName().compareTo(n.getName()) > 0) {
- group.add(i, n);
- inserted = true;
- }
- }
- if (!inserted) {
- group.add(n);
- }
- namedElementGroups.put(n.eClass(), group);
- }
- }
-
- for (EClass c : namedElementGroups.keySet()) {
- List<NamedElement> group = namedElementGroups.get(c);
- sortedList.addAll(group);
- }
-
- return sortedList;
- }
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java
deleted file mode 100644
index 7393058f664..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.contributions;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Element;
-
-public class OpenTextualEditorForStereotypeApplications extends AbstractHandler implements IObjectActionDelegate {
-
- public OpenTextualEditorForStereotypeApplications() {
- // TODO Auto-generated constructor stub
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object execute(ExecutionEvent event) {
- Display current = Display.getCurrent();
-
- if (current == null) {
- current = Display.getDefault();
- }
- Shell shell = current.getActiveShell();
-
- if (shell != null) {
- updateSelectedEObject();
- } else {
- // Activator.log.error("impossible to find a shell to open the message dialog", null);
- }
-
- return null;
- }
-
- /**
- * Convert each selected elements from the explorator menu, or modeling view
- * to an EObject and add it to a list
- *
- * @return list of EObject
- */
- public void updateSelectedEObject() {
- Vector<EObject> currentSelectedEObjects = new Vector<EObject>();
-
- // Retrieve selected elements
- IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (activeWorkbenchWindow != null) {
- IStructuredSelection selection = (IStructuredSelection) activeWorkbenchWindow.getSelectionService().getSelection();
- Iterator<?> eltIt = selection.iterator();
-
- while (eltIt.hasNext()) {
- Object currentObject = eltIt.next();
-
- // If the object is an edit part, try to get semantic bridge
- if (currentObject instanceof GraphicalEditPart) {
- GraphicalEditPart editPart = (GraphicalEditPart) currentObject;
- EObject semantic = EMFHelper.getEObject(editPart);
- if (semantic instanceof Element) {
- // FIXME: The new XText integration doesn't support direct dialog creation on an edit part (The TextAwareEditPart is supposed to handle this case itself)
- // DirectEditManager manager = new StereotypeApplicationPopupEditorConfigurationContribution().createDirectEditManager(editPart);
- }
- }
-
- // check whether part of model explorer
- if (currentObject instanceof IAdaptable) {
- // modisco ModelElementItem supports IAdaptable (cleaner than cast / dependency with modisco)
- currentObject = ((IAdaptable) currentObject).getAdapter(EObject.class);
- }
-
- // If element is a UML Element
- if (currentObject instanceof Element) {
- currentSelectedEObjects.add((EObject) currentObject);
- }
- }
- }
-
- selectedEObjects = currentSelectedEObjects;
- }
-
- /**
- * Convert each selected elements from the explorator menu, or modeling view
- * to an EObject and add it to a list
- *
- * @return list of EObject
- */
- public EObject getSelectedEObject() {
- if (selectedEObjects.size() > 0) {
- return selectedEObjects.get(0);
- }
- return null;
- }
-
- public List<EObject> getSelectedEObjects() {
- return selectedEObjects;
- }
-
- private List<EObject> selectedEObjects;
-
-
- @Override
- public void run(IAction action) {
- // TODO Auto-generated method stub
- this.execute(null);
- }
-
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
-
- @Override
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java
deleted file mode 100644
index dcb940da92b..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.contributions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.ExpressionValueRule;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationRule;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationsRule;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.TagSpecificationRule;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.internal.StereotypeApplicationWithVSLActivator;
-import org.eclipse.papyrus.marte.vsl.extensions.VSLSerializationUtil;
-import org.eclipse.papyrus.marte.vsl.ui.contentassist.VSLProposalUtils;
-import org.eclipse.papyrus.marte.vsl.vSL.CollectionOrTuple;
-import org.eclipse.papyrus.marte.vsl.vSL.Expression;
-import org.eclipse.papyrus.marte.vsl.vSL.NameOrChoiceOrBehaviorCall;
-import org.eclipse.papyrus.marte.vsl.validation.VSLJavaValidator;
-import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.EnumerationLiteral;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.PrimitiveType;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-import com.google.inject.Injector;
-
-/**
- * @author CEA LIST
- *
- *
- */
-public class StereotypeApplicationPopupEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#getTextToEdit(java.lang.Object)
- */
-
- @Override
- public String getTextToEdit(Object editedObject) {
- if (editedObject instanceof Element) {
- Element stereotypedElement = (Element) editedObject;
- String textToEdit = "";
-
- for (Stereotype stereotype : stereotypedElement.getAppliedStereotypes()) {
- textToEdit += "<<" + stereotype.getName() + ">>";
- boolean first = true;
- for (Property p : stereotype.getAllAttributes()) {
- if (!(p.getName().startsWith("base_") || p.isDerived())) {
- Object value = stereotypedElement.getValue(stereotype, p.getName());
- if (value instanceof EnumerationLiteral) {
- if (p.getType() instanceof Stereotype || p.getType() instanceof org.eclipse.uml2.uml.Class) {
- value = VSLProposalUtils.getNameLabel((NamedElement) value);
- } else {
- value = ((NamedElement) value).getName();
- }
- } else if (value instanceof NamedElement) {
- value = VSLProposalUtils.getNameLabel((NamedElement) value);
- } else if (value instanceof EObject) {
- Element stereoElement = UMLUtil.getBaseElement((EObject) value);
- if (stereoElement != null && stereoElement instanceof NamedElement) {
- value = VSLProposalUtils.getNameLabel(((NamedElement) stereoElement));
- } else {
- // TODO ... Compute a label in case of Element without Name
- value = "/* The referenced element is not a named element. You should edit this stereotype with the property view */";
- }
- } else if (value instanceof String) {
- if ((p.getType() instanceof PrimitiveType) && (p.getType().getName().equals("String"))) {
- // quote strings
- value = "\"" + value + "\"";
- }
- }
-
- if (value != null && value instanceof List) {
- List listOfValues = (List) value;
- if (!listOfValues.isEmpty()) {
- String collString = "{";
- boolean nestedFirst = true;
- for (Object o : listOfValues) {
- if (!nestedFirst) {
- collString += ", ";
- } else {
- nestedFirst = false;
- }
- if (o instanceof EnumerationLiteral) {
- if (p.getType() instanceof Stereotype || p.getType() instanceof org.eclipse.uml2.uml.Class) {
- value = VSLProposalUtils.getNameLabel((NamedElement) value);
- } else {
- value = ((NamedElement) value).getName();
- }
- } else if (o instanceof NamedElement) {
- collString += VSLProposalUtils.getNameLabel((NamedElement) o);
- } else if (o instanceof EObject) {
- Element stereoElement = UMLUtil.getBaseElement((EObject) o);
- if (stereoElement != null && stereoElement instanceof NamedElement) {
- collString += VSLProposalUtils.getNameLabel((NamedElement) stereoElement);
- } else {
- // TODO ... Compute a label in case of Element without Name
- collString += "/* The referenced element is not a named element. You should edit this stereotype with the property view */";
- }
- } else {
- // o is a string
- collString += o;
- }
- }
- collString += "}";
- if (first) {
- textToEdit += "\n";
- first = false;
- } else {
- textToEdit += ",\n";
- }
- textToEdit += p.getName() + " = " + collString;
- }
- } else if (value != null) {
- if (first) {
- textToEdit += "\n";
- first = false;
- } else {
- textToEdit += ",\n";
- }
- textToEdit += p.getName() + " = " + value;
- }
- }
- }
- textToEdit += "\n\n";
- }
-
- return textToEdit;
- }
-
- return "// not an Element";
- }
-
- /**
- * @author CEA LIST
- *
- * A command for updating the context UML model
- */
- protected class UpdateStereotypeApplicationsCommand extends AbstractTransactionalCommand {
-
- private Element stereotypedElement;
-
- private StereotypeApplicationsRule stereotypeApplicationsObject;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor
- * , org.eclipse.core.runtime.IAdaptable)
- */
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
-
- // //////////////////////////////////////////////////////////
- // First delete any stereotype application associated with the stereotyped element
- // //////////////////////////////////////////////////////////
- List<Stereotype> appliedStereotypes = stereotypedElement.getAppliedStereotypes();
- for (Stereotype s : appliedStereotypes) {
- stereotypedElement.unapplyStereotype(s);
- }
-
-
- // ////////////////////////////////////////////////////////////////////////////////////////////////
- // Then extract any relevant information from the StereotypeApplicationRules object, and update the stereotypedElement
- // ////////////////////////////////////////////////////////////////////////////////////////////////
- for (StereotypeApplicationRule sApp : stereotypeApplicationsObject.getStereotypeApplications()) {
- Stereotype stereotype = sApp.getStereotype();
- stereotypedElement.applyStereotype(stereotype);
- for (TagSpecificationRule tag : sApp.getTagSpecification()) {
- Property property = tag.getProperty();
- Type type = property.getType();
- ExpressionValueRule value = tag.getValue();
- Object valueRepresentation = null;
-
- // TODO shouldStoreObjectsAndNotStrings is not enough. Should have a specific boolean for the case of stereotype applications
- boolean shouldStoreObjectsAndNotStrings = (type instanceof Stereotype || type instanceof org.eclipse.uml2.uml.Class);
- boolean propertyIsACollection = VSLJavaValidator.isACollection(value.getExpression()) != null;
-
- if (!propertyIsACollection) {
- if (!shouldStoreObjectsAndNotStrings) {
- valueRepresentation = VSLSerializationUtil.printExpression(value.getExpression());
- if ((type instanceof PrimitiveType) && (type.getName().equals("String")) && (valueRepresentation instanceof String)) {
- // unquote Strings, remove 1st and last character
- String stringValue = (String) valueRepresentation;
- if (stringValue.length() > 2) {
- valueRepresentation = stringValue.substring(1, stringValue.length() - 1);
- } else {
- valueRepresentation = "";
- }
- }
- } else {
- NameOrChoiceOrBehaviorCall nameRule = VSLSerializationUtil.extractNameReference(value.getExpression());
- if (nameRule != null) {
- if (!(property.getType() instanceof Stereotype)) {
- valueRepresentation = nameRule.getId();
- } else {
- valueRepresentation = nameRule.getId().getStereotypeApplication(((Stereotype) property.getType()));
- }
- }
- // TODO: specific case of stereotype applications
- }
- } else {
- // the property has an upper bound > 1
- if (!shouldStoreObjectsAndNotStrings) {
- List<String> listOfValues = new ArrayList<String>();
- CollectionOrTuple collection = VSLJavaValidator.isACollection(value.getExpression());
- for (Expression e : collection.getListOfValues().getValues()) {
- listOfValues.add(VSLSerializationUtil.printExpression(e));
- }
- valueRepresentation = listOfValues;
- } else {
- List<Object> listOfValues = new ArrayList<Object>();
- CollectionOrTuple collection = VSLJavaValidator.isACollection(value.getExpression());
- for (Expression e : collection.getListOfValues().getValues()) {
- NameOrChoiceOrBehaviorCall nameRule = VSLSerializationUtil.extractNameReference(e);
- if (nameRule != null) {
- if (!(property.getType() instanceof Stereotype)) {
- listOfValues.add(nameRule.getId());
- } else {
- listOfValues.add(nameRule.getId().getStereotypeApplication(((Stereotype) property.getType())));
- }
- }
- // TODO: specific case of stereotype applications
- }
- valueRepresentation = listOfValues;
- }
- }
-
- stereotypedElement.setValue(stereotype, property.getName(), valueRepresentation);
-
- }
- }
-
- return CommandResult.newOKCommandResult(stereotypedElement);
- }
-
- public UpdateStereotypeApplicationsCommand(Element stereotypedElement, StereotypeApplicationsRule stereotypeApplicationsObject) {
- super((TransactionalEditingDomain) EMFHelper.resolveEditingDomain(stereotypedElement), "Stereotype Applications Update", getWorkspaceFiles(stereotypedElement));
- this.stereotypedElement = stereotypedElement;
- this.stereotypeApplicationsObject = stereotypeApplicationsObject;
- }
- }
-
- @Override
- public Injector getInjector() {
- return StereotypeApplicationWithVSLActivator.getInstance().getInjector(StereotypeApplicationWithVSLActivator.ORG_ECLIPSE_PAPYRUS_MARTE_TEXTEDIT_STEREOTYPEAPPLICATIONWITHVSL_XTEXT_STEREOTYPEAPPLICATIONWITHVSL);
- }
-
- @Override
- protected ICommand getParseCommand(EObject modelObject, EObject xtextObject) {
- // first: retrieves / determines if the xtextObject is a TransitionRule object
- EObject modifiedObject = xtextObject;
- if (!(modelObject instanceof Element)) {
- return UnexecutableCommand.INSTANCE;
- }
- while (xtextObject != null && !(xtextObject instanceof StereotypeApplicationsRule)) {
- modifiedObject = modifiedObject.eContainer();
- }
- if (modifiedObject == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- Element stereotypedElement = (Element) modelObject;
- StereotypeApplicationsRule stereotypeApplicationsObject = (StereotypeApplicationsRule) xtextObject;
-
- // Creates and executes the update command
- UpdateStereotypeApplicationsCommand updateCommand = new UpdateStereotypeApplicationsCommand(stereotypedElement, stereotypeApplicationsObject);
- return updateCommand;
- }
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLDescriptionLabelProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLDescriptionLabelProvider.java
deleted file mode 100644
index 9550ffa3ed5..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLDescriptionLabelProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.labeling;
-
-import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
-
-/**
- * Provides labels for a IEObjectDescriptions and IResourceDescriptions.
- *
- * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
- */
-public class StereotypeApplicationWithVSLDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
-
- /*
- * //Labels and icons can be computed like this:
- *
- * String text(IEObjectDescription ele) {
- * return "my "+ele.getName();
- * }
- *
- * String image(IEObjectDescription ele) {
- * return ele.getEClass().getName() + ".gif";
- * }
- */
-
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLLabelProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLLabelProvider.java
deleted file mode 100644
index 5b0d7565b71..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/labeling/StereotypeApplicationWithVSLLabelProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.labeling;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
-
-import com.google.inject.Inject;
-
-/**
- * Provides labels for a EObjects.
- *
- * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
- */
-public class StereotypeApplicationWithVSLLabelProvider extends DefaultEObjectLabelProvider {
-
- @Inject
- public StereotypeApplicationWithVSLLabelProvider(AdapterFactoryLabelProvider delegate) {
- super(delegate);
- }
-
- /*
- * //Labels and icons can be computed like this:
- *
- * String text(MyModel ele) {
- * return "my "+ele.getName();
- * }
- *
- * String image(MyModel ele) {
- * return "MyModel.gif";
- * }
- */
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/outline/StereotypeApplicationWithVSLOutlineTreeProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/outline/StereotypeApplicationWithVSLOutlineTreeProvider.java
deleted file mode 100644
index 57bf9fd126d..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/outline/StereotypeApplicationWithVSLOutlineTreeProvider.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * generated by Xtext
- */
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.outline;
-
-import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
-
-/**
- * customization of the default outline structure
- *
- */
-public class StereotypeApplicationWithVSLOutlineTreeProvider extends DefaultOutlineTreeProvider {
-
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/quickfix/StereotypeApplicationWithVSLQuickfixProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/quickfix/StereotypeApplicationWithVSLQuickfixProvider.java
deleted file mode 100644
index 056f74a1af7..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/quickfix/StereotypeApplicationWithVSLQuickfixProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.quickfix;
-
-import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
-
-public class StereotypeApplicationWithVSLQuickfixProvider extends DefaultQuickfixProvider {
-
- // @Fix(MyJavaValidator.INVALID_NAME)
- // public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) {
- // acceptor.accept(issue, "Capitalize name", "Capitalize the name.", "upcase.png", new IModification() {
- // public void apply(IModificationContext context) throws BadLocationException {
- // IXtextDocument xtextDocument = context.getXtextDocument();
- // String firstLetter = xtextDocument.get(issue.getOffset(), 1);
- // xtextDocument.replace(issue.getOffset(), 1, firstLetter.toUpperCase());
- // }
- // });
- // }
-
-}

Back to the top