- Timestamp:
- 09/26/11 20:24:03 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/MainWindow.java
r192 r195 5 5 import org.eclipse.swt.widgets.Menu; 6 6 import org.eclipse.swt.SWT; 7 import org.eclipse.swt.widgets.FileDialog; 7 8 import org.eclipse.swt.widgets.MenuItem; 8 9 import org.eclipse.swt.widgets.Text; … … 13 14 import org.eclipse.swt.events.SelectionAdapter; 14 15 import org.eclipse.swt.events.SelectionEvent; 16 17 import de.ugoe.cs.util.console.CommandExecuter; 15 18 16 19 public class MainWindow { … … 26 29 protected ModelsTabComposite modelsTabComposite; 27 30 protected DataTabComposite dataTabComposite; 31 32 protected CommandHistoryDialog historyDialog; 28 33 29 34 … … 36 41 createContents(); 37 42 new SWTConsole(getTextConsoleOutput()); 43 historyDialog = new CommandHistoryDialog(shell, SWT.NONE); 38 44 shell.open(); 39 45 shell.layout(); … … 64 70 65 71 MenuItem mntmShowHistory = new MenuItem(menu_1, SWT.NONE); 72 mntmShowHistory.addSelectionListener(new SelectionAdapter() { 73 @Override 74 public void widgetSelected(SelectionEvent e) { 75 if( !historyDialog.isOpen()) { 76 historyDialog.open(); 77 } 78 } 79 }); 66 80 mntmShowHistory.setText("Show History"); 67 81 68 82 MenuItem mntmExecBatchFile = new MenuItem(menu_1, SWT.NONE); 83 mntmExecBatchFile.addSelectionListener(new SelectionAdapter() { 84 @Override 85 public void widgetSelected(SelectionEvent e) { 86 FileDialog fileDialog = new FileDialog(shell, SWT.OPEN); 87 String filename = fileDialog.open(); 88 if( filename!=null ) { 89 String command = "exec '" + filename + "'"; 90 CommandExecuter.getInstance().exec(command); 91 } 92 } 93 }); 69 94 mntmExecBatchFile.setText("Exec. Batch File"); 70 95 … … 72 97 73 98 MenuItem mntmLoad = new MenuItem(menu_1, SWT.NONE); 99 mntmLoad.addSelectionListener(new SelectionAdapter() { 100 @Override 101 public void widgetSelected(SelectionEvent e) { 102 FileDialog fileDialog = new FileDialog(shell, SWT.OPEN); 103 String filename = fileDialog.open(); 104 if( filename!=null ) { 105 String command = "load '" + filename + "'"; 106 CommandExecuter.getInstance().exec(command); 107 } 108 } 109 }); 74 110 mntmLoad.setText("Load..."); 75 111 76 112 MenuItem mntmSave = new MenuItem(menu_1, SWT.NONE); 113 mntmSave.addSelectionListener(new SelectionAdapter() { 114 @Override 115 public void widgetSelected(SelectionEvent e) { 116 FileDialog fileDialog = new FileDialog(shell, SWT.SAVE); 117 String filename = fileDialog.open(); 118 if( filename!=null ) { 119 String command = "save '" + filename + "'"; 120 CommandExecuter.getInstance().exec(command); 121 } 122 } 123 }); 77 124 mntmSave.setText("Save..."); 78 125 … … 80 127 81 128 MenuItem mntmExit = new MenuItem(menu_1, SWT.NONE); 129 mntmExit.addSelectionListener(new SelectionAdapter() { 130 @Override 131 public void widgetSelected(SelectionEvent e) { 132 shell.dispose(); 133 } 134 }); 82 135 mntmExit.setText("Exit"); 83 136 … … 89 142 90 143 MenuItem mntmAbout = new MenuItem(menu_2, SWT.NONE); 144 mntmAbout.addSelectionListener(new SelectionAdapter() { 145 @Override 146 public void widgetSelected(SelectionEvent e) { 147 AboutDialog aboutDialog = new AboutDialog(shell, SWT.NONE); 148 aboutDialog.open(); 149 } 150 }); 91 151 mntmAbout.setText("About"); 92 152 … … 125 185 modelsTabComposite = new ModelsTabComposite(tabFolder, SWT.NO_BACKGROUND); 126 186 modelsTab.setControl(modelsTabComposite); 127 187 128 188 dataTab = new TabItem(tabFolder, SWT.NONE); 129 189 dataTab.setText("Data");
Note: See TracChangeset
for help on using the changeset viewer.