1 | if (contentOutlinePage == null)↵ | | 1 | if (contentOutlinePage == null)↵
|
2 | {↵ | | 2 | {↵
|
3 | // The content outline is just a tree.↵ | | 3 | // The content outline is just a tree.↵
|
4 | //↵ | | 4 | //↵
|
5 | class MyContentOutlinePage extends ContentOutlinePage↵ | | 5 | class MyContentOutlinePage extends ContentOutlinePage↵
|
6 | {↵ | | 6 | {↵
|
7 | @Override↵ | | 7 | @Override↵
|
8 | public void createControl(Composite parent)↵ | | 8 | public void createControl(Composite parent)↵
|
9 | {↵ | | 9 | {↵
|
10 | super.createControl(parent);↵ | | 10 | super.createControl(parent);↵
|
11 | contentOutlineViewer = getTreeViewer();↵ | | 11 | contentOutlineViewer = getTreeViewer();↵
|
12 | contentOutlineViewer.addSelectionChangedListener(this);↵ | | 12 | contentOutlineViewer.addSelectionChangedListener(this);↵
|
|
13 | // Set up the tree viewer.↵ | | 13 | // Set up the tree viewer.↵
|
14 | //↵ | | 14 | //↵
|
15 | contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));↵ | | 15 | contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));↵
|
16 | contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));↵ | | 16 | contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));↵
|
17 | contentOutlineViewer.setInput(editingDomain.getResourceSet());↵ | | 17 | contentOutlineViewer.setInput(editingDomain.getResourceSet());↵
|
|
18 | // Make sure our popups work.↵ | | 18 | // Make sure our popups work.↵
|
19 | //↵ | | 19 | //↵
|
20 | createContextMenuFor(contentOutlineViewer);↵ | | 20 | createContextMenuFor(contentOutlineViewer);↵
|
|
21 | if (!editingDomain.getResourceSet().getResources().isEmpty())↵ | | 21 | if (!editingDomain.getResourceSet().getResources().isEmpty())↵
|
22 | {↵ | | 22 | {↵
|
23 | // Select the root object in the view.↵ | | 23 | // Select the root object in the view.↵
|
24 | //↵ | | 24 | //↵
|
25 | contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);↵ | | 25 | contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);↵
|
26 | }↵ | | 26 | }↵
|
27 | }↵ | | 27 | }↵
|
|
28 | @Override↵ | | 28 | @Override↵
|
29 | public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)↵ | | 29 | public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)↵
|
30 | {↵ | | 30 | {↵
|
31 | super.makeContributions(menuManager, toolBarManager, statusLineManager);↵ | | 31 | super.makeContributions(menuManager, toolBarManager, statusLineManager);↵
|
32 | contentOutlineStatusLineManager = statusLineManager;↵ | | 32 | contentOutlineStatusLineManager = statusLineManager;↵
|
33 | }↵ | | 33 | }↵
|
|
34 | @Override↵ | | 34 | @Override↵
|
35 | public void setActionBars(IActionBars actionBars)↵ | | 35 | public void setActionBars(IActionBars actionBars)↵
|
36 | {↵ | | 36 | {↵
|
37 | super.setActionBars(actionBars);↵ | | 37 | super.setActionBars(actionBars);↵
|
38 | getActionBarContributor().shareGlobalActions(this, actionBars);↵ | | 38 | getActionBarContributor().shareGlobalActions(this, actionBars);↵
|
39 | }↵ | | 39 | }↵
|
40 | }↵ | | 40 | }↵
|
|
41 | contentOutlinePage = new MyContentOutlinePage();↵ | | 41 | contentOutlinePage = new MyContentOutlinePage();↵
|
|
42 | // Listen to selection so that we can handle it is a special way.↵ | | 42 | // Listen to selection so that we can handle it is a special way.↵
|
43 | //↵ | | 43 | //↵
|
44 | contentOutlinePage.addSelectionChangedListener↵ | | 44 | contentOutlinePage.addSelectionChangedListener↵
|
45 | (new ISelectionChangedListener()↵ | | 45 | (new ISelectionChangedListener()↵
|
46 | {↵ | | 46 | {↵
|
47 | // This ensures that we handle selections correctly.↵ | | 47 | // This ensures that we handle selections correctly.↵
|
48 | //↵ | | 48 | //↵
|
49 | public void selectionChanged(SelectionChangedEvent event)↵ | | 49 | public void selectionChanged(SelectionChangedEvent event)↵
|
50 | {↵ | | 50 | {↵
|
51 | handleContentOutlineSelection(event.getSelection());↵ | | 51 | handleContentOutlineSelection(event.getSelection());↵
|
52 | }↵ | | 52 | }↵
|
53 | });↵ | | 53 | });↵
|
54 | }↵ | | 54 | }↵
|
|
55 | return contentOutlinePage; | | 55 | return contentOutlinePage;
|