當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。