當前位置: 首頁>>代碼示例>>Java>>正文


Java IEditorReference.getEditor方法代碼示例

本文整理匯總了Java中org.eclipse.ui.IEditorReference.getEditor方法的典型用法代碼示例。如果您正苦於以下問題:Java IEditorReference.getEditor方法的具體用法?Java IEditorReference.getEditor怎麽用?Java IEditorReference.getEditor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.IEditorReference的用法示例。


在下文中一共展示了IEditorReference.getEditor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEditors

import org.eclipse.ui.IEditorReference; //導入方法依賴的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: getConnectorEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
private IEditorPart getConnectorEditor(IWorkbenchPage activePage, Connector connector) {
	IEditorPart editorPart = null;
	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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:25,代碼來源:ConnectorTreeObject.java

示例3: getConnectorEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:27,代碼來源:TraceTreeObject.java

示例4: getSequenceEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
private IEditorPart getSequenceEditor(IWorkbenchPage activePage, Sequence sequence) {
	IEditorPart editorPart = null;
	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)) {
							editorPart = editorRef.getEditor(false);
							break;
						}
					}
				} catch(PartInitException e) {
					//ConvertigoPlugin.logException(e, "Error while retrieving the sequence editor '" + editorRef.getName() + "'");
				}
			}
		}
	}
	return editorPart;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:24,代碼來源:SequenceTreeObject.java

示例5: getConnectorEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:26,代碼來源:MyAbstractAction.java

示例6: getJscriptTransactionEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
/**
 * Gets the jscript editor associated with given transaction.
 * !!MUST BE CALLED IN A UI-THREAD!!
 * @return IEditorPart : the found jscript editor or null
 */
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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:31,代碼來源:ConvertigoPlugin.java

示例7: getApplicationComponentEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的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;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:22,代碼來源:ConvertigoPlugin.java

示例8: notifyDbChanged

import org.eclipse.ui.IEditorReference; //導入方法依賴的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

示例9: closeEditorIfAlreadyOpen

import org.eclipse.ui.IEditorReference; //導入方法依賴的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;
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:ExternalSchemaUpdaterHandler.java

示例10: setMainGraphDirty

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
private void setMainGraphDirty(boolean dirty) {
	if(container.getLinkedMainGraphPath()!=null && container.isCurrentGraphSubjob()){
		for(IEditorReference editorReference:PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()){
			if(StringUtils.equals(editorReference.getTitleToolTip(), container.getLinkedMainGraphPath())){
				if(editorReference.getEditor(false) instanceof ELTGraphicalEditor);
				((ELTGraphicalEditor)editorReference.getEditor(false)).setDirty(true);
			}
		}
		
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:12,代碼來源:ELTGraphicalEditor.java

示例11: getOpenEditorOfMarker

import org.eclipse.ui.IEditorReference; //導入方法依賴的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

示例12: notifyColoringChange

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
/**
 * resets syntax coloring and notifies all ftc editors
 */
public void notifyColoringChange() {
	org.eclipse.ui.IWorkbench workbench = org.eclipse.ui.PlatformUI.getWorkbench();
	// org.eclipse.ui.IEditorPart editor =
	// workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor();

	for (IEditorReference p : workbench.getActiveWorkbenchWindow().getActivePage().getEditorReferences()) {
		IEditorPart editor = p.getEditor(false);
		if (editor != null && editor instanceof FtcEditor) {
			FtcEditor ftcEditor = (FtcEditor) editor;
			ftcEditor.invalidateTextRepresentation();
		}

	}

}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:19,代碼來源:FtcPlugin.java

示例13: closeAllEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
/**
 * closeAllEditor
 *   void
 */
public static void closeAllEditor() {

    for (final IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
        IEditorReference[] editorRefs = window.getActivePage().getEditorReferences();

        for (IEditorReference ref : editorRefs) {
            final IEditorPart editor = ref.getEditor(true);

            if (editor != null) {
                if ( editorList.contains(editor.getClass().getName()) || editor.getEditorInput() instanceof UMLEditorInput
                    || editor.getEditorInput() instanceof DiagramEditorInput) {
                    ViewerRegistry.getViewer().getControl().getDisplay().asyncExec(new Runnable() {
                        public void run() {
                            window.getActivePage().closeEditor(editor, true);
                        }
                    });
                }
            }
        }
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:26,代碼來源:ProjectUtil.java

示例14: closeEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
/**
 * closeEditor
 *   void
 */
public void closeEditor() {
    for (final IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
        IEditorReference[] editorRefs = window.getActivePage().getEditorReferences();

        for (IEditorReference ref : editorRefs) {
            final IEditorPart editor = ref.getEditor(false);
            if (editor != null && editor.getEditorInput() instanceof UMLEditorInput) {
                ViewerRegistry.getViewer().getControl().getDisplay().syncExec(new Runnable() {
                    public void run() {
                        window.getActivePage().closeEditor(editor, false);
                    }
                });
            } else if (editor != null && editor.getEditorInput() instanceof DiagramEditorInput) {
                ViewerRegistry.getViewer().getControl().getDisplay().syncExec(new Runnable() {
                    public void run() {
                        window.getActivePage().closeEditor(editor, false);
                    }
                });
            }
        }
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:27,代碼來源:BaseMultiFragmentAction.java

示例15: getSelectedDiagramEditor

import org.eclipse.ui.IEditorReference; //導入方法依賴的package包/類
/**
 * Find the selected diagram editor.
 *
 * @return the selected diagram editor
 */
public static TriqDiagramEditor getSelectedDiagramEditor() {
  TriqDiagramEditor result = null;
  IWorkbenchPage page = EclipseUtils.getPage();
  if (page != null) {
    IEditorPart activeEditor = page.getActiveEditor();
    if (activeEditor instanceof TriqDiagramEditor) {
      result = (TriqDiagramEditor) activeEditor;
    } else {
      for (IEditorReference editorRef : page.getEditorReferences()) {
        if (editorRef.getId().contains("triquetrum")) {
          result = ((TriqDiagramEditor) editorRef.getEditor(true));
          break;
        }
      }
    }
  }
  return result;
}
 
開發者ID:eclipse,項目名稱:triquetrum,代碼行數:24,代碼來源:EditorUtils.java


注:本文中的org.eclipse.ui.IEditorReference.getEditor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。