Search in sources :

Example 1 with UIEventTopic

use of org.eclipse.e4.ui.di.UIEventTopic in project ACS by ACS-Community.

the class MyStatusBar method getNotified.

@Inject
@Optional
private void getNotified(@UIEventTopic(STATUS_BAR_TOPIC_ID) MessageWithTime msgWithTime) {
    if (slm != null) {
        String flashMsg = msgWithTime.msg;
        int timeSeconds = msgWithTime.timeSeconds;
        slm.setMessage(flashMsg);
        // TODO fix truncation of larger strings, e.g.
        //			slm.getControl().pack(true); ??
        clearFlashJob();
        msgRestoreJob = new Job(MyStatusBar.class.getSimpleName() + "RemoveFlashMessage") {

            @Override
            protected IStatus run(IProgressMonitor monitor) {
                // restore the previous message
                uiSync.syncExec(new Runnable() {

                    @Override
                    public void run() {
                        slm.setMessage(permanentMessage);
                    }
                });
                return Status.OK_STATUS;
            }
        };
        msgRestoreJob.schedule(timeSeconds * 1000);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) Job(org.eclipse.core.runtime.jobs.Job) Inject(javax.inject.Inject) Optional(org.eclipse.e4.core.di.annotations.Optional)

Example 2 with UIEventTopic

use of org.eclipse.e4.ui.di.UIEventTopic in project AGREE by loonwerks.

the class VariablesView method beforeCreateStepArguments.

@Inject
@Optional
void beforeCreateStepArguments(@UIEventTopic(SimulatorUIEvents.BEFORE_STEP_FORWARD) final BeforeStepForwardEvent event) {
    // Take the focus away from cell editors widgets
    if (treeViewer != null) {
        final Control focusControl = Display.getCurrent().getFocusControl();
        final Tree tree = treeViewer.getTree();
        for (Control c = focusControl; c != null; c = c.getParent()) {
            if (c == tree) {
                treeViewer.getTree().forceFocus();
                break;
            }
        }
    }
    // Cancel the step
    if (elementToConstraintErrorMap.size() > 0) {
        event.cancelStep(new Throwable("One or more user constraints is invalid."));
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) Tree(org.eclipse.swt.widgets.Tree) Inject(javax.inject.Inject) Optional(org.eclipse.e4.core.di.annotations.Optional)

Example 3 with UIEventTopic

use of org.eclipse.e4.ui.di.UIEventTopic in project portfolio by buchen.

the class ThemeAddon method onThemeChanged.

@Inject
@Optional
public void onThemeChanged(@UIEventTopic(IThemeEngine.Events.THEME_CHANGED) Event event) {
    IThemeEngine engine = (IThemeEngine) event.getProperty(IThemeEngine.Events.THEME_ENGINE);
    engine.applyStyles(Colors.theme(), false);
}
Also used : IThemeEngine(org.eclipse.e4.ui.css.swt.theme.IThemeEngine) Inject(javax.inject.Inject) Optional(org.eclipse.e4.core.di.annotations.Optional)

Example 4 with UIEventTopic

use of org.eclipse.e4.ui.di.UIEventTopic in project portfolio by buchen.

the class CopyMenuToNewWindowAddon method onEvent.

@Inject
@Optional
public void onEvent(@UIEventTopic(UIEvents.Window.TOPIC_ALL) Event event) {
    if (UIEvents.isADD(event)) {
        MTrimmedWindow origin = (MTrimmedWindow) event.getProperty(EventTags.ELEMENT);
        MTrimmedWindow window = (MTrimmedWindow) event.getProperty(EventTags.NEW_VALUE);
        MMenu mainMenu = (MMenu) EcoreUtil.copy((EObject) origin.getMainMenu());
        mainMenu.setVisible(true);
        window.setMainMenu(mainMenu);
    }
}
Also used : MTrimmedWindow(org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow) EObject(org.eclipse.emf.ecore.EObject) MMenu(org.eclipse.e4.ui.model.application.ui.menu.MMenu) Inject(javax.inject.Inject) Optional(org.eclipse.e4.core.di.annotations.Optional)

Example 5 with UIEventTopic

use of org.eclipse.e4.ui.di.UIEventTopic in project aero.minova.rcp by minova-afis.

the class WFCIndexPart method load.

/**
 * Diese Methode ließt die Index-Spalten aus und erstellet daraus eine Table, diese wird dann an den CAS als Anfrage übergeben.
 */
@Inject
@Optional
public void load(@UIEventTopic(Constants.BROKER_LOADINDEXTABLE) Table resultTable) {
    MPerspective activePerspective = modelService.getActivePerspective(context.get(MWindow.class));
    if (!activePerspective.equals(mPerspective)) {
        return;
    }
    // clear the group by summary cache so the new summary calculation gets triggered
    bodyLayerStack.getBodyDataLayer().clearCache();
    // Daten in Nattable schreiben. Wenn Page != 1 werden die Zeilen nur angehängt
    updateData(resultTable.getRows(), resultTable.getMetaData().getPage() != 1);
    if (resultTable.getRows().isEmpty()) {
        MessageDialog.openInformation(Display.getDefault().getActiveShell(), translationService.translate("@Information", null), translationService.translate("@msg.NoRecordsLoaded", null));
    }
}
Also used : MPerspective(org.eclipse.e4.ui.model.application.ui.advanced.MPerspective) MWindow(org.eclipse.e4.ui.model.application.ui.basic.MWindow) Inject(javax.inject.Inject) Optional(org.eclipse.e4.core.di.annotations.Optional)

Aggregations

Inject (javax.inject.Inject)96 Optional (org.eclipse.e4.core.di.annotations.Optional)96 MUIElement (org.eclipse.e4.ui.model.application.ui.MUIElement)25 MWindow (org.eclipse.e4.ui.model.application.ui.basic.MWindow)23 MPerspective (org.eclipse.e4.ui.model.application.ui.advanced.MPerspective)19 MPart (org.eclipse.e4.ui.model.application.ui.basic.MPart)12 EObject (org.eclipse.emf.ecore.EObject)12 MToolBar (org.eclipse.e4.ui.model.application.ui.menu.MToolBar)9 IContributionItem (org.eclipse.jface.action.IContributionItem)9 ArrayList (java.util.ArrayList)8 MPerspectiveStack (org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack)8 MToolControl (org.eclipse.e4.ui.model.application.ui.menu.MToolControl)8 MToolBarElement (org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement)7 Shell (org.eclipse.swt.widgets.Shell)7 IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)6 Control (org.eclipse.swt.widgets.Control)6 MApplication (org.eclipse.e4.ui.model.application.MApplication)5 MKeyBinding (org.eclipse.e4.ui.model.application.commands.MKeyBinding)5 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)4 ExtendedObjectSupplier (org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier)4