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


Java FileEditorInput.getFile方法代碼示例

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


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

示例1: init

import org.eclipse.ui.part.FileEditorInput; //導入方法依賴的package包/類
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	super.init(site, input);
	setSite(site);
	setPartName(input.getName());
	setInputWithNotify(input);
	site.setSelectionProvider(this);
	if (getEditorInput() instanceof FileEditorInput) {
		FileEditorInput fei = (FileEditorInput) getEditorInput();
		IFile file = fei.getFile();
		gWGraph = ResourceManager.load(file);
		Display.getDefault().asyncExec(new Runnable() {
			@Override
			public void run() {
				gWGraph.initialize(getGraphicalViewer().getEditPartRegistry());
				if (!ResourceManager.isEditable(file)) {
					gWGraph.setReadOnly(true);
					getGraphicalViewer().getControl().setEnabled(false);
					String title = MessageUtil.getString("conversion");
					String message = MessageUtil.getString("not_formatted_as_json_convert_it");
					DialogManager.displayWarning(title, message);
				}
			}
		});
	}

}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:27,代碼來源:GW4EEditor.java

示例2: getShowInContext

import org.eclipse.ui.part.FileEditorInput; //導入方法依賴的package包/類
/**
 * Provides input so that the Project Explorer can locate the editor's input in its tree.
 */
@Override
public ShowInContext getShowInContext() {
	IEditorInput editorInput = getEditorInput();
	if (editorInput instanceof FileEditorInput) {
		FileEditorInput fei = (FileEditorInput) getEditorInput();
		return new ShowInContext(fei.getFile(), null);
	} else if (editorInput instanceof XtextReadonlyEditorInput) {
		XtextReadonlyEditorInput readOnlyEditorInput = (XtextReadonlyEditorInput) editorInput;
		IStorage storage;
		try {
			storage = readOnlyEditorInput.getStorage();
			return new ShowInContext(storage.getFullPath(), null);
		} catch (CoreException e) {
			// Do nothing
		}
	}
	return new ShowInContext(null, null);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:22,代碼來源:N4MFEditor.java

示例3: getEditedFileFolder

import org.eclipse.ui.part.FileEditorInput; //導入方法依賴的package包/類
public static File getEditedFileFolder() {
	IWorkbenchPage page = null;
	IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
	for (int i = 0; i < windows.length; i++) {
		if (windows[i] != null) {
			IWorkbenchWindow window = windows[i];
			page = windows[i].getActivePage();
			if (page != null)
				break;
		}
	}
	IEditorPart part = page.getActiveEditor();
	FileEditorInput editor = (FileEditorInput) part.getEditorInput();
	IFile file = editor.getFile();
	IFolder folder = (IFolder) file.getParent();
	File f = null;
	try {
		f = ResourceManager.toFile(folder.getFullPath());
	} catch (FileNotFoundException e) {
		ResourceManager.logException(e);
	}
	return f;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:24,代碼來源:EditorHelper.java

示例4: getEditedFile

import org.eclipse.ui.part.FileEditorInput; //導入方法依賴的package包/類
public static File getEditedFile() {
	IWorkbenchPage page = null;
	IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
	for (int i = 0; i < windows.length; i++) {
		if (windows[i] != null) {
			IWorkbenchWindow window = windows[i];
			page = windows[i].getActivePage();
			if (page != null)
				break;
		}
	}
	IEditorPart part = page.getActiveEditor();
	FileEditorInput editor = (FileEditorInput) part.getEditorInput();
	IFile file = editor.getFile();
	File f = null;
	try {
		f = ResourceManager.toFile(file.getFullPath());
	} catch (FileNotFoundException e) {
		ResourceManager.logException(e);
	}
	return f;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:23,代碼來源:EditorHelper.java

示例5: getEditorFile

import org.eclipse.ui.part.FileEditorInput; //導入方法依賴的package包/類
public static IFile getEditorFile(IEditorPart editor) {
	if (editor == null) {
		return null;
	}
	IEditorInput editorInput = editor.getEditorInput();
	if (!(editorInput instanceof FileEditorInput)) {
		return null;
	}

	FileEditorInput fileInput = (FileEditorInput) editorInput;

	return fileInput.getFile();
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:14,代碼來源:UiUtils.java

示例6: resourceChanged

import org.eclipse.ui.part.FileEditorInput; //導入方法依賴的package包/類
@Override
public void resourceChanged(IResourceChangeEvent event) {
	if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
		return;
	}
	IEditorInput editorInput = this.getEditorInput();
	if (!(editorInput instanceof FileEditorInput)) {
		return;
	}

	FileEditorInput fileInput = (FileEditorInput) editorInput;
	IFile file = fileInput.getFile();
	IResourceDelta candidate = event.getDelta().findMember(file.getFullPath());
	if (candidate == null) {
		return;
	}
	/* Changement de contenu. */
	if ((candidate.getFlags() & IResourceDelta.CONTENT) == 0) {
		return;
	}
	switch (candidate.getKind()) {
	case IResourceDelta.ADDED:
	case IResourceDelta.CHANGED:
		checkKsp(file);
		break;
	case IResourceDelta.REMOVED:
	default:
		break;
	}
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:31,代碼來源:KspEditor.java


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