• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MElementContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: switchTo

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例2: execute

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例3: getAdjacentElement

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例4: getAdjacentElement

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例5: doOtherWindow

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例6: saveApp

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例7: getMatchingChildren

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例8: setWindowSelectedElement

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例9: isSelectedElement

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的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


示例10: grid

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
static void grid(final MPartStack displayStack, final List<MPlaceholder> holders) {
	final MElementContainer currentSash = displayStack.getParent();
	final int size = holders.size();
	final List<MElementContainer> containers = new ArrayList<>();
	createContainers(currentSash, containers, size, true);
	for (int i = 0; i < holders.size(); i++) {
		associate(containers.get(i), holders.get(i), false);
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:10,代码来源:ArrangeDisplayViews.java


示例11: horizontalOrVertical

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
static void horizontalOrVertical(final MPartStack displayStack, final List<MPlaceholder> holders,
		final boolean horizontal) {
	final MElementContainer rootSash = displayStack.getParent();
	((MPartSashContainer) rootSash).setHorizontal(horizontal);
	for (int i = 0; i < holders.size(); i++) {
		associate(createContainer(rootSash), holders.get(i), false);
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:9,代码来源:ArrangeDisplayViews.java


示例12: createContainers

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
private static void createContainers(final MElementContainer root, final List<MElementContainer> containers,
		final int size, final boolean horizontal) {
	((MPartSashContainer) root).setHorizontal(horizontal);
	if (size == 0)
		return;
	else if (size == 1) {
		final MElementContainer container = createContainer(root);
		containers.add(container);
	} else {
		final int half = size / 2;
		createContainers(createSash(root), containers, half, !horizontal);
		createContainers(createSash(root), containers, size - half, !horizontal);
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:15,代码来源:ArrangeDisplayViews.java


示例13: createSash

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
static MPartSashContainer createSash(final MElementContainer root) {
	final MPartSashContainer sash = modelService.createModelElement(MPartSashContainer.class);
	sash.getTransientData().put("Dynamic", true);
	sash.setContainerData("5000");
	root.getChildren().add(sash);
	return sash;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:8,代码来源:ArrangeDisplayViews.java


示例14: createStack

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
static MPartStack createStack(final MElementContainer root) {
	final MPartStack stack = modelService.createModelElement(MPartStack.class);
	stack.getTransientData().put("Dynamic", true);
	stack.setContainerData("5000");
	root.getChildren().add(stack);
	return stack;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:8,代码来源:ArrangeDisplayViews.java


示例15: execute

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
@Execute
public void execute(EModelService modelService, MWindow window, EPartService partService) {

	// get active perpective and find stored snippet of this perspective
	MPerspective activePerspective = modelService.getActivePerspective(window);
	MUIElement perspectiveSnippet = modelService.cloneSnippet(window, activePerspective.getElementId(), window);

	// remove existing active perspective
	MElementContainer<MUIElement> parent = activePerspective.getParent();
	modelService.removePerspectiveModel(activePerspective, window);

	// add stored perspective snippet and switch to it
	parent.getChildren().add(perspectiveSnippet);
	partService.switchPerspective((MPerspective) perspectiveSnippet);
}
 
开发者ID:vogellacompany,项目名称:codeexamples-eclipse,代码行数:16,代码来源:RestorePerspectiveHandler.java


示例16: getOrderedStacks

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
/**
 * Get the ordered list of stacks
 * @param apart
 * @return a list of MElementContainer<MUIElement> representing all the PartStacks
 */
protected List<MElementContainer<MUIElement>> getOrderedStacks(MPart apart) {
	List<MElementContainer<MUIElement>> result = new ArrayList<MElementContainer<MUIElement>>();
	MElementContainer<MUIElement> parent = getTopElement(apart.getParent());
	if (parent != null) {
		result = getStacks(result, parent);
	} 
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:14,代码来源:E4WindowCmd.java


示例17: getStacks

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
private List<MElementContainer<MUIElement>> getStacks(List<MElementContainer<MUIElement>> result, MElementContainer<MUIElement> container) {
	for (MUIElement child : container.getChildren()) {
		@SuppressWarnings("unchecked") // We type check all the way down
		MElementContainer<MUIElement> c = (MElementContainer<MUIElement>)child;
		if (child instanceof MPartStack) {
			result.add(c);
		} else {
			getStacks(result,c);
		}
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:13,代码来源:E4WindowCmd.java


示例18: findTheStack

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
/**
 * If parent is a sash, keep looking until we find a PartStack
 * 
 * @param parent a sash of PartStack
 * @return the first PartStack we find
 */
@SuppressWarnings("unchecked")  // for safe cast to MElementContainer<MUIElement>
private MElementContainer<MUIElement> findTheStack(MElementContainer<MUIElement> parent) {
	MElementContainer<MUIElement> result = parent;
	if ((MPartSashContainerElement)parent instanceof MPartSashContainer) {
		List<MUIElement> children = parent.getChildren();
		result = findTheStack((MElementContainer<MUIElement>)children.get(0));
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:16,代码来源:E4WindowCmd.java


示例19: findNextStack

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
/**
 * Rotate through stacks by <count> elements
 *  
 * @param part the source part
 * @param stack the source stack
 * @param count the number to rotate by
 * @return the destination stack
 */
protected MElementContainer<MUIElement> findNextStack(MPart part, MElementContainer<MUIElement> stack, int count) {
	MElementContainer<MUIElement> nstack = null;		
	List<MElementContainer<MUIElement>> stacks = getOrderedStacks(part);		
	int size = stacks.size();
	if (size > 1) {
		int index = stacks.indexOf(stack) + (count % size);
		nstack = (index < 0) ? stacks.get(size + index) : (index < size) ? stacks.get(index) : stacks.get(index - size); 
	}
	return nstack;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:19,代码来源:E4WindowCmd.java


示例20: getTopElement

import org.eclipse.e4.ui.model.application.ui.MElementContainer; //导入依赖的package包/类
/**
 * @param ele start from here
 * @return the most distant parent for the editor area
 */
protected MElementContainer<MUIElement> getTopElement(MElementContainer<MUIElement> ele) {
	MElementContainer<MUIElement> parent = ele;
	// get the outer container
	if (parent != null) {
		while (!((Object)parent instanceof MArea) && parent.getParent() != null) {
				parent = parent.getParent();
		}
	}
	return parent;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:15,代码来源:E4WindowCmd.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BucketTaggingConfiguration类代码示例发布时间:2022-05-23
下一篇:
Java NormalizedNode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap