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


Java EModelService.createModelElement方法代码示例

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


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

示例1: execute

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
@Execute
public void execute(EModelService modelService, MApplication application) {
	// create a new window and set its size
	MWindow window = modelService.createModelElement(MWindow.class);
	window.setX(1025);
	window.setY(550);
	window.setWidth(400);
	window.setHeight(200);
	
	// need the contributor URI so the translation service is able to retrieve 
	// the translations
	window.setContributorURI("platform:/plugin/org.fipro.e4.translation");
	window.setLabel("%application");

	// add new Window to the application
	application.getChildren().add(window); 	
}
 
开发者ID:fipro78,项目名称:e4translationexample,代码行数:18,代码来源:WindowAddHandler.java

示例2: createFastViewStack

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
private static MPartStack createFastViewStack(MTrimmedWindow window, MPerspective mPerspective,
	EModelService eModelService){
	
	if (window != null && mPerspective != null) {
		MPartStack mPartStack = eModelService.createModelElement(MPartStack.class);
		mPartStack.setElementId(ELEXIS_FASTVIEW_STACK);
		mPartStack.setToBeRendered(true);
		mPartStack.getTags().add("Minimized");
		mPartStack.setOnTop(false);
		mPartStack.setVisible(false);
		mPartStack.getTags().add("NoAutoCollapse");
		mPartStack.getTags().add("active");
		mPerspective.getChildren().add(0, mPartStack);
		return mPartStack;
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:18,代码来源:ElexisFastViewUtil.java

示例3: createFastViewToolControl

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
private static MToolControl createFastViewToolControl(MTrimmedWindow window,
	MPerspective mPerspective, EModelService eModelService, MTrimBar mTrimBar){
	if (mTrimBar != null) {
		MToolControl mToolControl = eModelService.createModelElement(MToolControl.class);
		mToolControl.setElementId(getToolControlId(window, mPerspective));
		mToolControl.setContributionURI(
			"bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.minmax.TrimStack");
		mToolControl.setToBeRendered(true);
		mToolControl.setVisible(true);
		mToolControl.getTags().add("TrimStack");
		mToolControl.getPersistedState().put("YSize", "600");
		mTrimBar.getChildren().add(0, mToolControl);
		mTrimBar.setVisible(true);
		mTrimBar.setToBeRendered(true);
		
		return mToolControl;
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:20,代码来源:ElexisFastViewUtil.java

示例4: createDynamicPart

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
/**
 * Allow to avoid using of EPartService, because it is not working in life
 * cycle manager.
 * 
 * @param modelService
 *            using for creating part descriptor and new empty part.
 * @return MPart created on part descriptor. There are no menus, handlers
 *         and toolbar.
 */
@Inject
private MPart createDynamicPart(EModelService modelService) {
    MPartDescriptor descriptor = modelService.getPartDescriptor(IdStorage.DYNAMIC_PART_DESCRIPTOR_ID);
    if (descriptor == null) {
        return null;
    }
    MPart part = modelService.createModelElement(MPart.class);
    part.setElementId(descriptor.getElementId());

    // part.getMenus().addAll(EcoreUtil.copyAll(descriptor.getMenus()));
    // if (descriptor.getToolbar() != null) {
    // part.setToolbar((MToolBar) EcoreUtil.copy((EObject)
    // descriptor.getToolbar()));
    // }
    if (log.isDebugEnabled()) {
        log.debug("ContributorURI: " + descriptor.getContributorURI()); //$NON-NLS-1$
    }
    part.setContributorURI(descriptor.getContributorURI());
    part.setCloseable(descriptor.isCloseable());
    if (log.isDebugEnabled()) {
        log.debug("ContributionURI: " + descriptor.getContributionURI());
    }
    part.setContributionURI(descriptor.getContributionURI());
    part.setLabel(descriptor.getLabel());
    part.setIconURI(descriptor.getIconURI());
    part.setTooltip(descriptor.getTooltip());

    // part.getHandlers().addAll(EcoreUtil.copyAll(descriptor.getHandlers()));

    part.getTags().addAll(descriptor.getTags());

    // TODO set if property
    part.getPersistedState().putAll(descriptor.getPersistedState());
    part.getBindingContexts().addAll(descriptor.getBindingContexts());
    return part;
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:46,代码来源:PartServiceImpl.java

示例5: addMandantSelectionItem

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
private void addMandantSelectionItem(MApplication mApplication, EModelService eModelService){
	
	MTrimBar trimbar =
		(MTrimBar) eModelService.find("org.eclipse.ui.main.toolbar", mApplication);
	
	if (trimbar != null) {
		MTrimElement mTrimElement = null;
		int position = 0;
		int i = 0;
		List<MTrimElement> childrens = trimbar.getChildren();
		for (MTrimElement element : childrens) {
			
			if ("ch.elexis.core.ui.toolcontrol.mandantselection"
				.equals(element.getElementId())) {
				mTrimElement = element;
			}
			
			if (position == 0 && ("ch.elexis.toolbar1".equals(element.getElementId())
				|| "PerspectiveSpacer".equals(element.getElementId()))) {
				position = i;
			}
			i++;
		}
		
		if (mTrimElement == null) {
			MToolControl mToolControl = eModelService.createModelElement(MToolControl.class);
			mToolControl.setElementId("ch.elexis.core.ui.toolcontrol.mandantselection");
			mToolControl.setContributionURI(
				"bundleclass://ch.elexis.core.ui/ch.elexis.core.ui.coolbar.MandantSelectionContributionItem");
			mToolControl.setToBeRendered(true);
			mToolControl.setVisible(true);
			
			childrens.add(position, mToolControl);
		}
	}
	
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:38,代码来源:UiStartupHandler.java

示例6: changeFastViewBarFromLeftToBottom

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
/**
 * Changes the fastviews position from left trimbar to bottom trimbar
 */
public static void changeFastViewBarFromLeftToBottom(){
	EModelService eModelService = getService(EModelService.class);
	MApplication mApplication = getService(MApplication.class);
	MTrimmedWindow mWindow = getCurrentWindow(eModelService, mApplication);
	if (mWindow != null) {
		MPerspective mPerspective = eModelService.getActivePerspective(mWindow);
		
		if (mPerspective != null) {
			String perspectiveId = mPerspective.getElementId();
			
			MToolControl mToolControl =
				findFastViewToolControl(eModelService, mWindow, perspectiveId,
					SideValue.BOTTOM);
			if (mToolControl == null) {
				mToolControl = findFastViewToolControl(eModelService, mWindow, perspectiveId,
					SideValue.LEFT);
				if (mToolControl != null) {
					MTrimBar trimBarBottom =
						findTrimBar(eModelService, mWindow, SideValue.BOTTOM);
					if (trimBarBottom != null) {
						MToolControl copyToolcontrol =
							eModelService.createModelElement(MToolControl.class);
						copyToolcontrol.setElementId(mToolControl.getElementId());
						copyToolcontrol.setContributionURI(
							"bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.minmax.TrimStack");
						copyToolcontrol.setToBeRendered(true);
						copyToolcontrol.setVisible(true);
						copyToolcontrol.getTags().add("TrimStack");
						
						copyToolcontrol.getPersistedState().put("YSize", "600");
						trimBarBottom.getChildren().add(0, copyToolcontrol);
						
						mToolControl.setToBeRendered(false);
						mToolControl.setVisible(false);
						mToolControl.getParent().getChildren().remove(mToolControl);
						mToolControl.setParent(null);
						trimBarBottom.setVisible(true);
						trimBarBottom.setToBeRendered(true);
					}
					
				}
			}
			else {
				mToolControl.setToBeRendered(true);
			}
		}
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:52,代码来源:ElexisFastViewUtil.java

示例7: execute

import org.eclipse.e4.ui.workbench.modeling.EModelService; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	try {
		EModelService modelService = getService(EModelService.class);
		FileDialog dialog = new FileDialog(UiDesk.getTopShell(), SWT.OPEN);
		dialog.setFilterNames(new String[] {
			"XMI", "XML (Legacy)"
		});
		dialog.setFilterExtensions(new String[] {
			"*.xmi", "*.xml"
		});
		
		dialog.setFilterPath(CoreHub.getWritableUserDir().getAbsolutePath()); // Windows path
		
		String path = dialog.open();
		if (path != null) {
			IPerspectiveDescriptor createdPd = null;
			if (path.toLowerCase().endsWith("xml")) {
				// legacy
				
				MPerspective mPerspective = modelService.createModelElement(MPerspective.class);
				// the workbench window must be on top - otherwise the exception 'Application does not have an active window' occurs
				PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().open();
				List<String> fastViewIds =
					perspectiveImportService.createPerspectiveFromLegacy(path, mPerspective);
				createdPd = savePerspectiveToRegistryLegacy(mPerspective);
				perspectiveImportService.openPerspective(createdPd);
				switchToPerspectiveLegacy(mPerspective, fastViewIds);
				IWorkbenchPage wp = (IWorkbenchPage) PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getActivePage();
				wp.savePerspectiveAs(createdPd);
				
			} else {
				createdPd = perspectiveImportService.importPerspective(path, null, true);
				
			}
			
			if (createdPd != null) {
				MessageDialog.openInformation(UiDesk.getDisplay().getActiveShell(), "Import",
					"Die Perspektive '" + createdPd.getLabel()
						+ "' wurde erfolgreich importiert.");
			}
		}
	} catch (Exception e) {
		MessageDialog.openError(UiDesk.getDisplay().getActiveShell(), "Import",
			"Diese Perspektive kann nicht importiert werden.");
		LoggerFactory.getLogger(PerspektiveExportHandler.class).error("import error", e);
	}
	
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:52,代码来源:PerspektiveImportHandler.java


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