Java Code Examples for org.eclipse.e4.ui.workbench.UIEvents#isSET()
The following examples show how to use
org.eclipse.e4.ui.workbench.UIEvents#isSET() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InitialPerspectiveStorageAddon.java From codeexamples-eclipse with Eclipse Public License 1.0 | 6 votes |
@Inject @Optional public void selectedElement(@EventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) Event event, EModelService modelService) { if (!UIEvents.isSET(event)) { return; } Object newlySelectedPerspective = event.getProperty(EventTags.NEW_VALUE); if (newlySelectedPerspective instanceof MPerspective) { MPerspective perspectiveToBeCloned = (MPerspective) newlySelectedPerspective; MWindow topLevelWindow = modelService.getTopLevelWindowFor(perspectiveToBeCloned); // try to find already existing snippet if (null == modelService.findSnippet(topLevelWindow, perspectiveToBeCloned.getElementId())) { // clone perspective in case there is no snippet yet modelService.cloneElement(perspectiveToBeCloned, topLevelWindow); } } }
Example 2
Source File: QuitHandlerAddon.java From offspring with MIT License | 5 votes |
@Override public void handleEvent(final Event inEvent) { if (!UIEvents.isSET(inEvent)) { return; } final Object lElement = inEvent.getProperty(UIEvents.EventTags.ELEMENT); if (!(lElement instanceof MWindow)) { return; } final MWindow lWindow = (MWindow) lElement; if ("com.dgex.offspring.application.mainwindow".equals(lWindow .getElementId())) { logger.trace(UIEvents.Context.TOPIC_CONTEXT); if (lWindow.equals(inEvent.getProperty("ChangedElement")) && lWindow.getContext() != null) { lWindow.getContext().runAndTrack(new RunAndTrack() { @Override public boolean changed(final IEclipseContext inContext) { final Object lHandler = inContext.get(IWindowCloseHandler.class); if (!quitHandler.equals(lHandler)) { inContext.set(IWindowCloseHandler.class, quitHandler); } return true; } }); } } }