Ignore:
Timestamp:
2010-09-16T11:38:18+02:00 (15 years ago)
Author:
stoecker
Message:

fix last remaining tabs

Location:
applications/editors/josm/plugins/smed/src/smed
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/src/smed/plug/ifc/SmedPluggable.java

    r23199 r23209  
    66public interface SmedPluggable {
    77
    8         boolean start();
    9         boolean stop();
    10         String getName();
    11         String getInfo();
    12         JComponent getComponent();
    13        
    14         void setPluginManager(SmedPluginManager manager);
     8    boolean start();
     9    boolean stop();
     10    String getName();
     11    String getInfo();
     12    JComponent getComponent();
     13   
     14    void setPluginManager(SmedPluginManager manager);
    1515
    1616}
  • applications/editors/josm/plugins/smed/src/smed/plug/util/SmedPluginLoader.java

    r23199 r23209  
    2121
    2222
    23         public static List<SmedPluggable> loadPlugins(File plugDir) throws IOException {
    24                 File[] plugJars = plugDir.listFiles(new JARFileFilter());
    25                 Arrays.sort(plugJars);
    26                
    27                 URL[] urls = fileArrayToURLArray(plugJars);
    28                 if(urls == null) return null;
    29                
    30                 ClassLoader cl = new URLClassLoader(urls);
    31                 List<Class<SmedPluggable>> plugClasses = extractClassesFromJARs(plugJars, cl);
    32                
    33                 if(plugClasses == null) return null;
    34                 else return createPluggableObjects(plugClasses);
    35         }
     23    public static List<SmedPluggable> loadPlugins(File plugDir) throws IOException {
     24        File[] plugJars = plugDir.listFiles(new JARFileFilter());
     25        Arrays.sort(plugJars);
     26       
     27        URL[] urls = fileArrayToURLArray(plugJars);
     28        if(urls == null) return null;
     29       
     30        ClassLoader cl = new URLClassLoader(urls);
     31        List<Class<SmedPluggable>> plugClasses = extractClassesFromJARs(plugJars, cl);
     32       
     33        if(plugClasses == null) return null;
     34        else return createPluggableObjects(plugClasses);
     35    }
    3636
    3737    private static List<SmedPluggable> createPluggableObjects(List<Class<SmedPluggable>> pluggables) {
  • applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabbedPane.java

    r23199 r23209  
    2424    private static final long serialVersionUID = 1L;
    2525
    26         public SmedTabbedPane() {
    27                 super(new GridLayout(1, 1));
    28                
    29                 List<SmedPluggable> plugins = null;
    30                 String pluginDirName = Main.pref.getPluginsDirectory().getAbsolutePath();
    31                 try {
    32                         plugins = SmedPluginLoader.loadPlugins(new File(pluginDirName + "/splug"));
    33                 } catch (IOException e) {
    34                         e.printStackTrace();
    35                 }
    36                
     26    public SmedTabbedPane() {
     27        super(new GridLayout(1, 1));
     28
     29        List<SmedPluggable> plugins = null;
     30        String pluginDirName = Main.pref.getPluginsDirectory().getAbsolutePath();
     31        try {
     32            plugins = SmedPluginLoader.loadPlugins(new File(pluginDirName + "/splug"));
     33        } catch (IOException e) {
     34            e.printStackTrace();
     35        }
     36
    3737
    3838        Icon icon = null;
    3939        JTabbedPane tabbedPane = new JTabbedPane();
    4040
    41                 JComponent panel;
    42                 int i = 0;
    43                 for(SmedPluggable p : plugins) {
    44                         panel = p.getComponent();
    45                         tabbedPane.addTab(p.getName(),icon, panel, p.getInfo());
    46                         tabbedPane.setMnemonicAt(i, KeyEvent.VK_1 + i);
    47                        
    48                         i++;
    49                 }
     41        JComponent panel;
     42        int i = 0;
     43        for(SmedPluggable p : plugins) {
     44            panel = p.getComponent();
     45            tabbedPane.addTab(p.getName(),icon, panel, p.getInfo());
     46            tabbedPane.setMnemonicAt(i, KeyEvent.VK_1 + i);
     47
     48            i++;
     49        }
    5050
    5151        //Add the tabbed pane to this panel.
Note: See TracChangeset for help on using the changeset viewer.