|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
28 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
| 29 |
import org.eclipse.e4.ui.workbench.IPresentationEngine; |
29 |
import org.eclipse.e4.ui.workbench.IPresentationEngine; |
| 30 |
import org.eclipse.e4.ui.workbench.UIEvents; |
30 |
import org.eclipse.e4.ui.workbench.UIEvents; |
|
|
31 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
| 32 |
import org.eclipse.jface.viewers.IPostSelectionProvider; |
| 33 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
| 34 |
import org.eclipse.jface.viewers.ISelectionProvider; |
| 35 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
| 31 |
import org.eclipse.swt.SWT; |
36 |
import org.eclipse.swt.SWT; |
| 32 |
import org.eclipse.swt.custom.CTabFolder; |
37 |
import org.eclipse.swt.custom.CTabFolder; |
| 33 |
import org.eclipse.swt.custom.CTabItem; |
38 |
import org.eclipse.swt.custom.CTabItem; |
|
Lines 53-59
Link Here
|
| 53 |
import org.osgi.service.event.Event; |
58 |
import org.osgi.service.event.Event; |
| 54 |
import org.osgi.service.event.EventHandler; |
59 |
import org.osgi.service.event.EventHandler; |
| 55 |
|
60 |
|
| 56 |
public abstract class CompatibilityPart { |
61 |
public abstract class CompatibilityPart implements ISelectionChangedListener { |
| 57 |
|
62 |
|
| 58 |
public static final String COMPATIBILITY_EDITOR_URI = "bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor"; //$NON-NLS-1$ |
63 |
public static final String COMPATIBILITY_EDITOR_URI = "bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor"; //$NON-NLS-1$ |
| 59 |
|
64 |
|
|
Lines 151-156
Link Here
|
| 151 |
WorkbenchPlugin.log("Unable to initialize error part", ex.getStatus()); //$NON-NLS-1$ |
156 |
WorkbenchPlugin.log("Unable to initialize error part", ex.getStatus()); //$NON-NLS-1$ |
| 152 |
} |
157 |
} |
| 153 |
} |
158 |
} |
|
|
159 |
|
| 160 |
IWorkbenchPartSite site = legacyPart.getSite(); |
| 161 |
if (site != null) { |
| 162 |
ISelectionProvider selectionProvider = site.getSelectionProvider(); |
| 163 |
if (selectionProvider != null) { |
| 164 |
selectionProvider.addSelectionChangedListener(this); |
| 165 |
|
| 166 |
if (selectionProvider instanceof IPostSelectionProvider) { |
| 167 |
((IPostSelectionProvider) selectionProvider) |
| 168 |
.addPostSelectionChangedListener(this); |
| 169 |
} |
| 170 |
} |
| 171 |
} |
| 154 |
return true; |
172 |
return true; |
| 155 |
} |
173 |
} |
| 156 |
|
174 |
|
|
Lines 168-173
Link Here
|
| 168 |
} |
186 |
} |
| 169 |
|
187 |
|
| 170 |
private void invalidate() { |
188 |
private void invalidate() { |
|
|
189 |
if (wrapped != null) { |
| 190 |
IWorkbenchPartSite site = wrapped.getSite(); |
| 191 |
if (site != null) { |
| 192 |
ISelectionProvider selectionProvider = site.getSelectionProvider(); |
| 193 |
if (selectionProvider != null) { |
| 194 |
selectionProvider.removeSelectionChangedListener(this); |
| 195 |
|
| 196 |
if (selectionProvider instanceof IPostSelectionProvider) { |
| 197 |
((IPostSelectionProvider) selectionProvider) |
| 198 |
.removePostSelectionChangedListener(this); |
| 199 |
} |
| 200 |
} |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 171 |
WorkbenchPartReference reference = getReference(); |
204 |
WorkbenchPartReference reference = getReference(); |
| 172 |
reference.invalidate(); |
205 |
reference.invalidate(); |
| 173 |
|
206 |
|
|
Lines 380-383
Link Here
|
| 380 |
public MPart getModel() { |
413 |
public MPart getModel() { |
| 381 |
return part; |
414 |
return part; |
| 382 |
} |
415 |
} |
|
|
416 |
|
| 417 |
public void selectionChanged(SelectionChangedEvent e) { |
| 418 |
ESelectionService selectionService = (ESelectionService) part.getContext().get( |
| 419 |
ESelectionService.class.getName()); |
| 420 |
selectionService.setSelection(e.getSelection()); |
| 421 |
} |
| 383 |
} |
422 |
} |