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

me.dsnet.quickopener.actions.popup.PropertyTableModel 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!
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package me.dsnet.quickopener.actions.popup;

import me.dsnet.quickopener.prefs.PrefsUtil;
import me.dsnet.quickopener.prefs.QuickOpenerProperty;
import java.util.List;
import java.util.prefs.BackingStoreException;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author SessonaD
 */
public class PropertyTableModel extends AbstractTableModel {

    String[] columnNames = {"Name", "Path"};
    Object[][] data = null;

    public PropertyTableModel(String prefix) {
        setColumnNames(prefix);
        try {
            List prefs = PrefsUtil.getAllMatching(prefix);
            this.data = new Object[prefs.size()][2];
            for (int i = 0; i < prefs.size(); i++) {
                QuickOpenerProperty pref = prefs.get(i);
                String desc = pref.getDescription();
                String val = pref.getValue();
                this.data[i] = new String[]{desc, val};
            }
        } catch (BackingStoreException ex) {
            //Exceptions.printStackTrace(ex);
        }
    }

    private void setColumnNames(String prefix) {
        if (prefix.equals("command")) {
            columnNames = new String[]{"Name", "Command"};
        } else {
            columnNames = new String[]{"Name", "Path"};
        }
    }

    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    @Override
    public int getRowCount() {
        return data.length;
    }

    @Override
    public String getColumnName(int col) {
        return columnNames[col];
    }

    @Override
    public Object getValueAt(int row, int col) {
        return data[row][col];
    }

    @Override
    public Class getColumnClass(int c) {
        return String.class;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy