Ignore:
Timestamp:
2015-03-05T18:20:14+01:00 (9 years ago)
Author:
donvip
Message:

[josm_opendata] fix EDT violations and wrong png image paths

Location:
applications/editors/josm/plugins/opendata
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/ToulouseDataSetHandler.java

    r30340 r31048  
    3737
    3838public abstract class ToulouseDataSetHandler extends FrenchDataSetHandler implements ToulouseConstants {
    39    
     39
    4040    /**
    4141     * Categories
     
    4848    public static final DataSetCategory CAT_PATRIMOINE = new DataSetCategory("Patrimoine", "presets/ruins.png");
    4949    public static final DataSetCategory CAT_SERVICES = new DataSetCategory("Services", "styles/standard/vehicle/services.png");
    50     public static final DataSetCategory CAT_SPORT = new DataSetCategory("Sport", "presets/soccer.png");
     50    public static final DataSetCategory CAT_SPORT = new DataSetCategory("Sport", "styles/standard/sport/soccer.png");
    5151    public static final DataSetCategory CAT_TOPOGRAPHIE = new DataSetCategory("Topographie", "presets/peak.svg");
    5252    public static final DataSetCategory CAT_TRANSPORT = new DataSetCategory("Transport", "presets/bus.png");
    53     public static final DataSetCategory CAT_URBANISME = new DataSetCategory("Urbanisme", "presets/places.png");
     53    public static final DataSetCategory CAT_URBANISME = new DataSetCategory("Urbanisme", "styles/standard/place/settlement/city.png");
    5454
    5555    public ToulouseDataSetHandler(int portalId) {
    5656        init(portalId);
    5757    }
    58    
     58
    5959    public ToulouseDataSetHandler(int portalId, String relevantTag) {
    6060        super(relevantTag);
    6161        init(portalId);
    6262    }
    63    
     63
    6464    public ToulouseDataSetHandler(int portalId, boolean relevantUnion, String ... relevantTags) {
    6565        super(relevantUnion, relevantTags);
     
    7575        init(portalId);
    7676    }*/
    77    
     77
    7878    public ToulouseDataSetHandler(int portalId, boolean relevantUnion, Tag ... relevantTags) {
    7979        super(relevantUnion, relevantTags);
     
    8484        this(portalId, false, relevantTags);
    8585    }*/
    86    
     86
    8787    private final void init(int portalId) {
    8888        try {
     
    116116        return ICON_CROIX_16;
    117117    }
    118    
     118
    119119    protected final void setWikiPage(String wikiPage) {
    120120        if (wikiPage != null && !wikiPage.isEmpty()) {
     
    127127        }
    128128    }
    129    
     129
    130130    protected abstract class SplitAction extends JosmAction implements DataSetListener {
    131        
     131
    132132        public SplitAction(String name, String desc) {
    133133            super(name, null, desc, null, false);
     
    135135            ToulouseModule.data.addDataSetListener(this);
    136136        }
    137        
     137
    138138        protected abstract Collection<Relation> getBoundaries();
    139        
     139
    140140        @Override
    141141        public void actionPerformed(ActionEvent e) {
     
    191191        }
    192192    }
    193    
     193
    194194    protected class SplitByMunicipality extends SplitAction {
    195195        public SplitByMunicipality() {
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java

    r31015 r31048  
    2020import org.openstreetmap.josm.gui.MenuScroller;
    2121import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     22import org.openstreetmap.josm.gui.util.GuiHelper;
    2223import org.openstreetmap.josm.plugins.Plugin;
    2324import org.openstreetmap.josm.plugins.PluginInformation;
     
    4950
    5051    private static OdPlugin instance;
    51    
     52
    5253    public final XmlImporter xmlImporter = new XmlImporter();
    53    
     54
    5455    private final JMenu menu;
    55    
     56
    5657    private OdDialog dialog;
    57    
     58
    5859    public OdPlugin(PluginInformation info) {
    5960        super(info);
     
    7576
    7677        menu = Main.main.menu.dataMenu;
    77        
     78
    7879        new Thread(new Runnable() {
    7980            @Override
    8081            public void run() {
    81                 // Load modules
     82                // Load modules in new thread
    8283                loadModules();
    83                 // Add menu
    84                 buildMenu();
     84                // Add menu in EDT
     85                GuiHelper.runInEDT(new Runnable() {
     86                    @Override
     87                    public void run() {
     88                        buildMenu();
     89                    }
     90                });
    8591            }
    8692        }).start();
     
    9197        OdUtils.deletePreviousTempDirs();
    9298    }
    93    
     99
    94100    public static final OdPlugin getInstance() {
    95101        return instance;
    96102    }
    97    
     103
    98104    private JMenu getModuleMenu(Module module) {
    99105        String moduleName = module.getDisplayedName();
     
    105111        return moduleMenu;
    106112    }
    107    
     113
    108114    private void buildMenu() {
    109115        for (Module module : ModuleHandler.moduleList) {
     
    161167        MainMenu.add(menu, new OpenPreferencesActions());
    162168    }
    163    
     169
    164170    private void setMenuItemIcon(ImageIcon icon, JMenuItem menuItem) {
    165171        if (icon != null) {
    166             if (icon.getIconHeight() != 16 || icon.getIconWidth() != 16) { 
     172            if (icon.getIconHeight() != 16 || icon.getIconWidth() != 16) {
    167173                icon = new ImageIcon(icon.getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT));
    168174            }
     
    179185        }
    180186    }
    181    
     187
    182188    @Override
    183189    public PreferenceSetting getPreferenceSetting() {
    184190        return new OdPreferenceSetting();
    185191    }
    186    
     192
    187193    private final void loadModules() {
    188194        List<ModuleInformation> modulesToLoad = ModuleHandler.buildListOfModulesToLoad(Main.parent);
     
    194200        ModuleHandler.loadModules(Main.parent, modulesToLoad, null);
    195201    }
    196    
     202
    197203    private final File getSubDirectory(String name) {
    198204        File dir = new File(getPluginDir()+File.separator+name);
     
    202208        return dir;
    203209    }
    204    
     210
    205211    public final File getModulesDirectory() {
    206212        return getSubDirectory("modules");
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java

    r30723 r31048  
    6262        }
    6363    }*/
    64    
     64
    6565    public static String buildDownloadSummary(ModuleDownloadTask task) {
    6666        Collection<ModuleInformation> downloaded = task.getDownloadedModules();
     
    161161    }
    162162
     163    @Override
    163164    public void addGui(final PreferenceTabbedPane gui) {
    164165        GridBagConstraints gc = new GridBagConstraints();
     
    215216    }
    216217
     218    @Override
    217219    public boolean ok() {
    218220        if (! modulePreferencesActivated)
     
    236238        final ReadLocalModuleInformationTask task = new ReadLocalModuleInformationTask();
    237239        Runnable r = new Runnable() {
     240            @Override
    238241            public void run() {
    239242                if (task.isCanceled()) return;
    240243                SwingUtilities.invokeLater(new Runnable() {
     244                    @Override
    241245                    public void run() {
    242246                        model.setAvailableModules(task.getAvailableModules());
     
    262266        }
    263267
     268        @Override
    264269        public void actionPerformed(ActionEvent e) {
    265270            final ReadRemoteModuleInformationTask task = new ReadRemoteModuleInformationTask(OdPreferenceSetting.getModuleSites());
    266271            Runnable continuation = new Runnable() {
     272                @Override
    267273                public void run() {
    268274                    if (task.isCanceled()) return;
    269275                    SwingUtilities.invokeLater(new Runnable() {
     276                        @Override
    270277                        public void run() {
    271278                            model.updateAvailableModules(task.getAvailableModules());
     
    325332        }
    326333
     334        @Override
    327335        public void actionPerformed(ActionEvent e) {
    328336            final List<ModuleInformation> toUpdate = model.getSelectedModules();
     
    339347            //
    340348            final Runnable moduleDownloadContinuation = new Runnable() {
     349                @Override
    341350                public void run() {
    342351                    if (moduleDownloadTask.isCanceled())
     
    345354                    model.refreshLocalModuleVersion(moduleDownloadTask.getDownloadedModules());
    346355                    model.clearPendingModules(moduleDownloadTask.getDownloadedModules());
    347                     pnlModulePreferences.refreshView();
     356                    GuiHelper.runInEDT(new Runnable() {
     357                        @Override
     358                        public void run() {
     359                            pnlModulePreferences.refreshView();
     360                        }
     361                    });
    348362                }
    349363            };
     
    352366            //
    353367            final Runnable moduleInfoDownloadContinuation = new Runnable() {
     368                @Override
    354369                public void run() {
    355370                    if (moduleInfoDownloadTask.isCanceled())
     
    392407        }
    393408
     409        @Override
    394410        public void actionPerformed(ActionEvent e) {
    395411            configureSites();
     
    408424        }
    409425
     426        @Override
    410427        public void stateChanged(ChangeEvent e) {
    411428            JTabbedPane tp = (JTabbedPane)e.getSource();
     
    431448        }
    432449
     450        @Override
    433451        public void changedUpdate(DocumentEvent arg0) {
    434452            filter();
    435453        }
    436454
     455        @Override
    437456        public void insertUpdate(DocumentEvent arg0) {
    438457            filter();
    439458        }
    440459
     460        @Override
    441461        public void removeUpdate(DocumentEvent arg0) {
    442462            filter();
     
    459479            JPanel buttons = new JPanel(new GridBagLayout());
    460480            buttons.add(new JButton(new AbstractAction(tr("Add")){
     481                @Override
    461482                public void actionPerformed(ActionEvent e) {
    462483                    String s = JOptionPane.showInputDialog(
     
    472493            }), GBC.eol().fill(GBC.HORIZONTAL));
    473494            buttons.add(new JButton(new AbstractAction(tr("Edit")){
     495                @Override
    474496                public void actionPerformed(ActionEvent e) {
    475497                    if (list.getSelectedValue() == null) {
     
    497519            }), GBC.eol().fill(GBC.HORIZONTAL));
    498520            buttons.add(new JButton(new AbstractAction(tr("Delete")){
     521                @Override
    499522                public void actionPerformed(ActionEvent event) {
    500523                    if (list.getSelectedValue() == null) {
Note: See TracChangeset for help on using the changeset viewer.