diff options
Diffstat (limited to 'examples/others')
39 files changed, 4620 insertions, 4620 deletions
diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/about.html b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/about.html index 82d49bf5f81..d35d5aed64c 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/about.html +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/about.html @@ -1,28 +1,28 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html> diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java index a308c39c56d..8fc17c2f6be 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/helpers/UMLBaseEditHelper.java @@ -1,10 +1,10 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers;
-
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
-
-/**
- * @generated
- */
-public class UMLBaseEditHelper extends GeneratedEditHelperBase {
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.helpers; + +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase; + +/** + * @generated + */ +public class UMLBaseEditHelper extends GeneratedEditHelperBase { + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java index 48d0f013a65..fc86216f733 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ComponentNameEditPart.java @@ -1,626 +1,626 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate;
-import org.eclipse.gmf.runtime.diagram.ui.label.WrappingLabelDelegate;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLParserProvider;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.draw2d.labels.SimpleLabelDelegate;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @generated
- */
-public class ComponentNameEditPart extends CompartmentEditPart implements
- ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5001;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * @generated
- */
- private ILabelDelegate labelDelegate;
-
- /**
- * @generated
- */
- public ComponentNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
- new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
- new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
- new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof Label) {
- return ((Label) figure).getText();
- } else {
- return getLabelDelegate().getText();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof Label) {
- ((Label) figure).setText(text);
- } else {
- getLabelDelegate().setText(text);
- }
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof Label) {
- return ((Label) figure).getIcon();
- } else {
- return getLabelDelegate().getIcon(0);
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- return;
- } else if (figure instanceof Label) {
- ((Label) figure).setIcon(icon);
- return;
- } else {
- getLabelDelegate().setIcon(icon, 0);
- }
- }
-
- /**
- * @generated
- */
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- return UMLElementTypes.getImage(parserElement.eClass());
- }
-
- /**
- * @generated
- */
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- new EObjectAdapter(parserElement),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- refreshSelectionFeedback();
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
- .runExclusive(
- new RunnableWithResult.Impl<IParserEditStatus>() {
-
- public void run() {
- setResult(parser
- .isValidEditString(
- new EObjectAdapter(
- element),
- (String) value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null
- : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(
- new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider
- .getParser(
- UMLElementTypes.Component_2001,
- getParserElement(),
- UMLVisualIDRegistry
- .getType(org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new TextDirectEditManager(this, null,
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager().getClass() == TextDirectEditManager.class) {
- ((TextDirectEditManager) getManager()).show(eventLocation
- .getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else //
- {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
- final Request theRequest = request;
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- public void run() {
- if (isActive() && isEditable()) {
- if (theRequest
- .getExtendedData()
- .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) theRequest
- .getExtendedData()
- .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof DirectEditRequest)
- && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- refreshSelectionFeedback();
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style
- .isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(style.getFontName(),
- style.getFontHeight(), (style.isBold() ? SWT.BOLD
- : SWT.NORMAL)
- | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- private void refreshSelectionFeedback() {
- requestEditPolicyFeedbackRefresh(EditPolicy.PRIMARY_DRAG_ROLE);
- requestEditPolicyFeedbackRefresh(EditPolicy.SELECTION_FEEDBACK_ROLE);
- }
-
- /**
- * @generated
- */
- private void requestEditPolicyFeedbackRefresh(String editPolicyKey) {
- Object editPolicy = getEditPolicy(editPolicyKey);
- if (editPolicy instanceof IRefreshableFeedbackEditPolicy) {
- ((IRefreshableFeedbackEditPolicy) editPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser())
- .getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter(
- "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- private ILabelDelegate getLabelDelegate() {
- if (labelDelegate == null) {
- IFigure label = getFigure();
- if (label instanceof WrappingLabel) {
- labelDelegate = new WrappingLabelDelegate((WrappingLabel) label);
- } else {
- labelDelegate = new SimpleLabelDelegate((Label) label);
- }
- }
- return labelDelegate;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getAdapter(Class key) {
- if (ILabelDelegate.class.equals(key)) {
- return getLabelDelegate();
- }
- return super.getAdapter(key);
- }
-
- /**
- * @generated
- */
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(
- feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough()
- .equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(
- feature)
- || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(
- feature)
- || NotationPackage.eINSTANCE.getFontStyle_Bold()
- .equals(feature)
- || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(
- feature)) {
- refreshFont();
- } else {
- if (getParser() != null
- && getParser().isAffectingEvent(event,
- getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser = (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate; +import org.eclipse.gmf.runtime.diagram.ui.label.WrappingLabelDelegate; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes; +import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLParserProvider; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.draw2d.labels.SimpleLabelDelegate; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; + +/** + * @generated + */ +public class ComponentNameEditPart extends CompartmentEditPart implements + ITextAwareEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5001; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * @generated + */ + private ILabelDelegate labelDelegate; + + /** + * @generated + */ + public ComponentNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, + new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, + new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, + new DefaultNodeLabelDragPolicy()); + } + + /** + * @generated + */ + protected String getLabelTextHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof Label) { + return ((Label) figure).getText(); + } else { + return getLabelDelegate().getText(); + } + } + + /** + * @generated + */ + protected void setLabelTextHelper(IFigure figure, String text) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof Label) { + ((Label) figure).setText(text); + } else { + getLabelDelegate().setText(text); + } + } + + /** + * @generated + */ + protected Image getLabelIconHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof Label) { + return ((Label) figure).getIcon(); + } else { + return getLabelDelegate().getIcon(0); + } + } + + /** + * @generated + */ + protected void setLabelIconHelper(IFigure figure, Image icon) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + return; + } else if (figure instanceof Label) { + ((Label) figure).setIcon(icon); + return; + } else { + getLabelDelegate().setIcon(icon, 0); + } + } + + /** + * @generated + */ + public void setLabel(WrappingLabel figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + @SuppressWarnings("rawtypes") + protected List getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + EObject parserElement = getParserElement(); + if (parserElement == null) { + return null; + } + return UMLElementTypes.getImage(parserElement.eClass()); + } + + /** + * @generated + */ + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString( + new EObjectAdapter(parserElement), + getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + /** + * @generated + */ + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + refreshSelectionFeedback(); + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + public ICellEditorValidator getEditTextValidator() { + return new ICellEditorValidator() { + + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain() + .runExclusive( + new RunnableWithResult.Impl<IParserEditStatus>() { + + public void run() { + setResult(parser + .isValidEditString( + new EObjectAdapter( + element), + (String) value)); + } + }); + return valid.getCode() == ParserEditStatus.EDITABLE ? null + : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + + // shouldn't get here + return null; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor( + new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider + .getParser( + UMLElementTypes.Component_2001, + getParserElement(), + UMLVisualIDRegistry + .getType(org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new TextDirectEditManager(this, null, + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + getManager().show(); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager().getClass() == TextDirectEditManager.class) { + ((TextDirectEditManager) getManager()).show(eventLocation + .getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else // + { + performDirectEdit(); + } + } + + /** + * @generated + */ + protected void performDirectEditRequest(Request request) { + final Request theRequest = request; + try { + getEditingDomain().runExclusive(new Runnable() { + + public void run() { + if (isActive() && isEditable()) { + if (theRequest + .getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest + .getExtendedData() + .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) + && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + protected void refreshLabel() { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + refreshSelectionFeedback(); + } + + /** + * @generated + */ + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style + .isStrikeThrough()); + } + } + + /** + * @generated + */ + protected void refreshFont() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData(style.getFontName(), + style.getFontHeight(), (style.isBold() ? SWT.BOLD + : SWT.NORMAL) + | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + setFont(fontData); + } + } + + /** + * @generated + */ + private void refreshSelectionFeedback() { + requestEditPolicyFeedbackRefresh(EditPolicy.PRIMARY_DRAG_ROLE); + requestEditPolicyFeedbackRefresh(EditPolicy.SELECTION_FEEDBACK_ROLE); + } + + /** + * @generated + */ + private void requestEditPolicyFeedbackRefresh(String editPolicyKey) { + Object editPolicy = getEditPolicy(editPolicyKey); + if (editPolicy instanceof IRefreshableFeedbackEditPolicy) { + ((IRefreshableFeedbackEditPolicy) editPolicy).refreshFeedback(); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + protected void addSemanticListeners() { + if (getParser() instanceof ISemanticParser) { + EObject element = resolveSemanticElement(); + parserElements = ((ISemanticParser) getParser()) + .getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter( + "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ + } + } else { + super.addSemanticListeners(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * @generated + */ + private ILabelDelegate getLabelDelegate() { + if (labelDelegate == null) { + IFigure label = getFigure(); + if (label instanceof WrappingLabel) { + labelDelegate = new WrappingLabelDelegate((WrappingLabel) label); + } else { + labelDelegate = new SimpleLabelDelegate((Label) label); + } + } + return labelDelegate; + } + + /** + * @generated + */ + @Override + public Object getAdapter(Class key) { + if (ILabelDelegate.class.equals(key)) { + return getLabelDelegate(); + } + return super.getAdapter(key); + } + + /** + * @generated + */ + protected void addNotationalListeners() { + super.addNotationalListeners(); + addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ + } + + /** + * @generated + */ + protected void removeNotationalListeners() { + super.removeNotationalListeners(); + removeListenerFilter("PrimaryView"); //$NON-NLS-1$ + } + + /** + * @generated + */ + protected void handleNotificationEvent(Notification event) { + Object feature = event.getFeature(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); + setFontColor(DiagramColorRegistry.getInstance().getColor(c)); + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( + feature)) { + refreshUnderline(); + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() + .equals(feature)) { + refreshStrikeThrough(); + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( + feature) + || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( + feature) + || NotationPackage.eINSTANCE.getFontStyle_Bold() + .equals(feature) + || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( + feature)) { + refreshFont(); + } else { + if (getParser() != null + && getParser().isAffectingEvent(event, + getParserOptions().intValue())) { + refreshLabel(); + } + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { + removeSemanticListeners(); + if (resolveSemanticElement() != null) { + addSemanticListeners(); + } + refreshLabel(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java index be41ba5fbee..678a49f74e4 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/ModelEditPart.java @@ -1,48 +1,48 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelCanonicalEditPolicy;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelItemSemanticEditPolicy;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.reparent.CreationEditPolicyWithCustomReparent;
-
-/**
- * @generated
- */
-public class ModelEditPart extends DiagramEditPart {
-
- /**
- * @generated
- */
- public final static String MODEL_ID = "PapyrusNewDiagram"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 1000;
-
- /**
- * @generated
- */
- public ModelEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
- new ModelItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
- new ModelCanonicalEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE,
- new CreationEditPolicyWithCustomReparent(
- UMLVisualIDRegistry.TYPED_INSTANCE));
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts; + +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelCanonicalEditPolicy; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.policies.ModelItemSemanticEditPolicy; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.reparent.CreationEditPolicyWithCustomReparent; + +/** + * @generated + */ +public class ModelEditPart extends DiagramEditPart { + + /** + * @generated + */ + public final static String MODEL_ID = "PapyrusNewDiagram"; //$NON-NLS-1$ + + /** + * @generated + */ + public static final int VISUAL_ID = 1000; + + /** + * @generated + */ + public ModelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, + new ModelItemSemanticEditPolicy()); + installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, + new ModelCanonicalEditPolicy()); + installEditPolicy(EditPolicyRoles.CREATION_ROLE, + new CreationEditPolicyWithCustomReparent( + UMLVisualIDRegistry.TYPED_INSTANCE)); + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java index 03b6613e17e..4cc67802aa3 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/parts/UMLEditPartFactory.java @@ -1,54 +1,54 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
-
-/**
- * @generated
- */
-public class UMLEditPartFactory implements EditPartFactory {
-
- /**
- * @generated
- */
- public EditPart createEditPart(EditPart context, Object model) {
- if (model instanceof View) {
- View view = (View) model;
- switch (UMLVisualIDRegistry.getVisualID(view)) {
-
- case ModelEditPart.VISUAL_ID:
- return new ModelEditPart(view);
-
- case ComponentEditPart.VISUAL_ID:
- return new ComponentEditPart(view);
-
- case ComponentNameEditPart.VISUAL_ID:
- return new ComponentNameEditPart(view);
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-
- /**
- * @generated
- */
- private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-
- /**
- * @generated
- */
- public static CellEditorLocator getTextCellEditorLocator(
- ITextAwareEditPart source) {
- return CellEditorLocatorAccess.INSTANCE
- .getTextCellEditorLocator(source);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.parts; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPartFactory; +import org.eclipse.gef.tools.CellEditorLocator; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess; + +/** + * @generated + */ +public class UMLEditPartFactory implements EditPartFactory { + + /** + * @generated + */ + public EditPart createEditPart(EditPart context, Object model) { + if (model instanceof View) { + View view = (View) model; + switch (UMLVisualIDRegistry.getVisualID(view)) { + + case ModelEditPart.VISUAL_ID: + return new ModelEditPart(view); + + case ComponentEditPart.VISUAL_ID: + return new ComponentEditPart(view); + + case ComponentNameEditPart.VISUAL_ID: + return new ComponentNameEditPart(view); + } + } + return createUnrecognizedEditPart(context, model); + } + + /** + * @generated + */ + private EditPart createUnrecognizedEditPart(EditPart context, Object model) { + // Handle creation of unrecognized child node EditParts here + return null; + } + + /** + * @generated + */ + public static CellEditorLocator getTextCellEditorLocator( + ITextAwareEditPart source) { + return CellEditorLocatorAccess.INSTANCE + .getTextCellEditorLocator(source); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java index 33c0a1b65f2..2a4c6781840 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -1,295 +1,295 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
-
- /**
- * Extended request data key to hold editpart visual id.
- * @generated
- */
- public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final IElementType myElementType;
-
- /**
- * @generated
- */
- protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
- }
-
- /**
- * Extended request data key to hold editpart visual id.
- * Add visual id of edited editpart to extended data of the request
- * so command switch can decide what kind of diagram element is being edited.
- * It is done in those cases when it's not possible to deduce diagram
- * element kind from domain element.
- *
- * @generated
- */
- public Command getCommand(Request request) {
- if (request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest) request).getConnectionEditPart()
- .getModel();
- if (view instanceof View) {
- Integer id = new Integer(
- UMLVisualIDRegistry.getVisualID((View) view));
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * Returns visual id from request parameters.
- * @generated
- */
- protected int getVisualID(IEditCommandRequest request) {
- Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer) id).intValue() : -1;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommand(IEditCommandRequest request) {
- IEditCommandRequest completedRequest = completeRequest(request);
- Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest,
- semanticCommand);
- if (completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(
- semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-
- /**
- * @generated
- */
- protected Command addDeleteViewCommand(Command mainCommand,
- DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(
- getEditingDomain(), (View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand
- .chain(deleteViewCommand);
- }
-
- /**
- * @generated
- */
- private Command getEditHelperCommand(IEditCommandRequest request,
- Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand)
- .getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND,
- command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE,
- requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(),
- command.getLabel()).compose(command);
- }
- return new ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-
- /**
- * @generated
- */
- private IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = UMLElementTypes
- .getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType
- : myElementType;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
- if (req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest) req);
- } else if (req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest) req);
- } else if (req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest) req);
- } else if (req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest) req);
- } else if (req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest) req);
- } else if (req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest) req);
- } else if (req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest) req);
- } else if (req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest) req);
- } else if (req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
- } else if (req instanceof SetRequest) {
- return getSetCommand((SetRequest) req);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getSetCommand(SetRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getEditContextCommand(GetEditContextRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getMoveCommand(MoveRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(
- ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(
- ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return new ICommandProxy(cmd);
- }
-
- /**
- * Returns editing domain from the host edit part.
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- * @generated
- */
- protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
- assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for (Iterator it = view.getDiagram().getChildren().iterator(); it
- .hasNext();) {
- View nextView = (View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
- continue;
- }
- cmd.add(new DeleteCommand(getEditingDomain(), nextView));
- }
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies; + +import java.util.Iterator; + +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gef.requests.ReconnectRequest; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand; +import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes; + +/** + * @generated + */ +public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { + + /** + * Extended request data key to hold editpart visual id. + * @generated + */ + public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$ + + /** + * @generated + */ + private final IElementType myElementType; + + /** + * @generated + */ + protected UMLBaseItemSemanticEditPolicy(IElementType elementType) { + myElementType = elementType; + } + + /** + * Extended request data key to hold editpart visual id. + * Add visual id of edited editpart to extended data of the request + * so command switch can decide what kind of diagram element is being edited. + * It is done in those cases when it's not possible to deduce diagram + * element kind from domain element. + * + * @generated + */ + public Command getCommand(Request request) { + if (request instanceof ReconnectRequest) { + Object view = ((ReconnectRequest) request).getConnectionEditPart() + .getModel(); + if (view instanceof View) { + Integer id = new Integer( + UMLVisualIDRegistry.getVisualID((View) view)); + request.getExtendedData().put(VISUAL_ID_KEY, id); + } + } + return super.getCommand(request); + } + + /** + * Returns visual id from request parameters. + * @generated + */ + protected int getVisualID(IEditCommandRequest request) { + Object id = request.getParameter(VISUAL_ID_KEY); + return id instanceof Integer ? ((Integer) id).intValue() : -1; + } + + /** + * @generated + */ + protected Command getSemanticCommand(IEditCommandRequest request) { + IEditCommandRequest completedRequest = completeRequest(request); + Command semanticCommand = getSemanticCommandSwitch(completedRequest); + semanticCommand = getEditHelperCommand(completedRequest, + semanticCommand); + if (completedRequest instanceof DestroyRequest) { + DestroyRequest destroyRequest = (DestroyRequest) completedRequest; + return shouldProceed(destroyRequest) ? addDeleteViewCommand( + semanticCommand, destroyRequest) : null; + } + return semanticCommand; + } + + /** + * @generated + */ + protected Command addDeleteViewCommand(Command mainCommand, + DestroyRequest completedRequest) { + Command deleteViewCommand = getGEFWrapper(new DeleteCommand( + getEditingDomain(), (View) getHost().getModel())); + return mainCommand == null ? deleteViewCommand : mainCommand + .chain(deleteViewCommand); + } + + /** + * @generated + */ + private Command getEditHelperCommand(IEditCommandRequest request, + Command editPolicyCommand) { + if (editPolicyCommand != null) { + ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand) + .getICommand() : new CommandProxy(editPolicyCommand); + request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, + command); + } + IElementType requestContextElementType = getContextElementType(request); + request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, + requestContextElementType); + ICommand command = requestContextElementType.getEditCommand(request); + request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null); + request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null); + if (command != null) { + if (!(command instanceof CompositeTransactionalCommand)) { + command = new CompositeTransactionalCommand(getEditingDomain(), + command.getLabel()).compose(command); + } + return new ICommandProxy(command); + } + return editPolicyCommand; + } + + /** + * @generated + */ + private IElementType getContextElementType(IEditCommandRequest request) { + IElementType requestContextElementType = UMLElementTypes + .getElementType(getVisualID(request)); + return requestContextElementType != null ? requestContextElementType + : myElementType; + } + + /** + * @generated + */ + protected Command getSemanticCommandSwitch(IEditCommandRequest req) { + if (req instanceof CreateRelationshipRequest) { + return getCreateRelationshipCommand((CreateRelationshipRequest) req); + } else if (req instanceof CreateElementRequest) { + return getCreateCommand((CreateElementRequest) req); + } else if (req instanceof ConfigureRequest) { + return getConfigureCommand((ConfigureRequest) req); + } else if (req instanceof DestroyElementRequest) { + return getDestroyElementCommand((DestroyElementRequest) req); + } else if (req instanceof DestroyReferenceRequest) { + return getDestroyReferenceCommand((DestroyReferenceRequest) req); + } else if (req instanceof DuplicateElementsRequest) { + return getDuplicateCommand((DuplicateElementsRequest) req); + } else if (req instanceof GetEditContextRequest) { + return getEditContextCommand((GetEditContextRequest) req); + } else if (req instanceof MoveRequest) { + return getMoveCommand((MoveRequest) req); + } else if (req instanceof ReorientReferenceRelationshipRequest) { + return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req); + } else if (req instanceof ReorientRelationshipRequest) { + return getReorientRelationshipCommand((ReorientRelationshipRequest) req); + } else if (req instanceof SetRequest) { + return getSetCommand((SetRequest) req); + } + return null; + } + + /** + * @generated + */ + protected Command getConfigureCommand(ConfigureRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getCreateCommand(CreateElementRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getSetCommand(SetRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getEditContextCommand(GetEditContextRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getDuplicateCommand(DuplicateElementsRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getMoveCommand(MoveRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getReorientReferenceRelationshipCommand( + ReorientReferenceRelationshipRequest req) { + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getReorientRelationshipCommand( + ReorientRelationshipRequest req) { + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected final Command getGEFWrapper(ICommand cmd) { + return new ICommandProxy(cmd); + } + + /** + * Returns editing domain from the host edit part. + * @generated + */ + protected TransactionalEditingDomain getEditingDomain() { + return ((IGraphicalEditPart) getHost()).getEditingDomain(); + } + + /** + * Clean all shortcuts to the host element from the same diagram + * @generated + */ + protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) { + assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$ + for (Iterator it = view.getDiagram().getChildren().iterator(); it + .hasNext();) { + View nextView = (View) it.next(); + if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$ + continue; + } + cmd.add(new DeleteCommand(getEditingDomain(), nextView)); + } + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java index c95839130e8..1115682394e 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextNonResizableEditPolicy.java @@ -1,229 +1,229 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
-
-/**
- * @generated
- */
-public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx
- implements IRefreshableFeedbackEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(false);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void hideFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Rectangle getFeedbackBounds() {
- Rectangle bounds;
- if (getHostFigure() instanceof Label) {
- bounds = ((Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof Label) {
- Label feedbackFigure = new Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure
- .setBackgroundColor(ColorConstants.menuBackgroundSelected);
- feedbackFigure
- .setForegroundColor(ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- RectangleFigure feedbackFigure = new RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- /**
- * @generated
- */
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- /**
- * @generated
- */
- protected void refreshSelectionFeedback() {
- if (selectionFeedbackFigure != null) {
- if (selectionFeedbackFigure instanceof Label) {
- updateLabel((Label) selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
- 5));
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
-
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- private FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * @generated
- */
- protected List createSelectionHandles() {
- MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
- return Collections.singletonList(moveHandle);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.ColorConstants; +import org.eclipse.draw2d.Figure; +import org.eclipse.draw2d.FigureListener; +import org.eclipse.draw2d.Graphics; +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.RectangleFigure; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx; +import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy; + +/** + * @generated + */ +public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx + implements IRefreshableFeedbackEditPolicy { + + /** + * @generated + */ + private IFigure selectionFeedbackFigure; + + /** + * @generated + */ + private IFigure focusFeedbackFigure; + + /** + * @generated + */ + private FigureListener hostPositionListener; + + /** + * @generated + */ + protected void showPrimarySelection() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(true); + } else { + showSelection(); + showFocus(); + } + } + + /** + * @generated + */ + protected void showSelection() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(false); + } else { + hideSelection(); + addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); + getHostFigure().addFigureListener(getHostPositionListener()); + refreshSelectionFeedback(); + hideFocus(); + } + } + + /** + * @generated + */ + protected void hideSelection() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(false); + ((WrappingLabel) getHostFigure()).setFocus(false); + } else { + if (selectionFeedbackFigure != null) { + removeFeedback(selectionFeedbackFigure); + getHostFigure().removeFigureListener(getHostPositionListener()); + selectionFeedbackFigure = null; + } + hideFocus(); + } + } + + /** + * @generated + */ + protected void showFocus() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(true); + } else { + hideFocus(); + addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); + refreshFocusFeedback(); + } + } + + /** + * @generated + */ + protected void hideFocus() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(false); + } else { + if (focusFeedbackFigure != null) { + removeFeedback(focusFeedbackFigure); + focusFeedbackFigure = null; + } + } + } + + /** + * @generated + */ + protected Rectangle getFeedbackBounds() { + Rectangle bounds; + if (getHostFigure() instanceof Label) { + bounds = ((Label) getHostFigure()).getTextBounds(); + bounds.intersect(getHostFigure().getBounds()); + } else { + bounds = getHostFigure().getBounds().getCopy(); + } + getHostFigure().getParent().translateToAbsolute(bounds); + getFeedbackLayer().translateToRelative(bounds); + return bounds; + } + + /** + * @generated + */ + protected IFigure createSelectionFeedbackFigure() { + if (getHostFigure() instanceof Label) { + Label feedbackFigure = new Label(); + feedbackFigure.setOpaque(true); + feedbackFigure + .setBackgroundColor(ColorConstants.menuBackgroundSelected); + feedbackFigure + .setForegroundColor(ColorConstants.menuForegroundSelected); + return feedbackFigure; + } else { + RectangleFigure feedbackFigure = new RectangleFigure(); + feedbackFigure.setFill(false); + return feedbackFigure; + } + } + + /** + * @generated + */ + protected IFigure createFocusFeedbackFigure() { + return new Figure() { + + protected void paintFigure(Graphics graphics) { + graphics.drawFocus(getBounds().getResized(-1, -1)); + } + }; + } + + /** + * @generated + */ + protected void updateLabel(Label target) { + Label source = (Label) getHostFigure(); + target.setText(source.getText()); + target.setTextAlignment(source.getTextAlignment()); + target.setFont(source.getFont()); + } + + /** + * @generated + */ + protected void refreshSelectionFeedback() { + if (selectionFeedbackFigure != null) { + if (selectionFeedbackFigure instanceof Label) { + updateLabel((Label) selectionFeedbackFigure); + selectionFeedbackFigure.setBounds(getFeedbackBounds()); + } else { + selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, + 5)); + } + } + } + + /** + * @generated + */ + protected void refreshFocusFeedback() { + if (focusFeedbackFigure != null) { + focusFeedbackFigure.setBounds(getFeedbackBounds()); + } + } + + /** + * @generated + */ + + public void refreshFeedback() { + refreshSelectionFeedback(); + refreshFocusFeedback(); + } + + /** + * @generated + */ + private FigureListener getHostPositionListener() { + if (hostPositionListener == null) { + hostPositionListener = new FigureListener() { + public void figureMoved(IFigure source) { + refreshFeedback(); + } + }; + } + return hostPositionListener; + } + + /** + * @generated + */ + protected List createSelectionHandles() { + MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost()); + moveHandle.setBorder(null); + moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost())); + return Collections.singletonList(moveHandle); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java index f503e7dab0f..16670d3f351 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/edit/policies/UMLTextSelectionEditPolicy.java @@ -1,213 +1,213 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
-
-/**
- * @generated
- */
-public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements
- IRefreshableFeedbackEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(false);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void hideFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Rectangle getFeedbackBounds() {
- Rectangle bounds;
- if (getHostFigure() instanceof Label) {
- bounds = ((Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof Label) {
- Label feedbackFigure = new Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure
- .setBackgroundColor(ColorConstants.menuBackgroundSelected);
- feedbackFigure
- .setForegroundColor(ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- RectangleFigure feedbackFigure = new RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- /**
- * @generated
- */
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- /**
- * @generated
- */
- protected void refreshSelectionFeedback() {
- if (selectionFeedbackFigure != null) {
- if (selectionFeedbackFigure instanceof Label) {
- updateLabel((Label) selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
- 5));
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
-
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- private FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.edit.policies; + +import org.eclipse.draw2d.ColorConstants; +import org.eclipse.draw2d.Figure; +import org.eclipse.draw2d.FigureListener; +import org.eclipse.draw2d.Graphics; +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.RectangleFigure; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.editpolicies.SelectionEditPolicy; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy; + +/** + * @generated + */ +public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements + IRefreshableFeedbackEditPolicy { + + /** + * @generated + */ + private IFigure selectionFeedbackFigure; + + /** + * @generated + */ + private IFigure focusFeedbackFigure; + + /** + * @generated + */ + private FigureListener hostPositionListener; + + /** + * @generated + */ + protected void showPrimarySelection() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(true); + } else { + showSelection(); + showFocus(); + } + } + + /** + * @generated + */ + protected void showSelection() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(true); + ((WrappingLabel) getHostFigure()).setFocus(false); + } else { + hideSelection(); + addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); + getHostFigure().addFigureListener(getHostPositionListener()); + refreshSelectionFeedback(); + hideFocus(); + } + } + + /** + * @generated + */ + protected void hideSelection() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setSelected(false); + ((WrappingLabel) getHostFigure()).setFocus(false); + } else { + if (selectionFeedbackFigure != null) { + removeFeedback(selectionFeedbackFigure); + getHostFigure().removeFigureListener(getHostPositionListener()); + selectionFeedbackFigure = null; + } + hideFocus(); + } + } + + /** + * @generated + */ + protected void showFocus() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(true); + } else { + hideFocus(); + addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); + refreshFocusFeedback(); + } + } + + /** + * @generated + */ + protected void hideFocus() { + if (getHostFigure() instanceof WrappingLabel) { + ((WrappingLabel) getHostFigure()).setFocus(false); + } else { + if (focusFeedbackFigure != null) { + removeFeedback(focusFeedbackFigure); + focusFeedbackFigure = null; + } + } + } + + /** + * @generated + */ + protected Rectangle getFeedbackBounds() { + Rectangle bounds; + if (getHostFigure() instanceof Label) { + bounds = ((Label) getHostFigure()).getTextBounds(); + bounds.intersect(getHostFigure().getBounds()); + } else { + bounds = getHostFigure().getBounds().getCopy(); + } + getHostFigure().getParent().translateToAbsolute(bounds); + getFeedbackLayer().translateToRelative(bounds); + return bounds; + } + + /** + * @generated + */ + protected IFigure createSelectionFeedbackFigure() { + if (getHostFigure() instanceof Label) { + Label feedbackFigure = new Label(); + feedbackFigure.setOpaque(true); + feedbackFigure + .setBackgroundColor(ColorConstants.menuBackgroundSelected); + feedbackFigure + .setForegroundColor(ColorConstants.menuForegroundSelected); + return feedbackFigure; + } else { + RectangleFigure feedbackFigure = new RectangleFigure(); + feedbackFigure.setFill(false); + return feedbackFigure; + } + } + + /** + * @generated + */ + protected IFigure createFocusFeedbackFigure() { + return new Figure() { + + protected void paintFigure(Graphics graphics) { + graphics.drawFocus(getBounds().getResized(-1, -1)); + } + }; + } + + /** + * @generated + */ + protected void updateLabel(Label target) { + Label source = (Label) getHostFigure(); + target.setText(source.getText()); + target.setTextAlignment(source.getTextAlignment()); + target.setFont(source.getFont()); + } + + /** + * @generated + */ + protected void refreshSelectionFeedback() { + if (selectionFeedbackFigure != null) { + if (selectionFeedbackFigure instanceof Label) { + updateLabel((Label) selectionFeedbackFigure); + selectionFeedbackFigure.setBounds(getFeedbackBounds()); + } else { + selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, + 5)); + } + } + } + + /** + * @generated + */ + protected void refreshFocusFeedback() { + if (focusFeedbackFigure != null) { + focusFeedbackFigure.setBounds(getFeedbackBounds()); + } + } + + /** + * @generated + */ + + public void refreshFeedback() { + refreshSelectionFeedback(); + refreshFocusFeedback(); + } + + /** + * @generated + */ + private FigureListener getHostPositionListener() { + if (hostPositionListener == null) { + hostPositionListener = new FigureListener() { + public void figureMoved(IFigure source) { + refreshFeedback(); + } + }; + } + return hostPositionListener; + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java index 0cb00c061a7..dbcb00f1c27 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/AbstractParser.java @@ -1 +1 @@ -//Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser.
+//Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser. diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java index 0eefacbc76e..e233f14d26e 100755 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/parsers/MessageFormatParser.java @@ -1,204 +1,204 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.parsers;
-
-import java.text.FieldPosition;
-import java.text.MessageFormat;
-import java.text.ParsePosition;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @generated
- */
- private String defaultPattern;
- /**
- * @generated
- */
- private String defaultEditablePattern;
-
- /**
- * @generated
- */
- private MessageFormat viewProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editorProcessor;
-
- /**
- * @generated
- */
- private MessageFormat editProcessor;
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features,
- EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(
- getViewPattern() == null ? getDefaultPattern()
- : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(
- getEditorPattern() == null ? getDefaultEditablePattern()
- : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(
- getEditPattern() == null ? getDefaultEditablePattern()
- : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element),
- new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- public IParserEditStatus isValidEditString(IAdaptable adapter,
- String editString) {
- ParsePosition pos = new ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID,
- IParserEditStatus.UNEDITABLE, NLS.bind(
- Messages.MessageFormatParser_InvalidInputError,
- new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
- }
-
- /**
- * @generated
- */
- public ICommand getParseCommand(IAdaptable adapter, String newString,
- int flags) {
- Object[] values = getEditProcessor().parse(newString,
- new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject) adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element),
- new StringBuffer(), new FieldPosition(0)).toString();
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.parsers; + +import java.text.FieldPosition; +import java.text.MessageFormat; +import java.text.ParsePosition; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.example.diagram.simplediagram.part.Messages; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin; + +/** + * @generated + */ +public class MessageFormatParser extends AbstractAttributeParser { + + /** + * @generated + */ + private String defaultPattern; + /** + * @generated + */ + private String defaultEditablePattern; + + /** + * @generated + */ + private MessageFormat viewProcessor; + + /** + * @generated + */ + private MessageFormat editorProcessor; + + /** + * @generated + */ + private MessageFormat editProcessor; + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features) { + super(features); + } + + /** + * @generated + */ + public MessageFormatParser(EAttribute[] features, + EAttribute[] editableFeatures) { + super(features, editableFeatures); + } + + /** + * @generated + */ + protected String getDefaultPattern() { + if (defaultPattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < features.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultPattern = sb.toString(); + } + return defaultPattern; + } + + /** + * @generated + */ + public void setViewPattern(String viewPattern) { + super.setViewPattern(viewPattern); + viewProcessor = null; + } + + /** + * @generated + */ + public void setEditorPattern(String editorPattern) { + super.setEditorPattern(editorPattern); + editorProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getViewProcessor() { + if (viewProcessor == null) { + viewProcessor = new MessageFormat( + getViewPattern() == null ? getDefaultPattern() + : getViewPattern()); + } + return viewProcessor; + } + + /** + * @generated + */ + protected MessageFormat getEditorProcessor() { + if (editorProcessor == null) { + editorProcessor = new MessageFormat( + getEditorPattern() == null ? getDefaultEditablePattern() + : getEditorPattern()); + } + return editorProcessor; + } + + /** + * @generated + */ + protected String getDefaultEditablePattern() { + if (defaultEditablePattern == null) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < editableFeatures.length; i++) { + if (i > 0) { + sb.append(' '); + } + sb.append('{'); + sb.append(i); + sb.append('}'); + } + defaultEditablePattern = sb.toString(); + } + return defaultEditablePattern; + } + + /** + * @generated + */ + public void setEditPattern(String editPattern) { + super.setEditPattern(editPattern); + editProcessor = null; + } + + /** + * @generated + */ + protected MessageFormat getEditProcessor() { + if (editProcessor == null) { + editProcessor = new MessageFormat( + getEditPattern() == null ? getDefaultEditablePattern() + : getEditPattern()); + } + return editProcessor; + } + + /** + * @generated + */ + public String getEditString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getEditorProcessor().format(getEditableValues(element), + new StringBuffer(), new FieldPosition(0)).toString(); + } + + /** + * @generated + */ + public IParserEditStatus isValidEditString(IAdaptable adapter, + String editString) { + ParsePosition pos = new ParsePosition(0); + Object[] values = getEditProcessor().parse(editString, pos); + if (values == null) { + return new ParserEditStatus(UMLDiagramEditorPlugin.ID, + IParserEditStatus.UNEDITABLE, NLS.bind( + Messages.MessageFormatParser_InvalidInputError, + new Integer(pos.getErrorIndex()))); + } + return validateNewValues(values); + } + + /** + * @generated + */ + public ICommand getParseCommand(IAdaptable adapter, String newString, + int flags) { + Object[] values = getEditProcessor().parse(newString, + new ParsePosition(0)); + return getParseCommand(adapter, values, flags); + } + + /** + * @generated + */ + public String getPrintString(IAdaptable adapter, int flags) { + EObject element = (EObject) adapter.getAdapter(EObject.class); + return getViewProcessor().format(getValues(element), + new StringBuffer(), new FieldPosition(0)).toString(); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java index cb3f66e6736..2b95f2bc404 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/LoadResourceAction.java @@ -1,18 +1,18 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.actions.DefaultLoadResourceAction;
-
-/**
- * @generated
- */
-public class LoadResourceAction extends DefaultLoadResourceAction {
- /**
- * @generated
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- return super.execute(event);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.actions.DefaultLoadResourceAction; + +/** + * @generated + */ +public class LoadResourceAction extends DefaultLoadResourceAction { + /** + * @generated + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + return super.execute(event); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java index 58346c37a77..06722211dc6 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/ModelElementSelectionPage.java @@ -1,27 +1,27 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultModelElementSelectionPage;
-
-/**
- * Wizard page that allows to select element from model.
- * @generated
- */
-public class ModelElementSelectionPage extends DefaultModelElementSelectionPage {
-
- /**
- * @generated
- */
- public ModelElementSelectionPage(String pageName) {
- super(UMLDiagramEditorPlugin.getInstance()
- .getItemProvidersAdapterFactory(), pageName);
- }
-
- /**
- * Override to provide custom model element description.
- * @generated
- */
- protected String getSelectionTitle() {
- return Messages.ModelElementSelectionPageMessage;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultModelElementSelectionPage; + +/** + * Wizard page that allows to select element from model. + * @generated + */ +public class ModelElementSelectionPage extends DefaultModelElementSelectionPage { + + /** + * @generated + */ + public ModelElementSelectionPage(String pageName) { + super(UMLDiagramEditorPlugin.getInstance() + .getItemProvidersAdapterFactory(), pageName); + } + + /** + * Override to provide custom model element description. + * @generated + */ + protected String getSelectionTitle() { + return Messages.ModelElementSelectionPageMessage; + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java index 137c5ce3d47..d95ab2f9bd5 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorPlugin.java @@ -1,256 +1,256 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.LogHelper;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.ElementInitializers;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
-import org.osgi.framework.BundleContext;
-
-/**
- * @generated
- */
-public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.example.diagram.simplediagram"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private LogHelper myLogHelper;
-
- /**
- * @generated
- */
- public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(
- ID);
-
- /**
- * @generated
- */
- private static UMLDiagramEditorPlugin instance;
-
- /**
- * @generated
- */
- private ComposedAdapterFactory adapterFactory;
-
- /**
- * @generated
- */
- private UMLDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- private ElementInitializers initializers;
-
- /**
- * @generated
- */
- public UMLDiagramEditorPlugin() {
- }
-
- /**
- * @generated
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- myLogHelper = new LogHelper(this);
- PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT,
- getPreferenceStore());
- adapterFactory = createAdapterFactory();
- }
-
- /**
- * @generated
- */
- public void stop(BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
- initializers = null;
- instance = null;
- super.stop(context);
- }
-
- /**
- * @generated
- */
- public static UMLDiagramEditorPlugin getInstance() {
- return instance;
- }
-
- /**
- * @generated
- */
- protected ComposedAdapterFactory createAdapterFactory() {
- ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
- fillItemProviderFactories(factories);
- return new ComposedAdapterFactory(factories);
- }
-
- /**
- * @generated
- */
- protected void fillItemProviderFactories(List<AdapterFactory> factories) {
- factories.add(new UMLItemProviderAdapterFactory());
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new ResourceItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- }
-
- /**
- * @generated
- */
- public AdapterFactory getItemProvidersAdapterFactory() {
- return adapterFactory;
- }
-
- /**
- * @generated
- */
- public ImageDescriptor getItemImageDescriptor(Object item) {
- IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory
- .adapt(item, IItemLabelProvider.class);
- if (labelProvider != null) {
- return ExtendedImageRegistry.getInstance().getImageDescriptor(
- labelProvider.getImage(item));
- }
- return null;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @generated
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getBundledImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
- }
-
- /**
- * Respects images residing in any plug-in. If path is relative,
- * then this bundle is looked up for the image, otherwise, for absolute
- * path, first segment is taken as id of plug-in with image
- *
- * @generated
- * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
- * @return the image descriptor
- */
- public static ImageDescriptor findImageDescriptor(String path) {
- final IPath p = new Path(path);
- if (p.isAbsolute() && p.segmentCount() > 1) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p
- .removeFirstSegments(1).makeAbsolute().toString());
- } else {
- return getBundledImageDescriptor(p.makeAbsolute().toString());
- }
- }
-
- /**
- * Returns an image for the image file at the given plugin relative path.
- * Client do not need to dispose this image. Images will be disposed automatically.
- *
- * @generated
- * @param path the path
- * @return image instance
- */
- public Image getBundledImage(String path) {
- Image image = getImageRegistry().get(path);
- if (image == null) {
- getImageRegistry().put(path, getBundledImageDescriptor(path));
- image = getImageRegistry().get(path);
- }
- return image;
- }
-
- /**
- * Returns string from plug-in's resource bundle
- *
- * @generated
- */
- public static String getString(String key) {
- return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- public UMLDocumentProvider getDocumentProvider() {
- if (documentProvider == null) {
- documentProvider = new UMLDocumentProvider();
- }
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public ElementInitializers getElementInitializers() {
- return initializers;
- }
-
- /**
- * @generated
- */
- public void setElementInitializers(ElementInitializers i) {
- this.initializers = i;
- }
-
- /**
- * @generated
- */
- public void logError(String error) {
- getLogHelper().logError(error, null);
- }
-
- /**
- * @generated
- */
- public void logError(String error, Throwable throwable) {
- getLogHelper().logError(error, throwable);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message) {
- getLogHelper().logInfo(message, null);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message, Throwable throwable) {
- getLogHelper().logInfo(message, throwable);
- }
-
- /**
- * @generated
- */
- public LogHelper getLogHelper() {
- return myLogHelper;
- }
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.LogHelper; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.example.diagram.simplediagram.providers.ElementInitializers; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; +import org.osgi.framework.BundleContext; + +/** + * @generated + */ +public class UMLDiagramEditorPlugin extends AbstractUIPlugin { + + /** + * @generated + */ + public static final String ID = "org.eclipse.papyrus.example.diagram.simplediagram"; //$NON-NLS-1$ + + /** + * @generated + */ + private LogHelper myLogHelper; + + /** + * @generated + */ + public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint( + ID); + + /** + * @generated + */ + private static UMLDiagramEditorPlugin instance; + + /** + * @generated + */ + private ComposedAdapterFactory adapterFactory; + + /** + * @generated + */ + private UMLDocumentProvider documentProvider; + + /** + * @generated + */ + private ElementInitializers initializers; + + /** + * @generated + */ + public UMLDiagramEditorPlugin() { + } + + /** + * @generated + */ + public void start(BundleContext context) throws Exception { + super.start(context); + instance = this; + myLogHelper = new LogHelper(this); + PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, + getPreferenceStore()); + adapterFactory = createAdapterFactory(); + } + + /** + * @generated + */ + public void stop(BundleContext context) throws Exception { + adapterFactory.dispose(); + adapterFactory = null; + initializers = null; + instance = null; + super.stop(context); + } + + /** + * @generated + */ + public static UMLDiagramEditorPlugin getInstance() { + return instance; + } + + /** + * @generated + */ + protected ComposedAdapterFactory createAdapterFactory() { + ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>(); + fillItemProviderFactories(factories); + return new ComposedAdapterFactory(factories); + } + + /** + * @generated + */ + protected void fillItemProviderFactories(List<AdapterFactory> factories) { + factories.add(new UMLItemProviderAdapterFactory()); + factories.add(new EcoreItemProviderAdapterFactory()); + factories.add(new ResourceItemProviderAdapterFactory()); + factories.add(new ReflectiveItemProviderAdapterFactory()); + } + + /** + * @generated + */ + public AdapterFactory getItemProvidersAdapterFactory() { + return adapterFactory; + } + + /** + * @generated + */ + public ImageDescriptor getItemImageDescriptor(Object item) { + IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory + .adapt(item, IItemLabelProvider.class); + if (labelProvider != null) { + return ExtendedImageRegistry.getInstance().getImageDescriptor( + labelProvider.getImage(item)); + } + return null; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path. + * + * @generated + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getBundledImageDescriptor(String path) { + return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path); + } + + /** + * Respects images residing in any plug-in. If path is relative, + * then this bundle is looked up for the image, otherwise, for absolute + * path, first segment is taken as id of plug-in with image + * + * @generated + * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images + * @return the image descriptor + */ + public static ImageDescriptor findImageDescriptor(String path) { + final IPath p = new Path(path); + if (p.isAbsolute() && p.segmentCount() > 1) { + return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p + .removeFirstSegments(1).makeAbsolute().toString()); + } else { + return getBundledImageDescriptor(p.makeAbsolute().toString()); + } + } + + /** + * Returns an image for the image file at the given plugin relative path. + * Client do not need to dispose this image. Images will be disposed automatically. + * + * @generated + * @param path the path + * @return image instance + */ + public Image getBundledImage(String path) { + Image image = getImageRegistry().get(path); + if (image == null) { + getImageRegistry().put(path, getBundledImageDescriptor(path)); + image = getImageRegistry().get(path); + } + return image; + } + + /** + * Returns string from plug-in's resource bundle + * + * @generated + */ + public static String getString(String key) { + return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$ + } + + /** + * @generated + */ + public UMLDocumentProvider getDocumentProvider() { + if (documentProvider == null) { + documentProvider = new UMLDocumentProvider(); + } + return documentProvider; + } + + /** + * @generated + */ + public ElementInitializers getElementInitializers() { + return initializers; + } + + /** + * @generated + */ + public void setElementInitializers(ElementInitializers i) { + this.initializers = i; + } + + /** + * @generated + */ + public void logError(String error) { + getLogHelper().logError(error, null); + } + + /** + * @generated + */ + public void logError(String error, Throwable throwable) { + getLogHelper().logError(error, throwable); + } + + /** + * @generated + */ + public void logInfo(String message) { + getLogHelper().logInfo(message, null); + } + + /** + * @generated + */ + public void logInfo(String message, Throwable throwable) { + getLogHelper().logInfo(message, throwable); + } + + /** + * @generated + */ + public LogHelper getLogHelper() { + return myLogHelper; + } +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorUtil.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorUtil.java index edf1dbc14ad..1232543e24a 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorUtil.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramEditorUtil.java @@ -1,398 +1,398 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class UMLDiagramEditorUtil {
-
- /**
- * @generated
- */
- public static Map<?, ?> getSaveOptions() {
- HashMap<String, Object> saveOptions = new HashMap<String, Object>();
- saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
- saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED,
- Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
- return saveOptions;
- }
-
- /**
- * @generated
- */
- public static boolean openDiagram(Resource diagram)
- throws PartInitException {
- String path = diagram.getURI().toPlatformString(true);
- IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot()
- .findMember(new Path(path));
- if (workspaceResource instanceof IFile) {
- IWorkbenchPage page = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- return null != page.openEditor(new FileEditorInput(
- (IFile) workspaceResource), UMLDiagramEditor.ID);
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static void setCharset(IFile file) {
- if (file == null) {
- return;
- }
- try {
- file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$
- } catch (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public static String getUniqueFileName(IPath containerFullPath,
- String fileName, String extension) {
- return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath,
- fileName, extension,
- DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
- }
-
- /**
- * Runs the wizard in a dialog.
- *
- * @generated
- */
- public static void runWizard(Shell shell, Wizard wizard, String settingsKey) {
- IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin
- .getInstance().getDialogSettings();
- IDialogSettings wizardDialogSettings = pluginDialogSettings
- .getSection(settingsKey);
- if (wizardDialogSettings == null) {
- wizardDialogSettings = pluginDialogSettings
- .addNewSection(settingsKey);
- }
- wizard.setDialogSettings(wizardDialogSettings);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x),
- 500);
- dialog.open();
- }
-
- /**
- * This method should be called within a workspace modify operation since it creates resources.
- * @generated
- */
- public static Resource createDiagram(URI diagramURI, URI modelURI,
- IProgressMonitor progressMonitor) {
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
- .createEditingDomain();
- progressMonitor.beginTask(
- Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3);
- final Resource diagramResource = editingDomain.getResourceSet()
- .createResource(diagramURI);
- final Resource modelResource = editingDomain.getResourceSet()
- .createResource(modelURI);
- final String diagramName = diagramURI.lastSegment();
- AbstractTransactionalCommand command = new AbstractTransactionalCommand(
- editingDomain,
- Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel,
- Collections.EMPTY_LIST) {
- protected CommandResult doExecuteWithResult(
- IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- Model model = createInitialModel();
- attachModelToResource(model, modelResource);
-
- Diagram diagram = ViewService.createDiagram(model,
- ModelEditPart.MODEL_ID,
- UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- if (diagram != null) {
- diagramResource.getContents().add(diagram);
- diagram.setName(diagramName);
- diagram.setElement(model);
- }
-
- try {
- modelResource
- .save(org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorUtil
- .getSaveOptions());
- diagramResource
- .save(org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorUtil
- .getSaveOptions());
- } catch (IOException e) {
-
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to store model and diagram resources", e); //$NON-NLS-1$
- }
- return CommandResult.newOKCommandResult();
- }
- };
- try {
- OperationHistoryFactory.getOperationHistory().execute(command,
- new SubProgressMonitor(progressMonitor, 1), null);
- } catch (ExecutionException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to create model and diagram", e); //$NON-NLS-1$
- }
- setCharset(WorkspaceSynchronizer.getFile(modelResource));
- setCharset(WorkspaceSynchronizer.getFile(diagramResource));
- return diagramResource;
- }
-
- /**
- * Create a new instance of domain element associated with canvas.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static Model createInitialModel() {
- return UMLFactory.eINSTANCE.createModel();
- }
-
- /**
- * Store model element in the resource.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static void attachModelToResource(Model model, Resource resource) {
- resource.getContents().add(model);
- }
-
- /**
- * @generated
- */
- public static void selectElementsInDiagram(
- IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
- diagramPart.getDiagramGraphicalViewer().deselectAll();
-
- EditPart firstPrimary = null;
- for (EditPart nextPart : editParts) {
- diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
- if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
- firstPrimary = nextPart;
- }
- }
-
- if (!editParts.isEmpty()) {
- diagramPart.getDiagramGraphicalViewer().reveal(
- firstPrimary != null ? firstPrimary : (EditPart) editParts
- .get(0));
- }
- }
-
- /**
- * @generated
- */
- private static int findElementsInDiagramByID(DiagramEditPart diagramPart,
- EObject element, List<EditPart> editPartCollector) {
- IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart
- .getViewer();
- final int intialNumOfEditParts = editPartCollector.size();
-
- if (element instanceof View) { // support notation element lookup
- EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(
- element);
- if (editPart != null) {
- editPartCollector.add(editPart);
- return 1;
- }
- }
-
- String elementID = EMFCoreUtil.getProxyID(element);
- @SuppressWarnings("unchecked")
- List<EditPart> associatedParts = viewer.findEditPartsForElement(
- elementID, IGraphicalEditPart.class);
- // perform the possible hierarchy disjoint -> take the top-most parts only
- for (EditPart nextPart : associatedParts) {
- EditPart parentPart = nextPart.getParent();
- while (parentPart != null && !associatedParts.contains(parentPart)) {
- parentPart = parentPart.getParent();
- }
- if (parentPart == null) {
- editPartCollector.add(nextPart);
- }
- }
-
- if (intialNumOfEditParts == editPartCollector.size()) {
- if (!associatedParts.isEmpty()) {
- editPartCollector.add(associatedParts.get(0));
- } else {
- if (element.eContainer() != null) {
- return findElementsInDiagramByID(diagramPart,
- element.eContainer(), editPartCollector);
- }
- }
- }
- return editPartCollector.size() - intialNumOfEditParts;
- }
-
- /**
- * @generated
- */
- public static View findView(DiagramEditPart diagramEditPart,
- EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
- boolean hasStructuralURI = false;
- if (targetElement.eResource() instanceof XMLResource) {
- hasStructuralURI = ((XMLResource) targetElement.eResource())
- .getID(targetElement) == null;
- }
-
- View view = null;
- LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>();
- if (hasStructuralURI
- && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
- view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
- } else if (findElementsInDiagramByID(diagramEditPart, targetElement,
- editPartHolder) > 0) {
- EditPart editPart = editPartHolder.get(0);
- view = editPart.getModel() instanceof View ? (View) editPart
- .getModel() : null;
- }
-
- return (view == null) ? diagramEditPart.getDiagramView() : view;
- }
-
- /**
- * XXX This is quite suspicious code (especially editPartTmpHolder) and likely to be removed soon
- * @generated
- */
- public static class LazyElement2ViewMap {
- /**
- * @generated
- */
- private Map<EObject, View> element2ViewMap;
-
- /**
- * @generated
- */
- private View scope;
-
- /**
- * @generated
- */
- private Set<? extends EObject> elementSet;
-
- /**
- * @generated
- */
- public LazyElement2ViewMap(View scope, Set<? extends EObject> elements) {
- this.scope = scope;
- this.elementSet = elements;
- }
-
- /**
- * @generated
- */
- public final Map<EObject, View> getElement2ViewMap() {
- if (element2ViewMap == null) {
- element2ViewMap = new HashMap<EObject, View>();
- // map possible notation elements to itself as these can't be found by view.getElement()
- for (EObject element : elementSet) {
- if (element instanceof View) {
- View view = (View) element;
- if (view.getDiagram() == scope.getDiagram()) {
- element2ViewMap.put(element, view); // take only those that part of our diagram
- }
- }
- }
-
- buildElement2ViewMap(scope, element2ViewMap, elementSet);
- }
- return element2ViewMap;
- }
-
- /**
- * @generated
- */
- private static boolean buildElement2ViewMap(View parentView,
- Map<EObject, View> element2ViewMap,
- Set<? extends EObject> elements) {
- if (elements.size() == element2ViewMap.size()) {
- return true;
- }
-
- if (parentView.isSetElement()
- && !element2ViewMap.containsKey(parentView.getElement())
- && elements.contains(parentView.getElement())) {
- element2ViewMap.put(parentView.getElement(), parentView);
- if (elements.size() == element2ViewMap.size()) {
- return true;
- }
- }
- boolean complete = false;
- for (Iterator<?> it = parentView.getChildren().iterator(); it
- .hasNext() && !complete;) {
- complete = buildElement2ViewMap((View) it.next(),
- element2ViewMap, elements);
- }
- for (Iterator<?> it = parentView.getSourceEdges().iterator(); it
- .hasNext() && !complete;) {
- complete = buildElement2ViewMap((View) it.next(),
- element2ViewMap, elements);
- }
- for (Iterator<?> it = parentView.getTargetEdges().iterator(); it
- .hasNext() && !complete;) {
- complete = buildElement2ViewMap((View) it.next(),
- element2ViewMap, elements);
- }
- return complete;
- }
- } //LazyElement2ViewMap
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.diagram.core.services.ViewService; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart; +import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer; +import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; +import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.UMLFactory; + +/** + * @generated + */ +public class UMLDiagramEditorUtil { + + /** + * @generated + */ + public static Map<?, ?> getSaveOptions() { + HashMap<String, Object> saveOptions = new HashMap<String, Object>(); + saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$ + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, + Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + return saveOptions; + } + + /** + * @generated + */ + public static boolean openDiagram(Resource diagram) + throws PartInitException { + String path = diagram.getURI().toPlatformString(true); + IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot() + .findMember(new Path(path)); + if (workspaceResource instanceof IFile) { + IWorkbenchPage page = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage(); + return null != page.openEditor(new FileEditorInput( + (IFile) workspaceResource), UMLDiagramEditor.ID); + } + return false; + } + + /** + * @generated + */ + public static void setCharset(IFile file) { + if (file == null) { + return; + } + try { + file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$ + } catch (CoreException e) { + UMLDiagramEditorPlugin.getInstance().logError( + "Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public static String getUniqueFileName(IPath containerFullPath, + String fileName, String extension) { + return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, + fileName, extension, + DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE); + } + + /** + * Runs the wizard in a dialog. + * + * @generated + */ + public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { + IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin + .getInstance().getDialogSettings(); + IDialogSettings wizardDialogSettings = pluginDialogSettings + .getSection(settingsKey); + if (wizardDialogSettings == null) { + wizardDialogSettings = pluginDialogSettings + .addNewSection(settingsKey); + } + wizard.setDialogSettings(wizardDialogSettings); + WizardDialog dialog = new WizardDialog(shell, wizard); + dialog.create(); + dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), + 500); + dialog.open(); + } + + /** + * This method should be called within a workspace modify operation since it creates resources. + * @generated + */ + public static Resource createDiagram(URI diagramURI, URI modelURI, + IProgressMonitor progressMonitor) { + TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE + .createEditingDomain(); + progressMonitor.beginTask( + Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3); + final Resource diagramResource = editingDomain.getResourceSet() + .createResource(diagramURI); + final Resource modelResource = editingDomain.getResourceSet() + .createResource(modelURI); + final String diagramName = diagramURI.lastSegment(); + AbstractTransactionalCommand command = new AbstractTransactionalCommand( + editingDomain, + Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, + Collections.EMPTY_LIST) { + protected CommandResult doExecuteWithResult( + IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { + Model model = createInitialModel(); + attachModelToResource(model, modelResource); + + Diagram diagram = ViewService.createDiagram(model, + ModelEditPart.MODEL_ID, + UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); + if (diagram != null) { + diagramResource.getContents().add(diagram); + diagram.setName(diagramName); + diagram.setElement(model); + } + + try { + modelResource + .save(org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorUtil + .getSaveOptions()); + diagramResource + .save(org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorUtil + .getSaveOptions()); + } catch (IOException e) { + + UMLDiagramEditorPlugin.getInstance().logError( + "Unable to store model and diagram resources", e); //$NON-NLS-1$ + } + return CommandResult.newOKCommandResult(); + } + }; + try { + OperationHistoryFactory.getOperationHistory().execute(command, + new SubProgressMonitor(progressMonitor, 1), null); + } catch (ExecutionException e) { + UMLDiagramEditorPlugin.getInstance().logError( + "Unable to create model and diagram", e); //$NON-NLS-1$ + } + setCharset(WorkspaceSynchronizer.getFile(modelResource)); + setCharset(WorkspaceSynchronizer.getFile(diagramResource)); + return diagramResource; + } + + /** + * Create a new instance of domain element associated with canvas. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static Model createInitialModel() { + return UMLFactory.eINSTANCE.createModel(); + } + + /** + * Store model element in the resource. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static void attachModelToResource(Model model, Resource resource) { + resource.getContents().add(model); + } + + /** + * @generated + */ + public static void selectElementsInDiagram( + IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) { + diagramPart.getDiagramGraphicalViewer().deselectAll(); + + EditPart firstPrimary = null; + for (EditPart nextPart : editParts) { + diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart); + if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) { + firstPrimary = nextPart; + } + } + + if (!editParts.isEmpty()) { + diagramPart.getDiagramGraphicalViewer().reveal( + firstPrimary != null ? firstPrimary : (EditPart) editParts + .get(0)); + } + } + + /** + * @generated + */ + private static int findElementsInDiagramByID(DiagramEditPart diagramPart, + EObject element, List<EditPart> editPartCollector) { + IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart + .getViewer(); + final int intialNumOfEditParts = editPartCollector.size(); + + if (element instanceof View) { // support notation element lookup + EditPart editPart = (EditPart) viewer.getEditPartRegistry().get( + element); + if (editPart != null) { + editPartCollector.add(editPart); + return 1; + } + } + + String elementID = EMFCoreUtil.getProxyID(element); + @SuppressWarnings("unchecked") + List<EditPart> associatedParts = viewer.findEditPartsForElement( + elementID, IGraphicalEditPart.class); + // perform the possible hierarchy disjoint -> take the top-most parts only + for (EditPart nextPart : associatedParts) { + EditPart parentPart = nextPart.getParent(); + while (parentPart != null && !associatedParts.contains(parentPart)) { + parentPart = parentPart.getParent(); + } + if (parentPart == null) { + editPartCollector.add(nextPart); + } + } + + if (intialNumOfEditParts == editPartCollector.size()) { + if (!associatedParts.isEmpty()) { + editPartCollector.add(associatedParts.get(0)); + } else { + if (element.eContainer() != null) { + return findElementsInDiagramByID(diagramPart, + element.eContainer(), editPartCollector); + } + } + } + return editPartCollector.size() - intialNumOfEditParts; + } + + /** + * @generated + */ + public static View findView(DiagramEditPart diagramEditPart, + EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) { + boolean hasStructuralURI = false; + if (targetElement.eResource() instanceof XMLResource) { + hasStructuralURI = ((XMLResource) targetElement.eResource()) + .getID(targetElement) == null; + } + + View view = null; + LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>(); + if (hasStructuralURI + && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { + view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement); + } else if (findElementsInDiagramByID(diagramEditPart, targetElement, + editPartHolder) > 0) { + EditPart editPart = editPartHolder.get(0); + view = editPart.getModel() instanceof View ? (View) editPart + .getModel() : null; + } + + return (view == null) ? diagramEditPart.getDiagramView() : view; + } + + /** + * XXX This is quite suspicious code (especially editPartTmpHolder) and likely to be removed soon + * @generated + */ + public static class LazyElement2ViewMap { + /** + * @generated + */ + private Map<EObject, View> element2ViewMap; + + /** + * @generated + */ + private View scope; + + /** + * @generated + */ + private Set<? extends EObject> elementSet; + + /** + * @generated + */ + public LazyElement2ViewMap(View scope, Set<? extends EObject> elements) { + this.scope = scope; + this.elementSet = elements; + } + + /** + * @generated + */ + public final Map<EObject, View> getElement2ViewMap() { + if (element2ViewMap == null) { + element2ViewMap = new HashMap<EObject, View>(); + // map possible notation elements to itself as these can't be found by view.getElement() + for (EObject element : elementSet) { + if (element instanceof View) { + View view = (View) element; + if (view.getDiagram() == scope.getDiagram()) { + element2ViewMap.put(element, view); // take only those that part of our diagram + } + } + } + + buildElement2ViewMap(scope, element2ViewMap, elementSet); + } + return element2ViewMap; + } + + /** + * @generated + */ + private static boolean buildElement2ViewMap(View parentView, + Map<EObject, View> element2ViewMap, + Set<? extends EObject> elements) { + if (elements.size() == element2ViewMap.size()) { + return true; + } + + if (parentView.isSetElement() + && !element2ViewMap.containsKey(parentView.getElement()) + && elements.contains(parentView.getElement())) { + element2ViewMap.put(parentView.getElement(), parentView); + if (elements.size() == element2ViewMap.size()) { + return true; + } + } + boolean complete = false; + for (Iterator<?> it = parentView.getChildren().iterator(); it + .hasNext() && !complete;) { + complete = buildElement2ViewMap((View) it.next(), + element2ViewMap, elements); + } + for (Iterator<?> it = parentView.getSourceEdges().iterator(); it + .hasNext() && !complete;) { + complete = buildElement2ViewMap((View) it.next(), + element2ViewMap, elements); + } + for (Iterator<?> it = parentView.getTargetEdges().iterator(); it + .hasNext() && !complete;) { + complete = buildElement2ViewMap((View) it.next(), + element2ViewMap, elements); + } + return complete; + } + } //LazyElement2ViewMap + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramUpdater.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramUpdater.java index db9efd6af07..503d2d1c243 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramUpdater.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLDiagramUpdater.java @@ -1,157 +1,157 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.update.DiagramUpdater;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.PackageableElement;
-
-/**
- * @generated
- */
-public class UMLDiagramUpdater {
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getSemanticChildren(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case ModelEditPart.VISUAL_ID:
- return getModel_1000SemanticChildren(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getModel_1000SemanticChildren(
- View view) {
- if (!view.isSetElement()) {
- return Collections.emptyList();
- }
- Model modelElement = (Model) view.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it
- .hasNext();) {
- PackageableElement childElement = (PackageableElement) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view,
- childElement);
- if (visualID == ComponentEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getContainedLinks(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case ModelEditPart.VISUAL_ID:
- return getModel_1000ContainedLinks(view);
- case ComponentEditPart.VISUAL_ID:
- return getComponent_2001ContainedLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getIncomingLinks(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case ComponentEditPart.VISUAL_ID:
- return getComponent_2001IncomingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getOutgoingLinks(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case ComponentEditPart.VISUAL_ID:
- return getComponent_2001OutgoingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getModel_1000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getComponent_2001ContainedLinks(
- View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getComponent_2001IncomingLinks(
- View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getComponent_2001OutgoingLinks(
- View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static final DiagramUpdater TYPED_INSTANCE = new DiagramUpdater() {
- /**
- * @generated
- */
-
- public List<UMLNodeDescriptor> getSemanticChildren(View view) {
- return UMLDiagramUpdater.getSemanticChildren(view);
- }
-
- /**
- * @generated
- */
-
- public List<UMLLinkDescriptor> getContainedLinks(View view) {
- return UMLDiagramUpdater.getContainedLinks(view);
- }
-
- /**
- * @generated
- */
-
- public List<UMLLinkDescriptor> getIncomingLinks(View view) {
- return UMLDiagramUpdater.getIncomingLinks(view);
- }
-
- /**
- * @generated
- */
-
- public List<UMLLinkDescriptor> getOutgoingLinks(View view) {
- return UMLDiagramUpdater.getOutgoingLinks(view);
- }
- };
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.update.DiagramUpdater; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.PackageableElement; + +/** + * @generated + */ +public class UMLDiagramUpdater { + + /** + * @generated + */ + public static List<UMLNodeDescriptor> getSemanticChildren(View view) { + switch (UMLVisualIDRegistry.getVisualID(view)) { + case ModelEditPart.VISUAL_ID: + return getModel_1000SemanticChildren(view); + } + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLNodeDescriptor> getModel_1000SemanticChildren( + View view) { + if (!view.isSetElement()) { + return Collections.emptyList(); + } + Model modelElement = (Model) view.getElement(); + LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); + for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it + .hasNext();) { + PackageableElement childElement = (PackageableElement) it.next(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, + childElement); + if (visualID == ComponentEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + } + return result; + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getContainedLinks(View view) { + switch (UMLVisualIDRegistry.getVisualID(view)) { + case ModelEditPart.VISUAL_ID: + return getModel_1000ContainedLinks(view); + case ComponentEditPart.VISUAL_ID: + return getComponent_2001ContainedLinks(view); + } + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getIncomingLinks(View view) { + switch (UMLVisualIDRegistry.getVisualID(view)) { + case ComponentEditPart.VISUAL_ID: + return getComponent_2001IncomingLinks(view); + } + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getOutgoingLinks(View view) { + switch (UMLVisualIDRegistry.getVisualID(view)) { + case ComponentEditPart.VISUAL_ID: + return getComponent_2001OutgoingLinks(view); + } + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getModel_1000ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getComponent_2001ContainedLinks( + View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getComponent_2001IncomingLinks( + View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public static List<UMLLinkDescriptor> getComponent_2001OutgoingLinks( + View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public static final DiagramUpdater TYPED_INSTANCE = new DiagramUpdater() { + /** + * @generated + */ + + public List<UMLNodeDescriptor> getSemanticChildren(View view) { + return UMLDiagramUpdater.getSemanticChildren(view); + } + + /** + * @generated + */ + + public List<UMLLinkDescriptor> getContainedLinks(View view) { + return UMLDiagramUpdater.getContainedLinks(view); + } + + /** + * @generated + */ + + public List<UMLLinkDescriptor> getIncomingLinks(View view) { + return UMLDiagramUpdater.getIncomingLinks(view); + } + + /** + * @generated + */ + + public List<UMLLinkDescriptor> getOutgoingLinks(View view) { + return UMLDiagramUpdater.getOutgoingLinks(view); + } + }; + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLLinkDescriptor.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLLinkDescriptor.java index 8afa40f619c..3a3ee2cb657 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLLinkDescriptor.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLLinkDescriptor.java @@ -1,27 +1,27 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.update.UpdaterLinkDescriptor;
-
-/**
- * @generated
- */
-public class UMLLinkDescriptor extends UpdaterLinkDescriptor {
- /**
- * @generated
- */
- public UMLLinkDescriptor(EObject source, EObject destination,
- IElementType elementType, int linkVID) {
- super(source, destination, elementType, linkVID);
- }
-
- /**
- * @generated
- */
- public UMLLinkDescriptor(EObject source, EObject destination,
- EObject linkElement, IElementType elementType, int linkVID) {
- super(source, destination, linkElement, elementType, linkVID);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.update.UpdaterLinkDescriptor; + +/** + * @generated + */ +public class UMLLinkDescriptor extends UpdaterLinkDescriptor { + /** + * @generated + */ + public UMLLinkDescriptor(EObject source, EObject destination, + IElementType elementType, int linkVID) { + super(source, destination, elementType, linkVID); + } + + /** + * @generated + */ + public UMLLinkDescriptor(EObject source, EObject destination, + EObject linkElement, IElementType elementType, int linkVID) { + super(source, destination, linkElement, elementType, linkVID); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLNodeDescriptor.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLNodeDescriptor.java index ef0fc6a148c..a25c5f511a8 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLNodeDescriptor.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLNodeDescriptor.java @@ -1,17 +1,17 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.update.UpdaterNodeDescriptor;
-
-/**
- * @generated
- */
-public class UMLNodeDescriptor extends UpdaterNodeDescriptor {
- /**
- * @generated
- */
- public UMLNodeDescriptor(EObject modelElement, int visualID) {
- super(modelElement, visualID);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.update.UpdaterNodeDescriptor; + +/** + * @generated + */ +public class UMLNodeDescriptor extends UpdaterNodeDescriptor { + /** + * @generated + */ + public UMLNodeDescriptor(EObject modelElement, int visualID) { + super(modelElement, visualID); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLPaletteFactory.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLPaletteFactory.java index 882240ee3b8..9d9635a25b0 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLPaletteFactory.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLPaletteFactory.java @@ -1,56 +1,56 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import java.util.Collections;
-
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteGroup;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultNodeToolEntry;
-import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class UMLPaletteFactory {
-
- /**
- * @generated
- */
- public void fillPalette(PaletteRoot paletteRoot) {
- paletteRoot.add(createUml1Group());
- }
-
- /**
- * Creates "uml" palette tool group
- * @generated
- */
- private PaletteContainer createUml1Group() {
- PaletteGroup paletteContainer = new PaletteGroup(
- Messages.Uml1Group_title);
- paletteContainer.setId("createUml1Group"); //$NON-NLS-1$
- paletteContainer.setSmallIcon(UMLDiagramEditorPlugin
- .findImageDescriptor("icons/obj16/Diagram_UML.gif")); //$NON-NLS-1$
- paletteContainer.setLargeIcon(UMLDiagramEditorPlugin
- .findImageDescriptor("icons/obj16/Diagram_UML.gif")); //$NON-NLS-1$
- paletteContainer.add(createComponent1CreationTool());
- return paletteContainer;
- }
-
- /**
- * @generated
- */
- private ToolEntry createComponent1CreationTool() {
- DefaultNodeToolEntry entry = new DefaultNodeToolEntry(
- Messages.Component1CreationTool_title,
- Messages.Component1CreationTool_desc,
- Collections.singletonList(UMLElementTypes.Component_2001));
- entry.setId("createComponent1CreationTool"); //$NON-NLS-1$
- entry.setSmallIcon(UMLDiagramEditorPlugin
- .findImageDescriptor("icons/obj16/Component.gif")); //$NON-NLS-1$
- entry.setLargeIcon(UMLDiagramEditorPlugin
- .findImageDescriptor("icons/obj16/Component.gif")); //$NON-NLS-1$
- return entry;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import java.util.Collections; + +import org.eclipse.gef.palette.PaletteContainer; +import org.eclipse.gef.palette.PaletteGroup; +import org.eclipse.gef.palette.PaletteRoot; +import org.eclipse.gef.palette.ToolEntry; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultNodeToolEntry; +import org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes; + +/** + * @generated + */ +public class UMLPaletteFactory { + + /** + * @generated + */ + public void fillPalette(PaletteRoot paletteRoot) { + paletteRoot.add(createUml1Group()); + } + + /** + * Creates "uml" palette tool group + * @generated + */ + private PaletteContainer createUml1Group() { + PaletteGroup paletteContainer = new PaletteGroup( + Messages.Uml1Group_title); + paletteContainer.setId("createUml1Group"); //$NON-NLS-1$ + paletteContainer.setSmallIcon(UMLDiagramEditorPlugin + .findImageDescriptor("icons/obj16/Diagram_UML.gif")); //$NON-NLS-1$ + paletteContainer.setLargeIcon(UMLDiagramEditorPlugin + .findImageDescriptor("icons/obj16/Diagram_UML.gif")); //$NON-NLS-1$ + paletteContainer.add(createComponent1CreationTool()); + return paletteContainer; + } + + /** + * @generated + */ + private ToolEntry createComponent1CreationTool() { + DefaultNodeToolEntry entry = new DefaultNodeToolEntry( + Messages.Component1CreationTool_title, + Messages.Component1CreationTool_desc, + Collections.singletonList(UMLElementTypes.Component_2001)); + entry.setId("createComponent1CreationTool"); //$NON-NLS-1$ + entry.setSmallIcon(UMLDiagramEditorPlugin + .findImageDescriptor("icons/obj16/Component.gif")); //$NON-NLS-1$ + entry.setLargeIcon(UMLDiagramEditorPlugin + .findImageDescriptor("icons/obj16/Component.gif")); //$NON-NLS-1$ + return entry; + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLVisualIDRegistry.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLVisualIDRegistry.java index 7053dd08f66..cc121e9e93a 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLVisualIDRegistry.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/part/UMLVisualIDRegistry.java @@ -1,282 +1,282 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.part;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.structure.DiagramStructure;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * This registry is used to determine which type of visual object should be
- * created for the corresponding Diagram, Node, ChildNode or Link represented
- * by a domain model object.
- *
- * @generated
- */
-public class UMLVisualIDRegistry {
-
- /**
- * @generated
- */
- private static final String DEBUG_KEY = "org.eclipse.uml2.uml.diagram/debug/visualID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static int getVisualID(View view) {
- if (view instanceof Diagram) {
- if (ModelEditPart.MODEL_ID.equals(view.getType())) {
- return ModelEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getVisualID(view.getType());
- }
-
- /**
- * @generated
- */
- public static String getModelID(View view) {
- View diagram = view.getDiagram();
- while (view != diagram) {
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if (annotation != null) {
- return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$
- }
- view = (View) view.eContainer();
- }
- return diagram != null ? diagram.getType() : null;
- }
-
- /**
- * @generated
- */
- public static int getVisualID(String type) {
- try {
- return Integer.parseInt(type);
- } catch (NumberFormatException e) {
- if (Boolean.TRUE.toString().equalsIgnoreCase(
- Platform.getDebugOption(DEBUG_KEY))) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to parse view type as a visualID number: "
- + type);
- }
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static String getType(int visualID) {
- return Integer.toString(visualID);
- }
-
- /**
- * @generated
- */
- public static int getDiagramVisualID(EObject domainElement) {
- if (domainElement == null) {
- return -1;
- }
- if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(
- domainElement.eClass())
- && isDiagram((Model) domainElement)) {
- return ModelEditPart.VISUAL_ID;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static int getNodeVisualID(View containerView, EObject domainElement) {
- if (domainElement == null) {
- return -1;
- }
- String containerModelID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getModelID(containerView);
- if (!ModelEditPart.MODEL_ID.equals(containerModelID)) {
- return -1;
- }
- int containerVisualID;
- if (ModelEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getVisualID(containerView);
- } else {
- if (containerView instanceof Diagram) {
- containerVisualID = ModelEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- switch (containerVisualID) {
- case ModelEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(
- domainElement.eClass())) {
- return ComponentEditPart.VISUAL_ID;
- }
- break;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static boolean canCreateNode(View containerView, int nodeVisualID) {
- String containerModelID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getModelID(containerView);
- if (!ModelEditPart.MODEL_ID.equals(containerModelID)) {
- return false;
- }
- int containerVisualID;
- if (ModelEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getVisualID(containerView);
- } else {
- if (containerView instanceof Diagram) {
- containerVisualID = ModelEditPart.VISUAL_ID;
- } else {
- return false;
- }
- }
- switch (containerVisualID) {
- case ModelEditPart.VISUAL_ID:
- if (ComponentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ComponentEditPart.VISUAL_ID:
- if (ComponentNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static int getLinkWithClassVisualID(EObject domainElement) {
- if (domainElement == null) {
- return -1;
- }
- return -1;
- }
-
- /**
- * User can change implementation of this method to handle some specific
- * situations not covered by default logic.
- *
- * @generated
- */
- private static boolean isDiagram(Model element) {
- return true;
- }
-
- /**
- * @generated
- */
- public static boolean checkNodeVisualID(View containerView,
- EObject domainElement, int candidate) {
- if (candidate == -1) {
- //unrecognized id is always bad
- return false;
- }
- int basic = getNodeVisualID(containerView, domainElement);
- return basic == candidate;
- }
-
- /**
- * @generated
- */
- public static boolean isCompartmentVisualID(int visualID) {
- return false;
- }
-
- /**
- * @generated
- */
- public static boolean isSemanticLeafVisualID(int visualID) {
- switch (visualID) {
- case ModelEditPart.VISUAL_ID:
- return false;
- case ComponentEditPart.VISUAL_ID:
- return true;
- default:
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() {
- /**
- * @generated
- */
-
- public int getVisualID(View view) {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getVisualID(view);
- }
-
- /**
- * @generated
- */
-
- public String getModelID(View view) {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getModelID(view);
- }
-
- /**
- * @generated
- */
-
- public int getNodeVisualID(View containerView, EObject domainElement) {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .getNodeVisualID(containerView, domainElement);
- }
-
- /**
- * @generated
- */
-
- public boolean checkNodeVisualID(View containerView,
- EObject domainElement, int candidate) {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .checkNodeVisualID(containerView, domainElement, candidate);
- }
-
- /**
- * @generated
- */
-
- public boolean isCompartmentVisualID(int visualID) {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .isCompartmentVisualID(visualID);
- }
-
- /**
- * @generated
- */
-
- public boolean isSemanticLeafVisualID(int visualID) {
- return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry
- .isSemanticLeafVisualID(visualID);
- }
- };
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.part; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentNameEditPart; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.structure.DiagramStructure; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * This registry is used to determine which type of visual object should be + * created for the corresponding Diagram, Node, ChildNode or Link represented + * by a domain model object. + * + * @generated + */ +public class UMLVisualIDRegistry { + + /** + * @generated + */ + private static final String DEBUG_KEY = "org.eclipse.uml2.uml.diagram/debug/visualID"; //$NON-NLS-1$ + + /** + * @generated + */ + public static int getVisualID(View view) { + if (view instanceof Diagram) { + if (ModelEditPart.MODEL_ID.equals(view.getType())) { + return ModelEditPart.VISUAL_ID; + } else { + return -1; + } + } + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getVisualID(view.getType()); + } + + /** + * @generated + */ + public static String getModelID(View view) { + View diagram = view.getDiagram(); + while (view != diagram) { + EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ + if (annotation != null) { + return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$ + } + view = (View) view.eContainer(); + } + return diagram != null ? diagram.getType() : null; + } + + /** + * @generated + */ + public static int getVisualID(String type) { + try { + return Integer.parseInt(type); + } catch (NumberFormatException e) { + if (Boolean.TRUE.toString().equalsIgnoreCase( + Platform.getDebugOption(DEBUG_KEY))) { + UMLDiagramEditorPlugin.getInstance().logError( + "Unable to parse view type as a visualID number: " + + type); + } + } + return -1; + } + + /** + * @generated + */ + public static String getType(int visualID) { + return Integer.toString(visualID); + } + + /** + * @generated + */ + public static int getDiagramVisualID(EObject domainElement) { + if (domainElement == null) { + return -1; + } + if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf( + domainElement.eClass()) + && isDiagram((Model) domainElement)) { + return ModelEditPart.VISUAL_ID; + } + return -1; + } + + /** + * @generated + */ + public static int getNodeVisualID(View containerView, EObject domainElement) { + if (domainElement == null) { + return -1; + } + String containerModelID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getModelID(containerView); + if (!ModelEditPart.MODEL_ID.equals(containerModelID)) { + return -1; + } + int containerVisualID; + if (ModelEditPart.MODEL_ID.equals(containerModelID)) { + containerVisualID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getVisualID(containerView); + } else { + if (containerView instanceof Diagram) { + containerVisualID = ModelEditPart.VISUAL_ID; + } else { + return -1; + } + } + switch (containerVisualID) { + case ModelEditPart.VISUAL_ID: + if (UMLPackage.eINSTANCE.getComponent().isSuperTypeOf( + domainElement.eClass())) { + return ComponentEditPart.VISUAL_ID; + } + break; + } + return -1; + } + + /** + * @generated + */ + public static boolean canCreateNode(View containerView, int nodeVisualID) { + String containerModelID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getModelID(containerView); + if (!ModelEditPart.MODEL_ID.equals(containerModelID)) { + return false; + } + int containerVisualID; + if (ModelEditPart.MODEL_ID.equals(containerModelID)) { + containerVisualID = org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getVisualID(containerView); + } else { + if (containerView instanceof Diagram) { + containerVisualID = ModelEditPart.VISUAL_ID; + } else { + return false; + } + } + switch (containerVisualID) { + case ModelEditPart.VISUAL_ID: + if (ComponentEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ComponentEditPart.VISUAL_ID: + if (ComponentNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + } + return false; + } + + /** + * @generated + */ + public static int getLinkWithClassVisualID(EObject domainElement) { + if (domainElement == null) { + return -1; + } + return -1; + } + + /** + * User can change implementation of this method to handle some specific + * situations not covered by default logic. + * + * @generated + */ + private static boolean isDiagram(Model element) { + return true; + } + + /** + * @generated + */ + public static boolean checkNodeVisualID(View containerView, + EObject domainElement, int candidate) { + if (candidate == -1) { + //unrecognized id is always bad + return false; + } + int basic = getNodeVisualID(containerView, domainElement); + return basic == candidate; + } + + /** + * @generated + */ + public static boolean isCompartmentVisualID(int visualID) { + return false; + } + + /** + * @generated + */ + public static boolean isSemanticLeafVisualID(int visualID) { + switch (visualID) { + case ModelEditPart.VISUAL_ID: + return false; + case ComponentEditPart.VISUAL_ID: + return true; + default: + break; + } + return false; + } + + /** + * @generated + */ + public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() { + /** + * @generated + */ + + public int getVisualID(View view) { + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getVisualID(view); + } + + /** + * @generated + */ + + public String getModelID(View view) { + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getModelID(view); + } + + /** + * @generated + */ + + public int getNodeVisualID(View containerView, EObject domainElement) { + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .getNodeVisualID(containerView, domainElement); + } + + /** + * @generated + */ + + public boolean checkNodeVisualID(View containerView, + EObject domainElement, int candidate) { + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .checkNodeVisualID(containerView, domainElement, candidate); + } + + /** + * @generated + */ + + public boolean isCompartmentVisualID(int visualID) { + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .isCompartmentVisualID(visualID); + } + + /** + * @generated + */ + + public boolean isSemanticLeafVisualID(int visualID) { + return org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry + .isSemanticLeafVisualID(visualID); + } + }; + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLEditPartProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLEditPartProvider.java index dc7647a51e7..170cad7eca3 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLEditPartProvider.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLEditPartProvider.java @@ -1,21 +1,21 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.providers;
-
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DefaultEditPartProvider;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.UMLEditPartFactory;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLEditPartProvider extends DefaultEditPartProvider {
-
- /**
- * @generated
- */
- public UMLEditPartProvider() {
- super(new UMLEditPartFactory(), UMLVisualIDRegistry.TYPED_INSTANCE,
- ModelEditPart.MODEL_ID);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.providers; + +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DefaultEditPartProvider; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.UMLEditPartFactory; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLVisualIDRegistry; + +/** + * @generated + */ +public class UMLEditPartProvider extends DefaultEditPartProvider { + + /** + * @generated + */ + public UMLEditPartProvider() { + super(new UMLEditPartFactory(), UMLVisualIDRegistry.TYPED_INSTANCE, + ModelEditPart.MODEL_ID); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLElementTypes.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLElementTypes.java index 1b8c21ca8d2..bf8a3f8b082 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLElementTypes.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLElementTypes.java @@ -1,170 +1,170 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.providers;
-
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypes;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class UMLElementTypes {
-
- /**
- * @generated
- */
- private UMLElementTypes() {
- }
-
- /**
- * @generated
- */
- private static Map<IElementType, ENamedElement> elements;
-
- /**
- * @generated
- */
- private static DiagramElementTypeImages elementTypeImages = new DiagramElementTypeImages(
- UMLDiagramEditorPlugin.getInstance()
- .getItemProvidersAdapterFactory());
-
- /**
- * @generated
- */
- private static Set<IElementType> KNOWN_ELEMENT_TYPES;
-
- /**
- * @generated
- */
- public static final IElementType Model_1000 = getElementType("org.eclipse.uml2.uml.diagram.Model_1000"); //$NON-NLS-1$
- /**
- * @generated
- */
- public static final IElementType Component_2001 = getElementType("org.eclipse.uml2.uml.diagram.Component_2001"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static ImageDescriptor getImageDescriptor(ENamedElement element) {
- return elementTypeImages.getImageDescriptor(element);
- }
-
- /**
- * @generated
- */
- public static Image getImage(ENamedElement element) {
- return elementTypeImages.getImage(element);
- }
-
- /**
- * @generated
- */
- public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
- return getImageDescriptor(getElement(hint));
- }
-
- /**
- * @generated
- */
- public static Image getImage(IAdaptable hint) {
- return getImage(getElement(hint));
- }
-
- /**
- * Returns 'type' of the ecore object associated with the hint.
- *
- * @generated
- */
- public static ENamedElement getElement(IAdaptable hint) {
- Object type = hint.getAdapter(IElementType.class);
- if (elements == null) {
- elements = new IdentityHashMap<IElementType, ENamedElement>();
-
- elements.put(Model_1000, UMLPackage.eINSTANCE.getModel());
-
- elements.put(Component_2001, UMLPackage.eINSTANCE.getComponent());
- }
- return (ENamedElement) elements.get(type);
- }
-
- /**
- * @generated
- */
- private static IElementType getElementType(String id) {
- return ElementTypeRegistry.getInstance().getType(id);
- }
-
- /**
- * @generated
- */
- public static boolean isKnownElementType(IElementType elementType) {
- if (KNOWN_ELEMENT_TYPES == null) {
- KNOWN_ELEMENT_TYPES = new HashSet<IElementType>();
- KNOWN_ELEMENT_TYPES.add(Model_1000);
- KNOWN_ELEMENT_TYPES.add(Component_2001);
- }
- return KNOWN_ELEMENT_TYPES.contains(elementType);
- }
-
- /**
- * @generated
- */
- public static IElementType getElementType(int visualID) {
- switch (visualID) {
- case ModelEditPart.VISUAL_ID:
- return Model_1000;
- case ComponentEditPart.VISUAL_ID:
- return Component_2001;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public static final DiagramElementTypes TYPED_INSTANCE = new DiagramElementTypes(
- elementTypeImages) {
-
- /**
- * @generated
- */
- @Override
- public boolean isKnownElementType(IElementType elementType) {
- return org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes
- .isKnownElementType(elementType);
- }
-
- /**
- * @generated
- */
- @Override
- public IElementType getElementTypeForVisualId(int visualID) {
- return org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes
- .getElementType(visualID);
- }
-
- /**
- * @generated
- */
- @Override
- public ENamedElement getDefiningNamedElement(
- IAdaptable elementTypeAdapter) {
- return org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes
- .getElement(elementTypeAdapter);
- }
- };
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.providers; + +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypes; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ComponentEditPart; +import org.eclipse.papyrus.example.diagram.simplediagram.edit.parts.ModelEditPart; +import org.eclipse.papyrus.example.diagram.simplediagram.part.UMLDiagramEditorPlugin; +import org.eclipse.swt.graphics.Image; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class UMLElementTypes { + + /** + * @generated + */ + private UMLElementTypes() { + } + + /** + * @generated + */ + private static Map<IElementType, ENamedElement> elements; + + /** + * @generated + */ + private static DiagramElementTypeImages elementTypeImages = new DiagramElementTypeImages( + UMLDiagramEditorPlugin.getInstance() + .getItemProvidersAdapterFactory()); + + /** + * @generated + */ + private static Set<IElementType> KNOWN_ELEMENT_TYPES; + + /** + * @generated + */ + public static final IElementType Model_1000 = getElementType("org.eclipse.uml2.uml.diagram.Model_1000"); //$NON-NLS-1$ + /** + * @generated + */ + public static final IElementType Component_2001 = getElementType("org.eclipse.uml2.uml.diagram.Component_2001"); //$NON-NLS-1$ + + /** + * @generated + */ + public static ImageDescriptor getImageDescriptor(ENamedElement element) { + return elementTypeImages.getImageDescriptor(element); + } + + /** + * @generated + */ + public static Image getImage(ENamedElement element) { + return elementTypeImages.getImage(element); + } + + /** + * @generated + */ + public static ImageDescriptor getImageDescriptor(IAdaptable hint) { + return getImageDescriptor(getElement(hint)); + } + + /** + * @generated + */ + public static Image getImage(IAdaptable hint) { + return getImage(getElement(hint)); + } + + /** + * Returns 'type' of the ecore object associated with the hint. + * + * @generated + */ + public static ENamedElement getElement(IAdaptable hint) { + Object type = hint.getAdapter(IElementType.class); + if (elements == null) { + elements = new IdentityHashMap<IElementType, ENamedElement>(); + + elements.put(Model_1000, UMLPackage.eINSTANCE.getModel()); + + elements.put(Component_2001, UMLPackage.eINSTANCE.getComponent()); + } + return (ENamedElement) elements.get(type); + } + + /** + * @generated + */ + private static IElementType getElementType(String id) { + return ElementTypeRegistry.getInstance().getType(id); + } + + /** + * @generated + */ + public static boolean isKnownElementType(IElementType elementType) { + if (KNOWN_ELEMENT_TYPES == null) { + KNOWN_ELEMENT_TYPES = new HashSet<IElementType>(); + KNOWN_ELEMENT_TYPES.add(Model_1000); + KNOWN_ELEMENT_TYPES.add(Component_2001); + } + return KNOWN_ELEMENT_TYPES.contains(elementType); + } + + /** + * @generated + */ + public static IElementType getElementType(int visualID) { + switch (visualID) { + case ModelEditPart.VISUAL_ID: + return Model_1000; + case ComponentEditPart.VISUAL_ID: + return Component_2001; + } + return null; + } + + /** + * @generated + */ + public static final DiagramElementTypes TYPED_INSTANCE = new DiagramElementTypes( + elementTypeImages) { + + /** + * @generated + */ + @Override + public boolean isKnownElementType(IElementType elementType) { + return org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes + .isKnownElementType(elementType); + } + + /** + * @generated + */ + @Override + public IElementType getElementTypeForVisualId(int visualID) { + return org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes + .getElementType(visualID); + } + + /** + * @generated + */ + @Override + public ENamedElement getDefiningNamedElement( + IAdaptable elementTypeAdapter) { + return org.eclipse.papyrus.example.diagram.simplediagram.providers.UMLElementTypes + .getElement(elementTypeAdapter); + } + }; + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLIconProvider.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLIconProvider.java index 468b6e6223f..9a5a0b36b21 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLIconProvider.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/providers/UMLIconProvider.java @@ -1,19 +1,19 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.providers;
-
-import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DefaultElementTypeIconProvider;
-
-/**
- * @generated
- */
-public class UMLIconProvider extends DefaultElementTypeIconProvider implements
- IIconProvider {
-
- /**
- * @generated
- */
- public UMLIconProvider() {
- super(UMLElementTypes.TYPED_INSTANCE);
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.providers; + +import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DefaultElementTypeIconProvider; + +/** + * @generated + */ +public class UMLIconProvider extends DefaultElementTypeIconProvider implements + IIconProvider { + + /** + * @generated + */ + public UMLIconProvider() { + super(UMLElementTypes.TYPED_INSTANCE); + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/sheet/UMLPropertySection.java b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/sheet/UMLPropertySection.java index a2dfbd9a23c..c4bc608194b 100644 --- a/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/sheet/UMLPropertySection.java +++ b/examples/others/org.eclipse.papyrus.example.diagram.simplediagram/src/org/eclipse/papyrus/example/diagram/simplediagram/sheet/UMLPropertySection.java @@ -1,22 +1,22 @@ -package org.eclipse.papyrus.example.diagram.simplediagram.sheet;
-
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.sheet.DefaultPropertySection;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-
-/**
- * @generated
- */
-public class UMLPropertySection extends DefaultPropertySection implements
- IPropertySourceProvider {
-
- /**
- * Modify/unwrap selection.
- * @generated
- */
- @Override
- protected Object transformSelection(Object selected) {
- selected = /*super.*/transformSelectionToDomain(selected);
- return selected;
- }
-
-}
+package org.eclipse.papyrus.example.diagram.simplediagram.sheet; + +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.sheet.DefaultPropertySection; +import org.eclipse.ui.views.properties.IPropertySourceProvider; + +/** + * @generated + */ +public class UMLPropertySection extends DefaultPropertySection implements + IPropertySourceProvider { + + /** + * Modify/unwrap selection. + * @generated + */ + @Override + protected Object transformSelection(Object selected) { + selected = /*super.*/transformSelectionToDomain(selected); + return selected; + } + +} diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/.classpath b/examples/others/org.eclipse.papyrus.example.text.instance/.classpath index 45f024e850e..304e86186aa 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/.classpath +++ b/examples/others/org.eclipse.papyrus.example.text.instance/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/.project b/examples/others/org.eclipse.papyrus.example.text.instance/.project index 1f1bbbf348a..35c719b324a 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/.project +++ b/examples/others/org.eclipse.papyrus.example.text.instance/.project @@ -1,28 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.example.text.instance</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.example.text.instance</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/about.html b/examples/others/org.eclipse.papyrus.example.text.instance/about.html index 82d49bf5f81..d35d5aed64c 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/about.html +++ b/examples/others/org.eclipse.papyrus.example.text.instance/about.html @@ -1,28 +1,28 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html> diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/build.properties b/examples/others/org.eclipse.papyrus.example.text.instance/build.properties index 83183307edb..38c809d77da 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/build.properties +++ b/examples/others/org.eclipse.papyrus.example.text.instance/build.properties @@ -1,22 +1,22 @@ -# Copyright (c) 2012 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:
-# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
-#
-
-bin.includes = .,\
- model/,\
- META-INF/,\
- plugin.xml,\
- about.html,\
- plugin.properties,\
- build.properties
-jars.compile.order = .
-source.. = src/
-output.. = bin/
-src.includes = about.html
+# Copyright (c) 2012 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: +# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation +# + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + about.html,\ + plugin.properties,\ + build.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ +src.includes = about.html diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore b/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore index 1efefbcdd3e..cacc29ab16b 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore +++ b/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="papyrustextinstance" nsURI="http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance"
- nsPrefix="papyrustextinstance">
- <eClassifiers xsi:type="ecore:EClass" name="PapyrusTextInstance" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement">
- <eStructuralFeatures xsi:type="ecore:EReference" name="editedObject" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="papyrustextinstance" nsURI="http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance" + nsPrefix="papyrustextinstance"> + <eClassifiers xsi:type="ecore:EClass" name="PapyrusTextInstance" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="editedObject" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> +</ecore:EPackage> diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel b/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel index 02d981047ff..346cb6ed859 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel +++ b/examples/others/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel @@ -1,16 +1,16 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2012 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:
 Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
"
- modelDirectory="/org.eclipse.papyrus.example.text.instance/src" modelPluginID="org.eclipse.papyrus.example.text.instance"
- modelName="Papyrustextinstance" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0"
- copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
- <foreignModel>papyrustextinstance.ecore</foreignModel>
- <genPackages prefix="Papyrustextinstance" basePackage="org.eclipse.papyrus.example.test.instance"
- disposableProviderFactory="true" ecorePackage="papyrustextinstance.ecore#/">
- <genClasses ecoreClass="papyrustextinstance.ecore#//PapyrusTextInstance">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference papyrustextinstance.ecore#//PapyrusTextInstance/editedObject"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrustextinstance.ecore#//PapyrusTextInstance/type"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrustextinstance.ecore#//PapyrusTextInstance/name"/>
- </genClasses>
- </genPackages>
-</genmodel:GenModel>
+<?xml version="1.0" encoding="UTF-8"?> +<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2012 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:
 Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
" + modelDirectory="/org.eclipse.papyrus.example.text.instance/src" modelPluginID="org.eclipse.papyrus.example.text.instance" + modelName="Papyrustextinstance" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" + copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore"> + <foreignModel>papyrustextinstance.ecore</foreignModel> + <genPackages prefix="Papyrustextinstance" basePackage="org.eclipse.papyrus.example.test.instance" + disposableProviderFactory="true" ecorePackage="papyrustextinstance.ecore#/"> + <genClasses ecoreClass="papyrustextinstance.ecore#//PapyrusTextInstance"> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference papyrustextinstance.ecore#//PapyrusTextInstance/editedObject"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrustextinstance.ecore#//PapyrusTextInstance/type"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrustextinstance.ecore#//PapyrusTextInstance/name"/> + </genClasses> + </genPackages> +</genmodel:GenModel> diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/plugin.properties b/examples/others/org.eclipse.papyrus.example.text.instance/plugin.properties index 6cb01adb217..1036a1530bc 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/plugin.properties +++ b/examples/others/org.eclipse.papyrus.example.text.instance/plugin.properties @@ -1,15 +1,15 @@ -# Copyright (c) 2012 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:
-# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
-#
-
-pluginName = Papyrus Text Editor Example (Incubation)
-providerName = Eclipse Modeling Project
-
+# Copyright (c) 2012 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: +# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation +# + +pluginName = Papyrus Text Editor Example (Incubation) +providerName = Eclipse Modeling Project + pluginDescription=This plugin provides the content model for the papyrus text editor
\ No newline at end of file diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/plugin.xml b/examples/others/org.eclipse.papyrus.example.text.instance/plugin.xml index 35c4d727312..436174b2165 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/plugin.xml +++ b/examples/others/org.eclipse.papyrus.example.text.instance/plugin.xml @@ -1,26 +1,26 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-
-<!--
- Copyright (c) 2012 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:
- Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
-
--->
-
-<plugin>
-
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
- uri="http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance"
- class="org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage"
- genModel="model/papyrustextinstance.genmodel"/>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- + Copyright (c) 2012 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: + Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + +--> + +<plugin> + + <extension point="org.eclipse.emf.ecore.generated_package"> + <package + uri="http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance" + class="org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage" + genModel="model/papyrustextinstance.genmodel"/> + </extension> + +</plugin> diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrusTextInstance.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrusTextInstance.java index bfc86b555f1..70fe01e0c41 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrusTextInstance.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrusTextInstance.java @@ -1,115 +1,115 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Papyrus Text Instance</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}</li>
- * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}</li>
- * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance()
- * @model
- * @generated
- */
-public interface PapyrusTextInstance extends EModelElement {
- /**
- * Returns the value of the '<em><b>Edited Object</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Edited Object</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Edited Object</em>' reference.
- * @see #setEditedObject(EObject)
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_EditedObject()
- * @model
- * @generated
- */
- EObject getEditedObject();
-
- /**
- * Sets the value of the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Edited Object</em>' reference.
- * @see #getEditedObject()
- * @generated
- */
- void setEditedObject(EObject value);
-
- /**
- * Returns the value of the '<em><b>Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Type</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Type</em>' attribute.
- * @see #setType(String)
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_Type()
- * @model
- * @generated
- */
- String getType();
-
- /**
- * Sets the value of the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Type</em>' attribute.
- * @see #getType()
- * @generated
- */
- void setType(String value);
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_Name()
- * @model
- * @generated
- */
- String getName();
-
- /**
- * Sets the value of the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- void setName(String value);
-
-} // PapyrusTextInstance
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance; + +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Papyrus Text Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}</li> + * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}</li> + * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance() + * @model + * @generated + */ +public interface PapyrusTextInstance extends EModelElement { + /** + * Returns the value of the '<em><b>Edited Object</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Edited Object</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Edited Object</em>' reference. + * @see #setEditedObject(EObject) + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_EditedObject() + * @model + * @generated + */ + EObject getEditedObject(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Edited Object</em>' reference. + * @see #getEditedObject() + * @generated + */ + void setEditedObject(EObject value); + + /** + * Returns the value of the '<em><b>Type</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Type</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Type</em>' attribute. + * @see #setType(String) + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_Type() + * @model + * @generated + */ + String getType(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Type</em>' attribute. + * @see #getType() + * @generated + */ + void setType(String value); + + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Name</em>' attribute. + * @see #setName(String) + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Name</em>' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // PapyrusTextInstance diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstanceFactory.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstanceFactory.java index b63d4820bdc..4d39347cad6 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstanceFactory.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstanceFactory.java @@ -1,52 +1,52 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage
- * @generated
- */
-public interface PapyrustextinstanceFactory extends EFactory {
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- PapyrustextinstanceFactory eINSTANCE = org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstanceFactoryImpl.init();
-
- /**
- * Returns a new object of class '<em>Papyrus Text Instance</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Papyrus Text Instance</em>'.
- * @generated
- */
- PapyrusTextInstance createPapyrusTextInstance();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package supported by this factory.
- * @generated
- */
- PapyrustextinstancePackage getPapyrustextinstancePackage();
-
-} //PapyrustextinstanceFactory
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage + * @generated + */ +public interface PapyrustextinstanceFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + PapyrustextinstanceFactory eINSTANCE = org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstanceFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Papyrus Text Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Papyrus Text Instance</em>'. + * @generated + */ + PapyrusTextInstance createPapyrusTextInstance(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + PapyrustextinstancePackage getPapyrustextinstancePackage(); + +} //PapyrustextinstanceFactory diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstancePackage.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstancePackage.java index 098e6014f2e..ceb6ceefbff 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstancePackage.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/PapyrustextinstancePackage.java @@ -1,226 +1,226 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstanceFactory
- * @model kind="package"
- * @generated
- */
-public interface PapyrustextinstancePackage extends EPackage {
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNAME = "papyrustextinstance";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_URI = "http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_PREFIX = "papyrustextinstance";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- PapyrustextinstancePackage eINSTANCE = org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl <em>Papyrus Text Instance</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl#getPapyrusTextInstance()
- * @generated
- */
- int PAPYRUS_TEXT_INSTANCE = 0;
-
- /**
- * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_TEXT_INSTANCE__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS;
-
- /**
- * The feature id for the '<em><b>Edited Object</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_TEXT_INSTANCE__TYPE = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_TEXT_INSTANCE__NAME = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Papyrus Text Instance</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_TEXT_INSTANCE_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 3;
-
-
- /**
- * Returns the meta object for class '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance <em>Papyrus Text Instance</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Papyrus Text Instance</em>'.
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance
- * @generated
- */
- EClass getPapyrusTextInstance();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Edited Object</em>'.
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject()
- * @see #getPapyrusTextInstance()
- * @generated
- */
- EReference getPapyrusTextInstance_EditedObject();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Type</em>'.
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType()
- * @see #getPapyrusTextInstance()
- * @generated
- */
- EAttribute getPapyrusTextInstance_Type();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName()
- * @see #getPapyrusTextInstance()
- * @generated
- */
- EAttribute getPapyrusTextInstance_Name();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- PapyrustextinstanceFactory getPapyrustextinstanceFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- interface Literals {
- /**
- * The meta object literal for the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl <em>Papyrus Text Instance</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl#getPapyrusTextInstance()
- * @generated
- */
- EClass PAPYRUS_TEXT_INSTANCE = eINSTANCE.getPapyrusTextInstance();
-
- /**
- * The meta object literal for the '<em><b>Edited Object</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT = eINSTANCE.getPapyrusTextInstance_EditedObject();
-
- /**
- * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute PAPYRUS_TEXT_INSTANCE__TYPE = eINSTANCE.getPapyrusTextInstance_Type();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute PAPYRUS_TEXT_INSTANCE__NAME = eINSTANCE.getPapyrusTextInstance_Name();
-
- }
-
-} //PapyrustextinstancePackage
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstanceFactory + * @model kind="package" + * @generated + */ +public interface PapyrustextinstancePackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "papyrustextinstance"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "papyrustextinstance"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + PapyrustextinstancePackage eINSTANCE = org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl <em>Papyrus Text Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl#getPapyrusTextInstance() + * @generated + */ + int PAPYRUS_TEXT_INSTANCE = 0; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PAPYRUS_TEXT_INSTANCE__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Edited Object</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Type</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PAPYRUS_TEXT_INSTANCE__TYPE = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PAPYRUS_TEXT_INSTANCE__NAME = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the '<em>Papyrus Text Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PAPYRUS_TEXT_INSTANCE_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 3; + + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance <em>Papyrus Text Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Papyrus Text Instance</em>'. + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance + * @generated + */ + EClass getPapyrusTextInstance(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Edited Object</em>'. + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject() + * @see #getPapyrusTextInstance() + * @generated + */ + EReference getPapyrusTextInstance_EditedObject(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Type</em>'. + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getType() + * @see #getPapyrusTextInstance() + * @generated + */ + EAttribute getPapyrusTextInstance_Type(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Name</em>'. + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance#getName() + * @see #getPapyrusTextInstance() + * @generated + */ + EAttribute getPapyrusTextInstance_Name(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + PapyrustextinstanceFactory getPapyrustextinstanceFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl <em>Papyrus Text Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl#getPapyrusTextInstance() + * @generated + */ + EClass PAPYRUS_TEXT_INSTANCE = eINSTANCE.getPapyrusTextInstance(); + + /** + * The meta object literal for the '<em><b>Edited Object</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT = eINSTANCE.getPapyrusTextInstance_EditedObject(); + + /** + * The meta object literal for the '<em><b>Type</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute PAPYRUS_TEXT_INSTANCE__TYPE = eINSTANCE.getPapyrusTextInstance_Type(); + + /** + * The meta object literal for the '<em><b>Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute PAPYRUS_TEXT_INSTANCE__NAME = eINSTANCE.getPapyrusTextInstance_Name(); + + } + +} //PapyrustextinstancePackage diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java index ac9c90a6d53..358c23bd40a 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java @@ -1,289 +1,289 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.EModelElementImpl;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Papyrus Text Instance</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getEditedObject <em>Edited Object</em>}</li>
- * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getType <em>Type</em>}</li>
- * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class PapyrusTextInstanceImpl extends EModelElementImpl implements PapyrusTextInstance {
- /**
- * The cached value of the '{@link #getEditedObject() <em>Edited Object</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getEditedObject()
- * @generated
- * @ordered
- */
- protected EObject editedObject;
-
- /**
- * The default value of the '{@link #getType() <em>Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getType()
- * @generated
- * @ordered
- */
- protected static final String TYPE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getType()
- * @generated
- * @ordered
- */
- protected String type = TYPE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PapyrusTextInstanceImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return PapyrustextinstancePackage.Literals.PAPYRUS_TEXT_INSTANCE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EObject getEditedObject() {
- if (editedObject != null && editedObject.eIsProxy()) {
- InternalEObject oldEditedObject = (InternalEObject)editedObject;
- editedObject = eResolveProxy(oldEditedObject);
- if (editedObject != oldEditedObject) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT, oldEditedObject, editedObject));
- }
- }
- return editedObject;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EObject basicGetEditedObject() {
- return editedObject;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setEditedObject(EObject newEditedObject) {
- EObject oldEditedObject = editedObject;
- editedObject = newEditedObject;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT, oldEditedObject, editedObject));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getType() {
- return type;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setType(String newType) {
- String oldType = type;
- type = newType;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE, oldType, type));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME, oldName, name));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
- if (resolve) return getEditedObject();
- return basicGetEditedObject();
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
- return getType();
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
- return getName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
- setEditedObject((EObject)newValue);
- return;
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
- setType((String)newValue);
- return;
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
- setName((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
- setEditedObject((EObject)null);
- return;
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
- setType(TYPE_EDEFAULT);
- return;
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
- setName(NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
- return editedObject != null;
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
- return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (type: ");
- result.append(type);
- result.append(", name: ");
- result.append(name);
- result.append(')');
- return result.toString();
- }
-
-} //PapyrusTextInstanceImpl
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.EModelElementImpl; +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance; +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Papyrus Text Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getEditedObject <em>Edited Object</em>}</li> + * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getType <em>Type</em>}</li> + * <li>{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class PapyrusTextInstanceImpl extends EModelElementImpl implements PapyrusTextInstance { + /** + * The cached value of the '{@link #getEditedObject() <em>Edited Object</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEditedObject() + * @generated + * @ordered + */ + protected EObject editedObject; + + /** + * The default value of the '{@link #getType() <em>Type</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getType() + * @generated + * @ordered + */ + protected static final String TYPE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getType() <em>Type</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getType() + * @generated + * @ordered + */ + protected String type = TYPE_EDEFAULT; + + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected PapyrusTextInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return PapyrustextinstancePackage.Literals.PAPYRUS_TEXT_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getEditedObject() { + if (editedObject != null && editedObject.eIsProxy()) { + InternalEObject oldEditedObject = (InternalEObject)editedObject; + editedObject = eResolveProxy(oldEditedObject); + if (editedObject != oldEditedObject) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT, oldEditedObject, editedObject)); + } + } + return editedObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetEditedObject() { + return editedObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setEditedObject(EObject newEditedObject) { + EObject oldEditedObject = editedObject; + editedObject = newEditedObject; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT, oldEditedObject, editedObject)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getType() { + return type; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setType(String newType) { + String oldType = type; + type = newType; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE, oldType, type)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME, oldName, name)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT: + if (resolve) return getEditedObject(); + return basicGetEditedObject(); + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE: + return getType(); + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT: + setEditedObject((EObject)newValue); + return; + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE: + setType((String)newValue); + return; + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT: + setEditedObject((EObject)null); + return; + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE: + setType(TYPE_EDEFAULT); + return; + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT: + return editedObject != null; + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE: + return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (type: "); + result.append(type); + result.append(", name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //PapyrusTextInstanceImpl diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java index 109a41b16f6..1301cc712e4 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java @@ -1,105 +1,105 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.*;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class PapyrustextinstanceFactoryImpl extends EFactoryImpl implements PapyrustextinstanceFactory {
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static PapyrustextinstanceFactory init() {
- try {
- PapyrustextinstanceFactory thePapyrustextinstanceFactory = (PapyrustextinstanceFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance");
- if (thePapyrustextinstanceFactory != null) {
- return thePapyrustextinstanceFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new PapyrustextinstanceFactoryImpl();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrustextinstanceFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE: return createPapyrusTextInstance();
- default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrusTextInstance createPapyrusTextInstance() {
- PapyrusTextInstanceImpl papyrusTextInstance = new PapyrusTextInstanceImpl();
- return papyrusTextInstance;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrustextinstancePackage getPapyrustextinstancePackage() {
- return (PapyrustextinstancePackage)getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static PapyrustextinstancePackage getPackage() {
- return PapyrustextinstancePackage.eINSTANCE;
- }
-
-} //PapyrustextinstanceFactoryImpl
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class PapyrustextinstanceFactoryImpl extends EFactoryImpl implements PapyrustextinstanceFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static PapyrustextinstanceFactory init() { + try { + PapyrustextinstanceFactory thePapyrustextinstanceFactory = (PapyrustextinstanceFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance"); + if (thePapyrustextinstanceFactory != null) { + return thePapyrustextinstanceFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new PapyrustextinstanceFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PapyrustextinstanceFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE: return createPapyrusTextInstance(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PapyrusTextInstance createPapyrusTextInstance() { + PapyrusTextInstanceImpl papyrusTextInstance = new PapyrusTextInstanceImpl(); + return papyrusTextInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PapyrustextinstancePackage getPapyrustextinstancePackage() { + return (PapyrustextinstancePackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static PapyrustextinstancePackage getPackage() { + return PapyrustextinstancePackage.eINSTANCE; + } + +} //PapyrustextinstanceFactoryImpl diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java index 88af35e9cfc..ad510dc3592 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java @@ -1,218 +1,218 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstanceFactory;
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Package</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class PapyrustextinstancePackageImpl extends EPackageImpl implements PapyrustextinstancePackage {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass papyrusTextInstanceEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#eNS_URI
- * @see #init()
- * @generated
- */
- private PapyrustextinstancePackageImpl() {
- super(eNS_URI, PapyrustextinstanceFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
- * <p>This method is used to initialize {@link PapyrustextinstancePackage#eINSTANCE} when that field is accessed.
- * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static PapyrustextinstancePackage init() {
- if (isInited) return (PapyrustextinstancePackage)EPackage.Registry.INSTANCE.getEPackage(PapyrustextinstancePackage.eNS_URI);
-
- // Obtain or create and register package
- PapyrustextinstancePackageImpl thePapyrustextinstancePackage = (PapyrustextinstancePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PapyrustextinstancePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PapyrustextinstancePackageImpl());
-
- isInited = true;
-
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
-
- // Create package meta-data objects
- thePapyrustextinstancePackage.createPackageContents();
-
- // Initialize created meta-data
- thePapyrustextinstancePackage.initializePackageContents();
-
- // Mark meta-data to indicate it can't be changed
- thePapyrustextinstancePackage.freeze();
-
-
- // Update the registry and return the package
- EPackage.Registry.INSTANCE.put(PapyrustextinstancePackage.eNS_URI, thePapyrustextinstancePackage);
- return thePapyrustextinstancePackage;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getPapyrusTextInstance() {
- return papyrusTextInstanceEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getPapyrusTextInstance_EditedObject() {
- return (EReference)papyrusTextInstanceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getPapyrusTextInstance_Type() {
- return (EAttribute)papyrusTextInstanceEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getPapyrusTextInstance_Name() {
- return (EAttribute)papyrusTextInstanceEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrustextinstanceFactory getPapyrustextinstanceFactory() {
- return (PapyrustextinstanceFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated) return;
- isCreated = true;
-
- // Create classes and their features
- papyrusTextInstanceEClass = createEClass(PAPYRUS_TEXT_INSTANCE);
- createEReference(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT);
- createEAttribute(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__TYPE);
- createEAttribute(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__NAME);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized) return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Obtain other dependent packages
- EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
-
- // Create type parameters
-
- // Set bounds for type parameters
-
- // Add supertypes to classes
- papyrusTextInstanceEClass.getESuperTypes().add(theEcorePackage.getEModelElement());
-
- // Initialize classes and features; add operations and parameters
- initEClass(papyrusTextInstanceEClass, PapyrusTextInstance.class, "PapyrusTextInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getPapyrusTextInstance_EditedObject(), theEcorePackage.getEObject(), null, "editedObject", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPapyrusTextInstance_Type(), ecorePackage.getEString(), "type", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPapyrusTextInstance_Name(), ecorePackage.getEString(), "name", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- // Create resource
- createResource(eNS_URI);
- }
-
-} //PapyrustextinstancePackageImpl
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance; +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstanceFactory; +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class PapyrustextinstancePackageImpl extends EPackageImpl implements PapyrustextinstancePackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass papyrusTextInstanceEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage#eNS_URI + * @see #init() + * @generated + */ + private PapyrustextinstancePackageImpl() { + super(eNS_URI, PapyrustextinstanceFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link PapyrustextinstancePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static PapyrustextinstancePackage init() { + if (isInited) return (PapyrustextinstancePackage)EPackage.Registry.INSTANCE.getEPackage(PapyrustextinstancePackage.eNS_URI); + + // Obtain or create and register package + PapyrustextinstancePackageImpl thePapyrustextinstancePackage = (PapyrustextinstancePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PapyrustextinstancePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PapyrustextinstancePackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thePapyrustextinstancePackage.createPackageContents(); + + // Initialize created meta-data + thePapyrustextinstancePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thePapyrustextinstancePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(PapyrustextinstancePackage.eNS_URI, thePapyrustextinstancePackage); + return thePapyrustextinstancePackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getPapyrusTextInstance() { + return papyrusTextInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getPapyrusTextInstance_EditedObject() { + return (EReference)papyrusTextInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getPapyrusTextInstance_Type() { + return (EAttribute)papyrusTextInstanceEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getPapyrusTextInstance_Name() { + return (EAttribute)papyrusTextInstanceEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PapyrustextinstanceFactory getPapyrustextinstanceFactory() { + return (PapyrustextinstanceFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + papyrusTextInstanceEClass = createEClass(PAPYRUS_TEXT_INSTANCE); + createEReference(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT); + createEAttribute(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__TYPE); + createEAttribute(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__NAME); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + papyrusTextInstanceEClass.getESuperTypes().add(theEcorePackage.getEModelElement()); + + // Initialize classes and features; add operations and parameters + initEClass(papyrusTextInstanceEClass, PapyrusTextInstance.class, "PapyrusTextInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPapyrusTextInstance_EditedObject(), theEcorePackage.getEObject(), null, "editedObject", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPapyrusTextInstance_Type(), ecorePackage.getEString(), "type", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPapyrusTextInstance_Name(), ecorePackage.getEString(), "name", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //PapyrustextinstancePackageImpl diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java index 43e0df23636..611e831fc44 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java @@ -1,149 +1,149 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.*;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage
- * @generated
- */
-public class PapyrustextinstanceAdapterFactory extends AdapterFactoryImpl {
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static PapyrustextinstancePackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrustextinstanceAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = PapyrustextinstancePackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject)object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch that delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PapyrustextinstanceSwitch<Adapter> modelSwitch =
- new PapyrustextinstanceSwitch<Adapter>() {
- @Override
- public Adapter casePapyrusTextInstance(PapyrusTextInstance object) {
- return createPapyrusTextInstanceAdapter();
- }
- @Override
- public Adapter caseEModelElement(EModelElement object) {
- return createEModelElementAdapter();
- }
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject)target);
- }
-
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance <em>Papyrus Text Instance</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance
- * @generated
- */
- public Adapter createPapyrusTextInstanceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.emf.ecore.EModelElement
- * @generated
- */
- public Adapter createEModelElementAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} //PapyrustextinstanceAdapterFactory
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage + * @generated + */ +public class PapyrustextinstanceAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static PapyrustextinstancePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PapyrustextinstanceAdapterFactory() { + if (modelPackage == null) { + modelPackage = PapyrustextinstancePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected PapyrustextinstanceSwitch<Adapter> modelSwitch = + new PapyrustextinstanceSwitch<Adapter>() { + @Override + public Adapter casePapyrusTextInstance(PapyrusTextInstance object) { + return createPapyrusTextInstanceAdapter(); + } + @Override + public Adapter caseEModelElement(EModelElement object) { + return createEModelElementAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance <em>Papyrus Text Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance + * @generated + */ + public Adapter createPapyrusTextInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EModelElement + * @generated + */ + public Adapter createEModelElementAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //PapyrustextinstanceAdapterFactory diff --git a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java index 9807eb9bf56..98b3da42643 100644 --- a/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java +++ b/examples/others/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/text/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java @@ -1,137 +1,137 @@ -/**
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.example.text.instance.papyrustextinstance.util;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.emf.ecore.util.Switch;
-
-import org.eclipse.papyrus.example.text.instance.papyrustextinstance.*;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage
- * @generated
- */
-public class PapyrustextinstanceSwitch<T> extends Switch<T> {
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static PapyrustextinstancePackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrustextinstanceSwitch() {
- if (modelPackage == null) {
- modelPackage = PapyrustextinstancePackage.eINSTANCE;
- }
- }
-
- /**
- * Checks whether this is a switch for the given package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @parameter ePackage the package in question.
- * @return whether this is a switch for the given package.
- * @generated
- */
- @Override
- protected boolean isSwitchFor(EPackage ePackage) {
- return ePackage == modelPackage;
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- @Override
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE: {
- PapyrusTextInstance papyrusTextInstance = (PapyrusTextInstance)theEObject;
- T result = casePapyrusTextInstance(papyrusTextInstance);
- if (result == null) result = caseEModelElement(papyrusTextInstance);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- default: return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Papyrus Text Instance</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Papyrus Text Instance</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePapyrusTextInstance(PapyrusTextInstance object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseEModelElement(EModelElement object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- @Override
- public T defaultCase(EObject object) {
- return null;
- }
-
-} //PapyrustextinstanceSwitch
+/** + * Copyright (c) 2012 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: + * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + */ +package org.eclipse.papyrus.example.text.instance.papyrustextinstance.util; + +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.eclipse.papyrus.example.text.instance.papyrustextinstance.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrustextinstancePackage + * @generated + */ +public class PapyrustextinstanceSwitch<T> extends Switch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static PapyrustextinstancePackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public PapyrustextinstanceSwitch() { + if (modelPackage == null) { + modelPackage = PapyrustextinstancePackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE: { + PapyrusTextInstance papyrusTextInstance = (PapyrusTextInstance)theEObject; + T result = casePapyrusTextInstance(papyrusTextInstance); + if (result == null) result = caseEModelElement(papyrusTextInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Papyrus Text Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Papyrus Text Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePapyrusTextInstance(PapyrusTextInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEModelElement(EModelElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //PapyrustextinstanceSwitch |