1 | adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());↵ | | 1 | adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());↵
|
2 | adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());↵ | | 2 | adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());↵
|
|
3 | // Create the command stack that will notify this editor as commands are executed.↵ | | 3 | // Create the command stack that will notify this editor as commands are executed.↵
|
4 | //↵ | | 4 | //↵
|
5 | BasicCommandStack commandStack = new BasicCommandStack();↵ | | 5 | BasicCommandStack commandStack = new BasicCommandStack();↵
|
|
6 | // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.↵ | | 6 | // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.↵
|
7 | //↵ | | 7 | //↵
|
8 | commandStack.addCommandStackListener↵ | | 8 | commandStack.addCommandStackListener↵
|
9 | (new CommandStackListener()↵ | | 9 | (new CommandStackListener()↵
|
10 | {↵ | | 10 | {↵
|
11 | public void commandStackChanged(final EventObject event)↵ | | 11 | public void commandStackChanged(final EventObject event)↵
|
12 | {↵ | | 12 | {↵
|
13 | getContainer().getDisplay().asyncExec↵ | | 13 | getContainer().getDisplay().asyncExec↵
|
14 | (new Runnable()↵ | | 14 | (new Runnable()↵
|
15 | {↵ | | 15 | {↵
|
16 | public void run()↵ | | 16 | public void run()↵
|
17 | {↵ | | 17 | {↵
|
18 | firePropertyChange(IEditorPart.PROP_DIRTY);↵ | | 18 | firePropertyChange(IEditorPart.PROP_DIRTY);↵
|
|
19 | // Try to select the affected objects.↵ | | 19 | // Try to select the affected objects.↵
|
20 | //↵ | | 20 | //↵
|
21 | Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();↵ | | 21 | Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();↵
|
22 | if (mostRecentCommand != null)↵ | | 22 | if (mostRecentCommand != null)↵
|
23 | {↵ | | 23 | {↵
|
24 | setSelectionToViewer(mostRecentCommand.getAffectedObjects());↵ | | 24 | setSelectionToViewer(mostRecentCommand.getAffectedObjects());↵
|
25 | }↵ | | 25 | }↵
|
26 | if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())↵ | | 26 | if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())↵
|
27 | {↵ | | 27 | {↵
|
28 | propertySheetPage.refresh();↵ | | 28 | propertySheetPage.refresh();↵
|
29 | }↵ | | 29 | }↵
|
30 | }↵ | | 30 | }↵
|
31 | });↵ | | 31 | });↵
|
32 | }↵ | | 32 | }↵
|
33 | });↵ | | 33 | });↵
|
|
34 | // Create the editing domain with a special command stack.↵ | | 34 | // Create the editing domain with a special command stack.↵
|
35 | //↵ | | 35 | //↵
|
36 | editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); | | 36 | editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
|