use of org.eclipse.core.filesystem.IFileStore in project eclipse.platform.text by eclipse.
the class FileStoreFileBuffersForNonExistingExternalFiles method setReadOnly.
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
@Override
protected void setReadOnly(boolean state) throws Exception {
IFileStore fileStore = FileBuffers.getFileStoreAtLocation(getPath());
assertNotNull(fileStore);
fileStore.fetchInfo().setAttribute(EFS.ATTRIBUTE_READ_ONLY, state);
}
use of org.eclipse.core.filesystem.IFileStore in project linuxtools by eclipse.
the class OpenVagrantfileCommandHandler method executeInJob.
@Override
void executeInJob(IVagrantVM vm, IProgressMonitor monitor) {
Display.getDefault().asyncExec(() -> {
IWorkbenchPage activePage = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IPath vgFilePath = new Path(vm.directory().getAbsolutePath()).append(// $NON-NLS-1$
"Vagrantfile");
IFileStore file = EFS.getLocalFileSystem().getStore(vgFilePath);
try {
IDE.openEditorOnFileStore(activePage, file);
} catch (PartInitException e) {
Activator.log(e);
}
});
}
use of org.eclipse.core.filesystem.IFileStore in project linuxtools by eclipse.
the class KernelBrowserView method validateProxy.
private boolean validateProxy(IRemoteFileProxy proxy, String kernelSource) {
if (proxy == null) {
return false;
}
IFileStore fs = proxy.getResource(kernelSource);
if (fs == null) {
return false;
}
IFileInfo info = fs.fetchInfo();
if (info == null) {
return false;
}
if (!info.exists()) {
return false;
}
return true;
}
use of org.eclipse.core.filesystem.IFileStore in project linuxtools by eclipse.
the class KernelSourceAction method run.
/**
* The main code body for this action. Causes one of the following to occur:
* <ul>
* <li>If the selected node is clickable, as specified in <code>TreeNode.isClickable</code>
* the browser creates an instance of <code>CEditor</code> on the file specified in the selection
* (<code>KernelBrowserView</code>'s tree only marks clickable on files, not folders) and
* opens it on the current window</li>
* <li>If the selected node is not clickable, the code runs the action specified in
* <code>TreeExpandCollapseAction</code></li>
* @see org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.c.CEditor
* @see TreeNode#isClickable()
* @see TreeExpandCollapseAction
*/
@Override
public void run() {
IWorkbench wb = PlatformUI.getWorkbench();
Object o = getSelectedElement();
if (o instanceof TreeNode) {
TreeNode t = (TreeNode) o;
if (t.isClickable()) {
IFileStore fs = (IFileStore) t.getData();
if (fs != null) {
IEditorInput input = new FileStoreEditorInput(fs);
try {
wb.getActiveWorkbenchWindow().getActivePage().openEditor(input, CDT_EDITOR_ID);
} catch (PartInitException e) {
// $NON-NLS-1$
ExceptionErrorDialog.openError(Localization.getString("KernelSourceAction.CantOpenEditor"), e);
}
}
} else {
runExpandAction();
}
}
}
use of org.eclipse.core.filesystem.IFileStore in project linuxtools by eclipse.
the class KernelSourceTree method buildKernelTree.
/**
* Builds the kernel tree from file parameter direct and stores the excluded string array.
*
* @param locationURI The URI to include into the tree.
* @param excluded The string array to store as excluded.
* @param proxy The proxy to be used to get the remote files
* @param monitor a progress monitor for this operation. Can be null.
* @throws CoreException If traversing the tree fails.
*
* @since 1.1
*/
public void buildKernelTree(URI locationURI, String[] excluded, IRemoteFileProxy proxy, IProgressMonitor monitor) throws CoreException {
if (excluded != null) {
this.excluded = Arrays.copyOf(excluded, excluded.length);
}
IFileStore fs = proxy.getResource(locationURI.getPath());
if (fs == null) {
kernelTree = null;
} else {
kernelTree = new TreeNode(fs, fs.getName(), false);
addLevel(kernelTree, monitor);
}
}
Aggregations