Changeset 26373 in osm for applications


Ignore:
Timestamp:
2011-07-20T01:07:59+02:00 (13 years ago)
Author:
frederik
Message:

fix selection bug in license change plugin; change some names

Location:
applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/Check.java

    r25955 r26373  
    9090                this.progressMonitor = progressMonitor;
    9191        }
    92         this.progressMonitor.beginTask(tr("Running test {0}", name));
    9392        errors = new ArrayList<LicenseProblem>(30);
    9493    }
  • applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/CheckAction.java

    r25955 r26373  
    5555    public void doCheck(ActionEvent ev)
    5656    {
    57         if (plugin.validateAction == null || Main.map == null || !Main.map.isVisible())
     57        if (plugin.checkAction == null || Main.map == null || !Main.map.isVisible())
    5858            return;
    5959
     
    9999        public CheckTask(Collection<OsmPrimitive> validatedPrimitives, Collection<OsmPrimitive> formerValidatedPrimitives)
    100100        {
    101             super(tr("Loading from Quick History Service"), false /*don't ignore exceptions */);
     101            super(tr("Loading"), false /*don't ignore exceptions */);
     102
    102103            this.validatedPrimitives  = validatedPrimitives;
    103104            this.formerValidatedPrimitives = formerValidatedPrimitives;
     
    120121            Runnable r = new Runnable()  {
    121122                public void run() {
    122                     plugin.validationDialog.tree.setErrors(problems);
    123                     plugin.validationDialog.setVisible(true);
     123                    plugin.problemDialog.tree.setErrors(problems);
     124                    plugin.problemDialog.setVisible(true);
    124125                    Main.main.getCurrentDataSet().fireSelectionChanged();
    125126                }
     
    139140                OsmTransferException
    140141        {
     142            getProgressMonitor().indeterminateSubTask(tr("Loading from Quick History Service..."));
    141143            plugin.loadDataFromQuickHistoryService(validatedPrimitives);
    142144            problems = new ArrayList<LicenseProblem>(200);
    143             getProgressMonitor().setTicksCount(validatedPrimitives.size());
    144145            int testCounter = 0;
    145             getProgressMonitor().setCustomText(tr("Analyzing"));
    146             licenseCheck.startCheck(getProgressMonitor().createSubTaskMonitor(validatedPrimitives.size(), false));
     146            getProgressMonitor().indeterminateSubTask(tr("Analyzing..."));
     147            //licenseCheck.startCheck(getProgressMonitor().createSubTaskMonitor(validatedPrimitives.size(), false));
     148            licenseCheck.startCheck(getProgressMonitor());
    147149            licenseCheck.visit(validatedPrimitives);
    148150            licenseCheck.endCheck();
  • applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/LicenseChangeDialog.java

    r26260 r26373  
    3636import org.openstreetmap.josm.actions.AutoScaleAction;
    3737import org.openstreetmap.josm.command.Command;
    38 import org.openstreetmap.josm.data.SelectionChangedListener;
    3938import org.openstreetmap.josm.data.osm.DataSet;
    4039import org.openstreetmap.josm.data.osm.Node;
     
    5554 * the list while single click will make the clicked entry the only selection.
    5655 */
    57 public class LicenseChangeDialog extends ToggleDialog implements ActionListener, SelectionChangedListener {
     56public class LicenseChangeDialog extends ToggleDialog implements ActionListener {
    5857    private LicenseChangePlugin plugin;
    5958
     
    7776        super(tr("Relicensing problems"), "licensechange", tr("Open the relicensing window."),
    7877                Shortcut.registerShortcut("subwindow:licensechange", tr("Toggle: {0}", tr("Relicensing problems")),
    79                         KeyEvent.VK_V, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 150);
     78                        KeyEvent.VK_L, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 150);
    8079
    8180        this.plugin = plugin;
     
    102101        selectButton.setEnabled(false);
    103102        buttonPanel.add(selectButton);
    104         buttonPanel.add(new SideButton(plugin.validateAction), "refresh");
     103        buttonPanel.add(new SideButton(plugin.checkAction), "refresh");
    105104        add(buttonPanel, BorderLayout.SOUTH);
    106105
     
    110109    public void showNotify()
    111110    {
    112         DataSet.addSelectionListener(this);
    113111        DataSet ds = Main.main.getCurrentDataSet();
    114112        if (ds != null) {
    115113            updateSelection(ds.getSelected());
    116114        }
    117     }
    118 
    119     @Override
    120     public void hideNotify()
    121     {
    122         DataSet.removeSelectionListener(this);
    123115    }
    124116
     
    321313    }
    322314
    323     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection)
    324     {
    325         updateSelection(newSelection);
    326     }
    327315}
  • applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/LicenseChangePlugin.java

    r25955 r26373  
    6565
    6666    /** The validate action */
    67     CheckAction validateAction = new CheckAction(this);
     67    CheckAction checkAction = new CheckAction(this);
    6868
    6969    /** The validation dialog */
    70     LicenseChangeDialog validationDialog;
     70    LicenseChangeDialog problemDialog;
    7171
    7272    /** The list of errors per layer*/
     
    9595        if (newFrame != null)
    9696        {
    97             validationDialog = new LicenseChangeDialog(this);
    98             newFrame.addToggleDialog(validationDialog);
     97            problemDialog = new LicenseChangeDialog(this);
     98            newFrame.addToggleDialog(problemDialog);
    9999            initializeProblemLayer();
    100100            MapView.addLayerChangeListener(this);
     
    123123        if (newLayer instanceof OsmDataLayer) {
    124124            List<LicenseProblem> errors = layerProblems.get(newLayer);
    125             validationDialog.tree.setErrorList(errors);
     125            problemDialog.tree.setErrorList(errors);
    126126            Main.map.repaint();
    127127        }
  • applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/ProblemLayer.java

    r25955 r26373  
    6161    public void paint(final Graphics2D g, final MapView mv, Bounds bounds)
    6262    {
    63         updateCount = plugin.validationDialog.tree.getUpdateCount();
    64         DefaultMutableTreeNode root = plugin.validationDialog.tree.getRoot();
     63        updateCount = plugin.problemDialog.tree.getUpdateCount();
     64        DefaultMutableTreeNode root = plugin.problemDialog.tree.getRoot();
    6565        if (root == null || root.getChildCount() == 0)
    6666            return;
     
    8686    {
    8787        Bag<Severity, LicenseProblem> problemTree = new Bag<Severity, LicenseProblem>();
    88         List<LicenseProblem> problems = plugin.validationDialog.tree.getErrors();
     88        List<LicenseProblem> problems = plugin.problemDialog.tree.getErrors();
    8989        for (LicenseProblem e : problems) {
    9090            problemTree.add(e.getSeverity(), e);
     
    118118    public boolean isChanged()
    119119    {
    120         return updateCount != plugin.validationDialog.tree.getUpdateCount();
     120        return updateCount != plugin.problemDialog.tree.getUpdateCount();
    121121    }
    122122
  • applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/Severity.java

    r26198 r26373  
    1414    /** Error messages */
    1515    DATA_LOSS(tr("Data loss"), "error.gif",                     
    16         Main.pref.getColor(marktr("license validation error"), Color.RED)),
     16        Main.pref.getColor(marktr("license check error"), Color.RED)),
    1717
    1818    /** Warning messages */
    1919    POSSIBLE_DATA_LOSS(tr("Possible data loss"), "warning.gif",
    20         Main.pref.getColor(marktr("license validation warning"), Color.ORANGE)),
     20        Main.pref.getColor(marktr("license check warning"), Color.ORANGE)),
    2121
    2222    /** Other messages */
    2323    DATA_REDUCTION(tr("Data reduction"), "other.gif",           
    24         Main.pref.getColor(marktr("license validation other"), Color.YELLOW));
     24        Main.pref.getColor(marktr("license check notice"), Color.YELLOW));
    2525
    2626    /** Description of the severity code */
Note: See TracChangeset for help on using the changeset viewer.