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

Java MPerspective类代码示例

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

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



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

示例1: getText

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Override
public final String getText(Object element) {
	String label = translationService.translate("unknown", 
			"platform:/plugin/" + E4PerspectiveSwitcherActivator.PLUGIN_ID); //$NON-NLS-1$ 
	
	if (element instanceof MPerspective) {
		MPerspective perspective = (MPerspective) element;
		String _lbl = perspective.getLocalizedLabel();
		
		if (_lbl != null && !_lbl.equals(""))
			label = _lbl;			
		
		if (markActive && E4Util.isSelectedElement(perspective)) {
			label = label + "\t(" + translationService.translate("active", 
					"platform:/plugin/" + E4PerspectiveSwitcherActivator.PLUGIN_ID) + ")"; //$NON-NLS-1$
		}
	}
	return label;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:20,代码来源:PerspectiveLabelProvider.java


示例2: handleEvent

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


示例3: removePerspectiveShortcut

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Override
public void removePerspectiveShortcut(MPerspective perspective) {
	ToolItem item = getToolItemFor(perspective);
	if (item == null || item.isDisposed())
		return;

	Image icon = item.getImage();
	if (icon != null) {
		item.setImage(null);
		icon.dispose();
		icon = null;
	}

	item.dispose();

	// update the layout

}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:PerspectiveSwitcherSwtTrim.java


示例4: setShowText

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Inject
void setShowText(
		@Preference(value = E4PerspectiveSwitcherPreferences.SHOW_TEXT, nodePath = E4PerspectiveSwitcherPreferences.ROOT_PREFERENCES_NODE) boolean showShortcutText) {
	this.showShortcutText = showShortcutText;

	if (toolBar == null || toolBar.isDisposed())
		return;

	for (ToolItem item : toolBar.getItems()) {
		if (!(item.getData() instanceof MPerspective))
			continue;

		MPerspective perspective = (MPerspective) item.getData();
		if (item.getImage() == null || this.showShortcutText) {
			String label = perspective.getLocalizedLabel();
			item.setText(label != null ? label : _null);
			item.setToolTipText(perspective.getLocalizedTooltip());
		} else {
			item.setText(_null);
			item.setToolTipText(perspective.getLocalizedLabel());
		}
	}

	// update the layout

}
 
开发者ID:cplutte,项目名称:bts,代码行数:27,代码来源:PerspectiveSwitcherSwtTrim.java


示例5: subscribeTopicSelectedElement

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Inject
@Optional
public void subscribeTopicSelectedElement(
		@UIEventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) Event event,
		MApplication application) {
	
	Object newValue = event.getProperty(EventTags.NEW_VALUE);
	if (newValue instanceof MPerspective) {
		boolean isPerspectiveOne = ((MPerspective) newValue).getElementId().equals(PERSPECTIVE_ONE);
		
		MTrimBar top = (MTrimBar) modelService.find("org.eclipse.ui.trimbar.top", application.getChildren().get(0));
		
		for (MTrimElement item : top.getChildren()) {
			if ((isPerspectiveOne && item.getElementId().equals(SECOND_TOOLBAR))
					|| !isPerspectiveOne && item.getElementId().equals(FIRST_TOOLBAR)) {
				item.setVisible(false);
			}
			else if ((!isPerspectiveOne && item.getElementId().equals(SECOND_TOOLBAR))
					|| isPerspectiveOne && item.getElementId().equals(FIRST_TOOLBAR)) {
				item.setVisible(true);
			}
		}
	}
}
 
开发者ID:fipro78,项目名称:e4-cookbook-migration-guide,代码行数:25,代码来源:PerspectiveSwitcherAddon.java


示例6: createGui

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@PostConstruct
  public void createGui(Composite parent, MApplication app, MWindow window) {
  	
List<MPerspectiveStack> psList = modelService.findElements(window, null,
		MPerspectiveStack.class, null);
if (psList.size() > 0) {
	System.out.println(psList.get(0).getChildren().size());
}

      List<MPerspective> perspectives = 
          modelService.findElements(app, null, MPerspective.class, null);

      for (final MPerspective perspective : perspectives) {
          Button button = new Button(parent, SWT.PUSH);
          button.setText(perspective.getLabel());
          button.addSelectionListener(new SelectionAdapter() {
		
              @Override
              public void widgetSelected(SelectionEvent e) {
                  partService.switchPerspective(perspective);
              }
          });
      }
  }
 
开发者ID:fipro78,项目名称:e4-cookbook-migration-guide,代码行数:25,代码来源:PerspectiveSwitcher.java


示例7: execute

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


示例8: selectedElement

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

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


示例10: createFastViewToolControl

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


示例11: savePerspectiveToRegistryLegacy

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@SuppressWarnings("restriction")
private IPerspectiveDescriptor savePerspectiveToRegistryLegacy(MPerspective perspective){
	IPerspectiveRegistry perspectiveRegistry =
		(PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
	IPerspectiveDescriptor pd =
		perspectiveRegistry.findPerspectiveWithId(perspective.getElementId());
	if (pd == null) {
		((PerspectiveRegistry) perspectiveRegistry).addPerspective(perspective);
		pd = perspectiveRegistry.findPerspectiveWithId(perspective.getElementId());
	} else {
		LoggerFactory.getLogger(PerspektiveImportHandler.class)
			.error("perspective descriptor already exists for perspective id: "
			+ perspective.getElementId());
	}
	
	return pd;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:18,代码来源:PerspektiveImportHandler.java


示例12: isPerspectiveInsideStack

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
private int isPerspectiveInsideStack(IPerspectiveDescriptor pd){
	int idx = -1;
	if (pd != null) {
		List<MPerspective> perspectivesInStack;
		MPerspectiveStack mPerspectiveStack = getPerspectiveStack();
		perspectivesInStack = mPerspectiveStack.getChildren();
		
		for (MPerspective perspectiveInStack : perspectivesInStack) {
			if (pd.getId().equals(perspectiveInStack.getElementId())) {
				idx++;
				break;
			}
		}
	}
	return idx;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:17,代码来源:PerspectiveImportService.java


示例13: getImage

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Override
public final Image getImage(Object element) {
	Image icon = null;
	
	if (element instanceof MPerspective) {
		MPerspective perspective = (MPerspective) element;
		
		String _uri = perspective.getIconURI();
		ImageDescriptor descriptor = null;
		
		try {
			URI iconURI = URI.createURI(_uri);
			descriptor = (ImageDescriptor) resourceUtilities.imageDescriptorFromURI(iconURI);
		} catch (RuntimeException ex) {
			logger.error("PerspectiveLabelProvider: uri=" + _uri);
		}
		
		if (descriptor != null) {
			icon = imageCache.get(descriptor);
			
			if (icon == null) {
				icon = descriptor.createImage();
				imageCache.put(descriptor, icon);
			}
		}
	}
	
	return icon;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:30,代码来源:PerspectiveLabelProvider.java


示例14: getElements

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Override
  public Object[] getElements(Object element) {
List<MPerspective> perspectives = new ArrayList<MPerspective>(5);

if (element instanceof MWindow)
	addElementsFrom((MWindow) element, perspectives);				

      return perspectives.toArray();
  }
 
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:PerspectiveContentProvider.java


示例15: addElementsFrom

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
private void addElementsFrom(MWindow window, List<MPerspective> perspectives) {
List<MWindowElement> windowElements = window.getChildren();
for (Iterator<MWindowElement> i = windowElements.iterator(); i.hasNext();) {
	MWindowElement _elm = i.next();

	if (_elm instanceof MPerspectiveStack)
		perspectives.addAll(((MPerspectiveStack) _elm).getChildren());
	else if (_elm instanceof MPartSashContainer)
		addChildPerspectives((MPartSashContainer) _elm, perspectives);
}
  }
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:PerspectiveContentProvider.java


示例16: addChildPerspectives

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
private void addChildPerspectives(MPartSashContainer partContainer, List<MPerspective> perspectives) {
List<MPartSashContainerElement> containerElements = partContainer.getChildren();
for (Iterator<MPartSashContainerElement> i = containerElements.iterator(); i.hasNext();) {
	MPartSashContainerElement _elm = i.next();
	
	if (_elm instanceof MPartSashContainer)
		addChildPerspectives((MPartSashContainer) _elm, perspectives);
	if (_elm instanceof MPerspectiveStack)
		perspectives.addAll(((MPerspectiveStack) _elm).getChildren());
}   	
  }
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:PerspectiveContentProvider.java


示例17: updateSelection

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
/**
 * Update the selection object.
 */
protected void updateSelection(SelectionChangedEvent event) {
    selection = null;
    IStructuredSelection _sel = (IStructuredSelection) event.getSelection();
    if (!_sel.isEmpty()) {
        Object obj = _sel.getFirstElement();
        if (obj instanceof MPerspective)
selection = obj;
    }
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:SelectPerspectiveDialog.java


示例18: okPressed

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
@Override
  protected void okPressed() {
  	HashMap<String,Object> parameters = new HashMap<String,Object>(2);
  	parameters.put(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_ID, 
  			((MPerspective) selection).getElementId());
  	parameters.put(E4WorkbenchParameterConstants.COMMAND_PERSPECTIVE_NEW_WINDOW,
  			"false");
  	
ParameterizedCommand command = commandService
		.createCommand(E4WorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, parameters);
handlerService.executeHandler(command);
super.okPressed();
  }
 
开发者ID:cplutte,项目名称:bts,代码行数:14,代码来源:SelectPerspectiveDialog.java


示例19: openNewWindowPerspective

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
/**
 * Opens the specified perspective in a new window.
 * 
 * @param perspectiveId
 *            The perspective to open; must not be <code>null</code>
 * @throws ExecutionException
 *             If the perspective could not be opened.
 */
private void openNewWindowPerspective(IEclipseContext context, String perspectiveID) {
	MApplication application = context.get(MApplication.class);
	EPartService partService = context.get(EPartService.class);
	EModelService modelService = context.get(EModelService.class);
	
	List<MPerspective> perspectives = modelService.findElements(application, perspectiveID, MPerspective.class, null);
	partService.switchPerspective(perspectives.get(0));
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:ShowPerspectiveHandler.java


示例20: openPerspective

import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; //导入依赖的package包/类
/**
 * Opens the perspective with the given identifier.
 * 
 * @param perspectiveId
 *            The perspective to open; must not be <code>null</code>
 * @throws ExecutionException
 *             If the perspective could not be opened.
 */
private final void openPerspective(IEclipseContext context, String perspectiveID) {
	MApplication application = context.get(MApplication.class);
	EPartService partService = context.get(EPartService.class);
	EModelService modelService = context.get(EModelService.class);
	
	List<MPerspective> perspectives = modelService.findElements(application, perspectiveID, MPerspective.class, null);
	partService.switchPerspective(perspectives.get(0));
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:ShowPerspectiveHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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