Package org.fusesource.ide.camel.model

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


  public static boolean isMandatory(Object bean, String propertyName) {
    // lets look at the setter method and see if its got a @Required
    // annotation
    if (bean instanceof AbstractNode) {
      AbstractNode node = (AbstractNode) bean;
      Class<?> camelClass = node.getCamelDefinitionClass();
      if (camelClass != null) {
        XmlAccessorType accessorType = camelClass.getAnnotation(XmlAccessorType.class);
        boolean useMethods = true;
        if (accessorType != null) {
          if (accessorType.value().equals(XmlAccessType.FIELD)) {
View Full Code Here


        } else if (o instanceof RouteContainer) {
            return viewer.getRootEditPart();
        } else if (o instanceof AbstractNode) {
            PictogramElement[] pes = editor.getFeatureProvider().getAllPictogramElementsForBusinessObject(o);
            if (pes.length>0) {
                AbstractNode node = (AbstractNode)o;
                RouteSupport oldRoute = editor.getSelectedRoute();
                RouteSupport newRoute = (RouteSupport)node.getParent();
                if (!oldRoute.equals(newRoute)) {
                    editor.switchRoute(newRoute);
                    editor.autoLayoutRoute();
                }
            }
            if (pes.length == 0) {
                // an element from another route was selected - we need to load the route into the diagram
                AbstractNode node = (AbstractNode)o;
                editor.switchRoute((RouteSupport)node.getParent());
                editor.getDiagramBehavior().refreshContent();
                Iterator<?> it = viewer.getEditPartRegistry().entrySet().iterator();
                while (it.hasNext()) {
                    Entry<?, ?> e = (Entry<?, ?>)it.next();
                    Object key = e.getKey();
                    EditPart value = (EditPart)e.getValue();
                    if (key instanceof ContainerShape) {
                        ContainerShape cs = (ContainerShape)key;
                        if (cs.getLink() != null &&
                            cs.getLink().getBusinessObjects() != null &&
                            cs.getLink().getBusinessObjects().size() > 0 &&
                            cs.getLink().getBusinessObjects().get(0) != null &&
                            cs.getLink().getBusinessObjects().get(0).equals(o)) {
                            // found the correct entry
                            return value;
                        }
                    }
                    continue;
                }
                // if all fails return the root edit part
                return viewer.getRootEditPart();
            }
            return editor.getDiagramBehavior().getEditPartForPictogramElement(pes[0]);
        } else if (o instanceof Diagram) {
            // someone selected the route inside the diagram editor
            RouteSupport route = editor.getSelectedRoute();
            return getEditPart(viewer, route);
        } else if (o instanceof ContainerShape) {
            // someone selected a diagram figure in the diagram editor
          AbstractNode node = null;
          node = (AbstractNode)Activator.getDiagramEditor().getFeatureProvider().getBusinessObjectForPictogramElement(((ContainerShape)o));
          if (node != null) {
            return getEditPart(viewer, node);
          }
        }        
View Full Code Here

        while (it.hasNext()) {
            Entry<?, ?> e = (Entry<?, ?>)it.next();
            Object key = e.getKey();
            EditPart value = (EditPart)e.getValue();
            if (key instanceof AbstractNode) {
                AbstractNode n = (AbstractNode)key;
                if (n.equals(node)) {
                    // found the correct entry
                    return value;
                }
            }
            continue;
View Full Code Here

  }

  protected void showRouteLayout() {
    List<AbstractNode> children = model.getChildren();
    if (children.size() > 0) {
      AbstractNode child = children.get(0);
      Activator.getLogger().debug("First child layout: " + child.getLayout() + " child: " + child);
    }
  }
View Full Code Here

   * (non-Javadoc)
   * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
   */
  @Override
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    AbstractNode lastNode = selectedNode;
    selectedNode = AbstractNodes.getSelectedNode(selection);
    if (selectedNode != null) {
      if (selectedNode instanceof RouteContainer) {
        nodeContainer = (RouteContainer) selectedNode;
      } else {
View Full Code Here

  protected void assertCanOutput(boolean expected, Class<? extends AbstractNode>... classes) throws Exception {
    for (Class<? extends AbstractNode> aClass : classes) {
      System.out.println("Testing class: " + aClass.getName());
     
      AbstractNode node = aClass.newInstance();
      boolean actual = node.canAcceptOutput();
     
      Assert.assertEquals("Class " + aClass.getName() + " canOutput?", expected, actual);
    }
  }
View Full Code Here

  @Override
  public Object[] getElements(Object input) {
    if (input instanceof Object[]) {
      return (Object[]) input;
    } else if (input instanceof AbstractNode) {
      AbstractNode node = (AbstractNode) input;

      Set<Flow> set = new HashSet<Flow>();
      RouteContainer parent;
      if (node instanceof RouteContainer) {
        parent = (RouteContainer) node;
      } else {
        parent = node.getParent();
      }
      if (parent == null) {
        set = node.getAllConnections();
      } else {
        Set<AbstractNode> descendents = parent.getDescendents();
        for (AbstractNode child : descendents) {
          set.addAll(child.getAllConnections());
        }
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;
          IFile contextFile = getContextFile();
          String fileName = contextFile.getName();
          String projectName = contextFile.getProject().getName();
           
          // now ask the user to define a condition using a language
          IBreakpoint bp = CamelDebugUtils.getBreakpointForSelection(_ep.getId(), fileName, projectName);
          if (bp != null && bp instanceof CamelConditionalBreakpoint) {
            CamelConditionalBreakpoint ccb = (CamelConditionalBreakpoint)bp;
            // TODO: open a dialog for the user to select language and enter the condition - maybe provide a helper for predefined variables
            ConditionalBreakpointEditorDialog dlg = new ConditionalBreakpointEditorDialog(Display.getDefault().getActiveShell(), _ep);
            dlg.setLanguage(ccb.getLanguage());
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();
           
          // now ask the user to define a condition using a language
          IBreakpoint bp = CamelDebugUtils.getBreakpointForSelection(_ep.getId(), fileName, projectName);
          return bp != null && bp instanceof CamelConditionalBreakpoint;
        }
        return false;
  }
View Full Code Here

   * @see org.eclipse.zest.core.viewers.IGraphContentProvider#getElements(java.lang.Object)
   */
  @Override
  public Object[] getElements(Object input) {
    if (input instanceof AbstractNode) {
      AbstractNode node = (AbstractNode) input;

      Set<AbstractNode> set = new HashSet<AbstractNode>();
      RouteContainer parent;
      if (node instanceof RouteContainer) {
        parent = (RouteContainer) node;
      } else {
        parent = node.getParent();
        set.add(node);
      }
      if (parent == null) {
        set.addAll(node.getOutputs());
      } else {
        set.addAll(parent.getDescendents());
      }
      return set.toArray();
    } else {
      List<Object> answer = new ArrayList<Object>();
      if (input instanceof GraphableNode) {
        GraphableNode node = (GraphableNode) input;
        answer.addAll(node.getChildrenGraph());
      } else if (input != null) {
        answer.add(input);
        if (input instanceof Node) {
          Node aNode = (Node) input;
          answer.addAll(aNode.getChildrenList());
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.