Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (12 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/src/panels/PanelSpec.java

    r30737 r30738  
    2424                                int idx = categories.get(cat);
    2525                                if (dlg.node != null && (idx == categoryBox.getSelectedIndex()))
    26                                         dlg.panelMain.mark.setCategory(cat);
     26                                        SmedAction.panelMain.mark.setCategory(cat);
    2727                        }
    2828                }
     
    3535                                int idx = moorings.get(cat);
    3636                                if (dlg.node != null && (idx == mooringBox.getSelectedIndex())) {
    37                                         dlg.panelMain.mark.setCategory(cat);
     37                                        SmedAction.panelMain.mark.setCategory(cat);
    3838                                        if ((cat == Cat.INB_CALM) || (cat == Cat.INB_SBM)) {
    39                                                 dlg.panelMain.mark.setObject(Obj.BOYINB);
    40                                                 dlg.panelMain.mark.setShape(Shp.UNKSHP);
     39                                                SmedAction.panelMain.mark.setObject(Obj.BOYINB);
     40                                                SmedAction.panelMain.mark.setShape(Shp.UNKSHP);
    4141                                        } else {
    42                                                 dlg.panelMain.mark.setObject(Obj.MORFAC);
     42                                                SmedAction.panelMain.mark.setObject(Obj.MORFAC);
    4343                                                if (cat != Cat.MOR_BUOY)
    44                                                         dlg.panelMain.mark.setShape(Shp.UNKSHP);
     44                                                        SmedAction.panelMain.mark.setShape(Shp.UNKSHP);
    4545                                        }
    4646                                }
     
    6666        public ActionListener alShape = new ActionListener() {
    6767                public void actionPerformed(java.awt.event.ActionEvent e) {
    68                         if ((dlg.panelMain.mark.getObject() != Obj.MORFAC) || (dlg.panelMain.mark.getCategory() == Cat.MOR_BUOY)) {
     68                        if ((SmedAction.panelMain.mark.getObject() != Obj.MORFAC) || (SmedAction.panelMain.mark.getCategory() == Cat.MOR_BUOY)) {
    6969                                for (Shp shp : shapes.keySet()) {
    7070                                        JRadioButton button = shapes.get(shp);
    7171                                        if (button.isSelected()) {
    72                                                 dlg.panelMain.mark.setShape(shp);
    73                                                 if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) != Ent.MOORING) {
    74                                                         dlg.panelMain.mark.setObject(objects.get(shp));
    75                                                         if (dlg.panelMain.mark.getObjColour(0) == Col.UNKCOL) {
    76                                                                 dlg.panelMain.mark.setObjPattern(Pat.NOPAT);
    77                                                                 dlg.panelMain.mark.setObjColour(Col.YELLOW);
     72                                                SmedAction.panelMain.mark.setShape(shp);
     73                                                if (SeaMark.EntMAP.get(SmedAction.panelMain.mark.getObject()) != Ent.MOORING) {
     74                                                        SmedAction.panelMain.mark.setObject(objects.get(shp));
     75                                                        if (SmedAction.panelMain.mark.getObjColour(0) == Col.UNKCOL) {
     76                                                                SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT);
     77                                                                SmedAction.panelMain.mark.setObjColour(Col.YELLOW);
    7878                                                        }
    7979                                                        if (button == cairnButton) {
    80                                                                 dlg.panelMain.mark.setObjPattern(Pat.NOPAT);
    81                                                                 dlg.panelMain.mark.setObjColour(Col.UNKCOL);
     80                                                                SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT);
     81                                                                SmedAction.panelMain.mark.setObjColour(Col.UNKCOL);
    8282                                                        }
    83                                                         topmarkButton.setVisible(dlg.panelMain.mark.testValid());
     83                                                        topmarkButton.setVisible(SmedAction.panelMain.mark.testValid());
    8484                                                }
    8585                                                button.setBorderPainted(true);
     
    8787                                                button.setBorderPainted(false);
    8888                                }
    89                                 dlg.panelMain.panelMore.syncPanel();
     89                                SmedAction.panelMain.panelMore.syncPanel();
    9090                        }
    9191                }
     
    9595                public void actionPerformed(java.awt.event.ActionEvent e) {
    9696                        if (topmarkButton.isSelected()) {
    97                                 dlg.panelMain.mark.setTopmark(Top.X_SHAPE);
    98                                 dlg.panelMain.mark.setTopPattern(Pat.NOPAT);
    99                                 dlg.panelMain.mark.setTopColour(Col.YELLOW);
     97                                SmedAction.panelMain.mark.setTopmark(Top.X_SHAPE);
     98                                SmedAction.panelMain.mark.setTopPattern(Pat.NOPAT);
     99                                SmedAction.panelMain.mark.setTopColour(Col.YELLOW);
    100100                                topmarkButton.setBorderPainted(true);
    101101                        } else {
    102                                 dlg.panelMain.mark.setTopmark(Top.NOTOP);
    103                                 dlg.panelMain.mark.setTopPattern(Pat.NOPAT);
    104                                 dlg.panelMain.mark.setTopColour(Col.UNKCOL);
     102                                SmedAction.panelMain.mark.setTopmark(Top.NOTOP);
     103                                SmedAction.panelMain.mark.setTopPattern(Pat.NOPAT);
     104                                SmedAction.panelMain.mark.setTopColour(Col.UNKCOL);
    105105                                topmarkButton.setBorderPainted(false);
    106106                        }
    107                         dlg.panelMain.panelTop.syncPanel();
     107                        SmedAction.panelMain.panelTop.syncPanel();
    108108                }
    109109        };
     
    111111        private ActionListener alNotice = new ActionListener() {
    112112                public void actionPerformed(java.awt.event.ActionEvent e) {
    113                         dlg.panelMain.mark.clrMark();
     113                        SmedAction.panelMain.mark.clrMark();
    114114                        if (noticeButton.isSelected()) {
    115                                 dlg.panelMain.mark.setObject(Obj.NOTMRK);
     115                                SmedAction.panelMain.mark.setObject(Obj.NOTMRK);
    116116                                noticeButton.setBorderPainted(true);
    117117                        } else {
    118                                 dlg.panelMain.mark.setObject(Obj.UNKOBJ);
     118                                SmedAction.panelMain.mark.setObject(Obj.UNKOBJ);
    119119                                noticeButton.setBorderPainted(false);
    120120                        }
    121                         dlg.panelMain.syncPanel();
     121                        SmedAction.panelMain.syncPanel();
    122122                }
    123123        };
     
    125125        private ActionListener alMooring = new ActionListener() {
    126126                public void actionPerformed(java.awt.event.ActionEvent e) {
    127                         dlg.panelMain.mark.setObject(Obj.UNKOBJ);
    128                         dlg.panelMain.mark.setCategory(Cat.NOCAT);
    129                         dlg.panelMain.mark.setTopmark(Top.NOTOP);
     127                        SmedAction.panelMain.mark.setObject(Obj.UNKOBJ);
     128                        SmedAction.panelMain.mark.setCategory(Cat.NOCAT);
     129                        SmedAction.panelMain.mark.setTopmark(Top.NOTOP);
    130130                        if (mooringButton.isSelected()) {
    131                                 dlg.panelMain.mark.setObject(Obj.MORFAC);
     131                                SmedAction.panelMain.mark.setObject(Obj.MORFAC);
    132132                                categoryBox.setVisible(false);
    133133                                mooringBox.setVisible(true);
     
    234234
    235235        public void syncPanel() {
    236                 if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) == Ent.MOORING) {
     236                if (SeaMark.EntMAP.get(SmedAction.panelMain.mark.getObject()) == Ent.MOORING) {
    237237                        mooringButton.setBorderPainted(true);
    238238                        categoryBox.setVisible(false);
     
    248248                        for (Cat cat : moorings.keySet()) {
    249249                                int item = moorings.get(cat);
    250                                 if (dlg.panelMain.mark.getCategory() == cat)
     250                                if (SmedAction.panelMain.mark.getCategory() == cat)
    251251                                        mooringBox.setSelectedIndex(item);
    252252                        }
     
    262262                        cairnButton.setEnabled(true);
    263263                        noticeButton.setEnabled(true);
    264                         topmarkButton.setBorderPainted(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
    265                         topmarkButton.setSelected(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
    266                         topmarkButton.setVisible(dlg.panelMain.mark.testValid());
     264                        topmarkButton.setBorderPainted(SmedAction.panelMain.mark.getTopmark() != Top.NOTOP);
     265                        topmarkButton.setSelected(SmedAction.panelMain.mark.getTopmark() != Top.NOTOP);
     266                        topmarkButton.setVisible(SmedAction.panelMain.mark.testValid());
    267267                        for (Cat cat : categories.keySet()) {
    268268                                int item = categories.get(cat);
    269                                 if (dlg.panelMain.mark.getCategory() == cat)
     269                                if (SmedAction.panelMain.mark.getCategory() == cat)
    270270                                        categoryBox.setSelectedIndex(item);
    271271                        }
     
    273273                for (Shp shp : shapes.keySet()) {
    274274                        JRadioButton button = shapes.get(shp);
    275                         if (dlg.panelMain.mark.getShape() == shp) {
     275                        if (SmedAction.panelMain.mark.getShape() == shp) {
    276276                                button.setBorderPainted(true);
    277277                        } else
     
    279279                }
    280280                noticeButton.setBorderPainted(false);
    281                 dlg.panelMain.mark.testValid();
     281                SmedAction.panelMain.mark.testValid();
    282282        }
    283283
Note: See TracChangeset for help on using the changeset viewer.