本文整理汇总了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);
}
}
});
}
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}