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


Java IStorageEditorInput类代码示例

本文整理汇总了Java中org.eclipse.ui.IStorageEditorInput的典型用法代码示例。如果您正苦于以下问题:Java IStorageEditorInput类的具体用法?Java IStorageEditorInput怎么用?Java IStorageEditorInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getEncoding

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
@Override
public String getEncoding(Object element) {
	String encoding = super.getEncoding(element);
	if (encoding == null && element instanceof IStorageEditorInput) {
		try {
			IStorage storage = ((IStorageEditorInput) element).getStorage();
			URI uri = storage2UriMapper.getUri(storage);
			if (uri != null) {
				encoding = encodingProvider.getEncoding(uri);
			} else if (storage instanceof IEncodedStorage) {
				encoding = ((IEncodedStorage)storage).getCharset();
			}
		} catch (CoreException e) {
			throw new WrappedException(e);
		}
	}
	return encoding;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:XtextDocumentProvider.java

示例2: openEditor

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
public static final void openEditor(String content, String name) {
	IStorageEditorInput input = streditors.get(content);
	if (input == null) {
		IStorage storage = new StringStorage(content);
		input = new StringInput(storage);
		streditors.put(content, input);
	}
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	if (window == null)
		window = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
	IWorkbenchPage page = window.getActivePage();
	try {
		IEditorReference[] er = page.findEditors(input, name, IWorkbenchPage.MATCH_INPUT);
		if (er != null)
			page.closeEditors(er, false);

		page.openEditor(input, name);
	} catch (PartInitException e) {
		UIUtils.showError(e);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:SelectionHelper.java

示例3: setPartName

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
/**
 * Set the part name based on the editor input.
 */
private void setPartName(final IEditorInput input) {
	String imageName = null;
	if (input instanceof IStorageEditorInput) {
		try {
			imageName = ((IStorageEditorInput) input).getStorage().getName();
		} catch (final CoreException ex) {
			// intentionally blank
		}
	}
	// this will catch ImageDataEditorInput as well
	if (imageName == null) {
		imageName = input.getName();
	}
	if (imageName == null) {
		imageName = getSite().getRegisteredName();
	}
	setPartName(imageName);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:22,代码来源:ImageViewer.java

示例4: getInputFromEditor

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
private Object getInputFromEditor(IEditorInput editorInput) {
	Object input= JavaUI.getEditorInputJavaElement(editorInput);
	if (input instanceof ICompilationUnit) {
		ICompilationUnit cu= (ICompilationUnit) input;
		if (!cu.getJavaProject().isOnClasspath(cu)) { // test needed for Java files in non-source folders (bug 207839)
			input= cu.getResource();
		}
	}
	if (input == null) {
		input= editorInput.getAdapter(IFile.class);
	}
	if (input == null && editorInput instanceof IStorageEditorInput) {
		try {
			input= ((IStorageEditorInput) editorInput).getStorage();
		} catch (CoreException e) {
			// ignore
		}
	}
	return input;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:PackageExplorerPart.java

示例5: PropertyKeyHyperlink

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
/**
 * Creates a new properties key hyperlink.
 *
 * @param region the region
 * @param key the properties key
 * @param editor the text editor
 */
public PropertyKeyHyperlink(IRegion region, String key, ITextEditor editor) {
	Assert.isNotNull(region);
	Assert.isNotNull(key);
	Assert.isNotNull(editor);

	fRegion= region;
	fPropertiesKey= key;
	fEditor= editor;
	fIsFileEditorInput= fEditor.getEditorInput() instanceof IFileEditorInput;
	IStorageEditorInput storageEditorInput= (IStorageEditorInput)fEditor.getEditorInput();
	fShell= fEditor.getEditorSite().getShell();
	try {
		fStorage= storageEditorInput.getStorage();
	} catch (CoreException e) {
		fStorage= null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:PropertyKeyHyperlink.java

示例6: isEclipseNLSAvailable

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
private static boolean isEclipseNLSAvailable(IStorageEditorInput editorInput) {
	IStorage storage;
	try {
		storage= editorInput.getStorage();
	} catch (CoreException ex) {
		return false;
	}
	if (!(storage instanceof IJarEntryResource))
		return false;

	IJavaProject javaProject= ((IJarEntryResource) storage).getPackageFragmentRoot().getJavaProject();

	if (javaProject == null || !javaProject.exists())
		return false;

	try {
		return javaProject.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$
	} catch (JavaModelException e) {
		return false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:PropertyKeyHyperlinkDetector.java

示例7: getAdapter

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
public Object getAdapter(Object element, Class key) {
	updateLazyLoadedAdapters();
	if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key) && element instanceof IEditorInput && JavaUI.getEditorInputJavaElement((IEditorInput)element) != null)
		return fSearchPageScoreComputer;

	if (IJavaElement.class.equals(key) && element instanceof IEditorInput) {
		IJavaElement je= JavaUI.getWorkingCopyManager().getWorkingCopy((IEditorInput)element);
		if (je != null)
			return je;
		if (element instanceof IStorageEditorInput) {
			try {
				return ((IStorageEditorInput)element).getStorage().getAdapter(key);
			} catch (CoreException ex) {
				// Fall through
			}
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:EditorInputAdapterFactory.java

示例8: PropertyKeyHyperlink

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
/**
 * Creates a new properties key hyperlink.
 *
 * @param region the region
 * @param key the properties key
 * @param editor the text editor
 */
public PropertyKeyHyperlink(IRegion region, String key, ITextEditor editor) {
	Assert.isNotNull(region);
	Assert.isNotNull(key);
	Assert.isNotNull(editor);

	fRegion= region;
	fPropertiesKey= key;
	fEditor= editor;
	IStorageEditorInput storageEditorInput= (IStorageEditorInput)fEditor.getEditorInput();
	fShell= fEditor.getEditorSite().getShell();
	try {
		fStorage= storageEditorInput.getStorage();
	} catch (CoreException e) {
		fStorage= null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:24,代码来源:PropertyKeyHyperlink.java

示例9: createModel

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
protected IBaseModel createModel(IEditorInput input) throws CoreException {
	BuildModel model = null;
	if (input instanceof IStorageEditorInput) {
		boolean isReconciling = input instanceof IFileEditorInput;
		IDocument document = getDocumentProvider().getDocument(input);
		model = new BuildModel(document, isReconciling);
		if (input instanceof IFileEditorInput) {
			IFile file = ((IFileEditorInput)input).getFile();
			model.setUnderlyingResource(file);
			model.setCharset(file.getCharset());
		/*} else if (input instanceof SystemFileEditorInput){
			File file = (File)((SystemFileEditorInput)input).getAdapter(File.class);
			model.setInstallLocation(file.getParent());
			model.setCharset(getDefaultCharset());*/
		} else {
			model.setCharset(getDefaultCharset());				
		}
		model.load();
	}
	return model;
}
 
开发者ID:patternbox,项目名称:patternbox-eclipse,代码行数:22,代码来源:DesignPatternInputContext.java

示例10: findContentTypesFromEditorInput

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
/**
 * Find the content types from the given {@link IDocument} by using
 * {@link IEditorInput} and null otherwise.
 * 
 * @param document
 * @return the content types from the given {@link IDocument} by using
 *         {@link IEditorInput} and null otherwise.
 */
private static ContentTypeInfo findContentTypesFromEditorInput(IDocument document) {
	IEditorInput editorInput = getEditorInput(document);
	if (editorInput != null) {
		if (editorInput instanceof IStorageEditorInput) {
			InputStream input = null;
			try {
				IStorage storage = ((IStorageEditorInput) editorInput).getStorage();
				String fileName = storage.getName();
				input = storage.getContents();
				return new ContentTypeInfo(fileName,
						Platform.getContentTypeManager().findContentTypesFor(input, fileName));
			} catch (Exception e) {
				return null;
			} finally {
				try {
					if (input != null)
						input.close();
				} catch (IOException x) {
				}
			}
		} else {
			// TODO: manage other type of IEditorInput
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:35,代码来源:ContentTypeHelper.java

示例11: initializeResourceObject

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
private void initializeResourceObject(IEditorInput editorInput) {
	if (editorInput instanceof FileEditorInput) {
		initializeResourceObjectFromFile((FileEditorInput) editorInput);
	} else if (editorInput instanceof IStorageEditorInput) {
		initializeResourceObjectFromStorage((IStorageEditorInput) editorInput);
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:8,代码来源:DwprofileEditor.java

示例12: openStream

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
private InputStream openStream(IEditorInput input) throws CoreException,
    IOException {
  if (input instanceof IStorageEditorInput) {
    final IStorage storage = ((IStorageEditorInput) input).getStorage();
    return storage.getContents();
  }
  if (input instanceof IURIEditorInput) {
    final URI uri = ((IURIEditorInput) input).getURI();
    return uri.toURL().openStream();
  }
  throw new IOException("Unsupported input type: " + input.getClass()); //$NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:13,代码来源:ExecutionDataContent.java

示例13: doFinish

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
/**
 * The worker method...
 */
private void doFinish(File scanDir, IProgressMonitor monitor) throws CoreException {
	
	monitor.beginTask("Creating analysis file", 3);
	monitor.worked(1);
	
	try {
		runTSVAnalysis(scanDir);
		monitor.worked(1);
		
		monitor.setTaskName("Opening results file...");
		getShell().getDisplay().asyncExec(new Runnable() {
			public void run() {
				
				IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
				
				try {
					IStorage storage = new TSVResultsStorage(getResultsString(), new Path("garbage"));
					IStorageEditorInput input = new TSVResultsInput(storage, "TSV Analysis");
					IDE.openEditor(page, input, "com.hybris.hyeclipse.tsv.editors.TSVEditor", true);
				}
				catch (PartInitException e) {
					e.printStackTrace();
				}
			}
		});
		monitor.worked(1);
	}
	catch (RuntimeException re) {
		System.out.println(re.getMessage());
	}
	
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:36,代码来源:RunTSVWizard.java

示例14: open

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
/**
 * Open the selected DfsPath in the editor window
 * 
 * @param selection
 * @throws JSchException
 * @throws IOException
 * @throws PartInitException
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
private void open(IStructuredSelection selection) throws IOException,
    PartInitException, InvocationTargetException, InterruptedException {

  for (DFSFile file : filterSelection(DFSFile.class, selection)) {

    IStorageEditorInput editorInput = new DFSFileEditorInput(file);
    targetPart.getSite().getWorkbenchWindow().getActivePage().openEditor(
        editorInput, "org.eclipse.ui.DefaultTextEditor");
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:DFSActionImpl.java

示例15: getEditorInputPath

import org.eclipse.ui.IStorageEditorInput; //导入依赖的package包/类
private IPath getEditorInputPath() {
	if (getEditor() == null)
		return null;

	IEditorInput input = getEditor().getEditorInput();
	if (input instanceof IStorageEditorInput) {
		try {
			return ((IStorageEditorInput) input).getStorage().getFullPath();
		} catch (CoreException ex) {
			TypeScriptUIPlugin.log(ex.getStatus());
		}
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:15,代码来源:AbstractAnnotationHover.java


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