Java Code Examples for org.eclipse.e4.ui.workbench.modeling.EModelService#getTrim()

The following examples show how to use org.eclipse.e4.ui.workbench.modeling.EModelService#getTrim() . 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: ElexisFastViewUtil.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private static MTrimBar findTrimBar(EModelService eModelService, MTrimmedWindow workbenchWindow,
	SideValue sideValue){
	if (workbenchWindow != null) {
		MTrimBar trimbar = eModelService.getTrim(workbenchWindow, sideValue);
		return trimbar;
	}
	return null;
}
 
Example 2
Source File: ElexisFastViewUtil.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Adds a view to the fastview, if {@link MPartStack} not exists it will be created and the view
 * will be added within a {@link MPlaceholder} element.
 * 
 * @param perspectiveId
 * @param viewId
 */
public static void addToFastView(String perspectiveId, String viewId){
	EModelService eModelService = getService(EModelService.class);
	MApplication mApplication = getService(MApplication.class);
	
	MTrimmedWindow window = getCurrentWindow(eModelService, mApplication);
	
	if (window != null) {
		Object obj = eModelService.find(perspectiveId, mApplication);
		if (obj instanceof MPerspective) {
			MPerspective mPerspective = (MPerspective) obj;
			// check if fastview stack exists
			MPartStack stack =
				(MPartStack) eModelService.find(ELEXIS_FASTVIEW_STACK, mPerspective);
			
			if (stack == null) {
				stack = createFastViewStack(window, mPerspective, eModelService);
			}
			if (stack != null) {
				// check if toolcontrol exists
				MToolControl toolControl = (MToolControl) eModelService
					.find(getToolControlId(window, mPerspective), mApplication);
				
				if (toolControl == null) {
					MTrimBar mTrimBar = eModelService.getTrim(window, SideValue.BOTTOM);
					if (toolControl == null) {
						toolControl = createFastViewToolControl(window, mPerspective,
							eModelService, mTrimBar);
					}
				}
				if (toolControl != null
					&& !ElexisFastViewUtil.isViewInsideFastview(stack, viewId)
					&& mApplication.getContext().getActiveChild() != null) {
					EPartService partService = getService(EPartService.class);
					MPlaceholder placeholder = partService.createSharedPart(viewId);
					placeholder.setToBeRendered(true);
					placeholder.setElementId(viewId);
					placeholder.setCloseable(true);
					placeholder.getTags().add(EPartService.REMOVE_ON_HIDE_TAG);
					((MPart) placeholder.getRef()).setToBeRendered(true);
					stack.getChildren().add(placeholder); // Add part to stack
				}
				
			}
		}
	}
}