当前位置: 首页>>代码示例>>Java>>正文


Java IDE.openEditorOnFileStore方法代码示例

本文整理汇总了Java中org.eclipse.ui.ide.IDE.openEditorOnFileStore方法的典型用法代码示例。如果您正苦于以下问题:Java IDE.openEditorOnFileStore方法的具体用法?Java IDE.openEditorOnFileStore怎么用?Java IDE.openEditorOnFileStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.ide.IDE的用法示例。


在下文中一共展示了IDE.openEditorOnFileStore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openManifestForProject

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public static void openManifestForProject(IProject project) {
	File fileToOpen = new File(project.getFile("META-INF/MANIFEST.MF")
			.getLocation().toOSString());
	if (fileToOpen.exists() && fileToOpen.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(
				fileToOpen.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			// Put your exception handler here if you wish to
		}
	} else {
		// Do something if the file does not exist
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:19,代码来源:OpenEditor.java

示例2: openFile

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public static void openFile(File file) {
	if (file.exists() && file.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(
				file.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			// Put your exception handler here if you wish to
		}
	} else {
		// Do something if the file does not exist
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:17,代码来源:OpenEditor.java

示例3: openEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
private Container openEditor(IPath jobFilePath) throws CoreException {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if (!isJobAlreadyOpen(jobFilePath)) {
		if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath).exists()) {
			IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath);
			IDE.openEditor(page, iFile);
	} else {
		if (jobFilePath.toFile().exists()) {
			IFileStore fileStore = EFS.getLocalFileSystem().fromLocalFile(jobFilePath.toFile());
			IEditorInput store = new FileStoreEditorInput(fileStore);
			IDE.openEditorOnFileStore(page, fileStore);
		}
	}

	return SubJobUtility.getCurrentEditor().getContainer();
	}else
		MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error",
				"Unable to open subjob : "+jobFilePath.lastSegment()+" Subjob is already open \n" +
						"Please close the job and retry");
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:SubJobOpenAction.java

示例4: openFileInEclipseEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public static void openFileInEclipseEditor(File file) {
	if (file.exists() && file.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			Log.error("Could not display file: " + file.getAbsolutePath(), e);
		}
	} else {
		MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.OK);
		mb.setText("Alert");
		mb.setMessage("Could not find file: " + file.getAbsolutePath());
		mb.open();
	}
}
 
开发者ID:JReFrameworker,项目名称:JReFrameworker,代码行数:17,代码来源:WorkspaceUtils.java

示例5: openFile

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
public void openFile(final String path) throws Exception
{
    final IPath rcp_path = new Path(path);
    final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    final IFile file = root.getFile(rcp_path);
    if (file.exists())
    {   // Open workspace file.
        // Clear the last-used-editor info to always get the default editor,
        // the one configurable via Preferences, General, Editors, File Associations,
        // and not whatever one user may have used last via Navigator's "Open With..".
        // Other cases below use a new, local file that won't have last-used-editor info, yet
        file.setPersistentProperty(IDE.EDITOR_KEY, null);
        IDE.openEditor(page, file, true);
    }
    else
    {   // Open file that is outside of workspace
        final IFileStore localFile = EFS.getLocalFileSystem().getStore(rcp_path);
        IDE.openEditorOnFileStore(page, localFile);
    }
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:23,代码来源:RCP_JFXRepresentation.java

示例6: openEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public static final boolean openEditor(IFile file, String path) {
	try {
		if (file != null && path != null) {
			// String pathname = FileUtils.findRelativePath(rpath, path);
			FileResolver fileResolver = getFileResolver(file);

			File fileToBeOpened = fileResolver.resolveFile(path);
			
			if (file != null && fileToBeOpened != null && fileToBeOpened.exists() && fileToBeOpened.isFile()) {
				IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileToBeOpened.toURI());

				IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

				IDE.openEditorOnFileStore(page, fileStore);
				return true;
			}
		}
	} catch (PartInitException e) {
		e.printStackTrace();
	}
	return false;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:SelectionHelper.java

示例7: open

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public void open()
{
	try
	{
		final IFileStore store = EFS.getStore(document);
		// Now open an editor to this file (and highlight the occurrence if possible)
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		IEditorPart part = IDE.openEditorOnFileStore(page, store);
		// Now select the occurrence if we can
		IFindReplaceTarget target = (IFindReplaceTarget) part.getAdapter(IFindReplaceTarget.class);
		if (target != null && target.canPerformFind())
		{
			target.findAndSelect(0, searchString, true, caseSensitive, wholeWord);
		}
	}
	catch (Exception e)
	{
		IdeLog.logError(CommonEditorPlugin.getDefault(), e);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:EditorSearchHyperlink.java

示例8: openPdf

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
/**
 * open the file document which is refered to in the bibtex entry. The path
 * has to start from the root of the project where the bibtex entry is
 * included.
 */
private void openPdf() {
	IFile res = Utils.getIFilefromDocument(document);
	if (res == null || res.getProject() == null) {
		MessageDialog.openInformation(this.getSite().getShell(), "Bibtex" + document.getKey(), "Root or Resource not found");
		return;
	}
	IFile file = res.getProject().getFile(document.getFile());
	if (file.exists()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.getLocation());
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			e.printStackTrace();
		}
	} else {
		MessageDialog.openInformation(this.getSite().getShell(), "Bibtex" + document.getKey(), "Document not found");
	}
}
 
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:26,代码来源:BibtexEditor.java

示例9: open

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
public void open() {
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench == null) {
		return;
	}
	IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
	if (activeWorkbenchWindow == null) {
		return;
	}
	IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
	if (activePage == null) {
		return;
	}
	try {
		if (fileStore != null) {
			IDE.openEditorOnFileStore(activePage, fileStore);
			return;
		}
		if (gradleFile != null) {
			IDE.openEditor(activePage, gradleFile);
			return;
		}
	} catch (PartInitException e) {

	}
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:28,代码来源:GradleFileHyperlink.java

示例10: perfomeOK

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
protected void perfomeOK() throws Exception {
    try {
        final ProgressMonitorDialog monitor = new ProgressMonitorDialog(getShell());

        final ExportWithProgressManager manager = getExportWithProgressManager(settings.getExportSetting());

        manager.init(diagram, getBaseDir());

        final ExportManagerRunner runner = new ExportManagerRunner(manager);

        monitor.run(true, true, runner);

        if (runner.getException() != null) {
            throw runner.getException();
        }

        if (openAfterSavedButton != null && openAfterSavedButton.getSelection()) {
            final File openAfterSaved = openAfterSaved();

            final URI uri = openAfterSaved.toURI();

            final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

            if (openWithExternalEditor()) {
                IDE.openEditor(page, uri, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID, true);

            } else {
                final IFileStore fileStore = EFS.getStore(uri);
                IDE.openEditorOnFileStore(page, fileStore);
            }
        }

        // there is a case in another project
        diagram.getEditor().refreshProject();

    } catch (final InterruptedException e) {
        throw new InputException();
    }
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:41,代码来源:AbstractExportDialog.java

示例11: openFileEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
/**
 * Open an editor given a file
 * 
 * @param file
 * @throws TurnusException
 */
public static void openFileEditor(File file) throws TurnusException {
	if (file.exists() && file.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (Exception e) {
			throw new TurnusException("The editor cannot be opened for the file \"" + file + "\"", e);
		}
	} else {
		throw new TurnusException("The file \"" + file + "\" does not exist or is not a file");
	}
}
 
开发者ID:turnus,项目名称:turnus,代码行数:21,代码来源:EclipseUtils.java

示例12: openEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
private IEditorPart openEditor(IWorkbenchWindow window, IPath filePath) {
	IFileStore fileStore = EFS.getLocalFileSystem().getStore(filePath);
	IFileInfo fetchInfo = fileStore.fetchInfo();
	if (fetchInfo.isDirectory() || !fetchInfo.exists()) {
		return null;
	}
	IWorkbenchPage page = window.getActivePage();
	try {
		IEditorPart editorPart = IDE.openEditorOnFileStore(page, fileStore);
		return editorPart;
	} catch (PartInitException e) {
		return null;
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:15,代码来源:GotoExternalFileBookmark.java

示例13: openInEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public static IEditorPart openInEditor(File file, Integer startLine, Integer startOffset, Integer endLine,
		Integer endOffset, boolean activate) {
	IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(file.getPath()));
	IEditorPart editor = null;
	IWorkbenchPage page = TypeScriptUIPlugin.getActivePage();
	try {
		if (startLine != null && startLine > 0) {
			editor = IDE.openEditorOnFileStore(page, fileStore);
			ITextEditor textEditor = null;
			if (editor instanceof ITextEditor) {
				textEditor = (ITextEditor) editor;
			} else if (editor instanceof IAdaptable) {
				textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
			}
			if (textEditor != null) {
				IDocument document = textEditor.getDocumentProvider().getDocument(editor.getEditorInput());
				int start = DocumentUtils.getPosition(document, startLine, startOffset);
				int end = DocumentUtils.getPosition(document, endLine, endOffset);
				int length = end - start;
				textEditor.selectAndReveal(start, length);
				page.activate(editor);
			}
		} else {
			editor = IDE.openEditorOnFileStore(page, fileStore);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	return editor;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:31,代码来源:EditorUtils.java

示例14: openEditor

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
public IEditorPart openEditor(IWorkbenchPage page) throws PartInitException {
    if(file != null){
        return IDE.openEditorOnFileStore(page, file);
    }
    if(isOpenable()){
        IDE.openEditor(page, input, editorId);
    }
    return null;
}
 
开发者ID:iloveeclipse,项目名称:skin4eclipse,代码行数:10,代码来源:EditorInfo.java

示例15: makeHyperlink

import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
private static IHyperlink makeHyperlink(String absoluteFilePath, int lineNumber)
{
	return new IHyperlink()
	{

		@Override
		public void linkExited()
		{
		}

		@Override
		public void linkEntered()
		{
		}

		@Override
		public void linkActivated()
		{
			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
			try
			{
				IEditorPart editorPart = IDE.openEditorOnFileStore(page, EFS.getStore(new File(absoluteFilePath).toURI()));
				goToLine(editorPart, lineNumber);
			}
			catch (Exception exception)
			{
				throw new RuntimeException(exception);
			}
		}
	};
}
 
开发者ID:mjwach,项目名称:ErrorLinkyThing,代码行数:32,代码来源:ErrorLinkyPatternMatchListenerDelegate.java


注:本文中的org.eclipse.ui.ide.IDE.openEditorOnFileStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。