public ListIterator<Node> getRemaining(Node current) {
   Vector<Node> v = new Vector<Node>();
   for (Node n : list.subList(indexOf(current), list.size())) {
     v.add(n.getLookup().lookup(ModelComponentNode.class));
   }
   return (v.listIterator());
 }
  private synchronized void updateCurrentFiles() {
    Set<FileObject> newCurrentFiles = new HashSet<FileObject>();

    newCurrentFiles.addAll(fileObjectResult.allInstances());

    for (DataObject d : dataObjectResult.allInstances()) {
      newCurrentFiles.add(d.getPrimaryFile());
    }

    for (Node n : nodeResult.allInstances()) {
      newCurrentFiles.addAll(n.getLookup().lookupAll(FileObject.class));

      for (DataObject d : n.getLookup().lookupAll(DataObject.class)) {
        newCurrentFiles.add(d.getPrimaryFile());
      }
    }

    List<FileObject> newCurrentFilesFiltered =
        OpenedEditors.filterSupportedMIMETypes(
            new LinkedList<FileObject>(newCurrentFiles), supportedMimeTypes);

    if (!currentFiles.equals(newCurrentFilesFiltered)) {
      currentFiles = newCurrentFilesFiltered;
      lookupContentChanged();
    }
  }
  public Node[] getServiceNodes(Project project) {
    WebServicesSupport jaxrpcWsSupport =
        WebServicesSupport.getWebServicesSupport(project.getProjectDirectory());

    if (jaxrpcWsSupport != null) {
      Sources sources = (Sources) project.getLookup().lookup(Sources.class);
      if (sources != null) {
        SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        if (groups != null) {
          List<FileObject> roots = new ArrayList<FileObject>();
          for (SourceGroup group : groups) {
            roots.add(group.getRootFolder());
          }
          if (jaxrpcWsSupport.getServices().size() > 0 && roots.size() > 0) {
            FileObject srcRoot = roots.get(0);
            Node servicesNode =
                WebServicesView.getWebServicesView(srcRoot).createWebServicesView(srcRoot);
            if (servicesNode != null) {
              return servicesNode.getChildren().getNodes();
            }
          }
        }
      }
    }
    return null;
  }
Пример #4
0
 /**
  * DOCUMENT ME!
  *
  * @param libNodes DOCUMENT ME!
  * @return DOCUMENT ME!
  */
 private boolean performDeploy(final List<Node> libNodes) {
   final List<DeployInformation> infos = new LinkedList<DeployInformation>();
   final ModificationStore modStore = ModificationStore.getInstance();
   for (final Node libNode : libNodes) {
     for (final Node node : libNode.getChildren().getNodes(true)) {
       for (final Action a : node.getActions(false)) {
         // if this action is registered it node should be of type
         // LocalManagement or StarterManagement
         if (a instanceof DeployChangedJarsAction) {
           for (final Node ch : node.getChildren().getNodes()) {
             final DeployInformation info = DeployInformation.getDeployInformation(ch);
             final String path = FileUtil.toFile(info.getSourceDir()).getAbsolutePath();
             if (modStore.anyModifiedInContext(path, ModificationStore.MOD_CHANGED)) {
               infos.add(info);
             }
           }
           // continue with outer loop since only one action of
           // this type should be registered
           break;
         }
       }
     }
   }
   try {
     JarHandler.deployAllJars(infos, JarHandler.ANT_TARGET_DEPLOY_CHANGED_JARS);
     for (final DeployInformation info : infos) {
       final String path = FileUtil.toFile(info.getSourceDir()).getAbsolutePath();
       modStore.removeAllModificationsInContext(path, ModificationStore.MOD_CHANGED);
     }
     return true;
   } catch (final IOException ex) {
     LOG.warn("could not deploy changed jars", ex); // NOI18N
     return false;
   }
 }
  /** Refreshes changed content nodes */
  private void refreshDataSourceTree() {
    Node selectedNode = getSelectedNode();
    final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());

    Children rootChildren = em.getRootContext().getChildren();
    Node dataSourcesFilterNode = rootChildren.findChild(DataSourcesNode.NAME);
    if (dataSourcesFilterNode == null) {
      logger.log(
          Level.SEVERE,
          "Cannot find data sources filter node, won't refresh the content tree"); // NON-NLS
      return;
    }
    OriginalNode imagesNodeOrig = dataSourcesFilterNode.getLookup().lookup(OriginalNode.class);

    if (imagesNodeOrig == null) {
      logger.log(
          Level.SEVERE, "Cannot find data sources node, won't refresh the content tree"); // NON-NLS
      return;
    }

    Node imagesNode = imagesNodeOrig.getNode();

    RootContentChildren contentRootChildren = (RootContentChildren) imagesNode.getChildren();
    contentRootChildren.refreshContentKeys();

    // final TreeView tree = getTree();
    // tree.expandNode(imagesNode);

    setSelectedNode(selectedPath, DataSourcesNode.NAME);
  }
  private void updateHistory(Node[] selectedNodes) {
    if (selectedNodes.length == 0) {
      return;
    }

    Node selectedNode = selectedNodes[0];
    String selectedNodeName = selectedNode.getName();

    /* get the previous entry to make sure we don't duplicate it.
     * Motivation for this is also that if we used the back button,
     * then we already added the 'current' node to 'back' and we will
     * detect that and not reset the forward list.
     */
    String[] currentLast = backList.peekLast();
    String lastNodeName = null;
    if (currentLast != null) {
      lastNodeName = currentLast[currentLast.length - 1];
    }

    if (currentLast == null || !selectedNodeName.equals(lastNodeName)) {
      // add to the list if the last if not the same as current
      final String[] selectedPath = NodeOp.createPath(selectedNode, em.getRootContext());
      backList.addLast(selectedPath); // add the node to the "backList"
      if (backList.size() > 1) {
        backButton.setEnabled(true);
      } else {
        backButton.setEnabled(false);
      }

      forwardList.clear(); // clear the "forwardList"
      forwardButton.setEnabled(false); // disable the forward Button
    }
  }
    private Node createServletsNode() {
      ExtendedServletsType[] servlets = webext.getExtendedServlets();
      Children servch = new Children.Array();
      Node[] servletNode = null;

      if (servlets != null && servlets.length > 0) {
        servletNode = new Node[servlets.length];
        for (int i = 0; i < servlets.length; i++) {
          servletNode[i] = new ServletsNode();
          servletNode[i].setDisplayName("Extended Servlet #" + (i + 1));
        }
        servch.add(servletNode);
      }

      Node servletsNode = new SectionContainerNode(servch);
      servletsNode.setDisplayName("Extended Servlets");

      servletsCont = new SectionContainer(this, servletsNode, "Extended Servlets");
      servletsCont.setHeaderActions(new javax.swing.Action[] {addServletAction});

      // creatings section panels for ResRefs
      if (servlets != null) {
        SectionPanel[] pan = new SectionPanel[servlets.length];
        for (int i = 0; i < servlets.length; i++) {
          pan[i] = new SectionPanel(this, servletNode[i], servlets[i]);
          pan[i].setHeaderActions(new javax.swing.Action[] {removeServletAction});
          servletsCont.addSection(pan[i]);
        }
      }
      addSection(servletsCont);
      return servletsNode;
    }
  /* (non-Javadoc)
   * @see org.openide.util.actions.NodeAction#enable(org.openide.nodes.Node[])
   */
  @Override
  protected boolean enable(Node[] nodes) {
    // TODO Solve friend dependency issues to maven module and try again :-/
    // boolean isMvn = false;
    if (null != nodes) {
      for (Node currentnode : nodes) {
        DataObject dObj = currentnode.getLookup().lookup(DataObject.class);
        if (null != dObj) {
          determineSelectedClass(dObj);
        }
        Project pro = Te2mWizardBase.findProjectThatOwnsNode(currentnode);

        /*
        if( null!=pro && pro instanceof NbMavenProject )
        {
            isMvn=true;
            NbMavenProject mvnPro = (NbMavenProject)pro;
            System.out.println("Works :-)");
        }

         */
      }
    }
    /*
    if (isMvn) {
        return isEnabled();
    }

    return false;
     */
    return isEnabled();
  }
    public void actionPerformed(java.awt.event.ActionEvent evt) {
      try {
        dObj.setChangedFromUI(true);
        WSWebExt webext = dObj.getWebExt();
        ExtendedServletsType es = new ExtendedServletsType();
        es.setDefaults();
        int number = webext.getExtendedServlets().length + 1;
        long time_id = java.lang.System.currentTimeMillis();

        es.setExtendedServlet("");
        es.setXmiId("ServletExtension_" + time_id);
        es.setHref("");

        // rr.setTitle("Binding Item #"+number);
        webext.addExtendedServlets(es);
        //////////////////////////////////
        Node servletNode = new ServletsNode();
        view.getRoot().getChildren().add(new Node[] {servletNode});
        servletNode.setDisplayName(servletNode.getDisplayName() + number);

        dObj.modelUpdatedFromUI();
        SectionPanel sectionPanel = new SectionPanel(view, servletNode, es);
        sectionPanel.setHeaderActions(new javax.swing.Action[] {removeServletAction});
        ((WSWebExtView) view).getServletsContainer().addSection(sectionPanel, true);
        dObj.setChangedFromUI(false);

      } catch (java.io.IOException ex) {
      } catch (java.lang.IllegalArgumentException ex) {
      }
    }
Пример #10
0
  public void actionPerformed(ActionEvent e) {
    Pattern selected = getDesignView().getSelectionModel().getSelectedPattern();

    if (selected == null) {
      return;
    }

    Node node = getDesignView().getNodeForPattern(selected);

    if (node == null) {
      return;
    }

    Action[] actions = node.getActions(true);
    if (actions == null) {
      return;
    }

    for (int i = actions.length - 1; i >= 0; i--) {
      Action action = actions[i];
      if (action instanceof GoToAction) {
        org.netbeans.modules.bpel.nodes.actions.GoToSourceAction gotoAction =
            SystemAction.get(org.netbeans.modules.bpel.nodes.actions.GoToSourceAction.class);
        Node[] nodes = new Node[] {node};
        if (gotoAction != null && gotoAction.enable(nodes)) {
          gotoAction.performAction(nodes);
        }
        break;
      }
    }
  }
  /* (non-Javadoc)
   * @see org.openide.util.actions.NodeAction#performAction(org.openide.nodes.Node[])
   */
  @Override
  protected void performAction(Node[] nodes) {
    // context.

    if (null != nodes) {
      for (Node currentnode : nodes) {
        DataObject dObj = currentnode.getLookup().lookup(DataObject.class);
        // Project pRoot = currentnode.getLookup().lookup(Project.class);
        Project pRoot = Te2mWizardBase.findProjectThatOwnsNode(currentnode);
        if (null != dObj) {
          determineSelectedClass(dObj);
          FileObject fo = dObj.getPrimaryFile();

          JavaSource jsource = JavaSource.forFileObject(fo);

          if (jsource == null) {
            StatusDisplayer.getDefault().setStatusText("Not a Java file: " + fo.getPath());
          } else {
            StatusDisplayer.getDefault().setStatusText("Hurray! A Java file: " + fo.getPath());

            executeWizard(currentnode);
          }
        }
      }
    }
  }
Пример #12
0
  private Node getNextMeaningfullNode() {
    if (comp.nodesForNext == null) {
      comp.nodesForNext = new LinkedList<Node>();
      comp.nodesForNext.add(comp.getExplorerManager().getRootContext());
    }

    List<Node> nodesForNext = comp.nodesForNext;

    while (!nodesForNext.isEmpty()) {
      Node top = nodesForNext.remove(0);

      if (top.getChildren() != Children.LEAF) {
        nodesForNext.addAll(0, Arrays.asList(top.getChildren().getNodes(true)));
        continue;
      }

      ErrorDescription ed = top.getLookup().lookup(ErrorDescription.class);

      if (ed != null) {
        Node[] selected = comp.getExplorerManager().getSelectedNodes();

        if (selected.length == 1 && selected[0] == top) {
          addToSeenNodes(top);
          continue;
        }

        return top;
      }
    }

    return null;
  }
Пример #13
0
  public void performAction(Node[] activatedNodes) {
    Node n = activatedNodes[0];
    Folder folder = (Folder) n.getValue("Folder"); // NOI18N
    assert folder != null;
    Node thisNode = (Node) n.getValue("This"); // NOI18N
    assert thisNode != null;
    Project project = (Project) n.getValue("Project"); // NOI18N
    assert project != null;

    ConfigurationDescriptorProvider pdp =
        project.getLookup().lookup(ConfigurationDescriptorProvider.class);
    MakeConfigurationDescriptor makeConfigurationDescriptor = pdp.getConfigurationDescriptor();
    if (!makeConfigurationDescriptor.okToChange()) {
      return;
    }

    NotifyDescriptor.InputLine dlg =
        new NotifyDescriptor.InputLine(getString("FolderNameTxt"), getString("NewFolderName"));
    dlg.setInputText(folder.suggestedNewFolderName());
    String newname = null;

    if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) {
      newname = dlg.getInputText();
    } else {
      return;
    }

    Folder newFolder = folder.addNewFolder(true);
    newFolder.setDisplayName(newname);
    MakeLogicalViewProvider.setVisible(project, newFolder);
  }
Пример #14
0
  /**
   * Perform special enablement check in addition to the normal one.
   *
   * <p>protected boolean enable (Node[] nodes) { if (!super.enable(nodes)) { return false; } }
   *
   * <p>if (...) { ... }
   */
  @Override
  protected boolean enable(Node[] nodes) {
    if (nodes.length == 0) {
      return false;
    }

    for (Node node : nodes) {
      DataObject dataObj = node.getCookie(DataObject.class);
      if (dataObj != null) {
        FileObject fileObj = dataObj.getPrimaryFile();
        if ((fileObj == null) || !fileObj.isValid()) {
          continue;
        }

        Project prj = FileOwnerQuery.getOwner(fileObj);
        if ((prj == null) || (getSourceGroup(fileObj, prj) == null)) {
          continue;
        }

        if (TestUtil.isJavaFile(fileObj) || (node.getCookie(DataFolder.class) != null)) {
          return true;
        }
      }
    }
    return false;
  }
Пример #15
0
  /*
   * @see org.openide.util.actions.SystemAction#getName()
   */
  @Override
  public String getName() {
    for (final Node node : nodes)
      if (node.getClass().equals(PackageNode.class))
        return Messages.getString("updateAction.getName"); // $NON-NLS-1$

    return null;
  }
Пример #16
0
 Explorer(Service service) {
   this.roots = new Children.Array();
   roots.add(new Node[] {new ServiceNode(service)});
   Node root = new AbstractNode(roots);
   root.setDisplayName("Root"); // Not visible
   this.manager = new ExplorerManager();
   this.manager.setRootContext(root);
   initialize();
 }
Пример #17
0
 /**
  * Copy this delegated dataobject node to the clipboard.
  *
  * @return {@link org.openide.util.datatransfer.ExTransferable.Single} with one copy flavor
  * @throws IOException if it could not copy
  * @see org.openide.nodes.NodeTransfer
  */
 @Override
 public Transferable clipboardCopy() throws IOException {
   DataObject dObj = getDataObject();
   if (dObj != null) {
     Node delegator = dObj.getNodeDelegate();
     return delegator != null ? delegator.clipboardCopy() : null;
   }
   return null;
 }
Пример #18
0
 private void actionPerformed(Node node) {
   int id = node.getLookup().lookup(Integer.class);
   Exception ex = node.getLookup().lookup(Exception.class);
   if (isInModalDialog()) {
     showDialog(ex);
   } else {
     showTopComponent(id, ex);
   }
 }
Пример #19
0
 @Override
 protected Node[] createNodes(Object key) {
   Node node;
   if (key == keyLayout) node = new LayoutNode((RADVisualContainer) container);
   else {
     node = new RADComponentNode((RADComponent) key);
     node.getChildren().getNodes(); // enforce subnodes creation
   }
   return new Node[] {node};
 }
Пример #20
0
  @Override
  public boolean isSupported(Node node) {
    if (node == null) {
      return false;
    }

    Collection<? extends MarkupSource> sources = node.getLookup().lookupAll(MarkupSource.class);
    HighlightLookup highlight = node.getLookup().lookup(HighlightLookup.class);

    return !sources.isEmpty() || highlight != null || solrHasContent(node);
  }
 protected Node[] createNodes(final Node n) {
   final DataObject dob = (DataObject) n.getCookie(DataObject.class);
   if (dob == null) return new Node[0];
   final ArrayList<Node> nodes = new ArrayList<Node>();
   for (FileObject fo : (java.util.Set<FileObject>) dob.files()) {
     if (acceptFileObject(fo)) {
       nodes.add(new FOBNode(n.cloneNode(), fo));
     }
   }
   return nodes.toArray(new Node[nodes.size()]);
 }
Пример #22
0
 /** Overrides superclass method. Initializes editor component. */
 protected void initializeCloneableEditor(CloneableEditor editor) {
   DataObject obj = getDataObject();
   if (obj.isValid()) {
     org.openide.nodes.Node ourNode = obj.getNodeDelegate();
     editor.setActivatedNodes(new org.openide.nodes.Node[] {ourNode});
     editor.setIcon(ourNode.getIcon(java.beans.BeanInfo.ICON_COLOR_16x16));
     NodeListener nl = new DataNodeListener(editor);
     ourNode.addNodeListener(WeakListener.node(nl, ourNode));
     nodeL = nl;
   }
 }
  @Override
  protected Node[] createNodes(Object key) {

    final Enterprise enterprise1 = (Enterprise) key;
    Node result;
    result =
        new AbstractNode(new EnterpriseChildren(enterprise1), Lookups.singleton(enterprise1)) {

          @Override
          protected Sheet createSheet() {
            Sheet sheet = Sheet.createDefault();
            Sheet.Set set = Sheet.createPropertiesSet();

            Property giamDocProperty =
                new PropertySupport.ReadOnly<String>(Giamdoc_PROPERTY, String.class, "Thu", "aaa") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateSumImportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(giamDocProperty);
            Property congTyMeProperty =
                new PropertySupport.ReadOnly<String>(
                    Congtyme_PROPERTY, String.class, "Chi", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateSumExportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(congTyMeProperty);
            sheet.put(set);
            return sheet;
          }
        };

    result.setDisplayName(enterprise1.getEnterpriseName());
    return new Node[] {result};
  }
 @Override
 public void doDelete(final Lookup lookup) {
   Collection<? extends Node> nodes = lookup.lookupAll(Node.class);
   FileObject[] fobs = new FileObject[nodes.size()];
   int i = 0;
   for (Node node : nodes) {
     DataObject dob = (DataObject) node.getCookie(DataObject.class);
     if (dob != null) {
       fobs[i++] = dob.getPrimaryFile();
     }
   }
   UI.openRefactoringUI(new SafeDeleteUI(fobs));
 }
Пример #25
0
 @Override
 public void mouseClicked(MouseEvent e) {
   int row = outline.rowAtPoint(e.getPoint());
   int col = outline.columnAtPoint(e.getPoint());
   if (prevCol == col && prevRow == row && System.currentTimeMillis() - time < 500) {
     Node node = Visualizer.findNode(outline.getValueAt(row, 0));
     time = 0;
     node.getPreferredAction().actionPerformed(null);
   } else {
     time = System.currentTimeMillis();
   }
   prevRow = row;
   prevCol = col;
 }
 public ModelItem[] getChildren() {
   if (group == null) return null;
   if (children == null) {
     final Node n = PackageView.createPackageView(group);
     if (n == null) return null;
     final Children ch = n.getChildren();
     if (ch == null) return null;
     final Node nodes[] = ch.getNodes(true);
     children = new ModelItem[nodes.length];
     for (int i = 0; i < nodes.length; i++) {
       children[i] = new ModelItem(nodes[i]);
     }
   }
   return children;
 }
 @Override
 public void resultChanged(LookupEvent le) {
   Collection<? extends Person> p = personResult.allInstances();
   if (p.size() == 1) {
     Person currentPerson = p.iterator().next();
     for (Node node : em.getRootContext().getChildren().getNodes()) {
       if (node.getLookup().lookup(Synchronizable.class).getPerson() == currentPerson) {
         try {
           em.setSelectedNodes(new Node[] {node});
         } catch (PropertyVetoException ex) {
           Exceptions.printStackTrace(ex);
         }
       }
     }
   }
 }
 public RootNode(Node node, TitanPlatformProject project) throws DataObjectNotFoundException {
   super(
       node,
       new FilterNode.Children(node),
       new ProxyLookup(new Lookup[] {Lookups.singleton(project), node.getLookup()}));
   this.project = project;
 }
Пример #29
0
  @Override
  public boolean isSupported(Node node) {
    if (node == null) {
      return false;
    }

    AbstractFile file = node.getLookup().lookup(AbstractFile.class);
    if (file == null) {
      return false;
    }

    if (file.getSize() == 0) {
      return false;
    }
    String name = file.getName().toLowerCase();
    if (imagePanelInited) {
      if (containsExt(name, imageExtensions)) {
        return true;
      } else if (Utilities.isJpegFileHeader(file)) {
        return true;
      }
      // for gstreamer formats, check if initialized first, then
      // support audio formats, and video formats
    }

    if (videoPanelInited && videoPanel.isInited()) {
      if (containsExt(name, AUDIO_EXTENSIONS) || (containsExt(name, videoExtensions))) {
        return true;
      }
    }

    return false;
  }
 public String getDisplayName() {
   if (group != null) {
     return group.getDisplayName();
   }
   final String nodeName = node.getName();
   return nodeName.length() == 0 ? DEFAULT_PACKAGE_DISPLAY_NAME : nodeName;
 }