dzsessona / QuickOpener-NetBeans

Sometimes while programming in NetBeans you want to explore a particular file that you are editing on the file system browser, or maybe launch a command in a terminal to do something with it.
53 stars 40 forks source link

Support project nodes #31

Closed markiewb closed 11 years ago

markiewb commented 11 years ago

Currently it is not possible to open a console/file browser for the selected project-node in the project TC. The action is not enabled.

EXPECTED: Support project nodes

The following code to determine the project directory is taken from my plugin @ http://code.google.com/p/show-path-in-title-netbeans-module/source/browse/src/de/markiewb/netbeans/plugin/showpathintitle/PathUtil.java

    private String getProjectDirectory(final FileObject primaryFile) {
        try {
            Project project = ProjectUtils.getInformation(FileOwnerQuery.getOwner(primaryFile)).getProject();
            return getProjectDirectory(project);
        } catch (Exception e) {
            //ignore the exception
            return null;
        }
    }

    private String getProjectDirectory(final Project project) {
        try {
            FileObject projectDirectory = project.getProjectDirectory();
            return projectDirectory.getPath();
        } catch (Exception e) {
            //ignore the exception
            return null;
        }
    }
dzsessona commented 11 years ago

projects

Hi markiewb, is this what you mean? If it is than it will be available next version, but I want to fix your other bug (support in favorites folder) before uploading the plugin again. Can you answer on that bug when you have time?

markiewb commented 11 years ago

Hi Diego. The plugin only seems to support ProjectNodes/ProjectTypes which contain a DataObject or FileObject in the lookup. Not all project types provide it in the lookup. That is the reason it does not work f.e. for NB module nor NB suite projects. See the screenshot. (I haven't tried PHP or JS or other projects) 2013-02-27_22h58_18

Please use project.getProjectDirectory() to get the path.

markiewb commented 11 years ago

FYI: Tested with 1.0.2

markiewb commented 11 years ago

I filed an issue in the NetBeans bugtracker.The Ant-based project nodes should include the project directory in their lookup

https://netbeans.org/bugzilla/show_bug.cgi?id=233682

markiewb commented 11 years ago

This issue is now invalid since the NB team added the datafolder of the project to the projectsnode of ant-based NBMs/suites. See https://netbeans.org/bugzilla/show_bug.cgi?id=233682#c12

Your (unchanged) plugin works now out of the box with NB74dev>201308072300