当前位置: 首页>>代码示例>>Java>>正文


Java MUIElement类代码示例

本文整理汇总了Java中org.eclipse.e4.ui.model.application.ui.MUIElement的典型用法代码示例。如果您正苦于以下问题:Java MUIElement类的具体用法?Java MUIElement怎么用?Java MUIElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MUIElement类属于org.eclipse.e4.ui.model.application.ui包,在下文中一共展示了MUIElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleEvent

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@Override
public void handleEvent(Event event) {
	if (window == null)
		return;

	MUIElement changedElement = (MUIElement) event.getProperty(UIEvents.EventTags.ELEMENT);
	if (!(changedElement instanceof MPerspective))
		return;

	MPerspective perspective = (MPerspective) changedElement;
	if (!perspective.isToBeRendered())
		return;
	
	MWindow perspectiveWindow = perspective.getContext().get(MWindow.class); 
	if (window != perspectiveWindow)
		return;
				
	String attName = (String) event.getProperty(UIEvents.EventTags.ATTNAME);
	Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE);
	
	control.updateAttributeFor(perspective, attName, newValue);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:EPerspectiveSwitcher.java

示例2: switchTo

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
void switchTo(MPart newPart) {
	if (getOrderedStacks(apart).size() == 1) {
		// case 1: 1 frame, split with miniPart
		// convenience hack: change direction on uArg
		splitIt(newPart, getDirection((isUniversalPresent()) ? !DISPLAY_HORIZONTAL : DISPLAY_HORIZONTAL));
	} else {
		// case 2: multiple stacks, move to adjacent stack
		// get the starting stack
		MElementContainer<MUIElement> stack = getParentStack(apart).getStack();
		// get the topart's stack
		MElementContainer<MUIElement> tstack = getParentStack(newPart).getStack();
		stack = findNextStack(apart, stack, 1);
		if (stack != null && stack != tstack) {
			modelService.move(newPart, stack, 0);
		}
	}
	if (displayOnly) {
		// brings to top
		partService.showPart(newPart, PartState.VISIBLE);
		reactivate(apart);
	} else {
		// bug in Kepler forces us to activate the old before the new
		reactivate(apart);
		reactivate(newPart);
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:27,代码来源:SwitchToBufferOtherCmd.java

示例3: execute

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@Execute
public Object execute(@Active MPart apart,  @Named(E4CmdHandler.CMD_CTX_KEY)Col stype, @Active EmacsPlusCmdHandler handler) {
	PartAndStack ps = getParentStack(apart);
	MElementContainer<MUIElement> stack = ps.getStack();
	MElementContainer<MUIElement> next = getAdjacentElement(stack, ps.getPart(), false);
	
	int count = handler.getUniversalCount();
	if (next != null) {
		switch (stype) {
		case SHRINK:
			adjustContainerData((MUIElement)stack, (MUIElement)next, count, getTotalSize(apart));
			break;
		case ENLARGE:
			adjustContainerData((MUIElement)next, (MUIElement)stack, count, getTotalSize(apart));
			break;
		case BALANCE:
			balancePartSash(stack);
			break;
		}
	}	
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:23,代码来源:WindowShrinkCmd.java

示例4: getAdjacentElement

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
/**
 * Find the first element with which we should join
 * 
 * @param dragStack the stack to join
 * @return the target stack 
 */
@SuppressWarnings("unchecked")  // for safe cast to MElementContainer<MUIElement>
protected MElementContainer<MUIElement> getAdjacentElement(MElementContainer<MUIElement> dragStack, MPart part, boolean stackp) {
	MElementContainer<MUIElement> result = null;
	if (dragStack != null) {
		MElementContainer<MUIElement> psash = dragStack.getParent();
		if ((Object)psash instanceof MPartSashContainer) {
			List<MUIElement> children = psash.getChildren();
			int size = children.size(); 
			if (size > 1) {
				int index = children.indexOf(dragStack)+1;
				result = (MElementContainer<MUIElement>)children.get((index == size) ? index - 2 : index);
				if (stackp) {
					result =  findTheStack(result);
				}
			}
		}
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:26,代码来源:E4WindowCmd.java

示例5: getEditArea

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
/**
 * Find the edit area.  
 * 
 * @param w
 * 
 * @return the MArea element containing the editors
 */
protected MUIElement getEditArea(MWindow w) {
	// Seems like we should be able to use modelService.find(ID_EDITOR_AREA, w), but that returns a useless PlaceHolder
	// NB Selectors aren't supported until Luna
	//		final Selector match = new Selector() {
	//			public boolean select(MApplicationElement element) {
	//				return !modelService.findElements((MUIElement)element, null, MPart.class, EDITOR_TAG, EModelService.IN_ANY_PERSPECTIVE).isEmpty();
	//			}
	//		};
	//		List<MArea> area = modelService.findElements(w, MArea.class, EModelService.IN_SHARED_AREA, match);
	List<MArea> area = modelService.findElements(w, null, MArea.class, null, EModelService.IN_SHARED_AREA);
	List<MArea> refined = new ArrayList<MArea>();
	if (area != null) {
		for (MArea m : area) {
			if (!modelService.findElements(m, null, MPart.class, EDITOR_TAG, EModelService.IN_ANY_PERSPECTIVE).isEmpty()) {
				refined.add(m);
			}
		}
	}
	return refined.isEmpty() ? null : refined.get(0);
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:28,代码来源:E4WindowCmd.java

示例6: getAdjacentElement

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
/**
 * @see com.mulgasoft.emacsplus.e4.commands.E4WindowCmd#getAdjacentElement(org.eclipse.e4.ui.model.application.ui.MElementContainer, boolean, org.eclipse.e4.ui.model.application.ui.basic.MPart)
 */
protected MElementContainer<MUIElement> getAdjacentElement(MElementContainer<MUIElement> dragStack, MPart part, boolean stackp) {
	MElementContainer<MUIElement> result = null;
	if (dragStack != null) {
		MElementContainer<MUIElement> psash = dragStack.getParent();
		MElementContainer<MUIElement> top = getTopElement(psash);
		if ((Object)top instanceof MTrimmedWindow) {
			// if we contain splits, remove them first
			if (top != psash) {
				super.joinAll(part);
			}
			Collection<MPart> parts = getParts(application.getChildren().get(0), EModelService.IN_SHARED_AREA);
			for (MPart p : parts) {
				List<MElementContainer<MUIElement>> all = getOrderedStacks(p);
				// if it has a PartStack, it sh/c/ould be an editor stack
				if (!all.isEmpty()) {
					result = all.get(0);
					break;
				};
			};
		}
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:27,代码来源:FrameJoinCmd.java

示例7: doOtherWindow

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@Execute
protected void doOtherWindow(@Active MPart apart, @Named(E4CmdHandler.CMD_CTX_KEY)String cmd, @Active EmacsPlusCmdHandler handler) {
	PartAndStack ps = getParentStack(apart); 
	MElementContainer<MUIElement> otherStack = getAdjacentElement(ps.getStack(), ps.getPart(), true);
	MPart other = (MPart)otherStack.getSelectedElement();
	// TODO An egregious hack that may break at any time
	// Is there a defined way of getting the IEditorPart from an MPart?
	if (other.getObject() instanceof CompatibilityEditor) {
		IEditorPart editor = ((CompatibilityEditor) other.getObject()).getEditor();
		try {
			reactivate(other);
			if (handler.isUniversalPresent()) {
				EmacsPlusUtils.executeCommand(cmd, handler.getUniversalCount(), null, editor);
			} else {
				EmacsPlusUtils.executeCommand(cmd, null, editor);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		finally {
			reactivate(apart);
		}
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:25,代码来源:OtherWindowCmd.java

示例8: saveApp

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
/**
 * Save db settings and browser state to preferences.
 *
 * @param inApplication
 *            {@link MApplication}
 */
@SuppressWarnings("unchecked")
@PreDestroy
void saveApp(final MApplication inApplication,
        final EModelService inModelService) {
	// save browser id
	final MElementContainer<MUIElement> lBrowserStack = (MElementContainer<MUIElement>) inModelService
	        .find(RelationsConstants.PART_STACK_BROWSERS, inApplication);
	final MUIElement lBrowser = lBrowserStack.getSelectedElement();
	preferences.put(RelationsConstants.ACTIVE_BROWSER_ID,
	        lBrowser.getElementId());

	// save browser model
	browserManager.saveState(preferences);
	// flush preferences
	try {
		preferences.flush();
	}
	catch (final BackingStoreException exc) {
		log.error(exc, exc.getMessage());
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:28,代码来源:RelationsLifeCycle.java

示例9: getArea

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
private MArea getArea(MPart containerPart) {
	MUIElement targetParent = containerPart.getParent();
	while (!(targetParent instanceof MArea))
		targetParent = targetParent.getParent();
	MArea area = (MArea) targetParent;
	return area;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:8,代码来源:DwGraphicalFeatureModelEditor.java

示例10: getMatchingChildren

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends MUIElement> List<T> getMatchingChildren(MElementContainer<?> container, Class<T> type) {
	List<T> matchingChildren = new ArrayList<T>();
	
	for (Object child : container.getChildren()) {
		if (type.isInstance(child))
			matchingChildren.add((T) child);
	}		
	
	return matchingChildren;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:E4Util.java

示例11: setWindowSelectedElement

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
/**
 * Recursively sets the active selection to the element until it reaches the 
 * containing window.
 * 
 * @param element the new selected element
 */
public static void setWindowSelectedElement(MUIElement element) {
	MElementContainer<MUIElement> parent = element.getParent();
	parent.setSelectedElement(element);
	if (!((MUIElement) parent instanceof MWindow))
		setWindowSelectedElement(parent);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:E4Util.java

示例12: isSelectedElement

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
/**
 * Recursively checks if the active selection of the parent is the <tt>element</tt>, 
 * until the containing window element is reached. Returns true if the selected
 * element is the parameter in the window and false otherwise.
 *  
 * @param element the model element to check
 * @return true if the model element is the selected element 
 * 			false otherwise
 */
public static boolean isSelectedElement(MUIElement element) {
	MElementContainer<MUIElement> parent = element.getParent();
	if (parent.getSelectedElement() == element) {
		if (!((MUIElement) parent instanceof MWindow))
			return isSelectedElement(parent);
		else
			return true;
	}	
	
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:E4Util.java

示例13: getRenderer

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@Override
public AbstractPartRenderer getRenderer(final MUIElement uiElement, final Object parent) {
	if (uiElement instanceof MPart) {
		if (partRenderer == null) {
			partRenderer = new SwtToJoPartRenderer();
			super.initRenderer(partRenderer);
		}
		return partRenderer;
	}
	return super.getRenderer(uiElement, parent);
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:12,代码来源:SwtToJoRendererFactory.java

示例14: createWidget

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@Override
public Object createWidget(final MUIElement element, final Object parent) {
	if (!(element instanceof MPart) || !(parent instanceof Composite)) {
		return null;
	}

	final Composite parentComposite = (Composite) parent;
	final MPart part = (MPart) element;

	//Create a part composite that is also a IProvider<IComposite>
	//Unfortunately an IComposite can not be implemented by ContributedPartComposite because of some method naming clashes
	//Unfortunately an IComposite can not be returned because some the super renderer and the StackPartRenderer assumes that
	//SWT Controls will be created
	final ContributedPartComposite result = new ContributedPartComposite(part, parentComposite, SWT.NONE);
	final IComposite joComposite = SwtToJoWrapper.create(result);
	result.setJoComposite(joComposite);

	//bind the widget
	bindWidget(element, result);

	// Create a context for this part
	final IEclipseContext context = part.getContext();
	context.set(IProvider.class.getName(), result);

	//Register at the contribution factory
	final IContributionFactory contributionFactory = (IContributionFactory) context.get(IContributionFactory.class.getName());
	final Object newPart = contributionFactory.create(part.getContributionURI(), context);
	part.setObject(newPart);

	return result;
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:32,代码来源:SwtToJoPartRenderer.java

示例15: getOppositePart

import org.eclipse.e4.ui.model.application.ui.MUIElement; //导入依赖的package包/类
@Override
public MPart getOppositePart(MPart activePart) {
    MPart visiblePart = null;

    if (activePart != null) {
        // find opposite panel
        String oppositePanelId = getPanelId(activePart, PartCopyType.COPY);
        MUIElement oppositePanel = modelService.find(oppositePanelId, application);

        if (oppositePanel instanceof MPartStack) {
            for (MStackElement elem : ((MPartStack) oppositePanel).getChildren()) {
                if (elem instanceof MPart) {
                    MPart part = (MPart) elem;

                    // get opposite visible part
                    if (partService.isPartVisible(part)) {
                        visiblePart = part;

                        if (log.isDebugEnabled()) {
                            log.debug("tab number {} - oposite tab number {}", //$NON-NLS-1$
                                    tabService.getTabId(activePart), tabService.getTabId(visiblePart));
                        }
                        break;
                    }
                }
            }
        }
    }
    return visiblePart;
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:31,代码来源:PartServiceImpl.java


注:本文中的org.eclipse.e4.ui.model.application.ui.MUIElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。