0001: /*
0002: * ChainBuilder ESB
0003: * Visual Enterprise Integration
0004: *
0005: * Copyright (C) 2006 Bostech Corporation
0006: *
0007: * This program is free software; you can redistribute it and/or modify it
0008: * under the terms of the GNU General Public License as published by the
0009: * Free Software Foundation; either version 2 of the License, or (at your option)
0010: * any later version.
0011: *
0012: * This program is distributed in the hope that it will be useful,
0013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
0014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0015: * for more details.
0016: *
0017: * You should have received a copy of the GNU General Public License along with
0018: * this program; if not, write to the Free Software Foundation, Inc.,
0019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0020: *
0021: *
0022: * $Id$
0023: */
0024: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.edit.parts;
0025:
0026: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.CBR;
0027: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Comment;
0028: import java.util.Collection;
0029: import java.util.Collections;
0030: import java.util.HashMap;
0031: import java.util.Iterator;
0032: import java.util.LinkedList;
0033: import java.util.List;
0034: import java.util.Map;
0035:
0036: import org.eclipse.draw2d.FreeformLayer;
0037: import org.eclipse.draw2d.FreeformLayout;
0038: import org.eclipse.draw2d.IFigure;
0039: import org.eclipse.draw2d.MarginBorder;
0040: import org.eclipse.draw2d.geometry.Dimension;
0041: import org.eclipse.draw2d.geometry.Point;
0042: import org.eclipse.draw2d.geometry.Rectangle;
0043: import org.eclipse.emf.common.command.AbstractCommand;
0044: import org.eclipse.emf.common.command.CompoundCommand;
0045: import org.eclipse.emf.common.notify.Notification;
0046: import org.eclipse.emf.common.notify.impl.AdapterImpl;
0047: import org.eclipse.emf.ecore.EObject;
0048: import org.eclipse.emf.ecore.EStructuralFeature;
0049: import org.eclipse.emf.ecore.util.EContentAdapter;
0050: import org.eclipse.emf.edit.command.AddCommand;
0051: import org.eclipse.emf.transaction.NotificationFilter;
0052: import org.eclipse.emf.transaction.RecordingCommand;
0053: import org.eclipse.emf.transaction.ResourceSetChangeEvent;
0054: import org.eclipse.emf.transaction.ResourceSetListenerImpl;
0055: import org.eclipse.emf.transaction.TransactionalEditingDomain;
0056: import org.eclipse.emf.transaction.util.TransactionUtil;
0057: import org.eclipse.gef.EditPart;
0058: import org.eclipse.gef.EditPolicy;
0059: import org.eclipse.gef.SnapToGrid;
0060: import org.eclipse.gef.SnapToHelper;
0061: import org.eclipse.gef.commands.Command;
0062: import org.eclipse.gef.commands.UnexecutableCommand;
0063: import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
0064: import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
0065: import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
0066: import org.eclipse.gef.requests.ChangeBoundsRequest;
0067: import org.eclipse.gef.requests.CreateRequest;
0068: import org.eclipse.gmf.runtime.notation.Bounds;
0069: import org.eclipse.gmf.runtime.notation.Diagram;
0070: import org.eclipse.gmf.runtime.notation.Node;
0071: import org.eclipse.gmf.runtime.notation.NotationFactory;
0072: import org.eclipse.gmf.runtime.notation.NotationPackage;
0073: import org.eclipse.gmf.runtime.notation.View;
0074: import org.eclipse.jface.wizard.WizardDialog;
0075: import org.eclipse.ui.PlatformUI;
0076:
0077: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ComponentFlowEditorDocument;
0078: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Custom;
0079: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Email;
0080: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ComponentFlowEditorElement;
0081: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ExternalSystem;
0082: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.FTP;
0083: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.File;
0084: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.HTTP;
0085: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.JDBC;
0086: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.JMS;
0087: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Parser;
0088: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Script;
0089: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Sequencer;
0090: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.TCPIP;
0091: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Transformer;
0092: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.XSLT;
0093: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.componentflowFactory;
0094: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.componentflowPackage;
0095: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.edit.commands.CreateNotationalElementCommand;
0096: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.edit.commands.RemoveNotationalElementCommand;
0097: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.edit.commands.ReplaceNotationalElementCommand;
0098: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorPaletteFactory;
0099: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorVisualIDRegistry;
0100: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.CBRViewFactory;
0101: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.CommentViewFactory;
0102: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.CustomViewFactory;
0103: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.DomainElementInitializer;
0104: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.EmailViewFactory;
0105: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.ExternalSystemViewFactory;
0106: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.FTPViewFactory;
0107: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.FileViewFactory;
0108: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.HTTPViewFactory;
0109: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.JDBCViewFactory;
0110: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.JMSViewFactory;
0111: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.ParserViewFactory;
0112: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.ScriptViewFactory;
0113: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.SequencerViewFactory;
0114: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.TCPIPViewFactory;
0115: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.TransformerViewFactory;
0116: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.view.factories.XSLTViewFactory;
0117: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards.CBRPropertyWizard;
0118:
0119: /**
0120: * @generated
0121: */
0122: public class ComponentFlowEditorDocumentEditPart extends
0123: AbstractGraphicalEditPart implements IUpdatableEditPart {
0124: /**
0125: * @generated
0126: */
0127: public static String MODEL_ID = "ComponentFlowEditor";
0128:
0129: /**
0130: * @generated
0131: */
0132: public static final int VISUAL_ID = 1000;
0133:
0134: /**
0135: * @generated
0136: */
0137: public ComponentFlowEditorDocumentEditPart(Diagram model) {
0138: setModel(model);
0139: }
0140:
0141: /**
0142: * @generated NOT
0143: */
0144: public void wizardOut(View view, boolean newCom) {
0145: // NOTHING to do here
0146: }
0147:
0148: /**
0149: * @generated
0150: */
0151: public Diagram getDiagram() {
0152: return (Diagram) getModel();
0153: }
0154:
0155: /**
0156: * @generated
0157: */
0158: protected void createEditPolicies() {
0159: installEditPolicy(EditPolicy.COMPONENT_ROLE,
0160: new RootComponentEditPolicy());
0161: installEditPolicy(EditPolicy.LAYOUT_ROLE,
0162: new XYLayoutEditPolicy() {
0163: protected Command getCreateCommand(
0164: CreateRequest request) {
0165: if (request instanceof ComponentFlowEditorPaletteFactory.CreateRequestEx) {
0166: ComponentFlowEditorPaletteFactory.CreateRequestEx requestEx = (ComponentFlowEditorPaletteFactory.CreateRequestEx) request;
0167: int[] visualIds = requestEx.getVisualIds();
0168: CompoundCommand result = new CompoundCommand();
0169: for (int i = 0; i < visualIds.length; i++) {
0170: int nextVisualId = visualIds[i];
0171: switch (nextVisualId) {
0172: case TransformerEditPart.VISUAL_ID:
0173: result
0174: .append(new CreateTransformer2001Command(
0175: getDiagram(),
0176: requestEx,
0177: (Rectangle) getConstraintFor(request)));
0178: break;
0179: case ParserEditPart.VISUAL_ID:
0180: result
0181: .append(new CreateParser2002Command(
0182: getDiagram(),
0183: requestEx,
0184: (Rectangle) getConstraintFor(request)));
0185: break;
0186: case HTTPEditPart.VISUAL_ID:
0187: result
0188: .append(new CreateHTTP2003Command(
0189: getDiagram(),
0190: requestEx,
0191: (Rectangle) getConstraintFor(request)));
0192: break;
0193: case XSLTEditPart.VISUAL_ID:
0194: result
0195: .append(new CreateXSLT2004Command(
0196: getDiagram(),
0197: requestEx,
0198: (Rectangle) getConstraintFor(request)));
0199: break;
0200: case FTPEditPart.VISUAL_ID:
0201: result
0202: .append(new CreateFTP2005Command(
0203: getDiagram(),
0204: requestEx,
0205: (Rectangle) getConstraintFor(request)));
0206: break;
0207: case JMSEditPart.VISUAL_ID:
0208: result
0209: .append(new CreateJMS2006Command(
0210: getDiagram(),
0211: requestEx,
0212: (Rectangle) getConstraintFor(request)));
0213: break;
0214: case ExternalSystemEditPart.VISUAL_ID:
0215: result
0216: .append(new CreateExternalSystem2007Command(
0217: getDiagram(),
0218: requestEx,
0219: (Rectangle) getConstraintFor(request)));
0220: break;
0221: case FileEditPart.VISUAL_ID:
0222: result
0223: .append(new CreateFile2008Command(
0224: getDiagram(),
0225: requestEx,
0226: (Rectangle) getConstraintFor(request)));
0227: break;
0228: case SequencerEditPart.VISUAL_ID:
0229: result
0230: .append(new CreateSequencer2009Command(
0231: getDiagram(),
0232: requestEx,
0233: (Rectangle) getConstraintFor(request)));
0234: break;
0235: case CBREditPart.VISUAL_ID:
0236: result
0237: .append(new CreateCBR2010Command(
0238: getDiagram(),
0239: requestEx,
0240: (Rectangle) getConstraintFor(request)));
0241: break;
0242: case JDBCEditPart.VISUAL_ID:
0243: result
0244: .append(new CreateJDBC2011Command(
0245: getDiagram(),
0246: requestEx,
0247: (Rectangle) getConstraintFor(request)));
0248: break;
0249: case ScriptEditPart.VISUAL_ID:
0250: result
0251: .append(new CreateScript2012Command(
0252: getDiagram(),
0253: requestEx,
0254: (Rectangle) getConstraintFor(request)));
0255: break;
0256: case CommentEditPart.VISUAL_ID:
0257: result
0258: .append(new CreateComment2013Command(
0259: getDiagram(),
0260: requestEx,
0261: (Rectangle) getConstraintFor(request)));
0262: break;
0263: case TCPIPEditPart.VISUAL_ID:
0264: result
0265: .append(new CreateTCPIP2014Command(
0266: getDiagram(),
0267: requestEx,
0268: (Rectangle) getConstraintFor(request)));
0269: break;
0270: case CustomEditPart.VISUAL_ID:
0271: result
0272: .append(new CreateCustom2015Command(
0273: getDiagram(),
0274: requestEx,
0275: (Rectangle) getConstraintFor(request)));
0276: break;
0277: case EmailEditPart.VISUAL_ID:
0278: result
0279: .append(new CreateEmail2016Command(
0280: getDiagram(),
0281: requestEx,
0282: (Rectangle) getConstraintFor(request)));
0283: break;
0284: }
0285: }
0286: return new WrappingCommand(TransactionUtil
0287: .getEditingDomain(getDiagram()
0288: .getElement()), result);
0289: }
0290: return null;
0291: }
0292:
0293: protected Command createChangeConstraintCommand(
0294: final ChangeBoundsRequest request,
0295: EditPart child, Object constraint) {
0296: final Node node = (Node) child.getModel();
0297: org.eclipse.emf.common.command.Command emfCommand = new AbstractCommand(
0298: "Change node position/size") {
0299: private Point moveDelta;
0300:
0301: private Dimension resizeDelta;
0302:
0303: public boolean canUndo() {
0304: return canExecute();
0305: }
0306:
0307: protected boolean prepare() {
0308: if (node.getLayoutConstraint() instanceof Bounds == false) {
0309: return false;
0310: }
0311: Bounds bounds = (Bounds) node
0312: .getLayoutConstraint();
0313: Rectangle original = new Rectangle(
0314: bounds.getX(), bounds.getY(),
0315: bounds.getWidth(), bounds
0316: .getHeight());
0317: Rectangle transformed = request
0318: .getTransformedRectangle(original);
0319: resizeDelta = transformed.getSize()
0320: .expand(
0321: original.getSize()
0322: .negate());
0323: moveDelta = transformed.getTopLeft()
0324: .translate(
0325: original.getTopLeft()
0326: .negate());
0327: return true;
0328: }
0329:
0330: public void undo() {
0331: execute(moveDelta.getNegated(),
0332: resizeDelta.getNegated());
0333: }
0334:
0335: public void execute() {
0336: execute(moveDelta, resizeDelta);
0337: }
0338:
0339: public void redo() {
0340: execute();
0341: }
0342:
0343: private void execute(Point move,
0344: Dimension resize) {
0345: Bounds bounds = (Bounds) node
0346: .getLayoutConstraint();
0347: bounds.setX(bounds.getX() + move.x);
0348: bounds.setY(bounds.getY() + move.y);
0349: bounds.setWidth(bounds.getWidth()
0350: + resize.width);
0351: bounds.setHeight(bounds.getHeight()
0352: + resize.height);
0353: }
0354: };
0355: return new WrappingCommand(TransactionUtil
0356: .getEditingDomain(getDiagram()
0357: .getElement()), emfCommand);
0358: }
0359:
0360: protected Command createChangeConstraintCommand(
0361: EditPart child, Object constraint) {
0362: assert false;
0363: return UnexecutableCommand.INSTANCE;
0364: }
0365: });
0366: installNotationModelRefresher();
0367: }
0368:
0369: /**
0370: * @generated
0371: */
0372: protected IFigure createFigure() {
0373: IFigure f = new FreeformLayer();
0374: f.setBorder(new MarginBorder(5));
0375: f.setLayoutManager(new FreeformLayout());
0376: return f;
0377: }
0378:
0379: /**
0380: * @generated
0381: */
0382: public Object getAdapter(Class key) {
0383: if (SnapToHelper.class == key) {
0384: return new SnapToGrid(this );
0385: }
0386: return super .getAdapter(key);
0387: }
0388:
0389: /**
0390: * @generated
0391: */
0392: protected List getModelChildren() {
0393: return getDiagram().getVisibleChildren();
0394: }
0395:
0396: /**
0397: * @generated
0398: */
0399: private static class CreateTransformer2001NotationCommand extends
0400: CreateNotationalElementCommand {
0401: /**
0402: * @generated not
0403: */
0404: private CreateTransformer2001NotationCommand(View parent,
0405: EObject domainElement, Rectangle constraint) {
0406: super (parent);
0407: Node createdNode = NotationFactory.eINSTANCE.createNode();
0408: setCreatedView(createdNode);
0409: createdNode.setElement(domainElement);
0410: TransformerViewFactory.decorateView(createdNode);
0411: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
0412: createdNode.setLayoutConstraint(bounds);
0413: bounds.setX(constraint.x);
0414: bounds.setY(constraint.y);
0415: bounds.setWidth(Math.max(constraint.width, 60));
0416: bounds.setHeight(Math.max(constraint.height, 60));
0417: }
0418: }
0419:
0420: /**
0421: * @generated
0422: */
0423: private static class CreateTransformer2001Command extends
0424: AbstractCommand {
0425: /**
0426: * @generated
0427: */
0428: private final CreateTransformer2001NotationCommand notationAddCommand;
0429:
0430: /**
0431: * @generated
0432: */
0433: public CreateTransformer2001Command(
0434: View parent,
0435: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
0436: Rectangle constraint) {
0437: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
0438: .getEditingDomain(parent.getDiagram().getElement());
0439: Transformer createdDomainElement = componentflowFactory.eINSTANCE
0440: .createTransformer();
0441:
0442: DomainElementInitializer.Transformer_2001
0443: .initializeElement(createdDomainElement);
0444: this .domainModelAddCommand = AddCommand
0445: .create(
0446: domainModelEditDomain,
0447: parent.getElement(),
0448: componentflowPackage.eINSTANCE
0449: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
0450: createdDomainElement);
0451: this .notationAddCommand = new CreateTransformer2001NotationCommand(
0452: parent, createdDomainElement, constraint);
0453: request.setCreatedObject(notationAddCommand
0454: .getCreatedView());
0455: }
0456:
0457: /**
0458: * @generated NOT
0459: */
0460: public void wizardOut(View view, boolean newCom) {
0461: // NOTHING to do here
0462: }
0463:
0464: /**
0465: * @generated
0466: */
0467: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
0468:
0469: /**
0470: * @generated
0471: */
0472: public boolean canExecute() {
0473: return domainModelAddCommand != null
0474: && domainModelAddCommand.canExecute()
0475: && notationAddCommand != null
0476: && notationAddCommand.canExecute();
0477: }
0478:
0479: /**
0480: * @generated
0481: */
0482: public boolean canUndo() {
0483: return domainModelAddCommand != null
0484: && domainModelAddCommand.canUndo()
0485: && notationAddCommand != null
0486: && notationAddCommand.canUndo();
0487: }
0488:
0489: /**
0490: * @generated
0491: */
0492: public void execute() {
0493: domainModelAddCommand.execute();
0494: notationAddCommand.execute();
0495: }
0496:
0497: /**
0498: * @generated
0499: */
0500: public void undo() {
0501: notationAddCommand.undo();
0502: domainModelAddCommand.undo();
0503: }
0504:
0505: /**
0506: * @generated
0507: */
0508: public void redo() {
0509: execute();
0510: }
0511: }
0512:
0513: /**
0514: * @generated
0515: */
0516: private static class CreateParser2002NotationCommand extends
0517: CreateNotationalElementCommand {
0518: /**
0519: * @generated not
0520: */
0521: private CreateParser2002NotationCommand(View parent,
0522: EObject domainElement, Rectangle constraint) {
0523: super (parent);
0524: Node createdNode = NotationFactory.eINSTANCE.createNode();
0525: setCreatedView(createdNode);
0526: createdNode.setElement(domainElement);
0527: ParserViewFactory.decorateView(createdNode);
0528: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
0529: createdNode.setLayoutConstraint(bounds);
0530: bounds.setX(constraint.x);
0531: bounds.setY(constraint.y);
0532: bounds.setWidth(Math.max(constraint.width, 60));
0533: bounds.setHeight(Math.max(constraint.height, 60));
0534: }
0535: }
0536:
0537: /**
0538: * @generated
0539: */
0540: private static class CreateParser2002Command extends
0541: AbstractCommand {
0542: /**
0543: * @generated
0544: */
0545: private final CreateParser2002NotationCommand notationAddCommand;
0546:
0547: /**
0548: * @generated
0549: */
0550: public CreateParser2002Command(
0551: View parent,
0552: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
0553: Rectangle constraint) {
0554: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
0555: .getEditingDomain(parent.getDiagram().getElement());
0556: Parser createdDomainElement = componentflowFactory.eINSTANCE
0557: .createParser();
0558:
0559: DomainElementInitializer.Parser_2002
0560: .initializeElement(createdDomainElement);
0561: this .domainModelAddCommand = AddCommand
0562: .create(
0563: domainModelEditDomain,
0564: parent.getElement(),
0565: componentflowPackage.eINSTANCE
0566: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
0567: createdDomainElement);
0568: this .notationAddCommand = new CreateParser2002NotationCommand(
0569: parent, createdDomainElement, constraint);
0570: request.setCreatedObject(notationAddCommand
0571: .getCreatedView());
0572: }
0573:
0574: /**
0575: * @generated
0576: */
0577: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
0578:
0579: /**
0580: * @generated
0581: */
0582: public boolean canExecute() {
0583: return domainModelAddCommand != null
0584: && domainModelAddCommand.canExecute()
0585: && notationAddCommand != null
0586: && notationAddCommand.canExecute();
0587: }
0588:
0589: /**
0590: * @generated
0591: */
0592: public boolean canUndo() {
0593: return domainModelAddCommand != null
0594: && domainModelAddCommand.canUndo()
0595: && notationAddCommand != null
0596: && notationAddCommand.canUndo();
0597: }
0598:
0599: /**
0600: * @generated
0601: */
0602: public void execute() {
0603: domainModelAddCommand.execute();
0604: notationAddCommand.execute();
0605: }
0606:
0607: /**
0608: * @generated
0609: */
0610: public void undo() {
0611: notationAddCommand.undo();
0612: domainModelAddCommand.undo();
0613: }
0614:
0615: /**
0616: * @generated
0617: */
0618: public void redo() {
0619: execute();
0620: }
0621: }
0622:
0623: /**
0624: * @generated
0625: */
0626: private static class CreateHTTP2003NotationCommand extends
0627: CreateNotationalElementCommand {
0628: /**
0629: * @generated not
0630: */
0631: private CreateHTTP2003NotationCommand(View parent,
0632: EObject domainElement, Rectangle constraint) {
0633: super (parent);
0634: Node createdNode = NotationFactory.eINSTANCE.createNode();
0635: setCreatedView(createdNode);
0636: createdNode.setElement(domainElement);
0637: HTTPViewFactory.decorateView(createdNode);
0638: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
0639: createdNode.setLayoutConstraint(bounds);
0640: bounds.setX(constraint.x);
0641: bounds.setY(constraint.y);
0642: bounds.setWidth(Math.max(constraint.width, 60));
0643: bounds.setHeight(Math.max(constraint.height, 60));
0644: }
0645: }
0646:
0647: /**
0648: * @generated
0649: */
0650: private static class CreateHTTP2003Command extends AbstractCommand {
0651: /**
0652: * @generated
0653: */
0654: private final CreateHTTP2003NotationCommand notationAddCommand;
0655:
0656: /**
0657: * @generated
0658: */
0659: public CreateHTTP2003Command(
0660: View parent,
0661: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
0662: Rectangle constraint) {
0663: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
0664: .getEditingDomain(parent.getDiagram().getElement());
0665: HTTP createdDomainElement = componentflowFactory.eINSTANCE
0666: .createHTTP();
0667:
0668: DomainElementInitializer.HTTP_2003
0669: .initializeElement(createdDomainElement);
0670: this .domainModelAddCommand = AddCommand
0671: .create(
0672: domainModelEditDomain,
0673: parent.getElement(),
0674: componentflowPackage.eINSTANCE
0675: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
0676: createdDomainElement);
0677: this .notationAddCommand = new CreateHTTP2003NotationCommand(
0678: parent, createdDomainElement, constraint);
0679: request.setCreatedObject(notationAddCommand
0680: .getCreatedView());
0681: }
0682:
0683: /**
0684: * @generated
0685: */
0686: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
0687:
0688: /**
0689: * @generated
0690: */
0691: public boolean canExecute() {
0692: return domainModelAddCommand != null
0693: && domainModelAddCommand.canExecute()
0694: && notationAddCommand != null
0695: && notationAddCommand.canExecute();
0696: }
0697:
0698: /**
0699: * @generated
0700: */
0701: public boolean canUndo() {
0702: return domainModelAddCommand != null
0703: && domainModelAddCommand.canUndo()
0704: && notationAddCommand != null
0705: && notationAddCommand.canUndo();
0706: }
0707:
0708: /**
0709: * @generated
0710: */
0711: public void execute() {
0712: domainModelAddCommand.execute();
0713: notationAddCommand.execute();
0714: }
0715:
0716: /**
0717: * @generated
0718: */
0719: public void undo() {
0720: notationAddCommand.undo();
0721: domainModelAddCommand.undo();
0722: }
0723:
0724: /**
0725: * @generated
0726: */
0727: public void redo() {
0728: execute();
0729: }
0730: }
0731:
0732: /**
0733: * @generated
0734: */
0735: private static class CreateXSLT2004NotationCommand extends
0736: CreateNotationalElementCommand {
0737: /**
0738: * @generated not
0739: */
0740: private CreateXSLT2004NotationCommand(View parent,
0741: EObject domainElement, Rectangle constraint) {
0742: super (parent);
0743: Node createdNode = NotationFactory.eINSTANCE.createNode();
0744: setCreatedView(createdNode);
0745: createdNode.setElement(domainElement);
0746: XSLTViewFactory.decorateView(createdNode);
0747: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
0748: createdNode.setLayoutConstraint(bounds);
0749: bounds.setX(constraint.x);
0750: bounds.setY(constraint.y);
0751: bounds.setWidth(Math.max(constraint.width, 60));
0752: bounds.setHeight(Math.max(constraint.height, 60));
0753: }
0754: }
0755:
0756: /**
0757: * @generated
0758: */
0759: private static class CreateXSLT2004Command extends AbstractCommand {
0760: /**
0761: * @generated
0762: */
0763: private final CreateXSLT2004NotationCommand notationAddCommand;
0764:
0765: /**
0766: * @generated
0767: */
0768: public CreateXSLT2004Command(
0769: View parent,
0770: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
0771: Rectangle constraint) {
0772: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
0773: .getEditingDomain(parent.getDiagram().getElement());
0774: XSLT createdDomainElement = componentflowFactory.eINSTANCE
0775: .createXSLT();
0776:
0777: DomainElementInitializer.XSLT_2004
0778: .initializeElement(createdDomainElement);
0779: this .domainModelAddCommand = AddCommand
0780: .create(
0781: domainModelEditDomain,
0782: parent.getElement(),
0783: componentflowPackage.eINSTANCE
0784: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
0785: createdDomainElement);
0786: this .notationAddCommand = new CreateXSLT2004NotationCommand(
0787: parent, createdDomainElement, constraint);
0788: request.setCreatedObject(notationAddCommand
0789: .getCreatedView());
0790: }
0791:
0792: /**
0793: * @generated
0794: */
0795: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
0796:
0797: /**
0798: * @generated
0799: */
0800: public boolean canExecute() {
0801: return domainModelAddCommand != null
0802: && domainModelAddCommand.canExecute()
0803: && notationAddCommand != null
0804: && notationAddCommand.canExecute();
0805: }
0806:
0807: /**
0808: * @generated
0809: */
0810: public boolean canUndo() {
0811: return domainModelAddCommand != null
0812: && domainModelAddCommand.canUndo()
0813: && notationAddCommand != null
0814: && notationAddCommand.canUndo();
0815: }
0816:
0817: /**
0818: * @generated
0819: */
0820: public void execute() {
0821: domainModelAddCommand.execute();
0822: notationAddCommand.execute();
0823: }
0824:
0825: /**
0826: * @generated
0827: */
0828: public void undo() {
0829: notationAddCommand.undo();
0830: domainModelAddCommand.undo();
0831: }
0832:
0833: /**
0834: * @generated
0835: */
0836: public void redo() {
0837: execute();
0838: }
0839: }
0840:
0841: /**
0842: * @generated
0843: */
0844: private static class CreateFTP2005NotationCommand extends
0845: CreateNotationalElementCommand {
0846: /**
0847: * @generated not
0848: */
0849: private CreateFTP2005NotationCommand(View parent,
0850: EObject domainElement, Rectangle constraint) {
0851: super (parent);
0852: Node createdNode = NotationFactory.eINSTANCE.createNode();
0853: setCreatedView(createdNode);
0854: createdNode.setElement(domainElement);
0855: FTPViewFactory.decorateView(createdNode);
0856: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
0857: createdNode.setLayoutConstraint(bounds);
0858: bounds.setX(constraint.x);
0859: bounds.setY(constraint.y);
0860: bounds.setWidth(Math.max(constraint.width, 60));
0861: bounds.setHeight(Math.max(constraint.height, 60));
0862: }
0863: }
0864:
0865: /**
0866: * @generated
0867: */
0868: private static class CreateFTP2005Command extends AbstractCommand {
0869: /**
0870: * @generated
0871: */
0872: private final CreateFTP2005NotationCommand notationAddCommand;
0873:
0874: /**
0875: * @generated
0876: */
0877: public CreateFTP2005Command(
0878: View parent,
0879: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
0880: Rectangle constraint) {
0881: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
0882: .getEditingDomain(parent.getDiagram().getElement());
0883: FTP createdDomainElement = componentflowFactory.eINSTANCE
0884: .createFTP();
0885:
0886: DomainElementInitializer.FTP_2005
0887: .initializeElement(createdDomainElement);
0888: this .domainModelAddCommand = AddCommand
0889: .create(
0890: domainModelEditDomain,
0891: parent.getElement(),
0892: componentflowPackage.eINSTANCE
0893: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
0894: createdDomainElement);
0895: this .notationAddCommand = new CreateFTP2005NotationCommand(
0896: parent, createdDomainElement, constraint);
0897: request.setCreatedObject(notationAddCommand
0898: .getCreatedView());
0899: }
0900:
0901: /**
0902: * @generated
0903: */
0904: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
0905:
0906: /**
0907: * @generated
0908: */
0909: public boolean canExecute() {
0910: return domainModelAddCommand != null
0911: && domainModelAddCommand.canExecute()
0912: && notationAddCommand != null
0913: && notationAddCommand.canExecute();
0914: }
0915:
0916: /**
0917: * @generated
0918: */
0919: public boolean canUndo() {
0920: return domainModelAddCommand != null
0921: && domainModelAddCommand.canUndo()
0922: && notationAddCommand != null
0923: && notationAddCommand.canUndo();
0924: }
0925:
0926: /**
0927: * @generated
0928: */
0929: public void execute() {
0930: domainModelAddCommand.execute();
0931: notationAddCommand.execute();
0932: }
0933:
0934: /**
0935: * @generated
0936: */
0937: public void undo() {
0938: notationAddCommand.undo();
0939: domainModelAddCommand.undo();
0940: }
0941:
0942: /**
0943: * @generated
0944: */
0945: public void redo() {
0946: execute();
0947: }
0948: }
0949:
0950: /**
0951: * @generated
0952: */
0953: private static class CreateJMS2006NotationCommand extends
0954: CreateNotationalElementCommand {
0955: /**
0956: * @generated not
0957: */
0958: private CreateJMS2006NotationCommand(View parent,
0959: EObject domainElement, Rectangle constraint) {
0960: super (parent);
0961: Node createdNode = NotationFactory.eINSTANCE.createNode();
0962: setCreatedView(createdNode);
0963: createdNode.setElement(domainElement);
0964: JMSViewFactory.decorateView(createdNode);
0965: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
0966: createdNode.setLayoutConstraint(bounds);
0967: bounds.setX(constraint.x);
0968: bounds.setY(constraint.y);
0969: bounds.setWidth(Math.max(constraint.width, 60));
0970: bounds.setHeight(Math.max(constraint.height, 60));
0971: }
0972: }
0973:
0974: /**
0975: * @generated
0976: */
0977: private static class CreateJMS2006Command extends AbstractCommand {
0978: /**
0979: * @generated
0980: */
0981: private final CreateJMS2006NotationCommand notationAddCommand;
0982:
0983: /**
0984: * @generated
0985: */
0986: public CreateJMS2006Command(
0987: View parent,
0988: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
0989: Rectangle constraint) {
0990: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
0991: .getEditingDomain(parent.getDiagram().getElement());
0992: JMS createdDomainElement = componentflowFactory.eINSTANCE
0993: .createJMS();
0994:
0995: DomainElementInitializer.JMS_2006
0996: .initializeElement(createdDomainElement);
0997: this .domainModelAddCommand = AddCommand
0998: .create(
0999: domainModelEditDomain,
1000: parent.getElement(),
1001: componentflowPackage.eINSTANCE
1002: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1003: createdDomainElement);
1004: this .notationAddCommand = new CreateJMS2006NotationCommand(
1005: parent, createdDomainElement, constraint);
1006: request.setCreatedObject(notationAddCommand
1007: .getCreatedView());
1008: }
1009:
1010: /**
1011: * @generated
1012: */
1013: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1014:
1015: /**
1016: * @generated
1017: */
1018: public boolean canExecute() {
1019: return domainModelAddCommand != null
1020: && domainModelAddCommand.canExecute()
1021: && notationAddCommand != null
1022: && notationAddCommand.canExecute();
1023: }
1024:
1025: /**
1026: * @generated
1027: */
1028: public boolean canUndo() {
1029: return domainModelAddCommand != null
1030: && domainModelAddCommand.canUndo()
1031: && notationAddCommand != null
1032: && notationAddCommand.canUndo();
1033: }
1034:
1035: /**
1036: * @generated
1037: */
1038: public void execute() {
1039: domainModelAddCommand.execute();
1040: notationAddCommand.execute();
1041: }
1042:
1043: /**
1044: * @generated
1045: */
1046: public void undo() {
1047: notationAddCommand.undo();
1048: domainModelAddCommand.undo();
1049: }
1050:
1051: /**
1052: * @generated
1053: */
1054: public void redo() {
1055: execute();
1056: }
1057: }
1058:
1059: /**
1060: * @generated
1061: */
1062: private static class CreateExternalSystem2007NotationCommand extends
1063: CreateNotationalElementCommand {
1064: /**
1065: * @generated not
1066: */
1067: private CreateExternalSystem2007NotationCommand(View parent,
1068: EObject domainElement, Rectangle constraint) {
1069: super (parent);
1070: Node createdNode = NotationFactory.eINSTANCE.createNode();
1071: setCreatedView(createdNode);
1072: createdNode.setElement(domainElement);
1073: ExternalSystemViewFactory.decorateView(createdNode);
1074: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1075: createdNode.setLayoutConstraint(bounds);
1076: bounds.setX(constraint.x);
1077: bounds.setY(constraint.y);
1078: bounds.setWidth(Math.max(constraint.width, 60));
1079: bounds.setHeight(Math.max(constraint.height, 60));
1080: }
1081: }
1082:
1083: /**
1084: * @generated
1085: */
1086: private static class CreateExternalSystem2007Command extends
1087: AbstractCommand {
1088: /**
1089: * @generated
1090: */
1091: private final CreateExternalSystem2007NotationCommand notationAddCommand;
1092:
1093: /**
1094: * @generated
1095: */
1096: public CreateExternalSystem2007Command(
1097: View parent,
1098: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1099: Rectangle constraint) {
1100: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1101: .getEditingDomain(parent.getDiagram().getElement());
1102: ExternalSystem createdDomainElement = componentflowFactory.eINSTANCE
1103: .createExternalSystem();
1104:
1105: DomainElementInitializer.ExternalSystem_2007
1106: .initializeElement(createdDomainElement);
1107: this .domainModelAddCommand = AddCommand
1108: .create(
1109: domainModelEditDomain,
1110: parent.getElement(),
1111: componentflowPackage.eINSTANCE
1112: .getComponentFlowEditorDocument_DecorativeModelElements(),
1113: createdDomainElement);
1114: this .notationAddCommand = new CreateExternalSystem2007NotationCommand(
1115: parent, createdDomainElement, constraint);
1116: request.setCreatedObject(notationAddCommand
1117: .getCreatedView());
1118: }
1119:
1120: /**
1121: * @generated
1122: */
1123: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1124:
1125: /**
1126: * @generated
1127: */
1128: public boolean canExecute() {
1129: return domainModelAddCommand != null
1130: && domainModelAddCommand.canExecute()
1131: && notationAddCommand != null
1132: && notationAddCommand.canExecute();
1133: }
1134:
1135: /**
1136: * @generated
1137: */
1138: public boolean canUndo() {
1139: return domainModelAddCommand != null
1140: && domainModelAddCommand.canUndo()
1141: && notationAddCommand != null
1142: && notationAddCommand.canUndo();
1143: }
1144:
1145: /**
1146: * @generated
1147: */
1148: public void execute() {
1149: domainModelAddCommand.execute();
1150: notationAddCommand.execute();
1151: }
1152:
1153: /**
1154: * @generated
1155: */
1156: public void undo() {
1157: notationAddCommand.undo();
1158: domainModelAddCommand.undo();
1159: }
1160:
1161: /**
1162: * @generated
1163: */
1164: public void redo() {
1165: execute();
1166: }
1167: }
1168:
1169: /**
1170: * @generated
1171: */
1172: private static class CreateFile2008NotationCommand extends
1173: CreateNotationalElementCommand {
1174: /**
1175: * @generated not
1176: */
1177: private CreateFile2008NotationCommand(View parent,
1178: EObject domainElement, Rectangle constraint) {
1179: super (parent);
1180: Node createdNode = NotationFactory.eINSTANCE.createNode();
1181: setCreatedView(createdNode);
1182: createdNode.setElement(domainElement);
1183: FileViewFactory.decorateView(createdNode);
1184: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1185: createdNode.setLayoutConstraint(bounds);
1186: bounds.setX(constraint.x);
1187: bounds.setY(constraint.y);
1188: bounds.setWidth(Math.max(constraint.width, 60));
1189: bounds.setHeight(Math.max(constraint.height, 60));
1190: }
1191: }
1192:
1193: /**
1194: * @generated
1195: */
1196: private static class CreateFile2008Command extends AbstractCommand {
1197: /**
1198: * @generated
1199: */
1200: private final CreateFile2008NotationCommand notationAddCommand;
1201:
1202: /**
1203: * @generated
1204: */
1205: public CreateFile2008Command(
1206: View parent,
1207: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1208: Rectangle constraint) {
1209: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1210: .getEditingDomain(parent.getDiagram().getElement());
1211: File createdDomainElement = componentflowFactory.eINSTANCE
1212: .createFile();
1213:
1214: DomainElementInitializer.File_2008
1215: .initializeElement(createdDomainElement);
1216: this .domainModelAddCommand = AddCommand
1217: .create(
1218: domainModelEditDomain,
1219: parent.getElement(),
1220: componentflowPackage.eINSTANCE
1221: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1222: createdDomainElement);
1223: this .notationAddCommand = new CreateFile2008NotationCommand(
1224: parent, createdDomainElement, constraint);
1225: request.setCreatedObject(notationAddCommand
1226: .getCreatedView());
1227: }
1228:
1229: /**
1230: * @generated
1231: */
1232: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1233:
1234: /**
1235: * @generated
1236: */
1237: public boolean canExecute() {
1238: return domainModelAddCommand != null
1239: && domainModelAddCommand.canExecute()
1240: && notationAddCommand != null
1241: && notationAddCommand.canExecute();
1242: }
1243:
1244: /**
1245: * @generated
1246: */
1247: public boolean canUndo() {
1248: return domainModelAddCommand != null
1249: && domainModelAddCommand.canUndo()
1250: && notationAddCommand != null
1251: && notationAddCommand.canUndo();
1252: }
1253:
1254: /**
1255: * @generated
1256: */
1257: public void execute() {
1258: domainModelAddCommand.execute();
1259: notationAddCommand.execute();
1260: }
1261:
1262: /**
1263: * @generated
1264: */
1265: public void undo() {
1266: notationAddCommand.undo();
1267: domainModelAddCommand.undo();
1268: }
1269:
1270: /**
1271: * @generated
1272: */
1273: public void redo() {
1274: execute();
1275: }
1276: }
1277:
1278: /**
1279: * @generated
1280: */
1281: private static class CreateSequencer2009NotationCommand extends
1282: CreateNotationalElementCommand {
1283: /**
1284: * @generated not
1285: */
1286: private CreateSequencer2009NotationCommand(View parent,
1287: EObject domainElement, Rectangle constraint) {
1288: super (parent);
1289: Node createdNode = NotationFactory.eINSTANCE.createNode();
1290: setCreatedView(createdNode);
1291: createdNode.setElement(domainElement);
1292: SequencerViewFactory.decorateView(createdNode);
1293: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1294: createdNode.setLayoutConstraint(bounds);
1295: bounds.setX(constraint.x);
1296: bounds.setY(constraint.y);
1297: bounds.setWidth(Math.max(constraint.width, 60));
1298: bounds.setHeight(Math.max(constraint.height, 60));
1299: }
1300: }
1301:
1302: /**
1303: * @generated
1304: */
1305: private static class CreateSequencer2009Command extends
1306: AbstractCommand {
1307: /**
1308: * @generated
1309: */
1310: private final CreateSequencer2009NotationCommand notationAddCommand;
1311:
1312: /**
1313: * @generated
1314: */
1315: public CreateSequencer2009Command(
1316: View parent,
1317: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1318: Rectangle constraint) {
1319: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1320: .getEditingDomain(parent.getDiagram().getElement());
1321: Sequencer createdDomainElement = componentflowFactory.eINSTANCE
1322: .createSequencer();
1323:
1324: DomainElementInitializer.Sequencer_2009
1325: .initializeElement(createdDomainElement);
1326: this .domainModelAddCommand = AddCommand
1327: .create(
1328: domainModelEditDomain,
1329: parent.getElement(),
1330: componentflowPackage.eINSTANCE
1331: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1332: createdDomainElement);
1333: this .notationAddCommand = new CreateSequencer2009NotationCommand(
1334: parent, createdDomainElement, constraint);
1335: request.setCreatedObject(notationAddCommand
1336: .getCreatedView());
1337: }
1338:
1339: /**
1340: * @generated
1341: */
1342: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1343:
1344: /**
1345: * @generated
1346: */
1347: public boolean canExecute() {
1348: return domainModelAddCommand != null
1349: && domainModelAddCommand.canExecute()
1350: && notationAddCommand != null
1351: && notationAddCommand.canExecute();
1352: }
1353:
1354: /**
1355: * @generated
1356: */
1357: public boolean canUndo() {
1358: return domainModelAddCommand != null
1359: && domainModelAddCommand.canUndo()
1360: && notationAddCommand != null
1361: && notationAddCommand.canUndo();
1362: }
1363:
1364: /**
1365: * @generated
1366: */
1367: public void execute() {
1368: domainModelAddCommand.execute();
1369: notationAddCommand.execute();
1370: }
1371:
1372: /**
1373: * @generated
1374: */
1375: public void undo() {
1376: notationAddCommand.undo();
1377: domainModelAddCommand.undo();
1378: }
1379:
1380: /**
1381: * @generated
1382: */
1383: public void redo() {
1384: execute();
1385: }
1386: }
1387:
1388: /**
1389: * @generated
1390: */
1391: private static class CreateCBR2010NotationCommand extends
1392: CreateNotationalElementCommand {
1393: /**
1394: * @generated NOT
1395: */
1396: private CreateCBR2010NotationCommand(View parent,
1397: EObject domainElement, Rectangle constraint) {
1398: super (parent);
1399: Node createdNode = NotationFactory.eINSTANCE.createNode();
1400: setCreatedView(createdNode);
1401: createdNode.setElement(domainElement);
1402: CBRViewFactory.decorateView(createdNode);
1403: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1404: createdNode.setLayoutConstraint(bounds);
1405: bounds.setX(constraint.x);
1406: bounds.setY(constraint.y);
1407: bounds.setWidth(Math.max(constraint.width, 60));
1408: bounds.setHeight(Math.max(constraint.height, 60));
1409: }
1410: }
1411:
1412: /**
1413: * @generated
1414: */
1415: private static class CreateCBR2010Command extends AbstractCommand {
1416: /**
1417: * @generated
1418: */
1419: private final CreateCBR2010NotationCommand notationAddCommand;
1420:
1421: /**
1422: * @generated
1423: */
1424: public CreateCBR2010Command(
1425: View parent,
1426: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1427: Rectangle constraint) {
1428: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1429: .getEditingDomain(parent.getDiagram().getElement());
1430: CBR createdDomainElement = componentflowFactory.eINSTANCE
1431: .createCBR();
1432:
1433: DomainElementInitializer.CBR_2010
1434: .initializeElement(createdDomainElement);
1435: this .domainModelAddCommand = AddCommand
1436: .create(
1437: domainModelEditDomain,
1438: parent.getElement(),
1439: componentflowPackage.eINSTANCE
1440: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1441: createdDomainElement);
1442: this .notationAddCommand = new CreateCBR2010NotationCommand(
1443: parent, createdDomainElement, constraint);
1444: request.setCreatedObject(notationAddCommand
1445: .getCreatedView());
1446: }
1447:
1448: /**
1449: * @generated
1450: */
1451: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1452:
1453: /**
1454: * @generated
1455: */
1456: public boolean canExecute() {
1457: return domainModelAddCommand != null
1458: && domainModelAddCommand.canExecute()
1459: && notationAddCommand != null
1460: && notationAddCommand.canExecute();
1461: }
1462:
1463: /**
1464: * @generated
1465: */
1466: public boolean canUndo() {
1467: return domainModelAddCommand != null
1468: && domainModelAddCommand.canUndo()
1469: && notationAddCommand != null
1470: && notationAddCommand.canUndo();
1471: }
1472:
1473: /**
1474: * @generated
1475: */
1476: public void execute() {
1477: domainModelAddCommand.execute();
1478: notationAddCommand.execute();
1479: }
1480:
1481: /**
1482: * @generated
1483: */
1484: public void undo() {
1485: notationAddCommand.undo();
1486: domainModelAddCommand.undo();
1487: }
1488:
1489: /**
1490: * @generated
1491: */
1492: public void redo() {
1493: execute();
1494: }
1495: }
1496:
1497: /**
1498: * @generated
1499: */
1500: private static class CreateJDBC2011NotationCommand extends
1501: CreateNotationalElementCommand {
1502: /**
1503: * @generated NOT
1504: */
1505: private CreateJDBC2011NotationCommand(View parent,
1506: EObject domainElement, Rectangle constraint) {
1507: super (parent);
1508: Node createdNode = NotationFactory.eINSTANCE.createNode();
1509: setCreatedView(createdNode);
1510: createdNode.setElement(domainElement);
1511: JDBCViewFactory.decorateView(createdNode);
1512: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1513: createdNode.setLayoutConstraint(bounds);
1514: bounds.setX(constraint.x);
1515: bounds.setY(constraint.y);
1516: bounds.setWidth(Math.max(constraint.width, 60));
1517: bounds.setHeight(Math.max(constraint.height, 60));
1518: }
1519: }
1520:
1521: /**
1522: * @generated
1523: */
1524: private static class CreateJDBC2011Command extends AbstractCommand {
1525: /**
1526: * @generated
1527: */
1528: private final CreateJDBC2011NotationCommand notationAddCommand;
1529:
1530: /**
1531: * @generated
1532: */
1533: public CreateJDBC2011Command(
1534: View parent,
1535: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1536: Rectangle constraint) {
1537: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1538: .getEditingDomain(parent.getDiagram().getElement());
1539: JDBC createdDomainElement = componentflowFactory.eINSTANCE
1540: .createJDBC();
1541:
1542: DomainElementInitializer.JDBC_2011
1543: .initializeElement(createdDomainElement);
1544: this .domainModelAddCommand = AddCommand
1545: .create(
1546: domainModelEditDomain,
1547: parent.getElement(),
1548: componentflowPackage.eINSTANCE
1549: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1550: createdDomainElement);
1551: this .notationAddCommand = new CreateJDBC2011NotationCommand(
1552: parent, createdDomainElement, constraint);
1553: request.setCreatedObject(notationAddCommand
1554: .getCreatedView());
1555: }
1556:
1557: /**
1558: * @generated
1559: */
1560: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1561:
1562: /**
1563: * @generated
1564: */
1565: public boolean canExecute() {
1566: return domainModelAddCommand != null
1567: && domainModelAddCommand.canExecute()
1568: && notationAddCommand != null
1569: && notationAddCommand.canExecute();
1570: }
1571:
1572: /**
1573: * @generated
1574: */
1575: public boolean canUndo() {
1576: return domainModelAddCommand != null
1577: && domainModelAddCommand.canUndo()
1578: && notationAddCommand != null
1579: && notationAddCommand.canUndo();
1580: }
1581:
1582: /**
1583: * @generated
1584: */
1585: public void execute() {
1586: domainModelAddCommand.execute();
1587: notationAddCommand.execute();
1588: }
1589:
1590: /**
1591: * @generated
1592: */
1593: public void undo() {
1594: notationAddCommand.undo();
1595: domainModelAddCommand.undo();
1596: }
1597:
1598: /**
1599: * @generated
1600: */
1601: public void redo() {
1602: execute();
1603: }
1604: }
1605:
1606: /**
1607: * @generated
1608: */
1609: private static class CreateScript2012NotationCommand extends
1610: CreateNotationalElementCommand {
1611: /**
1612: * @generated NOT
1613: */
1614: private CreateScript2012NotationCommand(View parent,
1615: EObject domainElement, Rectangle constraint) {
1616: super (parent);
1617: Node createdNode = NotationFactory.eINSTANCE.createNode();
1618: setCreatedView(createdNode);
1619: createdNode.setElement(domainElement);
1620: ScriptViewFactory.decorateView(createdNode);
1621: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1622: createdNode.setLayoutConstraint(bounds);
1623: bounds.setX(constraint.x);
1624: bounds.setY(constraint.y);
1625: bounds.setWidth(Math.max(constraint.width, 60));
1626: bounds.setHeight(Math.max(constraint.height, 60));
1627: }
1628: }
1629:
1630: /**
1631: * @generated
1632: */
1633: private static class CreateScript2012Command extends
1634: AbstractCommand {
1635: /**
1636: * @generated
1637: */
1638: private final CreateScript2012NotationCommand notationAddCommand;
1639:
1640: /**
1641: * @generated
1642: */
1643: public CreateScript2012Command(
1644: View parent,
1645: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1646: Rectangle constraint) {
1647: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1648: .getEditingDomain(parent.getDiagram().getElement());
1649: Script createdDomainElement = componentflowFactory.eINSTANCE
1650: .createScript();
1651:
1652: DomainElementInitializer.Script_2012
1653: .initializeElement(createdDomainElement);
1654: this .domainModelAddCommand = AddCommand
1655: .create(
1656: domainModelEditDomain,
1657: parent.getElement(),
1658: componentflowPackage.eINSTANCE
1659: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1660: createdDomainElement);
1661: this .notationAddCommand = new CreateScript2012NotationCommand(
1662: parent, createdDomainElement, constraint);
1663: request.setCreatedObject(notationAddCommand
1664: .getCreatedView());
1665: }
1666:
1667: /**
1668: * @generated
1669: */
1670: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1671:
1672: /**
1673: * @generated
1674: */
1675: public boolean canExecute() {
1676: return domainModelAddCommand != null
1677: && domainModelAddCommand.canExecute()
1678: && notationAddCommand != null
1679: && notationAddCommand.canExecute();
1680: }
1681:
1682: /**
1683: * @generated
1684: */
1685: public boolean canUndo() {
1686: return domainModelAddCommand != null
1687: && domainModelAddCommand.canUndo()
1688: && notationAddCommand != null
1689: && notationAddCommand.canUndo();
1690: }
1691:
1692: /**
1693: * @generated
1694: */
1695: public void execute() {
1696: domainModelAddCommand.execute();
1697: notationAddCommand.execute();
1698: }
1699:
1700: /**
1701: * @generated
1702: */
1703: public void undo() {
1704: notationAddCommand.undo();
1705: domainModelAddCommand.undo();
1706: }
1707:
1708: /**
1709: * @generated
1710: */
1711: public void redo() {
1712: execute();
1713: }
1714: }
1715:
1716: /**
1717: * @generated
1718: */
1719: private static class CreateComment2013NotationCommand extends
1720: CreateNotationalElementCommand {
1721: /**
1722: * @generated NOT
1723: */
1724: private CreateComment2013NotationCommand(View parent,
1725: EObject domainElement, Rectangle constraint) {
1726: super (parent);
1727: Node createdNode = NotationFactory.eINSTANCE.createNode();
1728: setCreatedView(createdNode);
1729: createdNode.setElement(domainElement);
1730: CommentViewFactory.decorateView(createdNode);
1731: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1732: createdNode.setLayoutConstraint(bounds);
1733: bounds.setX(constraint.x);
1734: bounds.setY(constraint.y);
1735: bounds.setWidth(Math.max(constraint.width, 60));
1736: bounds.setHeight(Math.max(constraint.height, 60));
1737: }
1738: }
1739:
1740: /**
1741: * @generated
1742: */
1743: private static class CreateComment2013Command extends
1744: AbstractCommand {
1745: /**
1746: * @generated
1747: */
1748: private final CreateComment2013NotationCommand notationAddCommand;
1749:
1750: /**
1751: * @generated
1752: */
1753: public CreateComment2013Command(
1754: View parent,
1755: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1756: Rectangle constraint) {
1757: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1758: .getEditingDomain(parent.getDiagram().getElement());
1759: Comment createdDomainElement = componentflowFactory.eINSTANCE
1760: .createComment();
1761:
1762: DomainElementInitializer.Comment_2013
1763: .initializeElement(createdDomainElement);
1764: this .domainModelAddCommand = AddCommand
1765: .create(
1766: domainModelEditDomain,
1767: parent.getElement(),
1768: componentflowPackage.eINSTANCE
1769: .getComponentFlowEditorDocument_DecorativeModelElements(),
1770: createdDomainElement);
1771: this .notationAddCommand = new CreateComment2013NotationCommand(
1772: parent, createdDomainElement, constraint);
1773: request.setCreatedObject(notationAddCommand
1774: .getCreatedView());
1775: }
1776:
1777: /**
1778: * @generated
1779: */
1780: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1781:
1782: /**
1783: * @generated
1784: */
1785: public boolean canExecute() {
1786: return domainModelAddCommand != null
1787: && domainModelAddCommand.canExecute()
1788: && notationAddCommand != null
1789: && notationAddCommand.canExecute();
1790: }
1791:
1792: /**
1793: * @generated
1794: */
1795: public boolean canUndo() {
1796: return domainModelAddCommand != null
1797: && domainModelAddCommand.canUndo()
1798: && notationAddCommand != null
1799: && notationAddCommand.canUndo();
1800: }
1801:
1802: /**
1803: * @generated
1804: */
1805: public void execute() {
1806: domainModelAddCommand.execute();
1807: notationAddCommand.execute();
1808: }
1809:
1810: /**
1811: * @generated
1812: */
1813: public void undo() {
1814: notationAddCommand.undo();
1815: domainModelAddCommand.undo();
1816: }
1817:
1818: /**
1819: * @generated
1820: */
1821: public void redo() {
1822: execute();
1823: }
1824: }
1825:
1826: /**
1827: * @generated
1828: */
1829: private static class CreateTCPIP2014NotationCommand extends
1830: CreateNotationalElementCommand {
1831: /**
1832: * @generated NOT
1833: */
1834: private CreateTCPIP2014NotationCommand(View parent,
1835: EObject domainElement, Rectangle constraint) {
1836: super (parent);
1837: Node createdNode = NotationFactory.eINSTANCE.createNode();
1838: setCreatedView(createdNode);
1839: createdNode.setElement(domainElement);
1840: TCPIPViewFactory.decorateView(createdNode);
1841: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1842: createdNode.setLayoutConstraint(bounds);
1843: bounds.setX(constraint.x);
1844: bounds.setY(constraint.y);
1845: bounds.setWidth(Math.max(constraint.width, 60));
1846: bounds.setHeight(Math.max(constraint.height, 60));
1847: }
1848: }
1849:
1850: /**
1851: * @generated
1852: */
1853: private static class CreateTCPIP2014Command extends AbstractCommand {
1854: /**
1855: * @generated
1856: */
1857: private final CreateTCPIP2014NotationCommand notationAddCommand;
1858:
1859: /**
1860: * @generated
1861: */
1862: public CreateTCPIP2014Command(
1863: View parent,
1864: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1865: Rectangle constraint) {
1866: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1867: .getEditingDomain(parent.getDiagram().getElement());
1868: TCPIP createdDomainElement = componentflowFactory.eINSTANCE
1869: .createTCPIP();
1870:
1871: DomainElementInitializer.TCPIP_2014
1872: .initializeElement(createdDomainElement);
1873: this .domainModelAddCommand = AddCommand
1874: .create(
1875: domainModelEditDomain,
1876: parent.getElement(),
1877: componentflowPackage.eINSTANCE
1878: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1879: createdDomainElement);
1880: this .notationAddCommand = new CreateTCPIP2014NotationCommand(
1881: parent, createdDomainElement, constraint);
1882: request.setCreatedObject(notationAddCommand
1883: .getCreatedView());
1884: }
1885:
1886: /**
1887: * @generated
1888: */
1889: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
1890:
1891: /**
1892: * @generated
1893: */
1894: public boolean canExecute() {
1895: return domainModelAddCommand != null
1896: && domainModelAddCommand.canExecute()
1897: && notationAddCommand != null
1898: && notationAddCommand.canExecute();
1899: }
1900:
1901: /**
1902: * @generated
1903: */
1904: public boolean canUndo() {
1905: return domainModelAddCommand != null
1906: && domainModelAddCommand.canUndo()
1907: && notationAddCommand != null
1908: && notationAddCommand.canUndo();
1909: }
1910:
1911: /**
1912: * @generated
1913: */
1914: public void execute() {
1915: domainModelAddCommand.execute();
1916: notationAddCommand.execute();
1917: }
1918:
1919: /**
1920: * @generated
1921: */
1922: public void undo() {
1923: notationAddCommand.undo();
1924: domainModelAddCommand.undo();
1925: }
1926:
1927: /**
1928: * @generated
1929: */
1930: public void redo() {
1931: execute();
1932: }
1933: }
1934:
1935: /**
1936: * @generated
1937: */
1938: private static class CreateCustom2015NotationCommand extends
1939: CreateNotationalElementCommand {
1940: /**
1941: * @generated NOT
1942: */
1943: private CreateCustom2015NotationCommand(View parent,
1944: EObject domainElement, Rectangle constraint) {
1945: super (parent);
1946: Node createdNode = NotationFactory.eINSTANCE.createNode();
1947: setCreatedView(createdNode);
1948: createdNode.setElement(domainElement);
1949: CustomViewFactory.decorateView(createdNode);
1950: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
1951: createdNode.setLayoutConstraint(bounds);
1952: bounds.setX(constraint.x);
1953: bounds.setY(constraint.y);
1954: bounds.setWidth(Math.max(constraint.width, 60));
1955: bounds.setHeight(Math.max(constraint.height, 60));
1956: }
1957: }
1958:
1959: /**
1960: * @generated
1961: */
1962: private static class CreateCustom2015Command extends
1963: AbstractCommand {
1964: /**
1965: * @generated
1966: */
1967: private final CreateCustom2015NotationCommand notationAddCommand;
1968:
1969: /**
1970: * @generated
1971: */
1972: public CreateCustom2015Command(
1973: View parent,
1974: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
1975: Rectangle constraint) {
1976: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
1977: .getEditingDomain(parent.getDiagram().getElement());
1978: Custom createdDomainElement = componentflowFactory.eINSTANCE
1979: .createCustom();
1980:
1981: DomainElementInitializer.Custom_2015
1982: .initializeElement(createdDomainElement);
1983: this .domainModelAddCommand = AddCommand
1984: .create(
1985: domainModelEditDomain,
1986: parent.getElement(),
1987: componentflowPackage.eINSTANCE
1988: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
1989: createdDomainElement);
1990: this .notationAddCommand = new CreateCustom2015NotationCommand(
1991: parent, createdDomainElement, constraint);
1992: request.setCreatedObject(notationAddCommand
1993: .getCreatedView());
1994: }
1995:
1996: /**
1997: * @generated
1998: */
1999: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
2000:
2001: /**
2002: * @generated
2003: */
2004: public boolean canExecute() {
2005: return domainModelAddCommand != null
2006: && domainModelAddCommand.canExecute()
2007: && notationAddCommand != null
2008: && notationAddCommand.canExecute();
2009: }
2010:
2011: /**
2012: * @generated
2013: */
2014: public boolean canUndo() {
2015: return domainModelAddCommand != null
2016: && domainModelAddCommand.canUndo()
2017: && notationAddCommand != null
2018: && notationAddCommand.canUndo();
2019: }
2020:
2021: /**
2022: * @generated
2023: */
2024: public void execute() {
2025: domainModelAddCommand.execute();
2026: notationAddCommand.execute();
2027: }
2028:
2029: /**
2030: * @generated
2031: */
2032: public void undo() {
2033: notationAddCommand.undo();
2034: domainModelAddCommand.undo();
2035: }
2036:
2037: /**
2038: * @generated
2039: */
2040: public void redo() {
2041: execute();
2042: }
2043: }
2044:
2045: /**
2046: * @generated
2047: */
2048: private static class CreateEmail2016NotationCommand extends
2049: CreateNotationalElementCommand {
2050: /**
2051: * @generated NOT
2052: */
2053: private CreateEmail2016NotationCommand(View parent,
2054: EObject domainElement, Rectangle constraint) {
2055: super (parent);
2056: Node createdNode = NotationFactory.eINSTANCE.createNode();
2057: setCreatedView(createdNode);
2058: createdNode.setElement(domainElement);
2059: EmailViewFactory.decorateView(createdNode);
2060: Bounds bounds = NotationFactory.eINSTANCE.createBounds();
2061: createdNode.setLayoutConstraint(bounds);
2062: bounds.setX(constraint.x);
2063: bounds.setY(constraint.y);
2064: bounds.setWidth(Math.max(constraint.width, 60));
2065: bounds.setHeight(Math.max(constraint.height, 60));
2066: }
2067: }
2068:
2069: /**
2070: * @generated
2071: */
2072: private static class CreateEmail2016Command extends AbstractCommand {
2073: /**
2074: * @generated
2075: */
2076: private final CreateEmail2016NotationCommand notationAddCommand;
2077:
2078: /**
2079: * @generated
2080: */
2081: public CreateEmail2016Command(
2082: View parent,
2083: ComponentFlowEditorPaletteFactory.CreateRequestEx request,
2084: Rectangle constraint) {
2085: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
2086: .getEditingDomain(parent.getDiagram().getElement());
2087: Email createdDomainElement = componentflowFactory.eINSTANCE
2088: .createEmail();
2089:
2090: DomainElementInitializer.Email_2016
2091: .initializeElement(createdDomainElement);
2092: this .domainModelAddCommand = AddCommand
2093: .create(
2094: domainModelEditDomain,
2095: parent.getElement(),
2096: componentflowPackage.eINSTANCE
2097: .getComponentFlowEditorDocument_ComponentFlowEditorElements(),
2098: createdDomainElement);
2099: this .notationAddCommand = new CreateEmail2016NotationCommand(
2100: parent, createdDomainElement, constraint);
2101: request.setCreatedObject(notationAddCommand
2102: .getCreatedView());
2103: }
2104:
2105: /**
2106: * @generated
2107: */
2108: private final org.eclipse.emf.common.command.Command domainModelAddCommand;
2109:
2110: /**
2111: * @generated
2112: */
2113: public boolean canExecute() {
2114: return domainModelAddCommand != null
2115: && domainModelAddCommand.canExecute()
2116: && notationAddCommand != null
2117: && notationAddCommand.canExecute();
2118: }
2119:
2120: /**
2121: * @generated
2122: */
2123: public boolean canUndo() {
2124: return domainModelAddCommand != null
2125: && domainModelAddCommand.canUndo()
2126: && notationAddCommand != null
2127: && notationAddCommand.canUndo();
2128: }
2129:
2130: /**
2131: * @generated
2132: */
2133: public void execute() {
2134: domainModelAddCommand.execute();
2135: notationAddCommand.execute();
2136: }
2137:
2138: /**
2139: * @generated
2140: */
2141: public void undo() {
2142: notationAddCommand.undo();
2143: domainModelAddCommand.undo();
2144: }
2145:
2146: /**
2147: * @generated
2148: */
2149: public void redo() {
2150: execute();
2151: }
2152: }
2153:
2154: /**
2155: * @generated
2156: */
2157: private HashMap structuralFeatures2Refresher;
2158:
2159: /**
2160: * @generated
2161: */
2162: public Refresher getRefresher(EStructuralFeature feature,
2163: Notification msg) {
2164: if (structuralFeatures2Refresher == null) {
2165: createRefreshers();
2166: }
2167: return (Refresher) structuralFeatures2Refresher.get(feature);
2168: }
2169:
2170: /**
2171: * @generated
2172: */
2173: private void createRefreshers() {
2174: structuralFeatures2Refresher = new HashMap();
2175: Refresher childrenRefresher = new Refresher() {
2176: public void refresh() {
2177: refreshChildren();
2178: }
2179: };
2180: structuralFeatures2Refresher.put(NotationPackage.eINSTANCE
2181: .getView_PersistedChildren(), childrenRefresher);
2182: structuralFeatures2Refresher.put(NotationPackage.eINSTANCE
2183: .getView_TransientChildren(), childrenRefresher);
2184: }
2185:
2186: /**
2187: * @generated
2188: */
2189: private class UpdateManager extends EContentAdapter {
2190: /**
2191: * @generated
2192: */
2193: public void notifyChanged(Notification msg) {
2194: super .notifyChanged(msg);
2195: if (msg.isTouch()) {
2196: return;
2197: }
2198: Collection affectedEditParts = findAffectedParts(msg);
2199: for (Iterator it = affectedEditParts.iterator(); it
2200: .hasNext();) {
2201: IUpdatableEditPart next = (IUpdatableEditPart) it
2202: .next();
2203: IUpdatableEditPart.Refresher refresher = next
2204: .getRefresher((EStructuralFeature) msg
2205: .getFeature(), msg);
2206: if (refresher != null) {
2207: refresher.refresh();
2208: }
2209: }
2210: }
2211:
2212: /**
2213: * @generated
2214: */
2215: private Collection/*<IUpdatableEditPart>*/findAffectedParts(
2216: Notification msg) {
2217: Object notifier = msg.getNotifier();
2218: if (notifier instanceof EObject) {
2219: View view = getView((EObject) notifier);
2220: if (view != null) {
2221: EditPart affectedEditPart = (EditPart) getViewer()
2222: .getEditPartRegistry().get(view);
2223: if (affectedEditPart != null) {
2224: return Collections.singleton(affectedEditPart);
2225: }
2226: }
2227: }
2228: return Collections.EMPTY_LIST;
2229: }
2230:
2231: /**
2232: * @generated
2233: */
2234: private View getView(EObject offspring) {
2235: while (offspring != null
2236: && offspring instanceof View == false) {
2237: offspring = offspring.eContainer();
2238: }
2239: return (View) offspring;
2240: }
2241: }
2242:
2243: /**
2244: * @generated
2245: */
2246: public void activate() {
2247: super .activate();
2248: getDiagram().eAdapters().add(updateManager);
2249: getDiagram().getElement().eAdapters().add(domainModelRefresher);
2250: installNotationModelRefresher();
2251: }
2252:
2253: /**
2254: * @generated
2255: */
2256: public void deactivate() {
2257: uninstallNotationModelRefresher();
2258: getDiagram().getElement().eAdapters().remove(
2259: domainModelRefresher);
2260: getDiagram().eAdapters().remove(updateManager);
2261: super .deactivate();
2262: }
2263:
2264: /**
2265: * @generated
2266: */
2267: private void installNotationModelRefresher() {
2268: NotationModelRefresher refresher = getNotationModelRefresher();
2269: if (refresher.isInstalled()) {
2270: return;
2271: }
2272: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
2273: .getEditingDomain(getDiagram().getElement());
2274: refresher.install(domainModelEditDomain);
2275: refreshNotationModel();
2276: }
2277:
2278: /**
2279: * @generated
2280: */
2281: private void uninstallNotationModelRefresher() {
2282: getNotationModelRefresher().uninstall();
2283: }
2284:
2285: /**
2286: * @generated
2287: */
2288: private NotationModelRefresher notationModelRefresher;
2289:
2290: /**
2291: * @generated
2292: */
2293: private NotationModelRefresher getNotationModelRefresher() {
2294: if (notationModelRefresher == null) {
2295: notationModelRefresher = new NotationModelRefresher();
2296: }
2297: return notationModelRefresher;
2298: }
2299:
2300: /**
2301: * @generated
2302: */
2303: private class NotationModelRefresher extends
2304: ResourceSetListenerImpl {
2305: /**
2306: * @generated
2307: */
2308: private NotificationFilter filter;
2309:
2310: /**
2311: * @generated
2312: */
2313: private TransactionalEditingDomain editingDomain;
2314:
2315: /**
2316: * @generated
2317: */
2318: public NotationModelRefresher() {
2319: createFilter();
2320: }
2321:
2322: /**
2323: * Creates a notification filter which filters notifications that may possibly affect the notational model
2324: * @generated
2325: */
2326: private void createFilter() {
2327: filter = NotificationFilter
2328: .createFeatureFilter(componentflowPackage.eINSTANCE
2329: .getComponentFlowEditorDocument_ComponentFlowEditorElements());
2330: filter = filter
2331: .or(NotificationFilter
2332: .createFeatureFilter(componentflowPackage.eINSTANCE
2333: .getComponentFlowEditorDocument_DecorativeModelElements()));
2334: filter = filter.and(NotificationFilter
2335: .createNotifierFilter(getDiagram().getElement()));
2336: }
2337:
2338: /**
2339: * @generated
2340: */
2341: public void install(TransactionalEditingDomain editingDomain) {
2342: if (this .editingDomain != null
2343: && !this .editingDomain.equals(editingDomain)) {
2344: throw new IllegalStateException(
2345: "Already listening to another editing domain");
2346: }
2347: this .editingDomain = editingDomain;
2348: this .editingDomain.addResourceSetListener(this );
2349: }
2350:
2351: /**
2352: * @generated
2353: */
2354: public boolean isInstalled() {
2355: return editingDomain != null;
2356: }
2357:
2358: /**
2359: * @generated
2360: */
2361: public void uninstall() {
2362: if (isInstalled()) {
2363: editingDomain.removeResourceSetListener(this );
2364: editingDomain = null;
2365: }
2366: }
2367:
2368: /**
2369: * @generated
2370: */
2371: public boolean isPrecommitOnly() {
2372: return true;
2373: }
2374:
2375: /**
2376: * @generated
2377: */
2378: public org.eclipse.emf.common.command.Command transactionAboutToCommit(
2379: ResourceSetChangeEvent event) {
2380: return getRefreshNotationModelCommand();
2381: }
2382:
2383: /**
2384: * @generated
2385: */
2386: public NotificationFilter getFilter() {
2387: return filter;
2388: }
2389: }
2390:
2391: /**
2392: * @generated
2393: */
2394: protected void refreshNotationModel() {
2395: org.eclipse.emf.common.command.Command command = getRefreshNotationModelCommand();
2396: if (command == null) {
2397: return;
2398: }
2399: TransactionalEditingDomain domainModelEditDomain = TransactionUtil
2400: .getEditingDomain(getDiagram().getElement());
2401: getViewer().getEditDomain().getCommandStack().execute(
2402: new WrappingCommand(domainModelEditDomain, command));
2403: }
2404:
2405: /**
2406: * @generated
2407: */
2408: private org.eclipse.emf.common.command.Command getRefreshNotationModelCommand() {
2409: List semanticChildren = getSemanticChildren();
2410: List notationalChildren = getDiagram().getChildren();
2411: final Map semanticToNotational = new HashMap();
2412: for (Iterator it = notationalChildren.iterator(); it.hasNext();) {
2413: View next = (View) it.next();
2414: EObject nextSemantic = next.getElement();
2415: if (nextSemantic != null) {
2416: semanticToNotational.put(nextSemantic, next);
2417: }
2418: }
2419: View parentView = getDiagram();
2420: CompoundCommand command = new CompoundCommand();
2421: for (Iterator it = semanticChildren.iterator(); it.hasNext();) {
2422: EObject next = (EObject) it.next();
2423: View currentView = (View) semanticToNotational.remove(next);
2424: int nodeVisualID = ComponentFlowEditorVisualIDRegistry.INSTANCE
2425: .getNodeVisualID(parentView, next);
2426: if (currentView == null) {
2427: if (shouldCreateView(next)) {
2428: command
2429: .appendIfCanExecute(getCreateNotationalElementCommand(
2430: parentView, next, nodeVisualID));
2431: }
2432: } else if (nodeVisualID != ComponentFlowEditorVisualIDRegistry
2433: .getVisualID(currentView)) {
2434: CreateNotationalElementCommand notationalCommand = getCreateNotationalElementCommand(
2435: parentView, next, nodeVisualID);
2436: if (notationalCommand != null) {
2437: command
2438: .appendIfCanExecute(new ReplaceNotationalElementCommand(
2439: parentView, notationalCommand,
2440: currentView));
2441: }
2442: }
2443: }
2444: for (Iterator it = semanticToNotational.values().iterator(); it
2445: .hasNext();) {
2446: View obsoleteView = (View) it.next();
2447: command
2448: .appendIfCanExecute(new RemoveNotationalElementCommand(
2449: parentView, obsoleteView));
2450: }
2451: return command.getCommandList().isEmpty() ? null : command;
2452: }
2453:
2454: /**
2455: * @generated
2456: */
2457: private CreateNotationalElementCommand getCreateNotationalElementCommand(
2458: View parentView, EObject domainElement, int nodeVisualID) {
2459: switch (nodeVisualID) {
2460: case TransformerEditPart.VISUAL_ID:
2461: if (domainElement instanceof Transformer) {
2462: return new CreateTransformer2001NotationCommand(
2463: parentView, domainElement, new Rectangle(0, 0,
2464: 0, 0));
2465: }
2466: return null;
2467: case ParserEditPart.VISUAL_ID:
2468: if (domainElement instanceof Parser) {
2469: return new CreateParser2002NotationCommand(parentView,
2470: domainElement, new Rectangle(0, 0, 0, 0));
2471: }
2472: return null;
2473: case HTTPEditPart.VISUAL_ID:
2474: if (domainElement instanceof HTTP) {
2475: return new CreateHTTP2003NotationCommand(parentView,
2476: domainElement, new Rectangle(0, 0, 0, 0));
2477: }
2478: return null;
2479: case XSLTEditPart.VISUAL_ID:
2480: if (domainElement instanceof XSLT) {
2481: return new CreateXSLT2004NotationCommand(parentView,
2482: domainElement, new Rectangle(0, 0, 0, 0));
2483: }
2484: return null;
2485: case FTPEditPart.VISUAL_ID:
2486: if (domainElement instanceof FTP) {
2487: return new CreateFTP2005NotationCommand(parentView,
2488: domainElement, new Rectangle(0, 0, 0, 0));
2489: }
2490: return null;
2491: case JMSEditPart.VISUAL_ID:
2492: if (domainElement instanceof JMS) {
2493: return new CreateJMS2006NotationCommand(parentView,
2494: domainElement, new Rectangle(0, 0, 0, 0));
2495: }
2496: return null;
2497: case ExternalSystemEditPart.VISUAL_ID:
2498: if (domainElement instanceof ExternalSystem) {
2499: return new CreateExternalSystem2007NotationCommand(
2500: parentView, domainElement, new Rectangle(0, 0,
2501: 0, 0));
2502: }
2503: return null;
2504: case FileEditPart.VISUAL_ID:
2505: if (domainElement instanceof File) {
2506: return new CreateFile2008NotationCommand(parentView,
2507: domainElement, new Rectangle(0, 0, 0, 0));
2508: }
2509: return null;
2510: case SequencerEditPart.VISUAL_ID:
2511: if (domainElement instanceof Sequencer) {
2512: return new CreateSequencer2009NotationCommand(
2513: parentView, domainElement, new Rectangle(0, 0,
2514: 0, 0));
2515: }
2516: return null;
2517: case CBREditPart.VISUAL_ID:
2518: if (domainElement instanceof CBR) {
2519: return new CreateCBR2010NotationCommand(parentView,
2520: domainElement, new Rectangle(0, 0, 0, 0));
2521: }
2522: return null;
2523: case JDBCEditPart.VISUAL_ID:
2524: if (domainElement instanceof JDBC) {
2525: return new CreateJDBC2011NotationCommand(parentView,
2526: domainElement, new Rectangle(0, 0, 0, 0));
2527: }
2528: return null;
2529: case ScriptEditPart.VISUAL_ID:
2530: if (domainElement instanceof Script) {
2531: return new CreateScript2012NotationCommand(parentView,
2532: domainElement, new Rectangle(0, 0, 0, 0));
2533: }
2534: return null;
2535: case CommentEditPart.VISUAL_ID:
2536: if (domainElement instanceof Comment) {
2537: return new CreateComment2013NotationCommand(parentView,
2538: domainElement, new Rectangle(0, 0, 0, 0));
2539: }
2540: return null;
2541: case TCPIPEditPart.VISUAL_ID:
2542: if (domainElement instanceof TCPIP) {
2543: return new CreateTCPIP2014NotationCommand(parentView,
2544: domainElement, new Rectangle(0, 0, 0, 0));
2545: }
2546: return null;
2547: case CustomEditPart.VISUAL_ID:
2548: if (domainElement instanceof Custom) {
2549: return new CreateCustom2015NotationCommand(parentView,
2550: domainElement, new Rectangle(0, 0, 0, 0));
2551: }
2552: return null;
2553: case EmailEditPart.VISUAL_ID:
2554: if (domainElement instanceof Email) {
2555: return new CreateEmail2016NotationCommand(parentView,
2556: domainElement, new Rectangle(0, 0, 0, 0));
2557: }
2558: return null;
2559: default:
2560: return null;
2561: }
2562: }
2563:
2564: /**
2565: * @generated
2566: */
2567: private List getSemanticChildren() {
2568:
2569: List result = new LinkedList();
2570: View viewObject = getDiagram();
2571: EObject modelObject = getDiagram().getElement();
2572: EObject nextValue;
2573: int nodeVID;
2574: for (Iterator it = ((ComponentFlowEditorDocument) modelObject)
2575: .getComponentFlowEditorElements().iterator(); it
2576: .hasNext();) {
2577: nextValue = (EObject) it.next();
2578: nodeVID = ComponentFlowEditorVisualIDRegistry.INSTANCE
2579: .getNodeVisualID(viewObject, nextValue);
2580: switch (nodeVID) {
2581: case TransformerEditPart.VISUAL_ID: {
2582: result.add(nextValue);
2583: break;
2584: }
2585: case ParserEditPart.VISUAL_ID: {
2586: result.add(nextValue);
2587: break;
2588: }
2589: case HTTPEditPart.VISUAL_ID: {
2590: result.add(nextValue);
2591: break;
2592: }
2593: case XSLTEditPart.VISUAL_ID: {
2594: result.add(nextValue);
2595: break;
2596: }
2597: case FTPEditPart.VISUAL_ID: {
2598: result.add(nextValue);
2599: break;
2600: }
2601: case JMSEditPart.VISUAL_ID: {
2602: result.add(nextValue);
2603: break;
2604: }
2605: case FileEditPart.VISUAL_ID: {
2606: result.add(nextValue);
2607: break;
2608: }
2609: case SequencerEditPart.VISUAL_ID: {
2610: result.add(nextValue);
2611: break;
2612: }
2613: case CBREditPart.VISUAL_ID: {
2614: result.add(nextValue);
2615: break;
2616: }
2617: case JDBCEditPart.VISUAL_ID: {
2618: result.add(nextValue);
2619: break;
2620: }
2621: case ScriptEditPart.VISUAL_ID: {
2622: result.add(nextValue);
2623: break;
2624: }
2625: case TCPIPEditPart.VISUAL_ID: {
2626: result.add(nextValue);
2627: break;
2628: }
2629: case CustomEditPart.VISUAL_ID: {
2630: result.add(nextValue);
2631: break;
2632: }
2633: case EmailEditPart.VISUAL_ID: {
2634: result.add(nextValue);
2635: break;
2636: }
2637: }
2638: }
2639: for (Iterator it = ((ComponentFlowEditorDocument) modelObject)
2640: .getDecorativeModelElements().iterator(); it.hasNext();) {
2641: nextValue = (EObject) it.next();
2642: nodeVID = ComponentFlowEditorVisualIDRegistry.INSTANCE
2643: .getNodeVisualID(viewObject, nextValue);
2644: switch (nodeVID) {
2645: case ExternalSystemEditPart.VISUAL_ID: {
2646: result.add(nextValue);
2647: break;
2648: }
2649: case CommentEditPart.VISUAL_ID: {
2650: result.add(nextValue);
2651: break;
2652: }
2653: }
2654: }
2655: return result;
2656: }
2657:
2658: /**
2659: * Returns whether a notational element should be created for the given domain element.
2660: * The generated code always returns true.
2661: * User can change implementation of this method to handle a more sophisticated logic.
2662: * @generated
2663: */
2664: private boolean shouldCreateView(EObject domainElement) {
2665: return true;
2666: }
2667:
2668: /**
2669: * @generated
2670: */
2671: private DomainModelRefresher domainModelRefresher = new DomainModelRefresher();
2672:
2673: /**
2674: * @generated
2675: */
2676: private class DomainModelRefresher extends AdapterImpl {
2677: /**
2678: * @generated
2679: */
2680: public void notifyChanged(Notification msg) {
2681: super .notifyChanged(msg);
2682: if (msg.isTouch()) {
2683: return;
2684: }
2685: Refresher refresher = getRefresher((EStructuralFeature) msg
2686: .getFeature(), msg);
2687: if (refresher != null) {
2688: refresher.refresh();
2689: }
2690: }
2691: }
2692:
2693: /**
2694: * @generated
2695: */
2696: private UpdateManager updateManager = new UpdateManager();
2697:
2698: }
|