use of org.eclipse.e4.ui.model.application.MApplication in project archi by archimatetool.
the class GeneralPreferencePage method init.
public void init(IWorkbench workbench) {
// e4 method (taken from org.eclipse.ui.internal.dialogs.ViewsPreferencePage init(IWorkbench))
MApplication application = workbench.getService(MApplication.class);
IEclipseContext context = application.getContext();
// This is "org.eclipse.e4.ui.css.theme.e4_default" //$NON-NLS-1$
fDefaultTheme = (String) context.get("cssTheme");
fThemeEngine = context.get(IThemeEngine.class);
fCurrentTheme = fThemeEngine.getActiveTheme();
/*
// e3 method
Bundle bundle = FrameworkUtil.getBundle(ArchiPlugin.class);
BundleContext context = bundle.getBundleContext();
ServiceReference<IThemeManager> ref = context.getServiceReference(IThemeManager.class);
IThemeManager themeManager = context.getService(ref);
fThemeEngine = themeManager.getEngineForDisplay(Display.getCurrent());
fDefaultTheme = "org.eclipse.e4.ui.css.theme.e4_default"; //$NON-NLS-1$
*/
}
use of org.eclipse.e4.ui.model.application.MApplication in project nebula.widgets.nattable by eclipse.
the class LifecycleManager method preSave.
@PreSave
void preSave(EModelService modelService, MApplication app) {
List<String> tags = new ArrayList<>();
tags.add(CLOSE_ON_SHUTDOWN_TAG);
List<MPart> elementsWithTags = modelService.findElements(app, null, MPart.class, tags);
for (MPart part : elementsWithTags) {
try {
part.setToBeRendered(false);
part.setVisible(false);
MElementContainer<MUIElement> parent = part.getParent();
parent.getChildren().remove(part);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of org.eclipse.e4.ui.model.application.MApplication in project org.csstudio.display.builder by kasemir.
the class RuntimeViewPart method findPlaceholder.
/**
* Find the MPlaceholder corresponding to this MPart in the MPerspective. This
* may have persisted information relevant to loading this view.
* @return corresponding placeholder or <code>null</code>
*/
private MPlaceholder findPlaceholder() {
final IEclipseContext localContext = getViewSite().getService(IEclipseContext.class);
final MPart part = localContext.get(MPart.class);
final EModelService service = PlatformUI.getWorkbench().getService(EModelService.class);
final IEclipseContext globalContext = PlatformUI.getWorkbench().getService(IEclipseContext.class);
final MApplication app = globalContext.get(MApplication.class);
final List<MPlaceholder> phs = service.findElements(app, null, MPlaceholder.class, null);
for (MPlaceholder ph : phs) if (ph.getRef() == part)
return ph;
return null;
}
use of org.eclipse.e4.ui.model.application.MApplication in project n4js by eclipse.
the class N4JSApplicationWorkbenchWindowAdvisor method reviewDisabledCategoriesFromAppModel.
/**
* The 'Show View' dialog behavior slightly changed with E4. Even if the views are properly removed via activities
* (by the unique view IDs) the content provider creates the root category for the unavailable views as well since
* it is using the {@link MApplication}.
*/
private void reviewDisabledCategoriesFromAppModel() {
final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final MApplication service = workbenchWindow.getService(MApplication.class);
for (Iterator<MPartDescriptor> itr = service.getDescriptors().iterator(); itr.hasNext(); ) /**/
{
final MPartDescriptor descriptor = itr.next();
if (isView(descriptor) && isDisabledView(descriptor)) {
itr.remove();
}
}
}
use of org.eclipse.e4.ui.model.application.MApplication in project portfolio by buchen.
the class LifeCycleManager method removePortfolioPartsWithoutPersistedFile.
private void removePortfolioPartsWithoutPersistedFile(MApplication app, EPartService partService, EModelService modelService) {
List<MPart> parts = modelService.findElements(app, MPart.class, EModelService.IN_ACTIVE_PERSPECTIVE, new Selector() {
@Override
public boolean select(MApplicationElement element) {
if (// $NON-NLS-1$
!"name.abuchen.portfolio.ui.part.portfolio".equals(element.getElementId()))
return false;
// $NON-NLS-1$
return element.getPersistedState().get("file") == null;
}
});
for (MPart part : parts) {
MElementContainer<MUIElement> parent = part.getParent();
if (parent.getSelectedElement().equals(part))
parent.setSelectedElement(null);
parent.getChildren().remove(part);
}
}
Aggregations