|
Lines 22-33
Link Here
|
| 22 |
import org.eclipse.jface.resource.ResourceManager; |
22 |
import org.eclipse.jface.resource.ResourceManager; |
| 23 |
import org.eclipse.jface.util.Util; |
23 |
import org.eclipse.jface.util.Util; |
| 24 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
24 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
|
|
25 |
import org.eclipse.jface.viewers.IOpenListener; |
| 25 |
import org.eclipse.jface.viewers.LabelProvider; |
26 |
import org.eclipse.jface.viewers.LabelProvider; |
|
|
27 |
import org.eclipse.jface.viewers.OpenEvent; |
| 26 |
import org.eclipse.jface.viewers.TableViewer; |
28 |
import org.eclipse.jface.viewers.TableViewer; |
| 27 |
import org.eclipse.osgi.util.TextProcessor; |
29 |
import org.eclipse.osgi.util.TextProcessor; |
| 28 |
import org.eclipse.swt.SWT; |
30 |
import org.eclipse.swt.SWT; |
| 29 |
import org.eclipse.swt.graphics.Cursor; |
31 |
import org.eclipse.swt.graphics.Cursor; |
| 30 |
import org.eclipse.swt.graphics.Font; |
|
|
| 31 |
import org.eclipse.swt.graphics.Image; |
32 |
import org.eclipse.swt.graphics.Image; |
| 32 |
import org.eclipse.swt.layout.GridData; |
33 |
import org.eclipse.swt.layout.GridData; |
| 33 |
import org.eclipse.swt.layout.GridLayout; |
34 |
import org.eclipse.swt.layout.GridLayout; |
|
Lines 39-44
Link Here
|
| 39 |
import org.eclipse.swt.widgets.Label; |
40 |
import org.eclipse.swt.widgets.Label; |
| 40 |
import org.eclipse.swt.widgets.Listener; |
41 |
import org.eclipse.swt.widgets.Listener; |
| 41 |
import org.eclipse.swt.widgets.Shell; |
42 |
import org.eclipse.swt.widgets.Shell; |
|
|
43 |
import org.eclipse.swt.widgets.TabFolder; |
| 44 |
import org.eclipse.swt.widgets.TabItem; |
| 42 |
import org.eclipse.swt.widgets.Table; |
45 |
import org.eclipse.swt.widgets.Table; |
| 43 |
import org.eclipse.swt.widgets.TableItem; |
46 |
import org.eclipse.swt.widgets.TableItem; |
| 44 |
import org.eclipse.ui.IEditorDescriptor; |
47 |
import org.eclipse.ui.IEditorDescriptor; |
|
Lines 49-55
Link Here
|
| 49 |
import org.eclipse.ui.internal.registry.EditorDescriptor; |
52 |
import org.eclipse.ui.internal.registry.EditorDescriptor; |
| 50 |
import org.eclipse.ui.internal.registry.EditorRegistry; |
53 |
import org.eclipse.ui.internal.registry.EditorRegistry; |
| 51 |
|
54 |
|
| 52 |
|
|
|
| 53 |
/** |
55 |
/** |
| 54 |
* This class is used to allow the user to select a dialog from the set of |
56 |
* This class is used to allow the user to select a dialog from the set of |
| 55 |
* internal and external editors. |
57 |
* internal and external editors. |
|
Lines 60-72
Link Here
|
| 60 |
public final class EditorSelectionDialog extends Dialog { |
62 |
public final class EditorSelectionDialog extends Dialog { |
| 61 |
private EditorDescriptor selectedEditor; |
63 |
private EditorDescriptor selectedEditor; |
| 62 |
|
64 |
|
| 63 |
private Button externalButton; |
65 |
/** |
|
|
66 |
* The tab folder that holds the tabs for the listing of internal and |
| 67 |
* external editors. |
| 68 |
*/ |
| 69 |
private TabFolder editorsFolder; |
| 64 |
|
70 |
|
| 65 |
private Table editorTable; |
71 |
/** |
|
|
72 |
* The table that renders the list of internal editors to the user. |
| 73 |
*/ |
| 74 |
private Table internalEditorsTable; |
| 66 |
|
75 |
|
| 67 |
private Button browseExternalEditorsButton; |
76 |
/** |
|
|
77 |
* The table that renders the list of external editors to the user. |
| 78 |
*/ |
| 79 |
private Table externalEditorsTable; |
| 68 |
|
80 |
|
| 69 |
private Button internalButton; |
81 |
/** |
|
|
82 |
* The button for browsing to an external application for opening a file. |
| 83 |
*/ |
| 84 |
private Button browseExternalEditorsButton; |
| 70 |
|
85 |
|
| 71 |
private Button okButton; |
86 |
private Button okButton; |
| 72 |
|
87 |
|
|
Lines 85-91
Link Here
|
| 85 |
|
100 |
|
| 86 |
private ResourceManager resourceManager; |
101 |
private ResourceManager resourceManager; |
| 87 |
|
102 |
|
| 88 |
private TableViewer editorTableViewer; |
103 |
private TableViewer internalEditorsTreeViewer; |
|
|
104 |
|
| 105 |
private TableViewer externalEditorsTableViewer; |
| 106 |
|
| 107 |
private LabelProvider labelProvider; |
| 89 |
|
108 |
|
| 90 |
private static final String[] Executable_Filters; |
109 |
private static final String[] Executable_Filters; |
| 91 |
|
110 |
|
|
Lines 111-123
Link Here
|
| 111 |
} |
130 |
} |
| 112 |
|
131 |
|
| 113 |
/** |
132 |
/** |
| 114 |
* This method is called if a button has been pressed. |
133 |
* This method is called if the 'OK' button has been pressed. |
| 115 |
*/ |
134 |
*/ |
| 116 |
protected void buttonPressed(int buttonId) { |
135 |
protected void okPressed() { |
| 117 |
if (buttonId == IDialogConstants.OK_ID) { |
136 |
saveWidgetValues(); |
| 118 |
saveWidgetValues(); |
137 |
if (editorsFolder.getSelectionIndex() == 0) { |
|
|
138 |
selectedEditor = (EditorDescriptor) internalEditorsTable.getSelection()[0].getData(); |
| 139 |
} else { |
| 140 |
selectedEditor = (EditorDescriptor) externalEditorsTable.getSelection()[0].getData(); |
| 119 |
} |
141 |
} |
| 120 |
super.buttonPressed(buttonId); |
142 |
super.okPressed(); |
| 121 |
} |
143 |
} |
| 122 |
|
144 |
|
| 123 |
/** |
145 |
/** |
|
Lines 151-199
Link Here
|
| 151 |
* @return the dialog area control |
173 |
* @return the dialog area control |
| 152 |
*/ |
174 |
*/ |
| 153 |
protected Control createDialogArea(Composite parent) { |
175 |
protected Control createDialogArea(Composite parent) { |
| 154 |
Font font = parent.getFont(); |
|
|
| 155 |
// create main group |
176 |
// create main group |
| 156 |
Composite contents = (Composite) super.createDialogArea(parent); |
177 |
Composite contents = (Composite) super.createDialogArea(parent); |
| 157 |
((GridLayout) contents.getLayout()).numColumns = 2; |
|
|
| 158 |
|
178 |
|
| 159 |
// begin the layout |
179 |
// begin the layout |
| 160 |
Label textLabel = new Label(contents, SWT.NONE); |
180 |
Label textLabel = new Label(contents, SWT.NONE); |
| 161 |
textLabel.setText(message); |
181 |
textLabel.setText(message); |
| 162 |
GridData data = new GridData(); |
|
|
| 163 |
data.horizontalSpan = 2; |
| 164 |
textLabel.setLayoutData(data); |
| 165 |
textLabel.setFont(font); |
| 166 |
|
| 167 |
internalButton = new Button(contents, SWT.RADIO | SWT.LEFT); |
| 168 |
internalButton.setText(WorkbenchMessages.EditorSelection_internal); |
| 169 |
internalButton.addListener(SWT.Selection, listener); |
| 170 |
data = new GridData(); |
| 171 |
data.horizontalSpan = 1; |
| 172 |
internalButton.setLayoutData(data); |
| 173 |
internalButton.setFont(font); |
| 174 |
|
| 175 |
externalButton = new Button(contents, SWT.RADIO | SWT.LEFT); |
| 176 |
externalButton.setText(WorkbenchMessages.EditorSelection_external); |
| 177 |
externalButton.addListener(SWT.Selection, listener); |
| 178 |
data = new GridData(); |
| 179 |
data.horizontalSpan = 1; |
| 180 |
externalButton.setLayoutData(data); |
| 181 |
externalButton.setFont(font); |
| 182 |
|
182 |
|
| 183 |
editorTable = new Table(contents, SWT.SINGLE | SWT.BORDER); |
183 |
editorsFolder = new TabFolder(contents, SWT.TOP); |
| 184 |
data = new GridData(); |
184 |
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); |
| 185 |
data.widthHint = convertHorizontalDLUsToPixels(TABLE_WIDTH); |
185 |
data.widthHint = convertHorizontalDLUsToPixels(TABLE_WIDTH); |
| 186 |
data.horizontalAlignment = GridData.FILL; |
186 |
editorsFolder.setLayoutData(data); |
| 187 |
data.grabExcessHorizontalSpace = true; |
187 |
|
| 188 |
data.verticalAlignment = GridData.FILL; |
188 |
labelProvider = new LabelProvider() { |
| 189 |
data.grabExcessVerticalSpace = true; |
|
|
| 190 |
data.horizontalSpan = 2; |
| 191 |
editorTable.setLayoutData(data); |
| 192 |
editorTable.setFont(font); |
| 193 |
data.heightHint = editorTable.getItemHeight() * 12; |
| 194 |
editorTableViewer = new TableViewer(editorTable); |
| 195 |
editorTableViewer.setContentProvider(ArrayContentProvider.getInstance()); |
| 196 |
editorTableViewer.setLabelProvider(new LabelProvider() { |
| 197 |
public String getText(Object element) { |
189 |
public String getText(Object element) { |
| 198 |
IEditorDescriptor d = (IEditorDescriptor) element; |
190 |
IEditorDescriptor d = (IEditorDescriptor) element; |
| 199 |
return TextProcessor.process(d.getLabel(), "."); //$NON-NLS-1$ |
191 |
return TextProcessor.process(d.getLabel(), "."); //$NON-NLS-1$ |
|
Lines 203-238
Link Here
|
| 203 |
IEditorDescriptor d = (IEditorDescriptor) element; |
195 |
IEditorDescriptor d = (IEditorDescriptor) element; |
| 204 |
return (Image) resourceManager.get(d.getImageDescriptor()); |
196 |
return (Image) resourceManager.get(d.getImageDescriptor()); |
| 205 |
} |
197 |
} |
| 206 |
}); |
198 |
}; |
| 207 |
editorTable.addListener(SWT.Selection, listener); |
199 |
|
| 208 |
editorTable.addListener(SWT.DefaultSelection, listener); |
200 |
createInternalEditorsTable(); |
| 209 |
editorTable.addListener(SWT.MouseDoubleClick, listener); |
201 |
createExternalEditorsTable(); |
| 210 |
|
|
|
| 211 |
browseExternalEditorsButton = new Button(contents, SWT.PUSH); |
| 212 |
browseExternalEditorsButton |
| 213 |
.setText(WorkbenchMessages.EditorSelection_browse); |
| 214 |
browseExternalEditorsButton.addListener(SWT.Selection, listener); |
| 215 |
data = new GridData(); |
| 216 |
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); |
| 217 |
data.widthHint = Math.max(widthHint, browseExternalEditorsButton |
| 218 |
.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); |
| 219 |
browseExternalEditorsButton.setLayoutData(data); |
| 220 |
browseExternalEditorsButton.setFont(font); |
| 221 |
|
202 |
|
| 222 |
restoreWidgetValues(); // Place buttons to the appropriate state |
203 |
restoreWidgetValues(); // Place buttons to the appropriate state |
| 223 |
|
204 |
|
| 224 |
fillEditorTable(); |
205 |
internalEditorsTreeViewer.setInput(getInternalEditors()); |
|
|
206 |
handleTabSelection(); |
| 207 |
|
| 208 |
editorsFolder.addListener(SWT.Selection, listener); |
| 209 |
editorsFolder.addListener(SWT.DefaultSelection, listener); |
| 225 |
|
210 |
|
| 226 |
updateEnableState(); |
211 |
Dialog.applyDialogFont(contents); |
|
|
212 |
|
| 213 |
int tableHeight = externalEditorsTable.getItemHeight() * 12; |
| 214 |
((GridData) internalEditorsTreeViewer.getControl().getLayoutData()).heightHint = tableHeight; |
| 215 |
((GridData) externalEditorsTable.getLayoutData()).heightHint = tableHeight; |
| 227 |
|
216 |
|
| 228 |
return contents; |
217 |
return contents; |
| 229 |
} |
218 |
} |
| 230 |
|
219 |
|
| 231 |
protected void fillEditorTable() { |
220 |
private void createInternalEditorsTable() { |
| 232 |
if (internalButton.getSelection()) { |
221 |
TabItem internalEditorsItem = new TabItem(editorsFolder, SWT.LEAD); |
| 233 |
editorTableViewer.setInput(getInternalEditors()); |
222 |
internalEditorsItem.setText(WorkbenchMessages.EditorSelection_internal); |
|
|
223 |
|
| 224 |
Composite internalComposite = new Composite(editorsFolder, SWT.NONE); |
| 225 |
GridLayout layout = new GridLayout(1, false); |
| 226 |
layout.marginWidth = 0; |
| 227 |
layout.marginHeight = 0; |
| 228 |
internalComposite.setLayout(layout); |
| 229 |
|
| 230 |
internalEditorsTreeViewer = new TableViewer(internalComposite, SWT.SINGLE | SWT.BORDER); |
| 231 |
internalEditorsTreeViewer.setContentProvider(ArrayContentProvider.getInstance()); |
| 232 |
internalEditorsTreeViewer.setLabelProvider(labelProvider); |
| 233 |
internalEditorsTreeViewer.addOpenListener(new IOpenListener() { |
| 234 |
public void open(OpenEvent event) { |
| 235 |
okPressed(); |
| 236 |
} |
| 237 |
}); |
| 238 |
|
| 239 |
internalEditorsTable = internalEditorsTreeViewer.getTable(); |
| 240 |
internalEditorsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
| 241 |
internalEditorsTable.addListener(SWT.Selection, listener); |
| 242 |
internalEditorsTable.addListener(SWT.DefaultSelection, listener); |
| 243 |
|
| 244 |
internalEditorsItem.setControl(internalComposite); |
| 245 |
} |
| 246 |
|
| 247 |
private void createExternalEditorsTable() { |
| 248 |
Composite externalComposite = new Composite(editorsFolder, SWT.NONE); |
| 249 |
GridLayout layout = new GridLayout(1, false); |
| 250 |
layout.marginWidth = 0; |
| 251 |
layout.marginHeight = 0; |
| 252 |
externalComposite.setLayout(layout); |
| 253 |
|
| 254 |
TabItem externalEditorsItem = new TabItem(editorsFolder, SWT.LEAD); |
| 255 |
externalEditorsItem.setText(WorkbenchMessages.EditorSelection_external); |
| 256 |
|
| 257 |
externalEditorsTableViewer = new TableViewer(externalComposite, SWT.SINGLE | SWT.BORDER); |
| 258 |
externalEditorsTableViewer.setContentProvider(ArrayContentProvider.getInstance()); |
| 259 |
externalEditorsTableViewer.setLabelProvider(labelProvider); |
| 260 |
externalEditorsTableViewer.addOpenListener(new IOpenListener() { |
| 261 |
public void open(OpenEvent event) { |
| 262 |
okPressed(); |
| 263 |
} |
| 264 |
}); |
| 265 |
|
| 266 |
externalEditorsTable = externalEditorsTableViewer.getTable(); |
| 267 |
externalEditorsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
| 268 |
externalEditorsTable.addListener(SWT.Selection, listener); |
| 269 |
externalEditorsTable.addListener(SWT.DefaultSelection, listener); |
| 270 |
|
| 271 |
browseExternalEditorsButton = new Button(externalComposite, SWT.PUSH); |
| 272 |
GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); |
| 273 |
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); |
| 274 |
data.widthHint = Math.max(widthHint, browseExternalEditorsButton |
| 275 |
.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); |
| 276 |
browseExternalEditorsButton.setLayoutData(data); |
| 277 |
browseExternalEditorsButton.setText(WorkbenchMessages.EditorSelection_browse); |
| 278 |
browseExternalEditorsButton.addListener(SWT.Selection, listener); |
| 279 |
|
| 280 |
externalEditorsItem.setControl(externalComposite); |
| 281 |
} |
| 282 |
|
| 283 |
private void handleTabSelection() { |
| 284 |
if (editorsFolder.getSelectionIndex() == 0) { |
| 285 |
internalEditorsTable.setFocus(); |
| 234 |
} else { |
286 |
} else { |
| 235 |
editorTableViewer.setInput(getExternalEditors()); |
287 |
if (externalEditors == null) { |
|
|
288 |
externalEditorsTableViewer.setInput(getExternalEditors()); |
| 289 |
} |
| 290 |
externalEditorsTable.setFocus(); |
| 236 |
} |
291 |
} |
| 237 |
} |
292 |
} |
| 238 |
|
293 |
|
|
Lines 344-361
Link Here
|
| 344 |
if (result != null) { |
399 |
if (result != null) { |
| 345 |
EditorDescriptor editor = EditorDescriptor.createForProgram(result); |
400 |
EditorDescriptor editor = EditorDescriptor.createForProgram(result); |
| 346 |
// pretend we had obtained it from the list of os registered editors |
401 |
// pretend we had obtained it from the list of os registered editors |
| 347 |
TableItem ti = new TableItem(editorTable, SWT.NULL); |
402 |
TableItem ti = new TableItem(externalEditorsTable, SWT.NULL); |
| 348 |
ti.setData(editor); |
403 |
ti.setData(editor); |
| 349 |
ti.setText(editor.getLabel()); |
404 |
ti.setText(editor.getLabel()); |
| 350 |
Image image = editor.getImageDescriptor().createImage(); |
405 |
Image image = editor.getImageDescriptor().createImage(); |
| 351 |
ti.setImage(image); |
406 |
ti.setImage(image); |
| 352 |
|
407 |
|
| 353 |
// need to pass an array to setSelection -- 1FSKYVO: SWT:ALL - |
408 |
externalEditorsTable.setSelection(ti); |
| 354 |
// inconsistent setSelection api on Table |
409 |
externalEditorsTable.showSelection(); |
| 355 |
editorTable.setSelection(new TableItem[] { ti }); |
410 |
externalEditorsTable.setFocus(); |
| 356 |
editorTable.showSelection(); |
|
|
| 357 |
editorTable.setFocus(); |
| 358 |
selectedEditor = editor; |
| 359 |
|
411 |
|
| 360 |
/* |
412 |
/* |
| 361 |
* add to our collection of cached external editors in case the user |
413 |
* add to our collection of cached external editors in case the user |
|
Lines 370-390
Link Here
|
| 370 |
} |
422 |
} |
| 371 |
|
423 |
|
| 372 |
/** |
424 |
/** |
| 373 |
* Handle a double click event on the list |
|
|
| 374 |
*/ |
| 375 |
protected void handleDoubleClickEvent() { |
| 376 |
buttonPressed(IDialogConstants.OK_ID); |
| 377 |
} |
| 378 |
|
| 379 |
/** |
| 380 |
* Use the dialog store to restore widget values to the values that they |
425 |
* Use the dialog store to restore widget values to the values that they |
| 381 |
* held last time this wizard was used to completion |
426 |
* held last time this wizard was used to completion |
| 382 |
*/ |
427 |
*/ |
| 383 |
protected void restoreWidgetValues() { |
428 |
protected void restoreWidgetValues() { |
| 384 |
IDialogSettings settings = getDialogSettings(); |
429 |
IDialogSettings settings = getDialogSettings(); |
| 385 |
boolean wasExternal = settings.getBoolean(STORE_ID_INTERNAL_EXTERNAL); |
430 |
boolean wasExternal = settings.getBoolean(STORE_ID_INTERNAL_EXTERNAL); |
| 386 |
internalButton.setSelection(!wasExternal); |
431 |
editorsFolder.setSelection(wasExternal ? 1 : 0); |
| 387 |
externalButton.setSelection(wasExternal); |
|
|
| 388 |
} |
432 |
} |
| 389 |
|
433 |
|
| 390 |
/** |
434 |
/** |
|
Lines 394-401
Link Here
|
| 394 |
protected void saveWidgetValues() { |
438 |
protected void saveWidgetValues() { |
| 395 |
IDialogSettings settings = getDialogSettings(); |
439 |
IDialogSettings settings = getDialogSettings(); |
| 396 |
// record whether use was viewing internal or external editors |
440 |
// record whether use was viewing internal or external editors |
| 397 |
settings |
441 |
settings.put(STORE_ID_INTERNAL_EXTERNAL, editorsFolder.getSelectionIndex() == 1); |
| 398 |
.put(STORE_ID_INTERNAL_EXTERNAL, !internalButton.getSelection()); |
|
|
| 399 |
} |
442 |
} |
| 400 |
|
443 |
|
| 401 |
/** |
444 |
/** |
|
Lines 418-437
Link Here
|
| 418 |
editorsToFilter = editors; |
461 |
editorsToFilter = editors; |
| 419 |
} |
462 |
} |
| 420 |
|
463 |
|
| 421 |
/** |
|
|
| 422 |
* Update enabled state. |
| 423 |
*/ |
| 424 |
protected void updateEnableState() { |
| 425 |
boolean enableExternal = externalButton.getSelection(); |
| 426 |
browseExternalEditorsButton.setEnabled(enableExternal); |
| 427 |
updateOkButton(); |
| 428 |
} |
| 429 |
|
| 430 |
protected void createButtonsForButtonBar(Composite parent) { |
464 |
protected void createButtonsForButtonBar(Composite parent) { |
| 431 |
okButton = createButton(parent, IDialogConstants.OK_ID, |
465 |
super.createButtonsForButtonBar(parent); |
| 432 |
IDialogConstants.OK_LABEL, true); |
466 |
okButton = getButton(IDialogConstants.OK_ID); |
| 433 |
createButton(parent, IDialogConstants.CANCEL_ID, |
|
|
| 434 |
IDialogConstants.CANCEL_LABEL, false); |
| 435 |
// initially there is no selection so OK button should not be enabled |
467 |
// initially there is no selection so OK button should not be enabled |
| 436 |
okButton.setEnabled(false); |
468 |
okButton.setEnabled(false); |
| 437 |
|
469 |
|
|
Lines 442-457
Link Here
|
| 442 |
*/ |
474 |
*/ |
| 443 |
protected void updateOkButton() { |
475 |
protected void updateOkButton() { |
| 444 |
// Buttons are null during dialog creation |
476 |
// Buttons are null during dialog creation |
| 445 |
if (okButton == null) { |
477 |
if (okButton != null && !okButton.isDisposed()) { |
| 446 |
return; |
478 |
// only enable the 'OK' button if something was selected |
| 447 |
} |
479 |
if (editorsFolder.getSelectionIndex() == 0) { |
| 448 |
// If there is no selection, do not enable OK button |
480 |
okButton.setEnabled(internalEditorsTable.getSelectionCount() == 1); |
| 449 |
if (editorTable.getSelectionCount() == 0) { |
481 |
} else { |
| 450 |
okButton.setEnabled(false); |
482 |
okButton.setEnabled(externalEditorsTable.getSelectionCount() == 1); |
| 451 |
return; |
483 |
} |
| 452 |
} |
484 |
} |
| 453 |
// At this point, there is a selection |
|
|
| 454 |
okButton.setEnabled(selectedEditor != null); |
| 455 |
} |
485 |
} |
| 456 |
|
486 |
|
| 457 |
private class DialogListener implements Listener { |
487 |
private class DialogListener implements Listener { |
|
Lines 462-485
Link Here
|
| 462 |
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) |
492 |
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) |
| 463 |
*/ |
493 |
*/ |
| 464 |
public void handleEvent(Event event) { |
494 |
public void handleEvent(Event event) { |
| 465 |
if (event.type == SWT.MouseDoubleClick) { |
495 |
if (event.widget == editorsFolder) { |
| 466 |
handleDoubleClickEvent(); |
496 |
handleTabSelection(); |
| 467 |
return; |
|
|
| 468 |
} |
| 469 |
if (event.widget == externalButton) { |
| 470 |
fillEditorTable(); |
| 471 |
} else if (event.widget == browseExternalEditorsButton) { |
497 |
} else if (event.widget == browseExternalEditorsButton) { |
| 472 |
promptForExternalEditor(); |
498 |
promptForExternalEditor(); |
| 473 |
} else if (event.widget == editorTable) { |
|
|
| 474 |
if (editorTable.getSelectionIndex() != -1) { |
| 475 |
selectedEditor = (EditorDescriptor) editorTable |
| 476 |
.getSelection()[0].getData(); |
| 477 |
} else { |
| 478 |
selectedEditor = null; |
| 479 |
okButton.setEnabled(false); |
| 480 |
} |
| 481 |
} |
499 |
} |
| 482 |
updateEnableState(); |
500 |
updateOkButton(); |
| 483 |
} |
501 |
} |
| 484 |
|
502 |
|
| 485 |
} |
503 |
} |