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


Java IWorkbenchPartSite.getPage方法代码示例

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


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

示例1: activate

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * This function takes a workbench part site, which might be from a top-level view,
 * or from a top-level editor, or from a page-level editor in a multipage editor 
 * site.  The function finds the corresponding part for this site and activates it.
 * @param site
 */
public static void activate(IWorkbenchPartSite site) {
	try {
		IWorkbenchPart part;
		if (site instanceof MultiPageEditorSite) {
			part = ((MultiPageEditorSite)site).getMultiPageEditor();
		} else {
			part = site.getPart();
		}
		if (part == null) {
			return;
		}
		IWorkbenchPage page = site.getPage();
		if (page == null) {
			return;
		}
		page.activate(part);
	} catch (ThreadDeath td) {
		throw td;
	} catch (Throwable t) {
		Logger.getLogger(WorkbenchUtils.class).error("throwable in activate", t);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:29,代码来源:WorkbenchUtils.java

示例2: isSaveOnCloseNeeded

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean isSaveOnCloseNeeded() {
	// workaround for SPF-6678 "Dirty bit is only set when focus is removed from field in Template View, Details View "
	IWorkbenchPartSite site = getSite();
	if (site != null) {
		IWorkbenchPage page = site.getPage();
		IViewReference[] viewReferences = page.getViewReferences();
		for (IViewReference iViewReference : viewReferences) {
			IViewPart viewPart = iViewReference.getView(false);
			if(viewPart != null) {
				Object adapter = viewPart.getAdapter(IPage.class);
				if(adapter instanceof DetailPage) {
					DetailPage detailPage = (DetailPage) adapter;
					if(detailPage.hasSheet()) {
						this.setFocus();
						break;
					}
				}
			}	
		}			
	}
	// end workaround
	return super.isSaveOnCloseNeeded();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:MultiPagePlanEditor.java

示例3: runWhenNextVisible

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * Makes sure that the editor's folding state is correct the next time
 * it becomes visible. If it already is visible, it toggles the folding
 * state. If not, it either registers a part listener to toggle folding
 * when the editor becomes visible, or cancels an already registered
 * runner.
 */
public void runWhenNextVisible() {
	// if there is one already: toggling twice is the identity
	if (fFoldingRunner != null) {
		fFoldingRunner.cancel();
		return;
	}
	IWorkbenchPartSite site= getSite();
	if (site != null) {
		IWorkbenchPage page= site.getPage();
		if (!page.isPartVisible(JavaEditor.this)) {
			// if we're not visible - defer until visible
			fPage= page;
			fFoldingRunner= this;
			page.addPartListener(this);
			return;
		}
	}
	// we're visible - run now
	toggleFolding();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:JavaEditor.java

示例4: WorkingSetFilterActionGroup

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
public WorkingSetFilterActionGroup(IWorkbenchPartSite site, IPropertyChangeListener changeListener) {
	Assert.isNotNull(site);
	Assert.isNotNull(changeListener);

	fChangeListener= changeListener;
	fWorkbenchPage= site.getPage();
	fAllowWindowWorkingSetByDefault= true;
	fClearWorkingSetAction= new ClearWorkingSetAction(this);
	fSelectWorkingSetAction= new SelectWorkingSetAction(this, site);
	fEditWorkingSetAction= new EditWorkingSetAction(this, site);

	fWorkingSetListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			doPropertyChange(event);
		}
	};
	fWorkingSetFilter= new WorkingSetFilter();

	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	manager.addPropertyChangeListener(fWorkingSetListener);

	if (useWindowWorkingSetByDefault()) {
		setWorkingSet(site.getPage().getAggregateWorkingSet(), false);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:WorkingSetFilterActionGroup.java

示例5: getPage

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * Gets the page, even during startup.
 * @return the page
 */
public static IWorkbenchPage getPage(IWorkbenchPartSite site) {
	if (site != null) {
		IWorkbenchPage page = site.getPage();
		if (page != null) return page;
	}
	IWorkbenchPage activePage = PageUtil.getActivePage();
	if (activePage!=null) return activePage;
	return PageUtil.getDefaultPage();
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:14,代码来源:PageUtil.java

示例6: getPage

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
/**
 * Gets the page, even during startup.
 * @return the page
 */
public static IWorkbenchPage getPage(IWorkbenchPartSite site) {
	if (site != null) {
		IWorkbenchPage page = site.getPage();
		if (page != null) return page;
	}
	IWorkbenchPage activePage = getActivePage();
	if (activePage!=null) return activePage;
	return getDefaultPage();
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:14,代码来源:Util.java

示例7: closeEditor

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
public static void closeEditor(IEditorPart editor) {
	IWorkbenchPartSite site;
	IWorkbenchPage page;
	if (editor != null && (site= editor.getSite()) != null && (page= site.getPage()) != null) {
		UIThreadRunnable.syncExec(()->page.closeEditor(editor, false));
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:8,代码来源:SWTBotEditorHelper.java

示例8: findAndShowCallersView

import org.eclipse.ui.IWorkbenchPartSite; //导入方法依赖的package包/类
static CallHierarchyViewPart findAndShowCallersView(IWorkbenchPartSite site) {
    IWorkbenchPage workbenchPage = site.getPage();
    CallHierarchyViewPart callersView = null;

    try {
        callersView = (CallHierarchyViewPart) workbenchPage.showView(CallHierarchyViewPart.ID_CALL_HIERARCHY);
    } catch (PartInitException e) {
        JavaPlugin.log(e);
    }

    return callersView;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:CallHierarchyViewPart.java


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