Package org.fusesource.ide.camel.model

Examples of org.fusesource.ide.camel.model.AbstractNode


  protected void addMenuItem(IMenuManager menu, final String title, final String description, final Class<? extends AbstractNode> aClass) {
    // lets decide if we can actually add this kind of node first...
    Object newObject = newInstance(aClass);
    if (newObject instanceof AbstractNode) {
      final AbstractNode newNode = (AbstractNode) newObject;
      if (newNode instanceof RouteSupport || (selectedNode != null && selectedNode.canConnectTo(newNode))) {
        final AbstractNode node = selectedNode;
        Action action = new Action() {
          @Override
          public void runWithEvent(Event event) {
            if (newNode instanceof Route) {
              editor.addNewRoute();
View Full Code Here


  public String getInitialValue(IDirectEditingContext context) {
    // return the current name of the EClass
    PictogramElement pe = context.getPictogramElement();
    //EClass eClass = (EClass) getBusinessObjectForPictogramElement(pe);
    AbstractNode node = (AbstractNode)getBusinessObjectForPictogramElement(pe);
    //return eClass.getName();
    return node.getDisplayText();
  }
View Full Code Here

import com.google.common.collect.Iterables;

public class AbstractNodes {

  public static AbstractNode getSelectedNode(ISelection selection) {
    AbstractNode answer = null;
    if (selection instanceof IStructuredSelection) {

      /*
       * Control oldClient = section.getClient(); if (oldClient != null) {
       * //section.setClient(null); oldClient.dispose(); }
View Full Code Here

    }
    return answer;
  }

  public static AbstractNode toAbstractNode(Object input) {
    AbstractNode answer = null;
    if (input instanceof AbstractNode) {
      return (AbstractNode) input;
    } else if (input instanceof AbstractNodeFacade) {
      AbstractNodeFacade facade = (AbstractNodeFacade) input;
      answer = facade.getAbstractNode();
View Full Code Here

    // retrieve name from business model
    String businessName = null;
    Object bo = getBusinessObjectForPictogramElement(pictogramElement);
    if (bo instanceof AbstractNode) {
      AbstractNode eClass = (AbstractNode) bo;
      businessName = DiagramUtils.filterFigureLabel(eClass.getDisplayText());
    }

    // update needed, if names are different
    boolean updateNameNeeded = ((pictogramName == null && businessName != null) || (pictogramName != null && !pictogramName
        .equals(businessName)));
View Full Code Here

    // retrieve name from business model
    String businessName = null;
    PictogramElement pictogramElement = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pictogramElement);
    if (bo instanceof AbstractNode) {
      AbstractNode eClass = (AbstractNode) bo;
      businessName = DiagramUtils.filterFigureLabel(eClass.getDisplayText());
    }

    // Set name in pictogram model
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      
      boolean finished_label = false;
      boolean finished_icon = false;
      // now also adapt the text label of the figure
      for (Shape shape : cs.getChildren()) {
        // special handling for the text shape as its the figures label
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          // set the new figure label
          text.setValue(businessName);
         
          finished_label = true;
        } else if (shape.getGraphicsAlgorithm() instanceof Image) {
          // update the icon image
          AbstractNode addedClass = (AbstractNode)bo;
         
          // set the new icon id - refresh will to the rest
          String iconKey = ImageProvider.getKeyForLargeIcon(addedClass.getIconName());
          ((Image)shape.getGraphicsAlgorithm()).setId(iconKey);
         
          finished_icon = true;
        }
        if (finished_icon && finished_label) {
View Full Code Here

        deleteBOFromModel((AbstractNode)bo);
      } else if (bo instanceof EReferenceImpl) {
        EReferenceImpl eimpl = (EReferenceImpl) bo;
        EClassifier eType = eimpl.getEType();
        if (eType instanceof AbstractNode) {
          AbstractNode target = (AbstractNode) eType;
          Activator.getLogger().debug("==== trying to zap the target: " + target);
          EObject eContainer = eimpl.eContainer();
          if (eContainer instanceof AbstractNode) {
            AbstractNode source = (AbstractNode) eContainer;
            Activator.getLogger().debug("==== trying to source: " + source + " -> target: " + target);
            source.removeConnection(target);
          }
        }
      } else {
        Activator.getLogger().warning("Cannot figure out Node or Flow from BO: " + bo);
      }
View Full Code Here

    this.node = node;
  }

  @Override
  protected void doExecute() {
    AbstractNode selectedNode = this.node == null ? designEditor.getSelectedNode() : node;
    if (selectedNode == null) {
      // use the route node in this case
      selectedNode = designEditor.getSelectedRoute();
    }
    PictogramElement pe = selectedNode instanceof RouteSupport ? designEditor.getDiagram() : designEditor.getFeatureProvider().getPictogramElementForBusinessObject(selectedNode);
View Full Code Here

  }

  @Override
  public void execute(final ICustomContext context) {
    // create the object to add
    AbstractNode node = null;
    try {
      node = createNode();
    } catch (Exception ex) {
      return;
    }
View Full Code Here

        deleteBOFromModel((AbstractNode)bo);
      } else if (bo instanceof EReferenceImpl) {
        EReferenceImpl eimpl = (EReferenceImpl) bo;
        EClassifier eType = eimpl.getEType();
        if (eType instanceof AbstractNode) {
          AbstractNode target = (AbstractNode) eType;
          Activator.getLogger().debug("==== trying to zap the target: " + target);
          EObject eContainer = eimpl.eContainer();
          if (eContainer instanceof AbstractNode) {
            AbstractNode source = (AbstractNode) eContainer;
            Activator.getLogger().debug("==== trying to source: " + source + " -> target: " + target);
            source.removeConnection(target);
          }
        }
      } else {
        Activator.getLogger().warning("Cannot figure out Node or Flow from BO: " + bo);
      }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.camel.model.AbstractNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.