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


Java EModelService类代码示例

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


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

示例1: createControls

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
@PostConstruct
public void createControls(
		IEclipseContext context, 
		@Preference(nodePath = TermSuiteUI.PLUGIN_ID, value = TermSuiteUIPreferences.WRAP_TEXT) boolean wrap,
		final Composite parent, 
		MPart part,
		ILoggerProvider loggerProvider,
		EModelService modelService) {
	this.logger = loggerProvider.getClassLogger(this.getClass());

	parent.setLayout(new FillLayout());
	text = new StyledText(parent, getTheStyle(wrap, false));
	
	MToolItem wrapButton = (MToolItem)modelService.find(TOOL_ITEM_WRAP_TEXT, part.getToolbar());
	wrapButton.setSelected(wrap);
	
	text.addLineStyleListener(lineStyleListener);
	text.addLineBackgroundListener(lineBackgroundListener);
	text.setWrapIndent(20);
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:21,代码来源:FileEditorPart.java

示例2: insertEditor

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
public void insertEditor(float ratio, int where, MPart containerEditor, MPart editorToInsert) {
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

	EModelService service = window.getService(EModelService.class);
	

	if(secondEditor == null){
		secondEditor = getPartStack(editorToInsert);

		MArea area = getArea(containerEditor);

		MPartSashContainerElement relToElement = area.getChildren().get(0);
		service.insert(secondEditor, relToElement, where, ratio);
	}else{
		if(secondEditor.getChildren().isEmpty()){
			//secondEditor.getParent().getChildren().remove(secondEditor);
			secondEditor = null;
			
			insertEditor(ratio, where, containerEditor, editorToInsert);
		}else{
			secondEditor.getChildren().add(editorToInsert);	
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:25,代码来源:DwGraphicalFeatureModelEditor.java

示例3: createPartControl

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
@PostConstruct
public void createPartControl(Composite parent, EMenuService menuService, Shell shell, EPartService partService, EModelService modelService, MApplication application) {
	// Treeviewer
	this.viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	menuService.registerContextMenu(this.viewer.getControl(),
			"ch.droptilllate.application.popupmenu.table");		
	
	
	this.shell = shell;
	this.parent = parent;
	this.controller = ViewController.getInstance();
	this.controller.initViewController(this.viewer, shell, partService, modelService, application);
	addListeners();
	addCloseListener(parent);
	
}
 
开发者ID:dev131,项目名称:DropTillLate_Application,代码行数:17,代码来源:TreeView.java

示例4: initViewController

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
public void initViewController(TreeViewer viewer, Shell shell, EPartService partService, EModelService modelService, MApplication application) {
	// Treeviewer
	this.viewer = viewer;
	this.shell = shell;
	this.partService = partService;
	this.modelService = modelService;
	this.application = application;
	// Set ContentProvider and Labels
	viewer.setContentProvider(new DropTillLateContentProvider());
	viewer.setLabelProvider(new DropTillLateLabelProvider());
	// Expand the tree
	viewer.setAutoExpandLevel(2);
	// Change TreeTable
	tree = viewer.getTree();
	// Tree table specific code starts fill labels
	tree.setHeaderVisible(true);
	tree.setLinesVisible(true);
	for (TableIdentifier identifier : TableIdentifier.values()) {
		new TreeColumn(tree, SWT.NONE).setText(Messages
				.getTableColumnTitle(identifier));
		tree.getColumn(identifier.ordinal()).setWidth(
				identifier.columnWidth);
	}
	
}
 
开发者ID:dev131,项目名称:DropTillLate_Application,代码行数:26,代码来源:ViewController.java

示例5: execute

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
@Execute
public void execute(MWindow window, EPartService partService,
		EModelService modelService) {
	// assumes you have only two perspectives
	List<MPerspective> perspectives = modelService.findElements(window,
			null, MPerspective.class, null);
	if (perspectives.size() != 2) {
		System.out.println("works only for exactly two perspectives");
	}
	
	MPerspective activePerspective = modelService
			.getActivePerspective(window);
	if (activePerspective.equals(perspectives.get(0))) {
		partService.switchPerspective(perspectives.get(1));
	} else {
		partService.switchPerspective(perspectives.get(0));
	}
}
 
开发者ID:scela,项目名称:EclipseCon2014,代码行数:19,代码来源:SwitchPerspectiveHandler.java

示例6: getOpenedEditors

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
public static HashSet<MPart> getOpenedEditors(){
	
	EModelService modelService = CloudscaleContext.getGlobalContext().get(EModelService.class);
	MApplication app = CloudscaleContext.getGlobalContext().get(MApplication.class);

	if(modelService == null){
		throw new IllegalSelectorException();
	}
	if(app == null){
		throw new IllegalSelectorException();
	}
	
	HashSet<MPart> out = new HashSet<MPart>();
	MPartStack stack = (MPartStack)modelService.find("org.eclipse.e4.primaryDataStack", app);
	
	for(MStackElement el : stack.getChildren()){
		if(el instanceof MPart){
			MPart part = (MPart)el;
			if(part.getContext() != null){
				out.add(part);
			}
		}
	}
	return out;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:26,代码来源:ExplorerUtils.java

示例7: linkWithEditor

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
@Inject
@Optional
private void linkWithEditor(MApplication application, 
							EModelService modelService, 
							@Named(IExplorerConstants.LINK_WITH_EDITOR) Boolean enable,
							@Active MPart part){
	
	this.linkWithEditor = enable;
	if(enable){
		ExplorerEditorNode node = part.getContext().get(ExplorerEditorNode.class);
		if(node != null){
			if(treeViewer != null && !treeViewer.getTree().isDisposed()){
				treeViewer.setSelection(new StructuredSelection(node), true);
			}
		}
	}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:ExplorerViewPart.java

示例8: selectedElement

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
@Inject
@Optional
public void selectedElement(@EventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) Event event, EModelService modelService) {
	if (!UIEvents.isSET(event)) {
		return;
	}

	Object newlySelectedPerspective = event.getProperty(EventTags.NEW_VALUE);
	if (newlySelectedPerspective instanceof MPerspective) {
		MPerspective perspectiveToBeCloned = (MPerspective) newlySelectedPerspective;

		MWindow topLevelWindow = modelService.getTopLevelWindowFor(perspectiveToBeCloned);
		
		// try to find already existing snippet
		if (null == modelService.findSnippet(topLevelWindow, perspectiveToBeCloned.getElementId())) {
			// clone perspective in case there is no snippet yet
			modelService.cloneElement(perspectiveToBeCloned, topLevelWindow);
		}
	}
}
 
开发者ID:vogellacompany,项目名称:codeexamples-eclipse,代码行数:21,代码来源:InitialPerspectiveStorageAddon.java

示例9: getEditArea

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的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

示例10: getDetachedFrames

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
/**
 * Get the list of detached windows, if any
 * 
 * NB: The docs don't guarantee a non-null return, but the implementation seems to
 * Nor do they guarantee an order, but the implementation currently returns the same order
 * @return the list of detached windows 
 */
List<MTrimmedWindow> getDetachedFrames() {
	final MWindow topWindow = application.getChildren().get(0); 
	// NB Selectors aren't supported until Luna
	//		final Selector match = new Selector() {
	//			public boolean select(MApplicationElement element) {
	//				boolean result = element != topWindow && ((MTrimmedWindow)element).isToBeRendered();
	//				return result && !modelService.findElements((MUIElement)element, null, MPart.class, EDITOR_TAG, EModelService.IN_ANY_PERSPECTIVE).isEmpty();
	//			}
	//		};
	//		List<MTrimmedWindow> mts = modelService.findElements(topWindow, MTrimmedWindow.class, EModelService.IN_ANY_PERSPECTIVE, match); 
	// get the all detached editor trimmed windows
	// the implementation searches all detached windows in this case
	List<MTrimmedWindow> mts = modelService.findElements(topWindow, null, MTrimmedWindow.class, null, EModelService.IN_ANY_PERSPECTIVE); 
	List<MTrimmedWindow> refined = new ArrayList<MTrimmedWindow>();
	for (MTrimmedWindow mt : mts) {
		if (mt != topWindow && mt.isToBeRendered() && !modelService.findElements(mt, null, MPart.class, EDITOR_TAG, EModelService.IN_ANY_PERSPECTIVE).isEmpty()) {
			refined.add(mt);
		}
	}
	return refined; 
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:29,代码来源:E4WindowCmd.java

示例11: getAdjacentElement

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的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

示例12: ContributionItemsFactory

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
ContributionItemsFactory(final MApplication inApplication,
        final EModelService inModelService,
        final EBindingService inBindingService) {
	items = new ArrayList<StyleContributionItem>();

	final IEclipseContext lContext = inApplication.getContext();
	final CommandManager lCommandManager = lContext
	        .get(CommandManager.class);
	final ISWTResourceUtilities lResourceUtility = (ISWTResourceUtilities) lContext
	        .get(IResourceUtilities.class.getName());
	final EHandlerService lHandlerService = lContext
	        .get(EHandlerService.class);

	final MToolBar lToolbar = (MToolBar) inModelService
	        .find(MUI_ID_STYLING_TOOLBAR, inApplication);
	for (final MToolBarElement lElement : lToolbar.getChildren()) {
		if (lElement instanceof MHandledToolItem) {
			final StyleContributionItem lItem = new StyleContributionItem(
			        (MHandledToolItem) lElement, lResourceUtility,
			        inBindingService, lCommandManager, lHandlerService);
			ContextInjectionFactory.inject(lItem, lContext);
			items.add(lItem);
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:26,代码来源:AbstractEditForm.java

示例13: saveApp

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的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

示例14: activate

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
@Execute
void activate(final EPartService inPartService,
        final EModelService inModelService, final MApplication inApplication) {
	// get browser stack
	final MPartStack lStack = (MPartStack) inModelService.find(
	        RelationsConstants.PART_STACK_BROWSERS, inApplication);
	final Iterator<MStackElement> lParts = lStack.getChildren().iterator();
	// iterate over children
	while (lParts.hasNext()) {
		final MStackElement lElement = lParts.next();
		if (lElement instanceof MPart) {
			final MPart lPart = (MPart) lElement;
			// activate visible
			if (inPartService.isPartVisible(lPart)) {
				inPartService.activate(lPart, true);
				break;
			}
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:21,代码来源:ActivateViewBrowsers.java

示例15: execute

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入依赖的package包/类
/**
 * Style handler executor method to apply the selected style on the text in
 * the widget.
 *
 * @param inApplyStyleFlag
 *            String "true" to apply the selected style, "false" to remove
 *            it. A value <code>null</code> signals the active styled text
 *            widget is in the inspector view.
 * @param inApplication
 *            {@link MApplication}
 * @param inModel
 *            {@link EModelService}
 */
@Execute
public void execute(
        @Optional @Named(RelationsConstants.PN_COMMAND_STYLE_SELECTION) final String inApplyStyleFlag,
        final MApplication inApplication, final EModelService inModel) {
	boolean lApply = true;
	if (inApplyStyleFlag == null) {
		// inspector
		lApply = getStyleApplyForInspector(inApplication, inModel);
	} else {
		// form
		lApply = Boolean.parseBoolean(inApplyStyleFlag);
	}
	eventBroker.post(RelationsConstants.TOPIC_STYLE_CHANGE_FORM,
	        Styles.createStyleEvent(getStyle(), inApplyStyleFlag != null,
	                lApply));
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:30,代码来源:AbstractStyleHandler.java


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