Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram')
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDCreation.java87
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDDiagramForMultiEditor.java115
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDEditorFactory.java25
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/part/BlockNameEditPart.java41
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/policies/SysMLViewComponentEditPolicy.java38
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SYSMLOCLFactory.java180
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SysmlAbstractExpression.java170
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/figures/BlockFigure.java92
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/BlockNameParser.java93
-rw-r--r--deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/SysMLMessageFormatParser.java82
10 files changed, 0 insertions, 923 deletions
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDCreation.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDCreation.java
deleted file mode 100644
index bbd657be279..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDCreation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.papyrus.core.adaptor.gmf.AbstractPapyrusGmfCreateDiagramCommandHandler;
-import org.eclipse.papyrus.sysml.diagram.blockdiagram.part.SysmlDiagramEditorPlugin;
-import org.eclipse.papyrus.sysml.util.SysmlResource;
-import org.eclipse.papyrus.umlutils.PackageUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Profile;
-import org.eclipse.uml2.uml.UMLFactory;
-
-
-public class BDDCreation extends AbstractPapyrusGmfCreateDiagramCommandHandler {
-
- /**
- * Name of the Diagram
- */
- protected static final String CSD_DEFAULT_NAME = "BDD"; //$NON-NLS-1$
-
- public static final String MODEL_ID = "BDD"; //$NON-NLS-1$
-
- public BDDCreation() {
- }
-
- /**
- * {@inheritDoc}
- */
- protected String getDefaultDiagramName() {
- return openDiagramNameDialog(CSD_DEFAULT_NAME);
- }
-
- /**
- * {@inheritDoc}
- */
- protected String getDiagramNotationID() {
- return MODEL_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- protected PreferencesHint getPreferenceHint() {
- return SysmlDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * {@inheritDoc}
- */
- protected EObject createRootElement() {
- return UMLFactory.eINSTANCE.createModel();
- }
-
- /**
- * Overrides to add the SysML profile to the nearest containing package if it is not yet applied {@inheritDoc}
- */
- @Override
- protected void initializeModel(EObject owner) {
- if(owner instanceof Element) {
- Element element = (Element)owner;
- Package pack = element.getNearestPackage();
-
- if((pack.getAppliedProfile("SysML::Blocks", true) == null) || (pack.getAppliedProfile("SysML::PortAndFlows", true) == null)) {
- // Retrieve SysML profile and apply with sub-profiles
- Profile sysml = (Profile)PackageUtil.loadPackage(URI.createURI(SysmlResource.SYSML_PROFILE_URI), pack.eResource().getResourceSet());
- PackageUtil.applyProfile(pack, sysml, true);
- }
- }
- super.initializeModel(owner);
- }
-
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDDiagramForMultiEditor.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDDiagramForMultiEditor.java
deleted file mode 100644
index 95f53a702ac..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDDiagramForMultiEditor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.sysml.diagram.blockdiagram.part.SysmlDiagramEditor;
-import org.eclipse.papyrus.sysml.diagram.blockdiagram.part.SysmlDiagramEditorPlugin;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-
-public class BDDDiagramForMultiEditor extends SysmlDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/ResourceDiagramFile.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = SysmlDiagramEditorPlugin.getBundledImageDescriptor(BDDDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved from the
- * ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- */
- public BDDDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.sysml.diagram.blockdiagram.EditingDomain";
- }
-
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDEditorFactory.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDEditorFactory.java
deleted file mode 100644
index 81332ad08b3..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/BDDEditorFactory.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram;
-
-import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorFactory;
-
-
-public class BDDEditorFactory extends GmfEditorFactory {
-
- public BDDEditorFactory() {
- super(BDDDiagramForMultiEditor.class, BDDCreation.MODEL_ID);
- }
-
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/part/BlockNameEditPart.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/part/BlockNameEditPart.java
deleted file mode 100644
index 7f9b19ac44e..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/part/BlockNameEditPart.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.edit.part;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNameEditPart;
-import org.eclipse.papyrus.sysml.diagram.blockdiagram.part.SysmlVisualIDRegistry;
-import org.eclipse.papyrus.sysml.diagram.blockdiagram.providers.SysmlElementTypes;
-import org.eclipse.papyrus.sysml.diagram.blockdiagram.providers.SysmlParserProvider;
-
-
-public class BlockNameEditPart extends ClassNameEditPart {
-
- public static final int VISUAL_ID = 5129;
-
- private IParser parser;
-
- public BlockNameEditPart(View view) {
- super(view);
- }
-
- @Override
- public IParser getParser() {
- if(parser == null) {
- parser = SysmlParserProvider.getParser(SysmlElementTypes.Block_2001, getParserElement(), SysmlVisualIDRegistry.getType(VISUAL_ID));
- }
- return parser;
- }
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/policies/SysMLViewComponentEditPolicy.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/policies/SysMLViewComponentEditPolicy.java
deleted file mode 100644
index fcac25ed86c..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/edit/policies/SysMLViewComponentEditPolicy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.papyrus.diagram.clazz.custom.policies.CustomViewComponentEditPolicy;
-
-
-public class SysMLViewComponentEditPolicy extends CustomViewComponentEditPolicy {
-
- /**
- * Return a command to delete the host's view. The host's primary view is deleted if {@link GroupRequest#getEditParts()} returns a <tt>null</tt>
- * or empty list; otherwise each
- * editpart's view is deleted.
- *
- * @param deleteRequest
- * the original delete request.
- * @return Command
- */
- protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
- // TODO : refactor the deleteViewCommand
- return UnexecutableCommand.INSTANCE;
- }
-
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SYSMLOCLFactory.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SYSMLOCLFactory.java
deleted file mode 100644
index c25991a91d6..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SYSMLOCLFactory.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.expressions;
-
-import java.lang.ref.WeakReference;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.ocl.Environment;
-import org.eclipse.ocl.EvaluationEnvironment;
-import org.eclipse.ocl.ParserException;
-import org.eclipse.ocl.Query;
-import org.eclipse.ocl.ecore.EcoreFactory;
-import org.eclipse.ocl.expressions.OCLExpression;
-import org.eclipse.ocl.expressions.OperationCallExp;
-import org.eclipse.ocl.expressions.Variable;
-import org.eclipse.ocl.helper.OCLHelper;
-import org.eclipse.ocl.utilities.AbstractVisitor;
-import org.eclipse.ocl.utilities.PredefinedType;
-
-
-
-public class SYSMLOCLFactory {
-
- /**
- * @generated
- */
- private SYSMLOCLFactory() {
- }
-
- /**
- * @generated
- */
- public static SysmlAbstractExpression getExpression(String body, EClassifier context, Map environment) {
- return new Expression(body, context, environment);
- }
-
- /**
- * @generated
- */
- public static SysmlAbstractExpression getExpression(String body, EClassifier context) {
- return getExpression(body, context, Collections.EMPTY_MAP);
- }
-
- /**
- * @generated
- */
- private static class Expression extends SysmlAbstractExpression {
-
- /**
- * @generated
- */
- private WeakReference queryRef;
-
- /**
- * @generated
- */
- private final org.eclipse.ocl.ecore.OCL oclInstance;
-
- /**
- * @generated
- */
- public Expression(String body, EClassifier context, Map environment) {
- super(body, context);
- oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
- initCustomEnv(oclInstance.getEnvironment(), environment);
- }
-
- /**
- * @generated
- */
- protected Query getQuery() {
- Query oclQuery = null;
- if(this.queryRef != null) {
- oclQuery = (Query)this.queryRef.get();
- }
- if(oclQuery == null) {
- OCLHelper oclHelper = oclInstance.createOCLHelper();
- oclHelper.setContext(context());
- try {
- OCLExpression oclExpression = oclHelper.createQuery(body());
- oclQuery = oclInstance.createQuery(oclExpression);
- this.queryRef = new WeakReference(oclQuery);
- setStatus(IStatus.OK, null, null);
- } catch (ParserException e) {
- setStatus(IStatus.ERROR, e.getMessage(), e);
- }
- }
- return oclQuery;
- }
-
- /**
- * @generated
- */
- protected Object doEvaluate(Object context, Map env) {
- Query oclQuery = getQuery();
- if(oclQuery == null) {
- return null;
- }
- EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
- // init environment
- for(Iterator it = env.entrySet().iterator(); it.hasNext();) {
- Map.Entry nextEntry = (Map.Entry)it.next();
- evalEnv.replace((String)nextEntry.getKey(), nextEntry.getValue());
- }
- try {
- initExtentMap(context);
- Object result = oclQuery.evaluate(context);
- return (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;
- } finally {
- evalEnv.clear();
- oclQuery.getExtentMap().clear();
- }
- }
-
- /**
- * @generated
- */
- private void initExtentMap(Object context) {
- if(!getStatus().isOK() || context == null) {
- return;
- }
- final Query queryToInit = getQuery();
- final Object extentContext = context;
- queryToInit.getExtentMap().clear();
- if(queryToInit.queryText() != null && queryToInit.queryText().indexOf(PredefinedType.ALL_INSTANCES_NAME) >= 0) {
- AbstractVisitor visitior = new AbstractVisitor() {
-
- private boolean usesAllInstances = false;
-
- public Object visitOperationCallExp(OperationCallExp oc) {
- if(!usesAllInstances) {
- usesAllInstances = PredefinedType.ALL_INSTANCES == oc.getOperationCode();
- if(usesAllInstances) {
- queryToInit.getExtentMap().putAll(oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));
- }
- }
- return super.visitOperationCallExp(oc);
- }
- };
- queryToInit.getExpression().accept(visitior);
- }
- }
-
- /**
- * @generated
- */
- private static void initCustomEnv(Environment ecoreEnv, Map environment) {
- for(Iterator it = environment.keySet().iterator(); it.hasNext();) {
- String varName = (String)it.next();
- EClassifier varType = (EClassifier)environment.get(varName);
- ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
- }
- }
-
- /**
- * @generated
- */
- private static Variable createVar(Environment ecoreEnv, String name, EClassifier type) {
- Variable var = EcoreFactory.eINSTANCE.createVariable();
- var.setName(name);
- var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
- return var;
- }
- }
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SysmlAbstractExpression.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SysmlAbstractExpression.java
deleted file mode 100644
index f11e30f2277..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/expressions/SysmlAbstractExpression.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.expressions;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.diagram.clazz.part.UMLDiagramEditorPlugin;
-
-
-public abstract class SysmlAbstractExpression {
-
- /**
- * @generated
- */
- private IStatus status = Status.OK_STATUS;
-
- /**
- * @generated
- */
- protected void setStatus(int severity, String message, Throwable throwable) {
- String pluginID = UMLDiagramEditorPlugin.ID;
- this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
- if(!this.status.isOK()) {
- UMLDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body(), throwable); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * @generated
- */
- public IStatus getStatus() {
- return status;
- }
-
- /**
- * @generated
- */
- private final String myBody;
-
- /**
- * @generated
- */
- public String body() {
- return myBody;
- }
-
- /**
- * @generated
- */
- private final EClassifier myContext;
-
- /**
- * @generated
- */
- public EClassifier context() {
- return myContext;
- }
-
- /**
- * @generated
- */
- protected SysmlAbstractExpression(String body, EClassifier context) {
- myBody = body;
- myContext = context;
- }
-
- /**
- * @generated
- */
- protected abstract Object doEvaluate(Object context, Map env);
-
- /**
- * @generated
- */
- public Object evaluate(Object context) {
- return evaluate(context, Collections.EMPTY_MAP);
- }
-
- /**
- * @generated
- */
- public Object evaluate(Object context, Map env) {
- if(context().isInstance(context)) {
- try {
- return doEvaluate(context, env);
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body(), e); //$NON-NLS-1$
- }
- }
- return null;
- }
-
- /**
- * Expression may return number value which is not directly compatible with feature type (e.g.
- * Double when Integer is expected), or EEnumLiteral meta-object when literal instance is
- * expected
- *
- * @generated
- */
- public static Object performCast(Object value, EDataType targetType) {
- if(targetType instanceof EEnum) {
- if(value instanceof EEnumLiteral) {
- EEnumLiteral literal = (EEnumLiteral)value;
- return (literal.getInstance() != null) ? literal.getInstance() : literal;
- }
- }
- if(false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
- return value;
- }
- Class targetClass = targetType.getInstanceClass();
- Number num = (Number)value;
- Class valClass = value.getClass();
- Class targetWrapperClass = targetClass;
- if(targetClass.isPrimitive()) {
- targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);
- }
- if(valClass.equals(targetWrapperClass)) {
- return value;
- }
- if(Number.class.isAssignableFrom(targetWrapperClass)) {
- if(targetWrapperClass.equals(Byte.class)) {
- return new Byte(num.byteValue());
- }
- if(targetWrapperClass.equals(Integer.class)) {
- return new Integer(num.intValue());
- }
- if(targetWrapperClass.equals(Short.class)) {
- return new Short(num.shortValue());
- }
- if(targetWrapperClass.equals(Long.class)) {
- return new Long(num.longValue());
- }
- if(targetWrapperClass.equals(BigInteger.class)) {
- return BigInteger.valueOf(num.longValue());
- }
- if(targetWrapperClass.equals(Float.class)) {
- return new Float(num.floatValue());
- }
- if(targetWrapperClass.equals(Double.class)) {
- return new Double(num.doubleValue());
- }
- if(targetWrapperClass.equals(BigDecimal.class)) {
- return new BigDecimal(num.doubleValue());
- }
- }
- return value;
- }
-
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/figures/BlockFigure.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/figures/BlockFigure.java
deleted file mode 100644
index 533facc4533..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/figures/BlockFigure.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.figures;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ClassifierFigure;
-
-
-public class BlockFigure extends ClassifierFigure {
-
- /** The Constraint Compartment */
- private final static String CONSTRAINT_COMPARTMENT = "constraintCompartment";
-
- /** The Reference Compartment */
- private final static String REFERENCE_COMPARTMENT = "referenceCompartment";
-
- /** The Value Compartment */
- private final static String PART_COMPARTMENT = "partCompartment";
-
- /** The Value Compartment */
- private final static String VALUE_COMPARTMENT = "valueCompartment";
-
- public BlockFigure() {
- super();
- }
-
- /**
- *
- * @param compartmentFigure
- */
- protected void createContentPane(List<String> compartments) {
- super.createContentPane(updateCompartment(compartments));
-
- }
-
- private List<String> updateCompartment(List<String> compartments) {
- compartments.add(CONSTRAINT_COMPARTMENT);
- compartments.add(REFERENCE_COMPARTMENT);
- compartments.add(PART_COMPARTMENT);
- compartments.add(VALUE_COMPARTMENT);
- return compartments;
- }
-
- /**
- * Get the constraint's compartment figure
- *
- * @return
- */
- public IFigure getConstraintCompartmentFigure() {
- return getCompartment(CONSTRAINT_COMPARTMENT);
- }
-
- /**
- * Get the Reference's compartment figure
- *
- * @return
- */
- public IFigure getReferenceCompartmentFigure() {
- return getCompartment(REFERENCE_COMPARTMENT);
- }
-
- /**
- * Get the Part's compartment figure
- *
- * @return
- */
- public IFigure getPartCompartmentFigure() {
- return getCompartment(PART_COMPARTMENT);
- }
-
- /**
- * Get the Value's compartment figure
- *
- * @return
- */
- public IFigure getValueCompartmentFigure() {
- return getCompartment(VALUE_COMPARTMENT);
- }
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/BlockNameParser.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/BlockNameParser.java
deleted file mode 100644
index 2448233c93c..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/BlockNameParser.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.parsers;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.papyrus.sysml.blocks.Block;
-import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
-import org.eclipse.uml2.uml.UMLPackage;
-
-
-public class BlockNameParser extends SysMLMessageFormatParser {
-
- public BlockNameParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- @Override
- protected boolean isValidFeature(EStructuralFeature feature) {
- return super.isValidFeature(feature) || BlocksPackage.eINSTANCE.getBlock_IsEncapsulated().equals(feature);
- }
-
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- Object element = adapter.getAdapter(EObject.class);
- StringBuffer sb = new StringBuffer();
- if(element instanceof Block) {
- Block block = (Block)element;
- sb.append("<<Block>>\n");
- if(block.getBase_Class() != null) {
- // Set the name
- sb.append(block.getBase_Class().getName());
- }
- if(block.isIsEncapsulated()) {
- sb.append("\n").append("{encapsulated}");
- }
-
- }
- return sb.toString();
- }
-
- @Override
- protected Object getValue(EObject element, EAttribute feature) {
- if(UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) && element instanceof Block) {
- Block block = (Block)element;
- return super.getValue(block.getBase_Class(), feature);
- }
- return super.getValue(element, feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getParseCommand(IAdaptable adapter, Object[] values, int flags) {
- if(values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
- return UnexecutableCommand.INSTANCE;
- }
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- if(element instanceof Block) {
- element = ((Block)element).getBase_Class();
- }
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- for(int i = 0; i < values.length; i++) {
- command.compose(getModificationCommand(element, editableFeatures[i], values[i]));
- }
- return command;
- }
-
-}
diff --git a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/SysMLMessageFormatParser.java b/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/SysMLMessageFormatParser.java
deleted file mode 100644
index 30d0b624863..00000000000
--- a/deprecated/deprecated-plugins/sysml.deprecated/org.eclipse.papyrus.sysml.diagram.blockdiagram/custom-src/org/eclipse/papyrus/sysml/diagram/blockdiagram/parsers/SysMLMessageFormatParser.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.blockdiagram.parsers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.diagram.clazz.parsers.MessageFormatParser;
-import org.eclipse.papyrus.sysml.blocks.Block;
-import org.eclipse.uml2.uml.UMLPackage;
-
-
-public class SysMLMessageFormatParser extends MessageFormatParser implements ISemanticParser {
-
- public SysMLMessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- public SysMLMessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- *
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- *
- */
- public List getSemanticElementsBeingParsed(EObject element) {
- List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
- if(element instanceof Block) {
- Block block = (Block)element;
- semanticElementsBeingParsed.add(block);
- semanticElementsBeingParsed.add(block.getBase_Class());
- }
- return semanticElementsBeingParsed;
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- protected boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
-
-}

Back to the top