public static void open(File f) {
    FileObject fob = FileUtil.toFileObject(FileUtil.normalizeFile(f));
    if (fob == null) return;

    try {
      // the process succeeded
      DataObject dob = DataObject.find(fob);
      if (f.getName().toLowerCase().endsWith(".properties")) // NOI18N
      {
        EditCookie oc = dob.getCookie(EditCookie.class);
        if (oc != null) oc.edit();
      } else {
        OpenCookie oc = dob.getCookie(OpenCookie.class);
        if (oc != null) oc.open();
      }

    } catch (DataObjectNotFoundException ex) {
      ErrorManager.getDefault().notify(ex);
    }
  }
Beispiel #2
0
  public void actionPerformed(ActionEvent e) {
    Node node = getNextMeaningfullNode();

    if (node == null) {
      // should not happen
      fireEnabledChanged();
      return;
    }

    OpenCookie oc = node.getLookup().lookup(OpenCookie.class);

    assert oc != null;

    addToSeenNodes(node);

    try {
      comp.getExplorerManager().setSelectedNodes(new Node[] {node});
    } catch (PropertyVetoException ex) {
      Exceptions.printStackTrace(ex);
    }

    oc.open();
    fireEnabledChanged();
  }