1 | protected void hideTabs()↵ | | 1 | protected void hideTabs()↵
|
2 | {↵ | | 2 | {↵
|
3 | if (getPageCount() <= 1)↵ | | 3 | if (getPageCount() <= 1)↵
|
4 | {↵ | | 4 | {↵
|
5 | setPageText(0, "");↵ | | 5 | setPageText(0, ""); //$NON-NLS-1$↵
|
6 | if (getContainer() instanceof CTabFolder)↵ | | 6 | if (getContainer() instanceof CTabFolder)↵
|
7 | {↵ | | 7 | {↵
|
8 | ((CTabFolder)getContainer()).setTabHeight(1);↵ | | 8 | ((CTabFolder)getContainer()).setTabHeight(1);↵
|
9 | Point point = getContainer().getSize();↵ | | 9 | Point point = getContainer().getSize();↵
|
10 | getContainer().setSize(point.x, point.y + 6);↵ | | 10 | getContainer().setSize(point.x, point.y + 6);↵
|
11 | }↵ | | 11 | }↵
|
12 | }↵ | | 12 | }↵
|
13 | }↵ | | 13 | }↵
|
|
14 | /**↵ | | 14 | /**↵
|
15 | * If there is more than one page in the multi-page editor part,↵ | | 15 | * If there is more than one page in the multi-page editor part,↵
|
16 | * this shows the tabs at the bottom.↵ | | 16 | * this shows the tabs at the bottom.↵
|
17 | * <!-- begin-user-doc -->↵ | | 17 | * <!-- begin-user-doc -->↵
|
18 | * <!-- end-user-doc -->↵ | | 18 | * <!-- end-user-doc -->↵
|
19 | * @generated↵ | | 19 | * @generated↵
|
20 | */↵ | | 20 | */↵
|
21 | protected void showTabs()↵ | | 21 | protected void showTabs()↵
|
22 | {↵ | | 22 | {↵
|
23 | if (getPageCount() > 1)↵ | | 23 | if (getPageCount() > 1)↵
|
24 | {↵ | | 24 | {↵
|
25 | setPageText(0, getString("_UI_SelectionPage_label"));↵ | | 25 | setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$↵
|
26 | if (getContainer() instanceof CTabFolder)↵ | | 26 | if (getContainer() instanceof CTabFolder)↵
|
27 | {↵ | | 27 | {↵
|
28 | ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);↵ | | 28 | ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);↵
|
29 | Point point = getContainer().getSize();↵ | | 29 | Point point = getContainer().getSize();↵
|
30 | getContainer().setSize(point.x, point.y - 6);↵ | | 30 | getContainer().setSize(point.x, point.y - 6);↵
|
31 | }↵ | | 31 | }↵
|
32 | }↵ | | 32 | }↵
|
33 | }↵ | | 33 | }↵
|
|
34 | /**↵ | | 34 | /**↵
|
35 | * This is used to track the active viewer.↵ | | 35 | * This is used to track the active viewer.↵
|
36 | * <!-- begin-user-doc -->↵ | | 36 | * <!-- begin-user-doc -->↵
|
37 | * <!-- end-user-doc -->↵ | | 37 | * <!-- end-user-doc -->↵
|
38 | * @generated↵ | | 38 | * @generated↵
|
39 | */↵ | | 39 | */↵
|
40 | @Override↵ | | 40 | @Override↵
|
41 | protected void pageChange(int pageIndex)↵ | | 41 | protected void pageChange(int pageIndex)↵
|
42 | {↵ | | 42 | {↵
|
43 | super.pageChange(pageIndex);↵ | | 43 | super.pageChange(pageIndex);↵
|
|
44 | if (contentOutlinePage != null)↵ | | 44 | if (contentOutlinePage != null)↵
|
45 | {↵ | | 45 | {↵
|
46 | handleContentOutlineSelection(contentOutlinePage.getSelection());↵ | | 46 | handleContentOutlineSelection(contentOutlinePage.getSelection());↵
|
47 | }↵ | | 47 | }↵
|
48 | }↵ | | 48 | }↵
|
|
49 | /**↵ | | 49 | /**↵
|
50 | * This is how the framework determines which interfaces we implement.↵ | | 50 | * This is how the framework determines which interfaces we implement.↵
|
51 | * <!-- begin-user-doc -->↵ | | 51 | * <!-- begin-user-doc -->↵
|
52 | * <!-- end-user-doc -->↵ | | 52 | * <!-- end-user-doc -->↵
|
53 | * @generated↵ | | 53 | * @generated↵
|
54 | */↵ | | 54 | */↵
|
55 | @SuppressWarnings("unchecked")↵ | | 55 | @SuppressWarnings("unchecked")↵
|
56 | @Override↵ | | 56 | @Override↵
|
57 | public Object getAdapter(Class key)↵ | | 57 | public Object getAdapter(Class key)↵
|
58 | {↵ | | 58 | {↵
|
59 | if (key.equals(IContentOutlinePage.class))↵ | | 59 | if (key.equals(IContentOutlinePage.class))↵
|
60 | {↵ | | 60 | {↵
|
61 | return showOutlineView() ? getContentOutlinePage() : null;↵ | | 61 | return showOutlineView() ? getContentOutlinePage() : null;↵
|
62 | }↵ | | 62 | }↵
|
63 | else if (key.equals(IPropertySheetPage.class))↵ | | 63 | else if (key.equals(IPropertySheetPage.class))↵
|
64 | {↵ | | 64 | {↵
|
65 | return getPropertySheetPage();↵ | | 65 | return getPropertySheetPage();↵
|
66 | }↵ | | 66 | }↵
|
67 | else if (key.equals(IGotoMarker.class))↵ | | 67 | else if (key.equals(IGotoMarker.class))↵
|
68 | {↵ | | 68 | {↵
|
69 | return this;↵ | | 69 | return this;↵
|
70 | }↵ | | 70 | }↵
|
71 | else↵ | | 71 | else↵
|
72 | {↵ | | 72 | {↵
|
73 | return super.getAdapter(key);↵ | | 73 | return super.getAdapter(key);↵
|
74 | }↵ | | 74 | }↵
|
75 | }↵ | | 75 | }↵
|
|
76 | /**↵ | | 76 | /**↵
|
77 | * This accesses a cached version of the content outliner.↵ | | 77 | * This accesses a cached version of the content outliner.↵
|
78 | * <!-- begin-user-doc -->↵ | | 78 | * <!-- begin-user-doc -->↵
|
79 | * <!-- end-user-doc -->↵ | | 79 | * <!-- end-user-doc -->↵
|
80 | * @generated↵ | | 80 | * @generated↵
|
81 | */↵ | | 81 | */↵
|
82 | public IContentOutlinePage getContentOutlinePage()↵ | | 82 | public IContentOutlinePage getContentOutlinePage()↵
|
83 | {↵ | | 83 | {↵
|
84 | if (contentOutlinePage == null)↵ | | 84 | if (contentOutlinePage == null)↵
|
85 | {↵ | | 85 | {↵
|
86 | // The content outline is just a tree.↵ | | 86 | // The content outline is just a tree.↵
|
87 | //↵ | | 87 | //↵
|
88 | class MyContentOutlinePage extends ContentOutlinePage↵ | | 88 | class MyContentOutlinePage extends ContentOutlinePage↵
|
89 | {↵ | | 89 | {↵
|
90 | @Override↵ | | 90 | @Override↵
|
91 | public void createControl(Composite parent)↵ | | 91 | public void createControl(Composite parent)↵
|
92 | {↵ | | 92 | {↵
|
93 | super.createControl(parent);↵ | | 93 | super.createControl(parent);↵
|
94 | contentOutlineViewer = getTreeViewer();↵ | | 94 | contentOutlineViewer = getTreeViewer();↵
|
95 | contentOutlineViewer.addSelectionChangedListener(this);↵ | | 95 | contentOutlineViewer.addSelectionChangedListener(this);↵
|
|
96 | // Set up the tree viewer.↵ | | 96 | // Set up the tree viewer.↵
|
97 | //↵ | | 97 | //↵
|
98 | contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));↵ | | 98 | contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));↵
|
99 | contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));↵ | | 99 | contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));↵
|
100 | contentOutlineViewer.setInput(editingDomain.getResourceSet());↵ | | 100 | contentOutlineViewer.setInput(editingDomain.getResourceSet());↵
|
|
101 | // Make sure our popups work.↵ | | 101 | // Make sure our popups work.↵
|
102 | //↵ | | 102 | //↵
|
103 | createContextMenuFor(contentOutlineViewer);↵ | | 103 | createContextMenuFor(contentOutlineViewer);↵
|
|
104 | if (!editingDomain.getResourceSet().getResources().isEmpty())↵ | | 104 | if (!editingDomain.getResourceSet().getResources().isEmpty())↵
|
105 | {↵ | | 105 | {↵
|
106 | // Select the root object in the view.↵ | | 106 | // Select the root object in the view.↵
|
107 | //↵ | | 107 | //↵
|
108 | contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);↵ | | 108 | contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);↵
|
109 | }↵ | | 109 | }↵
|
110 | }↵ | | 110 | }↵
|
|
111 | @Override↵ | | 111 | @Override↵
|
112 | public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)↵ | | 112 | public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)↵
|
113 | {↵ | | 113 | {↵
|
114 | super.makeContributions(menuManager, toolBarManager, statusLineManager);↵ | | 114 | super.makeContributions(menuManager, toolBarManager, statusLineManager);↵
|
115 | contentOutlineStatusLineManager = statusLineManager;↵ | | 115 | contentOutlineStatusLineManager = statusLineManager;↵
|
116 | }↵ | | 116 | }↵
|
|
117 | @Override↵ | | 117 | @Override↵
|
118 | public void setActionBars(IActionBars actionBars)↵ | | 118 | public void setActionBars(IActionBars actionBars)↵
|
119 | {↵ | | 119 | {↵
|
120 | super.setActionBars(actionBars);↵ | | 120 | super.setActionBars(actionBars);↵
|
121 | getActionBarContributor().shareGlobalActions(this, actionBars);↵ | | 121 | getActionBarContributor().shareGlobalActions(this, actionBars);↵
|
122 | }↵ | | 122 | }↵
|
123 | }↵ | | 123 | }↵
|
|
124 | contentOutlinePage = new MyContentOutlinePage();↵ | | 124 | contentOutlinePage = new MyContentOutlinePage();↵
|
|
125 | // Listen to selection so that we can handle it is a special way.↵ | | 125 | // Listen to selection so that we can handle it is a special way.↵
|
126 | //↵ | | 126 | //↵
|
127 | contentOutlinePage.addSelectionChangedListener↵ | | 127 | contentOutlinePage.addSelectionChangedListener↵
|
128 | (new ISelectionChangedListener()↵ | | 128 | (new ISelectionChangedListener()↵
|
129 | {↵ | | 129 | {↵
|
130 | // This ensures that we handle selections correctly.↵ | | 130 | // This ensures that we handle selections correctly.↵
|
131 | //↵ | | 131 | //↵
|
132 | public void selectionChanged(SelectionChangedEvent event)↵ | | 132 | public void selectionChanged(SelectionChangedEvent event)↵
|
133 | {↵ | | 133 | {↵
|
134 | handleContentOutlineSelection(event.getSelection());↵ | | 134 | handleContentOutlineSelection(event.getSelection());↵
|
135 | }↵ | | 135 | }↵
|
136 | });↵ | | 136 | });↵
|
137 | }↵ | | 137 | }↵
|
|
138 | return contentOutlinePage;↵ | | 138 | return contentOutlinePage;↵
|
139 | }↵ | | 139 | }↵
|
|
140 | /**↵ | | 140 | /**↵
|
141 | * This accesses a cached version of the property sheet.↵ | | 141 | * This accesses a cached version of the property sheet.↵
|
142 | * <!-- begin-user-doc -->↵ | | 142 | * <!-- begin-user-doc -->↵
|
143 | * <!-- end-user-doc -->↵ | | 143 | * <!-- end-user-doc -->↵
|
144 | * @generated↵ | | 144 | * @generated↵
|
145 | */↵ | | 145 | */↵
|
146 | public IPropertySheetPage getPropertySheetPage()↵ | | 146 | public IPropertySheetPage getPropertySheetPage()↵
|
147 | {↵ | | 147 | {↵
|
148 | if (propertySheetPage == null)↵ | | 148 | if (propertySheetPage == null)↵
|
149 | {↵ | | 149 | {↵
|
150 | propertySheetPage =↵ | | 150 | propertySheetPage =↵
|
151 | new ExtendedPropertySheetPage(editingDomain)↵ | | 151 | new ExtendedPropertySheetPage(editingDomain)↵
|
152 | {↵ | | 152 | {↵
|
153 | @Override↵ | | 153 | @Override↵
|
154 | public void setSelectionToViewer(List<?> selection)↵ | | 154 | public void setSelectionToViewer(List<?> selection)↵
|
155 | {↵ | | 155 | {↵
|
156 | EcoreEditor.this.setSelectionToViewer(selection);↵ | | 156 | Ecore2XMLEditor.this.setSelectionToViewer(selection);↵
|
157 | EcoreEditor.this.setFocus();↵ | | 157 | Ecore2XMLEditor.this.setFocus();↵
|
158 | }↵ | | 158 | }↵
|
|
159 | @Override↵ | | 159 | @Override↵
|
160 | public void setActionBars(IActionBars actionBars)↵ | | 160 | public void setActionBars(IActionBars actionBars)↵
|
161 | {↵ | | 161 | {↵
|
162 | super.setActionBars(actionBars);↵ | | 162 | super.setActionBars(actionBars);↵
|
163 | getActionBarContributor().shareGlobalActions(this, actionBars);↵ | | 163 | getActionBarContributor().shareGlobalActions(this, actionBars);↵
|
164 | }↵ | | 164 | }↵
|
165 | };↵ | | 165 | };↵
|
166 | propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));↵ | | 166 | propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));↵
|
167 | }↵ | | 167 | }↵
|
|
168 | return propertySheetPage; | | 168 | return propertySheetPage;
|