GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
mark.george
/
NBFolderOpener
Browse code
Remove leftover println
master
1 parent
9b09e98
commit
45240f29f0a2f946b851739573d5c1621ea26263
Mark George
authored
on 10 Feb 2020
Patch
Showing
1 changed file
src/nz/ac/otago/infosci/folderopener/FileSystem.java
Ignore Space
Show notes
View
src/nz/ac/otago/infosci/folderopener/FileSystem.java
package nz.ac.otago.infosci.folderopener; import java.awt.Desktop; import java.io.File; import java.io.IOException; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionReferences; import org.openide.awt.ActionRegistration; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.NbBundle.Messages; import org.openide.util.actions.NodeAction; @ActionID( category = "File", id = "nz.ac.otago.infosci.folderopener.FolderOpener" ) @ActionRegistration( lazy=false, displayName = "#CTL_FolderOpener" ) @ActionReferences({ @ActionReference(path = "Projects/Actions", position = 10000, separatorBefore = 9999), @ActionReference(path = "Loaders/folder/any/Actions", position = 10000, separatorBefore = 9999) }) @Messages("CTL_FolderOpener=Open in File Manager") public final class FileSystem extends NodeAction { public FileSystem() { } @Override protected void performAction(Node[] nodes) { try { DataObject lookup = nodes[0].getLookup().lookup(DataObject.class); String path = lookup.files().iterator().next().getPath(); Desktop.getDesktop().open(new File(path)); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } @Override protected boolean enable(Node[] nodes) { return true; } @Override public String getName() { return Bundle.CTL_FolderOpener(); } @Override public HelpCtx getHelpCtx() { return null; } @Override protected boolean asynchronous() { return false; } }
package nz.ac.otago.infosci.folderopener; import java.awt.Desktop; import java.io.File; import java.io.IOException; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionRegistration; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.NbBundle.Messages; import org.openide.util.actions.NodeAction; @ActionID( category = "Tools", id = "nz.ac.otago.infosci.folderopener.FolderOpener" ) @ActionRegistration( lazy=false, displayName = "#CTL_FolderOpener" ) //@ActionReference(path = "Loaders/folder/any/Actions", position = 10000, separatorBefore = 9999) @ActionReference(path = "Projects/Actions", position = 10000, separatorBefore = 9999) @Messages("CTL_FolderOpener=Open in File Manager") public final class FileSystem extends NodeAction { public FileSystem() { } @Override protected void performAction(Node[] nodes) { try { DataObject lookup = nodes[0].getLookup().lookup(DataObject.class); String path = lookup.files().iterator().next().getPath(); System.out.println(path); Desktop.getDesktop().open(new File(path)); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } @Override protected boolean enable(Node[] nodes) { return true; } @Override public String getName() { return Bundle.CTL_FolderOpener(); } @Override public HelpCtx getHelpCtx() { return null; } @Override protected boolean asynchronous() { return false; } }
Show line notes below