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


Java IWorkbenchPage.closeEditor方法代碼示例

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


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

示例1: 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() + "'");
			}
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:23,代碼來源:ProjectTreeObject.java

示例2: 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() + "'");
				}
			}
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:27,代碼來源:ProjectTreeObject.java

示例3: rename

import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
@Override
public boolean rename(String newName, boolean dialog) {
	if (super.rename(newName, dialog)) {
		IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		if (activePage != null) {
			IEditorPart editorPart = getConnectorEditor(activePage, getObject());
			// If editor was open, close it and reopen it
			if (editorPart != null) {
				activePage.closeEditor(editorPart, false);
				openConnectorEditor();
			}
		}
		return true;
	}
	return false;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:17,代碼來源:ConnectorTreeObject.java

示例4: 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) {
		
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:22,代碼來源:MobileUIComponentTreeObject.java

示例5: 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) {
					
				}
			}
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:26,代碼來源:MobileApplicationComponentTreeObject.java

示例6: closeAllEditors

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

示例7: 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;
	}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:ExternalSchemaUpdaterHandler.java

示例8: closeEditor

import org.eclipse.ui.IWorkbenchPage; //導入方法依賴的package包/類
private boolean closeEditor(IWorkbenchPage activePage, IEditorReference editorRef) {
	if ((activePage != null) && (editorRef != null)) {
		try {
			return activePage.closeEditor(editorRef.getEditor(false),true);
		}
		catch (Exception e) {
			return false;
		}
	}
	return true;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:12,代碼來源:ProjectTreeObject.java


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