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


Java IPerspectiveDescriptor类代码示例

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


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

示例1: isPerspectiveShown

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
/**
 * Determines if given perspective is shown
 * 
 * @param id
 * @return true if the perspective with current id is shown, false otherwise
 */
public static boolean isPerspectiveShown(String perspectiveId) {
	if (perspectiveId == null || perspectiveId.equals("")) {
		return false;
	}
	IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
	for (int i = 0; i < workbenchWindows.length; i++) {
		IPerspectiveDescriptor[] openPerspectives = workbenchWindows[i].getActivePage().getOpenPerspectives();
		for (int j = 0; j < openPerspectives.length; j++) {
			if (perspectiveId.equals(openPerspectives[j].getId())) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:22,代码来源:UIHelper.java

示例2: maybeAddNewWizardActionsToWindow

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
/**
 * Adds the new wizards to the current perspective displayed in <code>activeWorkbenchWindow</code>, if they've not
 * been added already. Adds listeners on the window so that the same is done whenever the user switches perspectives
 * in the window.
 *
 * Note: This method can only be called once the workbench has been started.
 */
private void maybeAddNewWizardActionsToWindow(IWorkbenchWindow activeWorkbenchWindow) {
  if (activeWorkbenchWindow == null) {
    return;
  }

  activeWorkbenchWindow.addPerspectiveListener(perspectiveListener);

  WorkbenchPage activePage = (WorkbenchPage) activeWorkbenchWindow.getActivePage();
  if (activePage == null) {
    return;
  }

  IPerspectiveDescriptor perspectiveDesc = activePage.getPerspective();
  maybeAddNewWizardActionsToPerspective(activePage, perspectiveDesc);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:23,代码来源:GdtPlugin.java

示例3: perspectiveChanged

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId)
{
	if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE))
	{
		if (findView(page, OUTLINE_VIEW_ID) == null)
		{
			setCommandState(false);
		}
	}
	else if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW))
	{
		if (findView(page, OUTLINE_VIEW_ID) != null)
		{
			setCommandState(true);
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:18,代码来源:CommonEditorPlugin.java

示例4: replaceCurrentPerspective

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
private static void replaceCurrentPerspective(IPerspectiveDescriptor persp) {

		// Get the active page.
		IWorkbenchWindow window = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow();
		if (window == null) {
			return;
		}
		IWorkbenchPage page = window.getActivePage();
		if (page == null) {
			return;
		}

		// Set the perspective.
		page.setPerspective(persp);
	}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:EnsembleBasicNewProjectResourceWizard.java

示例5: addPerspectiveAndDescendants

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
/**
 * Adds to the list all perspective IDs in the Workbench who's original ID
 * matches the given ID.
 * 
 * @param perspectiveIds
 *            the list of perspective IDs to supplement.
 * @param id
 *            the id to query.
 * @since 3.0
 */
@SuppressWarnings({ "unchecked" })
private static void addPerspectiveAndDescendants(List perspectiveIds,
		String id) {
	IPerspectiveRegistry registry = PlatformUI.getWorkbench()
			.getPerspectiveRegistry();
	IPerspectiveDescriptor[] perspectives = registry.getPerspectives();
	for (int i = 0; i < perspectives.length; i++) {
		// @issue illegal ref to workbench internal class;
		// consider adding getOriginalId() as API on IPerspectiveDescriptor
		PerspectiveDescriptor descriptor = ((PerspectiveDescriptor) perspectives[i]);
		if (descriptor.getOriginalId().equals(id)) {
			perspectiveIds.add(descriptor.getId());
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:26,代码来源:EnsembleBasicNewProjectResourceWizard.java

示例6: run

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
public void run(IIntroSite site, Properties params) {
    PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());

    IPerspectiveDescriptor currentPerspective = site.getPage().getPerspective();
    if (!PERSPECTIVE_ID.equals(currentPerspective.getId())) {
        // show required perspective
        IWorkbenchWindow workbenchWindow = site.getWorkbenchWindow();
        try {
            workbenchWindow.getWorkbench().showPerspective(PERSPECTIVE_ID, workbenchWindow);
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }

    // find repository node
    repositoryNode = (RepositoryNode) RepositorySeekerManager.getInstance().searchRepoViewNode(params.getProperty("nodeId"),
            false);
    if (null != repositoryNode) {
        // expand/select node item
        RepositoryManagerHelper.getRepositoryView().getViewer().setSelection(new StructuredSelection(repositoryNode));
        init(repositoryNode);
        doRun();
    }
}
 
开发者ID:Talend,项目名称:tesb-studio-se,代码行数:26,代码来源:OpenWSDLEditorAction.java

示例7: addPerspectiveListener

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
private void addPerspectiveListener(IWorkbenchWindow window) {
	IPerspectiveListener perspectiveListener = new PerspectiveListener();
	window.addPerspectiveListener(perspectiveListener);

	// triggers the event for the currently open perspective, if there is
	// any
	IWorkbenchPage activePage = window.getActivePage();
	if (activePage != null) {
		IPerspectiveDescriptor currentPerspective = window.getActivePage()
				.getPerspective();
		if (currentPerspective != null) {
			perspectiveListener.perspectiveActivated(activePage,
					currentPerspective);
		}

	}
}
 
开发者ID:TestRoots,项目名称:watchdog,代码行数:18,代码来源:WindowListener.java

示例8: OpenPerspectiveAction

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
/**
 * Create a new action for opening a perspective
 * 
 * @param perspectiveDescriptor
 *            the perspective to be opened
 */
OpenPerspectiveAction(IPerspectiveDescriptor perspectiveDescriptor, String name, String icon){
	super(perspectiveDescriptor.getLabel());
	
	setId(perspectiveDescriptor.getId());
	if (!StringTool.isNothing(icon)) {
		setImageDescriptor(perspectiveDescriptor.getImageDescriptor());
	} else {
		
		setImageDescriptor(perspectiveDescriptor.getImageDescriptor());
	}
	
	setToolTipText((StringTool.isNothing(name) ? perspectiveDescriptor.getLabel() : name)
		+ Messages.ApplicationActionBarAdvisor_10);
	
	this.perspectiveDescriptor = perspectiveDescriptor;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:23,代码来源:ApplicationActionBarAdvisor.java

示例9: savePerspectiveToRegistryLegacy

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

示例10: deletePerspective

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
@Override
public int deletePerspective(String perspectiveId){
	IPerspectiveRegistry iPerspectiveRegistry =
		PlatformUI.getWorkbench().getPerspectiveRegistry();
	MApplication mApplication = getService(MApplication.class);
	IPerspectiveDescriptor existingPerspectiveDescriptor =
		iPerspectiveRegistry.findPerspectiveWithId(perspectiveId);
	
	int idx = -1;
	
	if (existingPerspectiveDescriptor != null) {
		
		idx = closePerspective(existingPerspectiveDescriptor);
		//NOT WORKING IF PERSPECTIVE IS PREDEFINED - workaround with generics
		iPerspectiveRegistry.deletePerspective(existingPerspectiveDescriptor);
		PerspectiveImportService.genericInvokMethod(iPerspectiveRegistry, "removeSnippet",
			MSnippetContainer.class, String.class, mApplication,
			existingPerspectiveDescriptor.getId());
		
	}
	return idx;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:23,代码来源:PerspectiveImportService.java

示例11: isPerspectiveInsideStack

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

示例12: fill

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
@Override
public void fill(ToolBar parent, int index) {
	IPerspectiveRegistry pr = PlatformUI.getWorkbench().
		getPerspectiveRegistry();
	
	String cfg = CoreHub.localCfg.get(Preferences.CFG_PERSPEKTIVEN, "");
	String[] ids = cfg.split(",");
	if (cfg == "") return;

	for (String id: ids) {
		IPerspectiveDescriptor pd = pr.findPerspectiveWithId(id);
		if (pd == null) continue;
		
		ToolItem ti = new ToolItem(parent, SWT.PUSH);
		ImageDescriptor idesc = pd.getImageDescriptor();
		Image im = (idesc != null ? idesc.createImage() : null);
		if (im != null)
			ti.setImage(im);
		else
			ti.setText(pd.getLabel());
		ti.setToolTipText(pd.getLabel());
		ti.addSelectionListener(new TISelListener(pd.getId()));
	}

	parent.update();
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:27,代码来源:PerspektivenContribution.java

示例13: perspectiveActivated

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {

		ConvertigoPlugin.logDebug3("IWorkbenchPage perspectiveActivated : " + page.getLabel() + "("
				+ page.toString() + ")");
		if (!perspective.getId().equalsIgnoreCase(ConvertigoPlugin.PLUGIN_PERSPECTIVE_ID)) {
		} else {
		}
	}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:9,代码来源:ConvertigoPerspectiveListener.java

示例14: perspectiveChanged

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
	ConvertigoPlugin.logDebug3("IWorkbenchPage perspectiveChanged : " + page.getLabel() + "("
			+ perspective.getLabel() + " - " + changeId + ")");

	IViewReference introView = page.findViewReference("org.eclipse.ui.internal.introview");
	// Maximize the intro view if present
	if (introView != null) {
		page.setPartState(introView, IWorkbenchPage.STATE_MAXIMIZED);
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:11,代码来源:ConvertigoPerspectiveListener.java

示例15: removeUnWantedPerspectives

import org.eclipse.ui.IPerspectiveDescriptor; //导入依赖的package包/类
/**
 * Removes the unwanted perspectives from your RCP application
 */
public void removeUnWantedPerspectives() {
	IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry();
	IPerspectiveDescriptor[] perspectiveDescriptors = getAllRegisteredPerspectiveDescriptors();
	ArrayList<IPerspectiveDescriptor> ignorePerspectiveList = getIgnorePerspectiveList(perspectiveDescriptors);
	removePerspetives(perspectiveRegistry, ignorePerspectiveList);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:10,代码来源:PerspectiveRemover.java


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