当前位置: 首页>>代码示例>>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;未经允许,请勿转载。