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


Java IWorkbenchWindow.getPages方法代码示例

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


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

示例1: getEditors

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
 * Obtains all editors that are currently opened.
 * @return the collection of the opened editors
 */
public static List<IEditorPart> getEditors() {
    List<IEditorPart> editors = new ArrayList<IEditorPart>();
    IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
    
    for (IWorkbenchWindow window : windows) {
        IWorkbenchPage[] pages = window.getPages();
        
        for (IWorkbenchPage page : pages) {
            IEditorReference[] refs = page.getEditorReferences();
            
            for (IEditorReference ref : refs) {
                IEditorPart part = ref.getEditor(false);
                if (part != null) {
                    editors.add(part);
                }
            }
        }
    }
    return editors;
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:25,代码来源:EditorUtilities.java

示例2: notifyDbChanged

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
public static void notifyDbChanged(DbInfo dbinfo) {
    String action = Activator.getDefault().getPreferenceStore().getString(PG_EDIT_PREF.EDITOR_UPDATE_ACTION);
    if (action.equals(PG_EDIT_PREF.NO_ACTION)) {
        return;
    }
    for (IWorkbenchWindow wnd : PlatformUI.getWorkbench().getWorkbenchWindows()) {
        for (IWorkbenchPage page : wnd.getPages()) {
            for (IEditorReference ref : page.getEditorReferences()) {
                IEditorPart ed = ref.getEditor(false);
                if (ed instanceof ProjectEditorDiffer) {
                    notifyDbChanged(dbinfo, (ProjectEditorDiffer) ed, action.equals(PG_EDIT_PREF.UPDATE));
                }
            }
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:17,代码来源:ProjectEditorDiffer.java

示例3: getOpenEditorOfMarker

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
 * Note: it compares marker's resource file name and open editors' file name.
 *
 * @param marker
 * @return if marker's editor is open, return editor, else return null
 */
public static IEditorPart getOpenEditorOfMarker(final IMarker marker) {
  final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
  for (final IWorkbenchWindow iWorkbenchWindow : windows) {
    final IWorkbenchPage[] pages = iWorkbenchWindow.getPages();
    for (final IWorkbenchPage iWorkbenchPage : pages) {
      final IEditorReference[] editors = iWorkbenchPage.getEditorReferences();
      for (final IEditorReference iEditorReference : editors) {
        try {
          if (iEditorReference instanceof IFileEditorInput) {
            final IFileEditorInput input = (IFileEditorInput) iEditorReference.getEditorInput();
            final IFile file = input.getFile();
            // TODO Caused by: java.lang.NullPointerException when delete marker on ecore editor.
            if (file.getFullPath().equals(marker.getResource().getFullPath())) {
              return iEditorReference.getEditor(false);
            }
          }
        } catch (final PartInitException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:31,代码来源:MarkerFactory.java

示例4: getEditor

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
 * Obtains an editor that may edits the contents of a file.
 * @param file the file
 * @return the editor of the file, or <code>null</code> if none
 */
public static IEditorPart getEditor(IFile file) {
    IEditorInput input = new FileEditorInput(file);
    IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
    
    for (IWorkbenchWindow window : windows) {
        IWorkbenchPage[] pages = window.getPages();
        
        for (IWorkbenchPage page : pages) {
            IEditorPart part = page.findEditor(input);
            return part;
        }
    }
    return null;
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:20,代码来源:EditorUtilities.java

示例5: windowClosed

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public void windowClosed(IWorkbenchWindow window) {
	IWorkbenchPage[] pages = window.getPages();
	for (IWorkbenchPage page : pages) {
		pageClosed(page);
	}
	window.removePageListener(this);
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:9,代码来源:EditorTracker.java

示例6: windowOpened

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public void windowOpened(IWorkbenchWindow window) {
	if (window.getShell() != null) {
		IWorkbenchPage[] pages = window.getPages();
		for (IWorkbenchPage page : pages) {
			pageOpened(page);
		}
		window.addPageListener(this);
	}
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:11,代码来源:EditorTracker.java

示例7: findProjectEditor

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
public static ProjectEditorDiffer findProjectEditor(IProject proj) {
    for (IWorkbenchWindow w : PlatformUI.getWorkbench().getWorkbenchWindows()) {
        for (IWorkbenchPage p : w.getPages()) {
            for (IEditorReference e : p.getEditorReferences()) {
                if (EDITOR.PROJECT.equals(e.getId())) {
                    ProjectEditorDiffer projEditor = (ProjectEditorDiffer) e.getEditor(false);
                    if (projEditor != null && projEditor.getProject().equals(proj)) {
                        return projEditor;
                    }
                }
            }
        }
    }
    return null;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:16,代码来源:ChangesJobTester.java


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