本文整理汇总了Java中org.eclipse.ui.part.IPage类的典型用法代码示例。如果您正苦于以下问题:Java IPage类的具体用法?Java IPage怎么用?Java IPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPage类属于org.eclipse.ui.part包,在下文中一共展示了IPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdapter
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
@Override
public Object getAdapter(Class key) {
if (key.equals(IContextProvider.class)) {
return new ContextProvider(ID);
}
if (key.equals(TreeViewer.class)) {
IPage page = this.getCurrentPage();
if (page instanceof PlanAdvisorPage) {
PlanAdvisorPage planAdvisorPage = (PlanAdvisorPage) page;
return planAdvisorPage.getPlanAdvisorTreeViewer();
}
else {
return null;
}
}
return super.getAdapter(key);
}
示例2: getConsole
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
public static IConsole getConsole(IWorkbenchPart part) {
if(!(part instanceof IViewPart)){
return null;
}
IViewPart vp =(IViewPart) part;
if (vp instanceof PageBookView) {
IPage page = ((PageBookView) vp).getCurrentPage();
ITextViewer viewer = getViewer(page);
if (viewer == null || viewer.getDocument() == null)
return null;
}
IConsole con = null;
try {
con = ((IConsoleView)part).getConsole();
} catch (Exception e) {
}
return con;
}
示例3: getViewer
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
public static ITextViewer getViewer(IPage page) {
if(page == null){
return null;
}
if(page instanceof TextConsolePage) {
return ((TextConsolePage)page).getViewer();
}
if(page.getClass().equals(MessagePage.class)){
// empty page placeholder
return null;
}
try {
/*
* org.eclipse.cdt.internal.ui.buildconsole.BuildConsolePage does not
* extend TextConsolePage, so we get access to the viewer with dirty tricks
*/
Method method = page.getClass().getDeclaredMethod("getViewer", (Class<?>[])null);
method.setAccessible(true);
return (ITextViewer) method.invoke(page, (Object[])null);
} catch (Exception e) {
// AnyEditToolsPlugin.logError("Can't get page viewer from the console page", e);
}
return null;
}
示例4: execute
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException
{
// assumes to expand to level 1 if not specified
int level = 1;
String levelStr = event.getParameter(LEVEL);
if (levelStr != null)
{
level = Integer.parseInt(levelStr);
}
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof ContentOutline)
{
IPage page = ((ContentOutline) part).getCurrentPage();
if (page instanceof CommonOutlinePage)
{
CommonOutlinePage outlinePage = (CommonOutlinePage) page;
// we want to expand to the specified level and collapse everything below
outlinePage.collapseAll();
outlinePage.expandToLevel(level);
}
}
return null;
}
示例5: pageActivated
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
@Override
protected void pageActivated(IPage page) {
if (page instanceof ConstraintsPage) {
ConstraintsPage constraintsPage = (ConstraintsPage)page;
final EPlan plan = constraintsPage.getPlan();
WidgetUtils.runInDisplayThread(page.getControl(), new Runnable() {
@Override
public void run() {
String planName = plan.getName();
if(planName == null) {
planName = "";
}
setContentDescription(planName);
}
});
} else {
setContentDescription("");
}
}
示例6: isSaveOnCloseNeeded
import org.eclipse.ui.part.IPage; //导入依赖的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();
}
示例7: getSelection
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
private ISelection getSelection(IWorkbenchPart part, ISelection selection) {
// for some reason, selection is empty when we select a revision from the P4 history view
if (!(part instanceof PageBookView)) {
return selection;
}
IPage page = ((PageBookView)part).getCurrentPage();
if (!(page instanceof P4HistoryPage)) {
return selection;
}
return getSelection((P4HistoryPage)page);
}
示例8: createDefaultPage
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
@Override
protected IPage createDefaultPage(PageBook book)
{
MessagePage defaultPage = new MessagePage();
initPage(defaultPage);
defaultPage.setMessage(m_defaultMsg);
defaultPage.createControl(book);
setPartName(m_defaultTitle);
return defaultPage;
}
示例9: createDefaultPage
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
@Override
protected IPage createDefaultPage(PageBook book) {
ReportStatePage page = new ReportStatePage(null);
initPage(page);
page.createControl(book);
return page;
}
示例10: hijackConsole
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
protected void hijackConsole(IViewPart view)
{
if (view instanceof ConsoleView)
{
IPage currentPage = ((ConsoleView) view).getCurrentPage();
if (currentPage != null)
{
hookTheme(currentPage.getControl(), false);
}
}
}
示例11: execute
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException
{
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof ContentOutline)
{
IPage page = ((ContentOutline) part).getCurrentPage();
if (page instanceof CommonOutlinePage)
{
((CommonOutlinePage) page).collapseAll();
}
}
return null;
}
示例12: execute
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException
{
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof ContentOutline)
{
IPage page = ((ContentOutline) part).getCurrentPage();
if (page instanceof CommonOutlinePage)
{
((CommonOutlinePage) page).expandAll();
}
}
return null;
}
示例13: pageActivated
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
@Override
protected void pageActivated(IPage page) {
if (page instanceof PlanAdvisorPage) {
PlanAdvisorPage planAdvisorPage = (PlanAdvisorPage) page;
EPlan plan = planAdvisorPage.getPlan();
PlanAdvisorMember planAdvisorMember = PlanAdvisorMember.get(plan);
viewIconListener.setPlanAdvisorMember(planAdvisorMember);
} else {
viewIconListener.setPlanAdvisorMember(null);
}
}
示例14: createDefaultPage
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected IPage createDefaultPage(PageBook book) {
MessagePage page = new MessagePage();
initPage(page);
page.createControl(book);
page.setMessage("default page");
return page;
}
示例15: getCurrentDetailPage
import org.eclipse.ui.part.IPage; //导入依赖的package包/类
private DetailPage getCurrentDetailPage(IWorkbenchPage page) {
DetailView detailView = DetailView.getDetailView(page);
if (detailView != null) {
IPage currentPage = detailView.getCurrentPage();
if (currentPage instanceof DetailPage)
return (DetailPage)currentPage;
}
return null;
}