本文整理汇总了Java中org.eclipse.core.filesystem.EFS.getStore方法的典型用法代码示例。如果您正苦于以下问题:Java EFS.getStore方法的具体用法?Java EFS.getStore怎么用?Java EFS.getStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filesystem.EFS
的用法示例。
在下文中一共展示了EFS.getStore方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSystemFileContexts
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
/**
* Adapted from {@link ProductEditor}, replacing references to
* {@link ProductInputContext}.
*/
@Override
protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) {
File file = new File(input.getURI());
if (file != null) {
String name = file.getName();
if (name.endsWith(".product")) {
IFileStore store;
try {
store = EFS.getStore(file.toURI());
IEditorInput in = new FileStoreEditorInput(store);
manager.putContext(in, new ProductXMLInputContext(this, in, true));
} catch (CoreException e) {
PDEPlugin.logException(e);
}
}
}
}
示例2: checkProjectName
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
/**
* Checks whether debug virtual project can be created.
* @param projectNameTry desired project name
* @return project project with parameters data or null if project with desired name cannot be
* created
*/
private static ProjectCheckData checkProjectName(String projectNameTry) throws CoreException {
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectNameTry);
if (project.exists()) {
URI projectURI = project.getLocationURI();
if (!ChromiumScriptFileSystem.isChromiumDebugURI(projectURI)) {
// This is not our project. Do not touch it.
return null;
}
}
IPath newPath = project.getFullPath();
final URI projectUriTry = ChromiumScriptFileSystem.getFileStoreUri(newPath);
IFileStore projectStore = EFS.getStore(projectUriTry);
if (projectStore.fetchInfo().exists()) {
return null;
}
return new ProjectCheckData() {
public IProject getProject() {
return project;
}
public URI getProjectUri() {
return projectUriTry;
}
};
}
示例3: deleteVirtualProjectAsync
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
/**
* Removes virtual project which was created for debug session. Does its job
* asynchronously.
*/
public static void deleteVirtualProjectAsync(final IProject debugProject) {
Job job = new Job("Remove virtual project") {
@Override
protected IStatus run(IProgressMonitor monitor) {
URI projectUri = debugProject.getLocationURI();
try {
IFileStore projectStore = EFS.getStore(projectUri);
if (projectStore.fetchInfo().exists()) {
projectStore.delete(EFS.NONE, null);
}
debugProject.delete(true, null);
} catch (CoreException e) {
ChromiumDebugPlugin.log(e);
return new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
"Failed to delete virtual project");
}
return Status.OK_STATUS;
}
};
job.schedule();
}
示例4: index
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
/**
* If a build path entry is added, we schedule a job to make sure the entry gets indexed (or it's index is
* up-to-date).
*
* @param entry
*/
private void index(IBuildPathEntry entry)
{
try
{
IFileStore fileStore = EFS.getStore(entry.getPath());
if (fileStore != null)
{
if (fileStore.fetchInfo().isDirectory())
{
new IndexContainerJob(entry.getDisplayName(), entry.getPath()).schedule();
}
else
{
new IndexFileJob(entry.getDisplayName(), entry.getPath()).schedule();
}
}
}
catch (Throwable e)
{
IdeLog.logError(BuildPathCorePlugin.getDefault(), e);
}
}
示例5: toFileStores
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
protected Set<IFileStore> toFileStores(IProgressMonitor monitor)
{
SubMonitor sub = SubMonitor.convert(monitor, files.size());
Set<IFileStore> fileStores = new HashSet<IFileStore>(files.size());
for (IFile file : files)
{
try
{
IFileStore store = EFS.getStore(file.getLocationURI());
if (store == null)
{
continue;
}
fileStores.add(store);
}
catch (CoreException e)
{
IdeLog.logError(IndexPlugin.getDefault(), e);
}
finally
{
sub.worked(1);
}
}
return fileStores;
}
示例6: open
import org.eclipse.core.filesystem.EFS; //导入方法依赖的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);
}
}
示例7: perfomeOK
import org.eclipse.core.filesystem.EFS; //导入方法依赖的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();
}
}
示例8: getLocalFile
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
static File getLocalFile(URI uri) {
if (uri != null) {
try {
IFileStore store = EFS.getStore(uri);
if(store != null) {
return store.toLocalFile(EFS.NONE,
new NullProgressMonitor());
}
} catch (CoreException e) {
// ignore
}
}
return null;
}
示例9: selectImageFromWorkspace
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
private void selectImageFromWorkspace() {
FilteredResourcesSelectionDialog fd = new FilteredResourcesSelectionDialog(Display.getCurrent().getActiveShell(),
false, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
fd.setInitialPattern("*.png");//$NON-NLS-1$
if (fd.open() == Dialog.OK) {
IFile file = (IFile) fd.getFirstResult();
IFile contextfile = (IFile) jConfig.get(FileUtils.KEY_FILE);
String filepath = null;
if (contextfile != null && file.getProject().equals(contextfile.getProject()))
filepath = file.getProjectRelativePath().toPortableString().replaceAll(file.getProject().getName() + "/", ""); //$NON-NLS-1$ //$NON-NLS-2$
else
filepath = file.getRawLocationURI().toASCIIString();
txtResourcePath.setText(filepath);
try {
IFileStore imgFileStore = EFS.getStore(file.getLocationURI());
loadImagePreview(file.getLocation().toOSString(), imgFileStore);
// Change the standard separator with an universal one
imageExpressionText = file.getLocation().toOSString()
.replace(System.getProperty("file.separator").charAt(0), '/');
} catch (CoreException e) {
UIUtils.showError(e);
}
} else {
// no image selected
txtResourcePath.setText(""); //$NON-NLS-1$
grpImagePreviewLayout.topControl = cmpNoImgPreview;
grpImagePreview.layout();
}
}
示例10: indexProjectBuildPaths
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
/**
* Grabs the list of {@link IBuildPathEntry}s for a project and make sure the indices for them are up-to-date.
*
* @param monitor
*/
private void indexProjectBuildPaths(IProgressMonitor monitor)
{
IProject project = getProjectHandle();
Set<IBuildPathEntry> entries = getBuildPathManager().getBuildPaths(project);
SubMonitor sub = SubMonitor.convert(monitor, entries.size());
for (IBuildPathEntry entry : entries)
{
try
{
IFileStore fileStore = EFS.getStore(entry.getPath());
if (fileStore != null)
{
if (fileStore.fetchInfo().isDirectory())
{
new IndexContainerJob(entry.getDisplayName(), entry.getPath()).run(sub.newChild(1));
}
else
{
new IndexFileJob(entry.getDisplayName(), entry.getPath()).run(sub.newChild(1));
}
}
}
catch (Throwable e)
{
IdeLog.logError(BuildPathCorePlugin.getDefault(), e);
}
}
}
示例11: perfomeOK
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
@Override
protected void perfomeOK() throws Exception {
try {
ProgressMonitorDialog monitor = new ProgressMonitorDialog(
this.getShell());
ExportWithProgressManager manager = this
.getExportWithProgressManager(this.settings
.getExportSetting());
manager.init(this.diagram, this.getBaseDir());
ExportManagerRunner runner = new ExportManagerRunner(manager);
monitor.run(true, true, runner);
if (runner.getException() != null) {
throw runner.getException();
}
if (this.openAfterSavedButton != null
&& this.openAfterSavedButton.getSelection()) {
File openAfterSaved = this.openAfterSaved();
URI uri = openAfterSaved.toURI();
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
if (this.openWithExternalEditor()) {
IDE.openEditor(page, uri,
IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID, true);
} else {
IFileStore fileStore = EFS.getStore(uri);
IDE.openEditorOnFileStore(page, fileStore);
}
}
// there is a case in another project
this.diagram.getEditor().refreshProject();
} catch (InterruptedException e) {
throw new InputException();
}
}
示例12: getRoot
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
public IFileStore getRoot() throws CoreException
{
return EFS.getStore(getRootURI());
}
示例13: loadAsDirectory
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
protected IPath loadAsDirectory(IPath x, String... extensions)
{
File packageJSON = x.append(PACKAGE_JSON).toFile();
if (packageJSON.isFile())
{
try
{
IFileStore fileStore = EFS.getStore(packageJSON.toURI());
String rawJSON = IOUtil.read(fileStore.openInputStream(EFS.NONE, new NullProgressMonitor()));
@SuppressWarnings("rawtypes")
Map json = (Map) JSON.parse(rawJSON);
String mainFile = (String) json.get(MAIN);
if (!StringUtil.isEmpty(mainFile))
{
// package.json may not have a 'main' property set
IPath m = x.append(mainFile);
IPath result = loadAsFile(m);
if (result != null)
{
return result;
}
}
}
catch (CoreException e)
{
IdeLog.log(JSCorePlugin.getDefault(), e.getStatus());
}
}
// If package.json doesn't point to a main file, fall back to index.js
List<String> ext = CollectionsUtil.newList(extensions);
ext.add(0, JS);
IPath index = x.append(INDEX);
for (String extension : ext)
{
IPath potential = index.addFileExtension(extension);
if (potential.toFile().isFile())
{
return potential;
}
}
return null;
}
示例14: getContainerFileStore
import org.eclipse.core.filesystem.EFS; //导入方法依赖的package包/类
protected IFileStore getContainerFileStore() throws CoreException
{
return EFS.getStore(getContainerURI());
}