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


Java IEditorReference類代碼示例

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


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

示例1: tryValidateManifestInEditor

import org.eclipse.ui.IEditorReference; //導入依賴的package包/類
private void tryValidateManifestInEditor(final IResourceDelta delta) {
	if (isWorkbenchRunning()) {
		Display.getDefault().asyncExec(() -> {
			final IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
			if (null != window) {
				final IWorkbenchPage page = window.getActivePage();
				for (final IEditorReference editorRef : page.getEditorReferences()) {
					if (isEditorForResource(editorRef, delta.getResource())) {
						final IWorkbenchPart part = editorRef.getPart(true);
						if (part instanceof XtextEditor) {
							editorCallback.afterSave((XtextEditor) part);
							return;
						}
					}
				}
			}
		});
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:N4JSAllContainersState.java

示例2: 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

示例3: closeConnectorEditors

import org.eclipse.ui.IEditorReference; //導入依賴的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() + "'");
			}
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:23,代碼來源:ProjectTreeObject.java

示例4: closeSequenceEditors

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

示例5: 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

示例6: closeComponentFileEditor

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

示例7: 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

示例8: closeAllEditors

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

示例9: closeAllEditors

import org.eclipse.ui.IEditorReference; //導入依賴的package包/類
public void closeAllEditors(boolean save) {
	MobileComponent mc = getObject();
	
	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 ComponentFileEditorInput) {
					if (((ComponentFileEditorInput)editorInput).is(mc) ||
						((ComponentFileEditorInput)editorInput).isChildOf(mc)) {
							activePage.closeEditor(editorRef.getEditor(false),save);
					}
				}
			} catch(Exception e) {
				
			}
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:23,代碼來源:MobileComponentTreeObject.java

示例10: 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

示例11: 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

示例12: getJscriptTransactionEditor

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

示例13: 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

示例14: 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

示例15: checkCondition

import org.eclipse.ui.IEditorReference; //導入依賴的package包/類
@Override
public boolean checkCondition() throws Exception {
	Display.getDefault().syncExec(new Runnable() {
		@Override
		public void run() {
			IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			 
			if (ww == null)
				return;
			IWorkbenchPage page = ww.getActivePage();
			if (page == null)
				return;
			IEditorReference[] part = page.getEditorReferences();
			if (part == null)
				return;
			for (IEditorReference iEditorReference : part) {
				if( title.equals(iEditorReference.getTitle()) ) 
					found = true;
			}
		}
	});
	return !found;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:24,代碼來源:EditorClosedCondition.java


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