Package org.fusesource.ide.camel.model

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


  }


  @Override
  public String getCategoryName() {
    AbstractNode node = getExemplar();
    if (node != null) {
      return node.getCategoryName();
    }
    return null;
  }
View Full Code Here


   * retrieves the icon name for the given class via reflection
   *
   * @return  the icon name or null
   */
  private String getIconName() {
    AbstractNode node = getExemplar();
    if (node != null) {
      return node.getIconName();
    }
    return null;
  }
View Full Code Here

   * (non-Javadoc)
   * @see org.eclipse.graphiti.func.ICreate#create(org.eclipse.graphiti.features.context.ICreateContext)
   */
  @Override
  public Object[] create(ICreateContext context) {
    AbstractNode node = createNode();

    RouteSupport selectedRoute = Activator.getDiagramEditor().getSelectedRoute();
    Diagram diagram = getDiagram();

    if (selectedRoute != null) {
View Full Code Here

    return new Object[] { node };
  }


  protected AbstractNode createNode() {
    AbstractNode node = null;

    try {
      node = (AbstractNode)this.clazz.newInstance();
    } catch (Exception ex) {
      throw new RuntimeException(ex);
View Full Code Here

    PictogramElement _pe = context.getPictogramElements()[0] instanceof Connection ? ((Connection) context.getPictogramElements()[0])
                .getStart().getParent() : context.getPictogramElements()[0];
        final Object bo = getBusinessObjectForPictogramElement(_pe);
      
        if (bo instanceof AbstractNode) {
          AbstractNode _ep = (AbstractNode) bo;
            try {
              IFile contextFile = getContextFile();
              String fileName = contextFile.getName();
              String projectName = contextFile.getProject().getName();
             
              IBreakpoint bp = CamelDebugUtils.getBreakpointForSelection(_ep.getId(), fileName, projectName);
              if (bp != null && bp.isEnabled() == false) {
                bp.setEnabled(true);
              }
            } catch (CoreException e) {
                final IDiagramContainer container = getDiagramBehavior().getDiagramContainer();
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();
          if (_ep.supportsBreakpoint()) {
            IBreakpoint bp = CamelDebugUtils.getBreakpointForSelection(_ep.getId(), fileName, projectName);
            try {
              return bp != null && bp.isEnabled() == false;
            } catch (CoreException ex) {
              Activator.getLogger().error(ex);
            }
View Full Code Here

   * @see org.eclipse.gef.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
   */
  @Override
  public void buildContextMenu(IMenuManager menu) {
    // add the delete route if a route is selected
    AbstractNode node = nodeViewer.getSelectedNode();
    if (node == null) {
      // lets choose the root container
      node = editor.getModel();
    }

    if (node != null && node instanceof Route) {
      DeleteRouteAction deleteRouteAction = new DeleteRouteAction();
      deleteRouteAction.setSelectedRoute((RouteSupport)node);
      menu.add(deleteRouteAction);
    }

    // add a separator
    menu.add(new Separator());

    final AddNodeMenuFactory factory = new AddNodeMenuFactory();
    final MenuManager subMenu = new MenuManager("Add", factory.getImageDescriptor("add.png"), "org.fusesource.ide.actions.add");
    menu.add(subMenu);

    subMenu.setRemoveAllWhenShown(true);
    subMenu.addMenuListener(new IMenuListener() {

      @Override
      public void menuAboutToShow(IMenuManager manager) {
        AbstractNode node = nodeViewer.getSelectedNode();
        if (node == null) {
          // lets choose the root container
          node = editor.getModel();
        }
        boolean enabled = node != null;
View Full Code Here

   * (non-Javadoc)
   * @see org.eclipse.ui.views.properties.tabbed.ITypeMapper#mapType(java.lang.Object)
   */
  @Override
  public Class mapType(Object object) {
    AbstractNode node = AbstractNodes.toAbstractNode(object);
    if (node != null) {
      return AbstractNode.class;
    }
    return object.getClass();
  }
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();
             
              ConditionalBreakpointEditorDialog dlg = new ConditionalBreakpointEditorDialog(Display.getDefault().getActiveShell(), _ep);
            dlg.setBlockOnOpen(true);
            if (Window.OK == dlg.open()) {
              String language = dlg.getLanguage();
              String condition = dlg.getCondition();
           
                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

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.