Changeset 27943 in osm for applications/editors/josm/plugins/smed/src
- Timestamp:
- 2012-02-26T21:04:29+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabAction.java
r27852 r27943 23 23 public class SmedTabAction extends JosmAction { 24 24 25 25 /** 26 26 * 27 27 */ … … 31 31 private JFrame frame = null; 32 32 private boolean isOpen = false; 33 private JMenuItem osmItem = null;33 private JMenuItem osmItem = null; 34 34 public static JTextField smedStatusBar = null; 35 private static String editor =tr("SeaMap Editor"); 36 37 public SmedTabAction() { 38 super( editor, "Smed",editor, 39 Shortcut.registerShortcut("tools:Seamaps", tr("Tool: {0}", tr("SeaMap Editor")), 40 KeyEvent.VK_K, Shortcut.SHIFT), 41 true); //$NON-NLS-1$ //$NON-NLS-2$ 42 } 35 private static String editor = tr("SeaMap Editor"); 43 36 37 public SmedTabAction() { 38 // super( editor, "Smed",editor, Shortcut.registerShortcut("tools:Seamaps", tr("Tool: {0}", tr("SeaMap Editor")), KeyEvent.VK_K, Shortcut.SHIFT), true); //$NON-NLS-1$ //$NON-NLS-2$ 39 } 44 40 45 @Override 46 public void actionPerformed(ActionEvent e) { 47 SwingUtilities.invokeLater(new Runnable() { 48 public void run() { 49 createAndShowTabs(); 50 } 51 }); 52 53 isOpen = true; 54 if (osmItem == null) return; 41 @Override 42 public void actionPerformed(ActionEvent e) { 43 SwingUtilities.invokeLater(new Runnable() { 44 public void run() { 45 createAndShowTabs(); 46 } 47 }); 48 49 isOpen = true; 50 if (osmItem == null) 51 return; 55 52 56 53 osmItem.setEnabled(false); 57 54 } 58 55 56 protected void createAndShowTabs() { 57 // Create and set up the window. 58 frame = new JFrame(editor); 59 smedStatusBar = new JTextField(); 60 frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 61 frame.setResizable(false); 62 frame.setAlwaysOnTop(true); 59 63 60 protected void createAndShowTabs() { 61 //Create and set up the window. 62 frame = new JFrame(editor); 63 smedStatusBar = new JTextField(); 64 frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 65 frame.setResizable(false); 66 frame.setAlwaysOnTop(true); 64 // Add content to the window. 65 frame.setJMenuBar(smedMenu); 66 frame.add(smedTabs, BorderLayout.CENTER); 67 frame.add(smedStatusBar, BorderLayout.PAGE_END); 67 68 68 //Add content tothe window.69 frame.setJMenuBar(smedMenu); 70 frame.add(smedTabs, BorderLayout.CENTER); 71 frame.add(smedStatusBar,BorderLayout.PAGE_END);69 // Display the window. 70 frame.addWindowListener(new java.awt.event.WindowAdapter() { 71 public void windowClosing(java.awt.event.WindowEvent e) { 72 osmItem.setEnabled(true); 72 73 73 //Display the window. 74 frame.addWindowListener(new java.awt.event.WindowAdapter() { 75 public void windowClosing(java.awt.event.WindowEvent e) { 76 osmItem.setEnabled(true); 77 78 closeDialog(); 79 } 80 }); 81 frame.setSize(new Dimension(420, 470)); 82 // frame.pack(); 83 frame.setVisible(true); 84 } 85 74 closeDialog(); 75 } 76 }); 77 frame.setSize(new Dimension(420, 470)); 78 // frame.pack(); 79 frame.setVisible(true); 80 } 86 81 87 82 public void closeDialog() { 88 83 List<SmedPluggable> plugins = SmedTabbedPane.getPlugins(); 89 90 if(plugins != null) { 91 for(SmedPluggable p : plugins) p.stop(); 84 85 if (plugins != null) { 86 for (SmedPluggable p : plugins) 87 p.stop(); 92 88 } 93 94 if (isOpen) {89 90 if (isOpen) { 95 91 frame.setVisible(false); 96 92 frame.dispose(); 97 93 } 98 94 99 95 isOpen = false; 100 96 } 101 97 102 103 98 public void setOsmItem(JMenuItem item) { 104 osmItem = item; 99 osmItem = item; 105 100 } 106 101
Note:
See TracChangeset
for help on using the changeset viewer.