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


Java FileEditorInput類代碼示例

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


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

示例1: initializeGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
protected void initializeGraphicalViewer() {
	super.initializeGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	setPartName(inp.getFile().getName());
	try {
		String path = inp.getFile().getLocation().toOSString();
		String text = FileUtils.readFileToString(new File(path));
		CompositeNode node = parse(text);
		root = new CompositeEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
		getGraphicalViewer().setContents(root);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:InitAssemblyEditor.java

示例2: getActiveEditorFile

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
/**
 * Returns the opened file of the currently active editor.
 *
 * Returns null if no editor is open.
 */
private static IFile getActiveEditorFile() {
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor();

	if (null == activeEditor) {
		return null;
	}

	IEditorInput input = activeEditor.getEditorInput();

	if (input instanceof FileEditorInput) {
		return ((FileEditorInput) input).getFile();
	} else {
		return null;
	}

}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:CreateNewN4JSElementInModuleHandler.java

示例3: doSaveAs

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void doSaveAs ()
{
    SaveAsDialog saveAsDialog = new SaveAsDialog ( getSite ().getShell () );
    saveAsDialog.open ();
    IPath path = saveAsDialog.getResult ();
    if ( path != null )
    {
        IFile file = ResourcesPlugin.getWorkspace ().getRoot ().getFile ( path );
        if ( file != null )
        {
            doSaveAs ( URI.createPlatformResourceURI ( file.getFullPath ().toString (), true ), new FileEditorInput ( file ) );
        }
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:ProtocolEditor.java

示例4: doSaveAs

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void doSaveAs ()
{
    final SaveAsDialog saveAsDialog = new SaveAsDialog ( getSite ().getShell () );
    saveAsDialog.open ();
    final IPath path = saveAsDialog.getResult ();
    if ( path != null )
    {
        final IFile file = ResourcesPlugin.getWorkspace ().getRoot ().getFile ( path );
        if ( file != null )
        {
            doSaveAs ( URI.createPlatformResourceURI ( file.getFullPath ()
                    .toString (), true ), new FileEditorInput ( file ) );
        }
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:ChartEditor.java

示例5: execute

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IFile file = getSelectedFile();
	if (file==null){
		return null;
	}
	IWorkbenchPage page = EclipseUtil.getActivePage();
	if (page==null){
		return null;
	}
	try {
		page.openEditor(new FileEditorInput(file), BashEditor.EDITOR_ID);
	} catch (PartInitException e) {
		throw new ExecutionException("Was not able to open bash editor for file:"+file.getName(),e);
	}
	return null;
}
 
開發者ID:de-jcup,項目名稱:eclipse-bash-editor,代碼行數:18,代碼來源:OpenWithBashEditor.java

示例6: resourceChanged

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
/**
 * Closes all project files on project close.
 */
public void resourceChanged(final IResourceChangeEvent event) {
	if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
		Display.getDefault().asyncExec(new Runnable() {
			public void run() {
				IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
				for (int i = 0; i < pages.length; i++) {
					if (((FileEditorInput) editor.getEditorInput()).getFile().getProject().equals(event.getResource())) {
						IEditorPart editorPart = pages[i].findEditor(editor.getEditorInput());
						pages[i].closeEditor(editorPart, true);
					}
				}
			}
		});
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:19,代碼來源:TypesEditor.java

示例7: resourceChanged

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
public void resourceChanged(IResourceChangeEvent event) {
	if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
		Display.getDefault().asyncExec(new Runnable() {
			public void run() {
				IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
				for (int i = 0; i < pages.length; i++) {
					if (((FileEditorInput) getEditorInput()).getFile().getProject().equals(event.getResource())) {
						IEditorPart editorPart = pages[i].findEditor(getEditorInput());
						pages[i].closeEditor(editorPart, true);
					}
				}
			}
		});
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:IntLogicalSysEditor.java

示例8: initializeGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
protected void initializeGraphicalViewer() {
	super.initializeGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	setPartName(inp.getFile().getName());
	try {
		String path = inp.getFile().getLocation().toOSString();
		String text = FileUtils.readFileToString(new File(path));
		LogicalSystemNode node = parse(text);
		root = new LogicalSystemEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
		getGraphicalViewer().setContents(root);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:IntLogicalSysEditor.java

示例9: configureGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	EditPartFactory factory = new EditPartFactory();
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	factory.setContainerName(inp.getFile().getProject().getFullPath().toOSString());
	getGraphicalViewer().setEditPartFactory(factory);
	((FigureCanvas) getGraphicalControl()).setScrollBarVisibility(FigureCanvas.ALWAYS);
	getActionRegistry().registerAction(new ExportImageAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new ExportAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new GenerateAPIAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new GenerateINTAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new GenerateUIDAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new ClearTargetAction(this, inp.getFile().getProject().getFullPath()));
	getGraphicalViewer().setContextMenu(new ContextMenuProvider(getGraphicalViewer(), getActionRegistry()));
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:IntLogicalSysEditor.java

示例10: initializeGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
public void initializeGraphicalViewer() {
	super.initializeGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	setPartName(inp.getFile().getName());
	try {
		String path = inp.getFile().getLocation().toOSString();
		String text = FileUtils.readFileToString(new File(path));
		CompositeNode node = parse(text);
		root = new CompositeEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
		getGraphicalViewer().setContents(root);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:IntFinalAssemblyEditor.java

示例11: configureGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	EditPartFactory factory = new EditPartFactory();
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	factory.setContainerName(inp.getFile().getProject().getFullPath().toOSString());
	getGraphicalViewer().setEditPartFactory(factory);
	((FigureCanvas) getGraphicalControl()).setScrollBarVisibility(FigureCanvas.ALWAYS);
	getActionRegistry().registerAction(new ExportImageAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new ExportAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new GenerateAPIAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new GenerateINTAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new GenerateUIDAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new ClearTargetAction(this, inp.getFile().getProject().getFullPath()));
	getActionRegistry().registerAction(new RefreshAction(this, inp.getFile().getProject().getFullPath(), inp.getFile()));
	getGraphicalViewer().setContextMenu(new ContextMenuProvider(getGraphicalViewer(), getActionRegistry()));
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:18,代碼來源:IntFinalAssemblyEditor.java

示例12: initializeGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
public void initializeGraphicalViewer() {
	super.initializeGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	setPartName(inp.getFile().getName());
	try {
		String path = inp.getFile().getLocation().toOSString();
		String text = FileUtils.readFileToString(new File(path));
		DeploymentNode node = parse(text);
		root = new DeploymentEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
		getGraphicalViewer().setContents(root);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:IntDeploymentEditor.java

示例13: initializeGraphicalViewer

import org.eclipse.ui.part.FileEditorInput; //導入依賴的package包/類
@Override
public void initializeGraphicalViewer() {
	super.initializeGraphicalViewer();
	getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
	FileEditorInput inp = (FileEditorInput) getEditorInput();
	setPartName(inp.getFile().getName());
	try {
		String path = inp.getFile().getLocation().toOSString();
		String text = FileUtils.readFileToString(new File(path));
		ComponentImplementationNode node = parse(text);
		root = new ComponentImplementationEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
		getGraphicalViewer().setContents(root);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:17,代碼來源:CompImplEditor.java

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

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


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