本文整理汇总了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);
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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();
}
示例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));
}
}
示例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;
}