All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.dsnet.quickopener.actions.popup.CustomCommandPopupAction Maven / Gradle / Ivy

Go to download

<p>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.</p> <p>This plugins brings to your NetBeans six action, three of them always available and three of them available when the selected node has a file assiociated with it.<br/> In particular:<p><p><em>When the selection has a valid file</em></p> <ul> <li><strong>Open the default OS shell</strong> on the location of the file (or its folder) selected.</li> <li><strong>Open the file system browser</strong> on the location of the file (or its folder) selected.</li> <li><strong>Copy to the clipboard</strong> the path of the file selected.</li> </ul> <p><em>Always enabled:</em></p> <ul> <li><strong>Launch a shell command</strong> (with parameters, customizable on preferences)</li> <li><strong>FileSystem browser on any location</strong> (favorites, customizable on preferences)</li> <li><strong>Open a shell on any location</strong> (favorites, customizable on preferences)</li> </ul>

The newest version!
package me.dsnet.quickopener.actions.popup;

import java.awt.Dimension;
import java.awt.HeadlessException;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import org.openide.util.NbBundle;

/**
 *
 * @author SessonaD
 */
@NbBundle.Messages("CTL_CustomCommandPopupAction=Launch custom command...")
public class CustomCommandPopupAction extends AbstractAction implements ActionListener {

    public CustomCommandPopupAction() {
    }

    public CustomCommandPopupAction(String name) {
        super(name);
    }

    public CustomCommandPopupAction(String name, Icon icon) {
        super(name, icon);
    }

    @Override
    public void actionPerformed(ActionEvent e) {

        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    DialogCustomCommandRun dialogue = new DialogCustomCommandRun(null, true);
                    final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                    final int x = (screenSize.width - dialogue.getWidth()) / 2;
                    final int y = (screenSize.height - dialogue.getHeight()) / 2;
                    dialogue.setLocation(x, y);
                    dialogue.setVisible(true);

                } catch (HeadlessException ex) {
                }
            }
        });
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy