Last change
on this file since 4067 was 3839, checked in by jttt, 13 years ago |
Fix #5893 Null Pointer Exception while loding custom presets at start - JOSM hangs on splash screen
|
-
Property svn:eol-style
set to
native
|
File size:
831 bytes
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import java.io.Serializable;
|
---|
5 | import java.util.Comparator;
|
---|
6 |
|
---|
7 | import javax.swing.JMenuItem;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 |
|
---|
11 | public class PresetTextComparator implements Comparator<JMenuItem>, Serializable {
|
---|
12 | public int compare(JMenuItem arg0, JMenuItem arg1) {
|
---|
13 | if (Main.main.menu.presetSearchAction.equals(arg0.getAction()))
|
---|
14 | return -1;
|
---|
15 | else if (Main.main.menu.presetSearchAction.equals(arg0.getAction()))
|
---|
16 | return 1;
|
---|
17 | else if (arg0.getText() == arg1.getText())
|
---|
18 | return 0;
|
---|
19 | else if (arg0.getText() == null)
|
---|
20 | return -1;
|
---|
21 | else if (arg1.getText() == null)
|
---|
22 | return 1;
|
---|
23 | else
|
---|
24 | return arg0.getText().compareTo(arg1.getText());
|
---|
25 | }
|
---|
26 |
|
---|
27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.