當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。