本文整理匯總了Java中org.eclipse.ui.IWorkbenchPage.getEditorReferences方法的典型用法代碼示例。如果您正苦於以下問題:Java IWorkbenchPage.getEditorReferences方法的具體用法?Java IWorkbenchPage.getEditorReferences怎麽用?Java IWorkbenchPage.getEditorReferences使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IWorkbenchPage
的用法示例。
在下文中一共展示了IWorkbenchPage.getEditorReferences方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getEditors
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的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;
}
示例2: closeConnectorEditors
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public void closeConnectorEditors() {
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ConnectorEditorInput)) {
if (((ConnectorEditorInput)editorInput).is(getObject()))
activePage.closeEditor(editorRef.getEditor(false),true);
}
}
catch(PartInitException e) {
ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
}
示例3: closeSequenceEditors
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public void closeSequenceEditors(Sequence sequence) {
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
if (sequence != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof SequenceEditorInput)) {
if (((SequenceEditorInput)editorInput).is(sequence)) {
activePage.closeEditor(editorRef.getEditor(false),true);
break;
}
}
}
catch(PartInitException e) {
ConvertigoPlugin.logException(e, "Error while retrieving the sequence editor '" + editorRef.getName() + "'");
}
}
}
}
}
示例4: getOpenEditorOfMarker
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的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;
}
示例5: closeComponentFileEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
private void closeComponentFileEditor(final IFile file) {
try {
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
for (IEditorReference editorReference : activePage.getEditorReferences()) {
IEditorInput editorInput = editorReference.getEditorInput();
if (editorInput instanceof ComponentFileEditorInput) {
ComponentFileEditorInput cfei = (ComponentFileEditorInput) editorInput;
if (cfei.getFile().equals(file)) {
activePage.closeEditor(editorReference.getEditor(false), true);
return;
}
}
}
} catch (Exception e) {
}
}
示例6: getConnectorEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public IEditorPart getConnectorEditor(Connector connector) {
IEditorPart editorPart = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
if (connector != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ConnectorEditorInput)) {
if (((ConnectorEditorInput)editorInput).is(connector)) {
editorPart = editorRef.getEditor(false);
break;
}
}
}
catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
}
return editorPart;
}
示例7: closeAllEditors
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
@Override
public void closeAllEditors(boolean save) {
super.closeAllEditors(save);// will close any child component editor
ApplicationComponent application = (ApplicationComponent) getObject();
synchronized (application) {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i = 0; i < editorRefs.length; i++) {
IEditorReference editorRef = (IEditorReference) editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if (editorInput != null && editorInput instanceof ApplicationComponentEditorInput) {
if (((ApplicationComponentEditorInput) editorInput).is(application)) {
activePage.closeEditor(editorRef.getEditor(false),false);
}
}
} catch(Exception e) {
}
}
}
}
}
示例8: notifyDbChanged
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的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));
}
}
}
}
}
示例9: closeEditorIfAlreadyOpen
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
private boolean closeEditorIfAlreadyOpen(IPath jobFilePath, String fileName) {
String jobPathRelative = StringUtils.removeStart(jobFilePath.toString(), "..");
jobPathRelative = StringUtils.removeStart(jobPathRelative, "/");
String jobPathAbsolute = StringUtils.replace(jobPathRelative, "/", "\\");
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
for (IEditorReference editorRefrence : activePage.getEditorReferences()) {
if (StringUtils.equals(editorRefrence.getTitleToolTip(), jobPathRelative)
|| StringUtils.equals(editorRefrence.getTitleToolTip(), jobPathAbsolute)
|| fileName.equals(editorRefrence.getTitleToolTip())) {
IEditorPart editor = editorRefrence.getEditor(true);
if (!activePage.closeEditor(editor, true)) {
LOGGER.debug("Editor not closed");
}
LOGGER.debug("Editor closed");
return true;
}
}
}
return false;
}
示例10: getConnectorEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public IEditorPart getConnectorEditor(Connector connector) {
IEditorPart editorPart = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
if (connector != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ConnectorEditorInput)) {
if (((ConnectorEditorInput)editorInput).is(connector)) {
editorPart = editorRef.getEditor(false);
break;
}
}
}
catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
}
return editorPart;
}
示例11: getJscriptTransactionEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public IEditorPart getJscriptTransactionEditor(Transaction transaction) {
IEditorPart editorPart = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
if (transaction != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof JscriptTransactionEditorInput)) {
if (((JscriptTransactionEditorInput)editorInput).transaction.equals(transaction)) {
editorPart = editorRef.getEditor(false);
break;
}
}
}
catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the jscript transaction editor '" + editorRef.getName() + "'");
}
}
}
}
return editorPart;
}
示例12: getApplicationComponentEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public IEditorPart getApplicationComponentEditor() {
IEditorPart editorPart = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ApplicationComponentEditorInput)) {
editorPart = editorRef.getEditor(false);
break;
}
}
catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
return editorPart;
}
示例13: getConnectorEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public IEditorPart getConnectorEditor(Connector connector) {
IEditorPart editorPart = null;
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
if (connector != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i = 0; i < editorRefs.length; i++) {
IEditorReference editorRef = (IEditorReference) editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof ConnectorEditorInput)) {
if (((ConnectorEditorInput) editorInput).is(connector)) {
editorPart = editorRef.getEditor(false);
break;
}
}
} catch(PartInitException e) {
//ConvertigoPlugin.logException(e, "Error while retrieving the connector editor '" + editorRef.getName() + "'");
}
}
}
}
return editorPart;
}
示例14: pageOpened
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
@Override
public void pageOpened(IWorkbenchPage page) {
IEditorReference[] rs = page.getEditorReferences();
for (IEditorReference r : rs) {
IEditorPart part = r.getEditor(false);
if (part != null) {
editorOpened(part);
}
}
page.addPartListener(this);
}
示例15: getSequenceEditor
import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
public SequenceEditor getSequenceEditor(Sequence sequence) {
SequenceEditor sequenceEditor = null;
IWorkbenchPage activePage = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
if (activePage != null) {
if (sequence != null) {
IEditorReference[] editorRefs = activePage.getEditorReferences();
for (int i=0;i<editorRefs.length;i++) {
IEditorReference editorRef = (IEditorReference)editorRefs[i];
try {
IEditorInput editorInput = editorRef.getEditorInput();
if ((editorInput != null) && (editorInput instanceof SequenceEditorInput)) {
if (((SequenceEditorInput)editorInput).is(sequence)) {
sequenceEditor = (SequenceEditor)editorRef.getEditor(true);
break;
}
}
}
catch(PartInitException e) {
ConvertigoPlugin.logException(e, "Error while retrieving the sequence editor '" + editorRef.getName() + "'");
}
}
}
}
return sequenceEditor;
}