use of org.eclipse.ui.internal.e4.compatibility.SelectionService in project eclipse.platform.ui by eclipse-platform.
the class WorkbenchWindow method initializeDefaultServices.
/**
* Initializes all of the default command-based services for the workbench
* window.
*/
private final void initializeDefaultServices() {
IEclipseContext windowContext = model.getContext();
serviceLocator.registerService(IWorkbenchLocationService.class, new WorkbenchLocationService(IServiceScopes.WINDOW_SCOPE, getWorkbench(), this, null, null, null, 1));
// added back for legacy reasons
serviceLocator.registerService(IWorkbenchWindow.class, this);
final ActionCommandMappingService mappingService = new ActionCommandMappingService();
serviceLocator.registerService(IActionCommandMappingService.class, mappingService);
selectionService = ContextInjectionFactory.make(SelectionService.class, model.getContext());
serviceLocator.registerService(ISelectionService.class, selectionService);
LegacyHandlerService hs = new LegacyHandlerService(windowContext);
windowContext.set(IHandlerService.class.getName(), hs);
final LegacyActionPersistence actionPersistence = new LegacyActionPersistence(this);
serviceLocator.registerService(LegacyActionPersistence.class, actionPersistence);
actionPersistence.read();
ICommandService cmdService = workbench.getService(ICommandService.class);
SlaveCommandService slaveCmdService = new SlaveCommandService(cmdService, IServiceScopes.WINDOW_SCOPE, this, model.getContext());
serviceLocator.registerService(ICommandService.class, slaveCmdService);
serviceLocator.registerService(IUpdateService.class, slaveCmdService);
IContextService cxs = ContextInjectionFactory.make(ContextService.class, model.getContext());
serviceLocator.registerService(IContextService.class, cxs);
IMenuService parent = getWorkbench().getService(IMenuService.class);
IMenuService msvs = new SlaveMenuService(parent, model);
serviceLocator.registerService(IMenuService.class, msvs);
}
use of org.eclipse.ui.internal.e4.compatibility.SelectionService in project eclipse.platform.ui by eclipse-platform.
the class WorkbenchPage method setup.
@PostConstruct
public void setup(MApplication application, EModelService modelService, IEventBroker broker, MWindow window, EPartService partService) {
this.application = application;
this.modelService = modelService;
this.broker = broker;
this.window = window;
this.partService = partService;
selectionService = ContextInjectionFactory.make(SelectionService.class, window.getContext());
partService.addPartListener(e4PartListener);
// create editor references for all editors
List<MPart> editors = modelService.findElements(window, CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null, EModelService.IN_ANY_PERSPECTIVE | EModelService.OUTSIDE_PERSPECTIVE | EModelService.IN_SHARED_AREA);
for (MPart editor : editors) {
createEditorReferenceForPart(editor, null, editor.getElementId(), null);
}
// create view references for rendered view placeholders
List<MPlaceholder> placeholders = modelService.findElements(window, null, MPlaceholder.class, null, EModelService.IN_ANY_PERSPECTIVE | EModelService.OUTSIDE_PERSPECTIVE);
for (MPlaceholder placeholder : placeholders) {
if (placeholder.isToBeRendered()) {
MUIElement ref = placeholder.getRef();
if (ref instanceof MPart) {
MPart part = (MPart) ref;
String uri = part.getContributionURI();
if (CompatibilityPart.COMPATIBILITY_VIEW_URI.equals(uri)) {
createViewReferenceForPart(part, part.getElementId());
}
}
}
}
broker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT, selectionHandler);
broker.subscribe(UIEvents.UIElement.TOPIC_WIDGET, widgetHandler);
broker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, referenceRemovalEventHandler);
broker.subscribe(UIEvents.Contribution.TOPIC_OBJECT, firingHandler);
broker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN, childrenHandler);
// Bug 479126 PERSPECTIVE_BAR_EXTRAS setting not taken into account
createPerspectiveBarExtras();
MPerspectiveStack perspectiveStack = getPerspectiveStack();
if (perspectiveStack != null) {
extendPerspectives(perspectiveStack);
}
IPerspectiveRegistry registry = getWorkbenchWindow().getWorkbench().getPerspectiveRegistry();
for (MPerspective perspective : perspectiveStack.getChildren()) {
IPerspectiveDescriptor desc = registry.findPerspectiveWithId(perspective.getElementId());
if (desc != null) {
sortedPerspectives.add(desc);
}
}
MPerspective selectedPerspective = perspectiveStack.getSelectedElement();
if (selectedPerspective != null) {
IPerspectiveDescriptor desc = registry.findPerspectiveWithId(selectedPerspective.getElementId());
if (desc != null) {
sortedPerspectives.remove(desc);
sortedPerspectives.add(desc);
}
}
restoreWorkingSets();
restoreShowInMruPartIdsList();
configureExistingWindows();
}
Aggregations