Package org.openide.nodes

Examples of org.openide.nodes.Node


    }

    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();
    }
View Full Code Here


      return null;
  }

  DataObject dataObject = activeTC.getLookup().lookup(DataObject.class);
  Project project = activeTC.getLookup().lookup(Project.class);
  Node node = activeTC.getLookup().lookup(Node.class);
  FileObject fileObject = activeTC.getLookup().lookup(FileObject.class);
  //                showInStatusBar(project);

  String projectName = null;
  String projectDir = null;
  String fileName = null;
  if (null != project) {
      projectName = getProjectName(project);
      projectDir = getProjectDirectory(project);
  }

  if (null != dataObject || null != fileObject) {

      final FileObject primaryFile;
      if (null != dataObject) {
    primaryFile = getFileObjectWithShadowSupport(dataObject);
      } else {
    primaryFile = fileObject;
      }
      projectDir = getProjectDirectory(primaryFile);
      projectName = getProjectName(primaryFile);


      if (null != primaryFile.getPath()) {
    fileName = primaryFile.getPath();
      }

      //support selected items in jars
      if (null != FileUtil.getArchiveFile(primaryFile)) {
    String fullJARPath = FileUtil.getArchiveFile(primaryFile).getPath();
    String archiveFileName = primaryFile.getPath();
    boolean hasFileName = null != archiveFileName && !"".equals(archiveFileName);
    if (hasFileName) {
        fileName = fullJARPath + "/" + archiveFileName;
    } else {
        fileName = fullJARPath;
    }
      }

  }
  // create title
  Set<String> list = new LinkedHashSet<String>();

  if (options.showProjectGroup) {
      String activeProjectGroup = new ProjectGroupUtil().getActiveProjectGroup();
      list.add(activeProjectGroup);
  }
  if (options.showProjectName) {
      list.add(projectName);
  }

  if (options.showFileName) {
      //show relative path, when project dir is in selected path
      //show no relative path, when project dir equals selected path
      boolean isRelativePath = null != fileName && null != projectDir && fileName.startsWith(projectDir) && !fileName.equals(projectDir);
      if (options.showRelativeFilename && isRelativePath) {
    //create and use relative file name
    String reducedFileName = fileName.substring(projectDir.length());
    fileName = reducedFileName;
      }
      if (null == fileName && null != projectDir) {
    //show projectDir as fallback
    fileName = projectDir;
      }
      if (null == fileName && null != node) {
    //show node label as further fallback
    fileName = (node.getDisplayName());
      }

      list.add(fileName);
  }
View Full Code Here

    protected boolean enable(Node[] activatedNodes) {
        if (activatedNodes.length == 0) {
            return false;
        }

        Node node = activatedNodes[0];
        DisconnectCookieInterface disconnect = node.getCookie(DisconnectCookieInterface.class);
        if (disconnect != null && disconnect.getIsConnected()) {
            return true;
        }

        return false;
View Full Code Here

    @Override
    protected void performAction(Node[] arg0) {
        //Object cls = arg0[0];
        //JOptionPane.showMessageDialog(null, "Object is " + cls.getClass().getName());
        Node nd = arg0[0];
        EditCookieInterface edit = nd.getCookie(EditCookieInterface.class);
        if (edit != null) {
            edit.Edit();
        }
    }
View Full Code Here

    protected boolean enable(Node[] activatedNodes) {
        if (activatedNodes.length == 0 || activatedNodes.length > 1) {
            return false;
        }

        Node node = activatedNodes[0];
        EditCookieInterface edit = node.getCookie(EditCookieInterface.class);
        if (edit != null && !edit.getIsConnected()) {
            return true;
        }

        return false;
View Full Code Here

    protected boolean enable(Node[] activatedNodes) {
        if (activatedNodes.length == 0) {
            return false;
        }

        Node node = activatedNodes[0];

        RefreshCookieInterface refresh = node.getCookie(RefreshCookieInterface.class);
        //if (server != null && server.isConnected()) {
        if (refresh != null) {
            return true;
        }
View Full Code Here

    @Override
    protected void performAction(Node[] arg0) {
        //Object cls = arg0[0];
        //JOptionPane.showMessageDialog(null, "Object is " + cls.getClass().getName());
        Node nd = arg0[0];
        DeleteCookieInterface delete = nd.getCookie(DeleteCookieInterface.class);
        if (delete != null) {
            int ret = JOptionPane.showConfirmDialog(null,
                    NbBundle.getMessage(Utils.getCommonClass(), "LBL_DeleteConfirmMsg", delete.toString()),
                    Utils.getBundle().getString("LBL_DeleteConfirmCaptionMsg"), JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE);
            if (ret == JOptionPane.YES_OPTION) {
                Node node = nd.getParentNode();
                delete.Delete();
                RefreshCookieInterface refresh = null;
                if (node != null) {
                    refresh = node.getCookie(RefreshCookieInterface.class);
                }
                try {
                    nd.destroy();
                    if (refresh != null) {
                        refresh.Refresh();
View Full Code Here

    @Override
    protected boolean enable(Node[] activatedNodes) {
        if (activatedNodes.length == 0 || activatedNodes.length > 1) {
            return false;
        }
        Node node = activatedNodes[0];
        DeleteCookieInterface delete = node.getCookie(DeleteCookieInterface.class);
        if (delete != null && !delete.getIsConnected()) {
            return true;
        }
        return false;
    }
View Full Code Here

    private static final String ICON = "org/netbeans/modules/languages/pl_sql/editor/resources/mydba.gif";

    @Override
    protected void performAction(Node[] arg0) {
        Node nd = arg0[0];
        ChangeOAccess(nd, ObjectAccessed.DBA);
    }
View Full Code Here

    @Override
    protected void performAction(Node[] arg0) {
        //Object cls = arg0[0];       
        //JOptionPane.showMessageDialog(null, "Object is " + cls.getClass().getName());
        Node nd = arg0[0];
        /*Node found = nd.getChildren().findChild("svco");
        if (found != null) {
        JOptionPane.showMessageDialog(null, "Found " + found.getName());
        return;
        }*/
        AddCookieInterface add = nd.getCookie(AddCookieInterface.class);
        if (add != null) {
            add.Add();
        }

    }
View Full Code Here

TOP

Related Classes of org.openide.nodes.Node

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.