org.eclipse.e4.ui.workbench.UIEvents Java Examples

The following examples show how to use org.eclipse.e4.ui.workbench.UIEvents. 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 vote down vote up
@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: PreferenceInitializerAddon.java    From saneclipse with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
@Optional
public void name(@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
	if(!preferencesInitialized) {
		preferencesInitialized = true;
		configureJDTUi();
		configureJDTCore();
		configurePDEUi();
		configureIde();
		configureWorkbench();
		configurePerformanceMonitoring();
		configureDebug();
		configureEditor();
		configureXMLEditor();
		configureMemoryMonitorActive();
	}
}
 
Example #3
Source File: CoreUiUtil.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
@Optional
public void subscribeAppStartupComplete(
	@UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) Event event, UISynchronize sync){
	
	synchronized (lock) {
		Object property = event.getProperty("org.eclipse.e4.data");
		if (property instanceof MApplication) {
			MApplication application = (MApplication) property;
			// A RAP application has one application context per client
			// the resp. context service implementation considers this
			contextService.getRootContext().setNamed("applicationContext",
				application.getContext());
			
			if (!delayedInjection.isEmpty()) {
				for (Object object : delayedInjection) {
					sync.asyncExec(() -> {
						injectServices(object);
					});
				}
				delayedInjection.clear();
			}
		}
	}
}
 
Example #4
Source File: QuitHandlerAddon.java    From offspring with MIT License 5 votes vote down vote up
@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;
        }
      });
    }
  }
}
 
Example #5
Source File: QuitHandlerAddon.java    From offspring with MIT License 5 votes vote down vote up
@PostConstruct
void hookListeners(INxtService nxt, Display display, IDataProviderPool pool) {
  this.nxt = nxt;
  this.display = display;
  this.pool = pool;
  broker.subscribe(UIEvents.Context.TOPIC_CONTEXT, eventHandler);
}
 
Example #6
Source File: StartHandlerAddon.java    From offspring with MIT License 5 votes vote down vote up
@PostConstruct
void hookListeners(MApplication application, IUserService userService,
    IWallet wallet, IDataProviderPool pool, INxtService nxt,
    IAssetExchange exchange) {
  this.application = application;
  this.userService = userService;
  this.wallet = wallet;
  this.pool = pool;
  this.nxt = nxt;
  this.exchange = exchange;
  broker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, eventHandler);

}
 
Example #7
Source File: MySellOrdersPart.java    From offspring with MIT License 5 votes vote down vote up
@Inject
@Optional
public void partActivation(
    @UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
  if (viewer != null && !viewer.getControl().isDisposed()) {
    viewer.refresh();
  }
}
 
Example #8
Source File: MyAssetsPart.java    From offspring with MIT License 5 votes vote down vote up
@Inject
@Optional
public void partActivation(
    @UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
  if (viewer != null && !viewer.getControl().isDisposed()) {
    viewer.refresh();
  }
}
 
Example #9
Source File: AssetsPart.java    From offspring with MIT License 5 votes vote down vote up
@Inject
@Optional
public void partActivation(
    @UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
  if (assetsViewer != null && !assetsViewer.getControl().isDisposed()) {
    assetsViewer.refresh();
  }
}
 
Example #10
Source File: MyBuyOrdersPart.java    From offspring with MIT License 5 votes vote down vote up
@Inject
@Optional
public void partActivation(
    @UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
  if (viewer != null && !viewer.getControl().isDisposed()) {
    viewer.refresh();
  }
}
 
Example #11
Source File: ApplicationConfiguration.java    From warcraft-remake with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Execute the injection.
 * 
 * @param eventBroker The event broker service.
 */
@PostConstruct
public void execute(IEventBroker eventBroker)
{
    final MWindow existingWindow = application.getChildren().get(0);
    existingWindow.setLabel(Activator.PLUGIN_NAME);
    eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new AppStartupCompleteEventHandler());
}
 
Example #12
Source File: OpenIntroAddon.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void handleEvent(Event event) {
    Object part = event.getProperty(UIEvents.EventTags.ELEMENT);
    if (part instanceof MPart) {
        if (((MPart) part).getElementId().equals("org.eclipse.e4.ui.compatibility.editor")) {
            if(repositoryAccessor.getCurrentRepository().isOpenIntroListenerEnabled()) {
                PlatformUtil.openIntroIfNoOtherEditorOpen();
            }
        }
    }
}
 
Example #13
Source File: RecentBlocksPart.java    From offspring with MIT License 4 votes vote down vote up
@Inject
@Optional
public void partActivation(
    @UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
  needs_refresh = true;
}
 
Example #14
Source File: RecentTransactionsPart.java    From offspring with MIT License 4 votes vote down vote up
@Inject
@Optional
public void partActivation(
    @UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
  needs_refresh = true;
}
 
Example #15
Source File: OpenIntroAddon.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@PostConstruct
public void pc(IEventBroker eventBroker, RepositoryAccessor repositoryAccessor) {
    this.repositoryAccessor = repositoryAccessor;
    eventBroker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, this::handleEvent);
}