Package org.fusesource.ide.camel.model

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


        return findEditPart(node, contents);
      }
    }
    if (part instanceof EditPart) {
      EditPart nodeEditPart = part;
      AbstractNode modelNode = AbstractNodes.toAbstractNode(nodeEditPart);
      if (Objects.equal(node, modelNode)) {
        return nodeEditPart;
      }
    }
    List<EditPart> children = part.getChildren();
View Full Code Here


      if (selection instanceof StructuredSelection) {
        StructuredSelection structuredSelection = (StructuredSelection) selection;
        Object firstElement = structuredSelection.getFirstElement();
        if (firstElement instanceof AbstractEditPart) {
          selectedEditPart = (AbstractEditPart) firstElement;
          AbstractNode node = AbstractNodes.toAbstractNode(firstElement);
          if (node != null) {
            if (data.selectedNode != null) {
              data.selectedNode
              .removePropertyChangeListener(nodePropertyListener);
            }
View Full Code Here

        int idx = data.selectedRouteIndex;
        if (idx < 0 || idx >= size) {
          idx = 0;
        }
        if (size > 0) {
          AbstractNode node = children.get(idx);
          if (node instanceof RouteSupport) {
            data.selectedRoute = (RouteSupport) node;
          }
        }
      }
View Full Code Here

   *
   * @param endpointNodeId  the node id
   */
  private synchronized void highlightBreakpointNodeWithID(String endpointNodeId) {
    // get the correct node for the id
    final AbstractNode node = getModel().getNode(endpointNodeId);
   
    if (node == null) return;
    if (this.highlightedNodeInDebugger != null && node.getId() != null && node.getId().equals(highlightedNodeInDebugger.getId())) return;

    // reset old highlight
    resetHighlightBreakpointNode();
   
    // add highlight to new node
View Full Code Here

   
    // and then our own
    IFeatureProvider featureProvider = getFeatureProvider();
    Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
    if (bo instanceof AbstractNode) {
      AbstractNode node = (AbstractNode) bo;

      ValidationResult res = ValidationFactory.getInstance().validate(node);
      if (res.getInformationCount() > 0) {
        for (String message : res.getInformations()) {
          IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_INFORMATION_TSK);
          imageRenderingDecorator.setMessage(message);
          decorators.add(imageRenderingDecorator);
        }
      }
      if (res.getWarningCount() > 0) {
        for (String message : res.getWarnings()) {
          IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_WARNING_TSK);
          imageRenderingDecorator.setMessage(message);
          decorators.add(imageRenderingDecorator);
        }
      }
      if (res.getErrorCount() > 0) {
        for (String message : res.getErrors()) {
          IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_ERROR_TSK);
          imageRenderingDecorator.setMessage(message);
          decorators.add(imageRenderingDecorator);
        }
      }
     
      // decorate breakpoints on endpoints
      if (getDiagramTypeProvider().getDiagramBehavior().getDiagramContainer() != null && getDiagramTypeProvider().getDiagramBehavior().getDiagramContainer() instanceof RiderDesignEditor) {
        RiderDesignEditor editor = (RiderDesignEditor)getDiagramTypeProvider().getDiagramBehavior().getDiagramContainer();
        IFile activeFile = editor.getCamelContextFile();
        String projectName = activeFile.getProject().getName();
        IBreakpoint bp = CamelDebugUtils.getBreakpointForSelection(node.getId(), activeFile.getName(), projectName);
        if (bp != null && bp instanceof CamelEndpointBreakpoint) {
          CamelEndpointBreakpoint cep = (CamelEndpointBreakpoint)bp;

          // we only want to decorate breakpoints which belong to this project
          if (cep.getProjectName().equals(activeFile.getProject().getName())) {
View Full Code Here

                .getStart().getParent() : context.getPictogramElements()[0];
        final Object bo = getBusinessObjectForPictogramElement(_pe);
        final IResource resource = getResource();
      
        if (bo instanceof AbstractNode) {
          AbstractNode _ep = (AbstractNode) bo;
            try {
              Boolean userWantsUpdate = null;
              IFile contextFile = getContextFile();
              String fileName = contextFile.getName();
              String projectName = contextFile.getProject().getName();
              if (Strings.isBlank(_ep.getCamelContextId()) ||
                Strings.isBlank(_ep.getId()) ) {
                // important ID fields are not yet set - ask the user if we
                // can update those fields for him
                userWantsUpdate = askForIDUpdate(_ep);
                if (userWantsUpdate) {
                  // update the context id if needed
                  if (Strings.isBlank(_ep.getCamelContextId())) {
                    String newContextId = ICamelDebugConstants.PREFIX_CONTEXT_ID + UUID.randomUUID().toString();
                    ((RouteContainer)_ep.getParent().getParent()).setContextId(newContextId);
                  }
                 
                  // update the node id if blank
                  boolean foundUniqueId = false;
                  if (Strings.isBlank(_ep.getId())) {
                    String newNodeId = null;
                    while (!foundUniqueId) {
                      newNodeId = ICamelDebugConstants.PREFIX_NODE_ID + _ep.getNewID();
                      // we need to check if the id is really unique in our context
                      if (((RiderDesignEditor)getDiagramBehavior().getDiagramContainer()).getModel().getNode(newNodeId) == null) {
                        foundUniqueId = true;
                      }
                    }
                    if (Strings.isBlank(newNodeId) == false) {
                      _ep.setId(newNodeId);
                    } else {
                      throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to determine a unique ID for node " + _ep));
                    }
                  }
                 
View Full Code Here

    PictogramElement _pe = cc.getPictogramElements()[0] instanceof Connection ? ((Connection) cc.getPictogramElements()[0])
                .getStart().getParent() : cc.getPictogramElements()[0];
        final Object bo = getBusinessObjectForPictogramElement(_pe);
      
        if (bo instanceof AbstractNode) {
          AbstractNode _ep = (AbstractNode) bo;
          IFile contextFile = getContextFile();
          String fileName = contextFile.getName();
          String projectName = contextFile.getProject().getName();
            return _ep.supportsBreakpoint() && CamelDebugUtils.getBreakpointForSelection(_ep.getId(), fileName, projectName) == null;
        }
        return false;
  }
View Full Code Here

   * @param rootMenu  the root menu entry (addNode)
   * @param context  the context
   * @param fp    the feature provider
   */
  public void setupMenuStructure(ContextMenuEntry rootMenu, ICustomContext context, IFeatureProvider fp) {
    AbstractNode selectedNode = getSelectedNode(context, fp);
    boolean onlyEndpoints = false;
    if (selectedNode instanceof Route || selectedNode == null) {
      // commented out as we already have a "add route" menu entry
      //addMenuItem(rootMenu, Messages.paletteRouteTitle, Messages.paletteRouteDescription, Route.class, context, fp);
      onlyEndpoints = true;
View Full Code Here


  protected void addMenuItem(ContextMenuEntry parent, String label, String description,
      Class<? extends AbstractNode> clazz, ICustomContext context, IFeatureProvider fp,
      CreateNodeConnectionFeature feature) {
    AbstractNode selectedNode = getSelectedNode(context, fp);
    Object newObject = newInstance(clazz);
    if (newObject instanceof AbstractNode) {
      AbstractNode newNode = (AbstractNode) newObject;

      // TODO change to allow us to add any new item to the selection...
      //if (newNode instanceof RouteSupport || (selectedNode != null && selectedNode.canConnectTo(newNode))) {

      // create a sub-menu for all AddNode operations
      ContextMenuEntry menuEntry = new ContextMenuEntry(feature, context);
      // set the menu label
      menuEntry.setText(label);
      // set the description
      menuEntry.setDescription(description);
      try {
        // set the image
        AbstractNode node = clazz.newInstance();
        String iconName = node.getIconName();
        menuEntry.setIconId(ImageProvider.getKeyForSmallIcon(iconName));
      } catch (Exception ex) {
        menuEntry.setIconId(DEFAULT_IMAGE_KEY);
      }
      // display sub-menu hierarchical or flat
View Full Code Here




  public static AbstractNode getSelectedNode(ICustomContext context, IFeatureProvider fp) {
    AbstractNode selectedNode = null;
    PictogramElement[] elements = context.getPictogramElements();
    if (elements != null && elements.length > 0) {
      Object bo = fp.getBusinessObjectForPictogramElement(elements[0]);
      if (bo instanceof AbstractNode) {
        selectedNode = (AbstractNode) 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.