mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-08 19:13:27 +02:00
minor refactoring changes
eclipse file system changes
This commit is contained in:
parent
84e14e782e
commit
8f7646f9be
23 changed files with 680 additions and 85 deletions
|
@ -12,6 +12,8 @@ Require-Bundle: org.eclipse.ui,
|
||||||
org.eclipse.rse.services,
|
org.eclipse.rse.services,
|
||||||
org.eclipse.rse.files.ui,
|
org.eclipse.rse.files.ui,
|
||||||
org.eclipse.core.resources,
|
org.eclipse.core.resources,
|
||||||
org.eclipse.rse.ui
|
org.eclipse.rse.ui,
|
||||||
|
org.eclipse.ui.ide,
|
||||||
|
org.eclipse.rse.core
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
Bundle-Vendor: Eclipse.org
|
Bundle-Vendor: Eclipse.org
|
||||||
|
|
|
@ -23,4 +23,38 @@ Contributors:
|
||||||
<run class="org.eclipse.rse.eclipse.filesystem.RSEFileSystem"/>
|
<run class="org.eclipse.rse.eclipse.filesystem.RSEFileSystem"/>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
</extension>
|
</extension>
|
||||||
</plugin>
|
<extension
|
||||||
|
id="org.eclipse.rse.eclipse.filesystemSupport"
|
||||||
|
point="org.eclipse.ui.ide.filesystemSupport">
|
||||||
|
<filesystemContributor
|
||||||
|
scheme="rse"
|
||||||
|
class="org.eclipse.rse.eclipse.filesystem.RSEFileSystemContributor"
|
||||||
|
label="RSE">
|
||||||
|
</filesystemContributor>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.rse.ui.popupMenus">
|
||||||
|
<objectContribution
|
||||||
|
adaptable="false"
|
||||||
|
subsystemfactoryCategory="files"
|
||||||
|
typefilter="folder"
|
||||||
|
id="org.eclipse.rse.eclipse.filesystem.createproject.">
|
||||||
|
<visibility>
|
||||||
|
<and>
|
||||||
|
<objectClass name="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/>
|
||||||
|
</and>
|
||||||
|
</visibility>
|
||||||
|
|
||||||
|
<action
|
||||||
|
label="Create Remote Project"
|
||||||
|
tooltip="%ImportToProject.tooltip"
|
||||||
|
class="org.eclipse.rse.eclipse.filesystem.ui.actions.CreateRemoteProjectActionDelegate"
|
||||||
|
menubarPath="group.importexport"
|
||||||
|
enablesFor="1"
|
||||||
|
id="importToProject">
|
||||||
|
</action>
|
||||||
|
</objectContribution>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
|
|
@ -16,7 +16,14 @@
|
||||||
|
|
||||||
package org.eclipse.rse.eclipse.filesystem;
|
package org.eclipse.rse.eclipse.filesystem;
|
||||||
|
|
||||||
|
import org.eclipse.core.filesystem.provider.FileSystem;
|
||||||
|
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.ui.internal.Workbench;
|
||||||
|
import org.eclipse.ui.internal.ide.filesystem.FileSystemSupportRegistry;
|
||||||
|
import org.eclipse.ui.internal.registry.UIExtensionTracker;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
@ -40,6 +47,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
*/
|
*/
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
|
RSECorePlugin.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,18 +16,29 @@
|
||||||
|
|
||||||
package org.eclipse.rse.eclipse.filesystem;
|
package org.eclipse.rse.eclipse.filesystem;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import org.eclipse.core.filesystem.EFS;
|
||||||
import org.eclipse.core.filesystem.IFileInfo;
|
import org.eclipse.core.filesystem.IFileInfo;
|
||||||
import org.eclipse.core.filesystem.IFileStore;
|
import org.eclipse.core.filesystem.IFileStore;
|
||||||
import org.eclipse.core.filesystem.provider.FileInfo;
|
import org.eclipse.core.filesystem.provider.FileInfo;
|
||||||
import org.eclipse.core.filesystem.provider.FileStore;
|
import org.eclipse.core.filesystem.provider.FileStore;
|
||||||
|
import org.eclipse.core.internal.filesystem.Messages;
|
||||||
|
import org.eclipse.core.internal.filesystem.Policy;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
|
import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
|
||||||
|
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
|
||||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
|
||||||
|
@ -69,10 +80,15 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
|
||||||
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
|
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
|
||||||
{
|
{
|
||||||
FileInfo info = new FileInfo(getName());
|
FileInfo info = new FileInfo(getName());
|
||||||
info.setExists(true);
|
info.setExists(_remoteFile.exists());
|
||||||
info.setLastModified(_remoteFile.getLastModified());
|
info.setLastModified(_remoteFile.getLastModified());
|
||||||
boolean isDir = _remoteFile.isDirectory();
|
boolean isDir = _remoteFile.isDirectory();
|
||||||
info.setDirectory(isDir);
|
info.setDirectory(isDir);
|
||||||
|
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, !_remoteFile.canWrite());
|
||||||
|
info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, _remoteFile.isExecutable());
|
||||||
|
info.setAttribute(EFS.ATTRIBUTE_ARCHIVE, _remoteFile.isArchive());
|
||||||
|
info.setAttribute(EFS.ATTRIBUTE_HIDDEN, _remoteFile.isHidden());
|
||||||
|
|
||||||
if (!isDir)
|
if (!isDir)
|
||||||
{
|
{
|
||||||
info.setLength(_remoteFile.getLength());
|
info.setLength(_remoteFile.getLength());
|
||||||
|
@ -81,6 +97,149 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
|
||||||
info.setName(getName());
|
info.setName(getName());
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return _remoteFile.getName();
|
||||||
|
}
|
||||||
|
public IFileStore getParent()
|
||||||
|
{
|
||||||
|
if (_parent == null)
|
||||||
|
{
|
||||||
|
_parent = new RSEFileStoreRemoteFileWrapper(null, _remoteFile.getParentRemoteFile());
|
||||||
|
}
|
||||||
|
return _parent;
|
||||||
|
}
|
||||||
|
public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
|
||||||
|
{
|
||||||
|
if (_remoteFile.exists())
|
||||||
|
{
|
||||||
|
IFile file = null;
|
||||||
|
if (_remoteFile.isFile() && _remoteFile.getParentRemoteFileSubSystem().isConnected())
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
SystemEditableRemoteFile editable = new SystemEditableRemoteFile(_remoteFile);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
editable.download(monitor);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
file = editable.getLocalResource();
|
||||||
|
*/
|
||||||
|
if (_remoteFile.getName().equals(".project"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// only temp file has contents
|
||||||
|
file = (IFile)UniversalFileTransferUtility.getTempFileFor(_remoteFile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file == null || !file.exists())
|
||||||
|
{
|
||||||
|
file = UniversalFileTransferUtility.copyRemoteFileToWorkspace(_remoteFile, monitor);
|
||||||
|
file.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file = (IFile)UniversalFileTransferUtility.getTempFileFor(_remoteFile);
|
||||||
|
}
|
||||||
|
// if (!file.isSynchronized(IFile.DEPTH_ZERO))
|
||||||
|
// file.refreshLocal(IFile.DEPTH_ZERO, monitor);
|
||||||
|
return file.getContents();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public URI toURI()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return new URI("rse", _remoteFile.getParentRemoteFileSubSystem().getHost().getHostName(), _remoteFile.getAbsolutePath(), null); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
catch (URISyntaxException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
|
||||||
|
{
|
||||||
|
if (!_remoteFile.exists())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_remoteFile.getParentRemoteFileSubSystem().createFolder(_remoteFile);
|
||||||
|
_remoteFile = _remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(_remoteFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
|
||||||
|
monitor = Policy.monitorFor(monitor);
|
||||||
|
File file = null;
|
||||||
|
try {
|
||||||
|
// create temp file first
|
||||||
|
if (!_remoteFile.exists())
|
||||||
|
{
|
||||||
|
_remoteFile.getParentRemoteFileSubSystem().createFile(_remoteFile);
|
||||||
|
_remoteFile = _remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(_remoteFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
SystemEditableRemoteFile editable = new SystemEditableRemoteFile(_remoteFile);
|
||||||
|
editable.download(monitor);
|
||||||
|
IFile localFile = editable.getLocalResource();
|
||||||
|
file = localFile.getLocation().toFile();
|
||||||
|
|
||||||
|
monitor.beginTask(null, 1);
|
||||||
|
|
||||||
|
return new FileOutputStream(file, (options & EFS.APPEND) != 0);
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException e)
|
||||||
|
{
|
||||||
|
//checkReadOnlyParent(file, e);
|
||||||
|
String message;
|
||||||
|
String path = _remoteFile.getAbsolutePath();
|
||||||
|
if (file.isDirectory())
|
||||||
|
message = NLS.bind(Messages.notAFile, path);
|
||||||
|
else
|
||||||
|
message = NLS.bind(Messages.couldNotWrite, path);
|
||||||
|
Policy.error(EFS.ERROR_WRITE, message, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IFileStore getChild(IPath path)
|
||||||
|
{
|
||||||
|
IFileStore result = this;
|
||||||
|
for (int i = 0, imax = path.segmentCount(); i < imax; i++)
|
||||||
|
{
|
||||||
|
String segment = path.segment(i);
|
||||||
|
result = result.getChild(segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public IFileStore getChild(String name)
|
public IFileStore getChild(String name)
|
||||||
{
|
{
|
||||||
if (!_remoteFile.isStale() && _remoteFile.hasContents(RemoteChildrenContentsType.getInstance(), name))
|
if (!_remoteFile.isStale() && _remoteFile.hasContents(RemoteChildrenContentsType.getInstance(), name))
|
||||||
|
@ -90,41 +249,53 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
|
||||||
{
|
{
|
||||||
return FileStoreConversionUtility.convert(_parent, (IRemoteFile)children[0]);
|
return FileStoreConversionUtility.convert(_parent, (IRemoteFile)children[0]);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
IRemoteFile[] children = _remoteFile.getParentRemoteFileSubSystem().listFoldersAndFiles(_remoteFile, name);
|
|
||||||
if (children != null && children.length > 0)
|
|
||||||
{
|
{
|
||||||
return FileStoreConversionUtility.convert(_parent, children[0]);
|
// need empty one
|
||||||
}
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile child = _remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(_remoteFile, name);
|
||||||
|
return FileStoreConversionUtility.convert(_parent, child);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_remoteFile.isDirectory())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile child = _remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(_remoteFile, name);
|
||||||
|
return FileStoreConversionUtility.convert(_parent, child);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return _remoteFile.getName();
|
|
||||||
}
|
|
||||||
public IFileStore getParent()
|
|
||||||
{
|
|
||||||
return _parent;
|
|
||||||
}
|
|
||||||
public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException
|
|
||||||
{
|
|
||||||
IFile file = UniversalFileTransferUtility.copyRemoteFileToWorkspace(_remoteFile, monitor);
|
|
||||||
return file.getContents();
|
|
||||||
}
|
|
||||||
|
|
||||||
public URI toURI()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return new URI("rse", _remoteFile.getAbsolutePath(), null); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
catch (URISyntaxException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException
|
||||||
|
{
|
||||||
|
if (_remoteFile.exists())
|
||||||
|
{
|
||||||
|
IResource file = null;
|
||||||
|
if (_remoteFile.isFile() && _remoteFile.getParentRemoteFileSubSystem().isConnected())
|
||||||
|
{
|
||||||
|
file = UniversalFileTransferUtility.copyRemoteFileToWorkspace(_remoteFile, monitor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file = UniversalFileTransferUtility.getTempFileFor(_remoteFile);
|
||||||
|
}
|
||||||
|
// if (!file.isSynchronized(IFile.DEPTH_ZERO))
|
||||||
|
// file.refreshLocal(IFile.DEPTH_ZERO, monitor);
|
||||||
|
return file.getLocation().toFile();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -17,18 +17,36 @@
|
||||||
package org.eclipse.rse.eclipse.filesystem;
|
package org.eclipse.rse.eclipse.filesystem;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.eclipse.core.filesystem.IFileStore;
|
import org.eclipse.core.filesystem.IFileStore;
|
||||||
import org.eclipse.core.filesystem.provider.FileSystem;
|
import org.eclipse.core.filesystem.provider.FileSystem;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.rse.model.IHost;
|
import org.eclipse.rse.model.IHost;
|
||||||
import org.eclipse.rse.model.ISystemRegistry;
|
import org.eclipse.rse.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
|
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.internal.Workbench;
|
||||||
|
|
||||||
public class RSEFileSystem extends FileSystem
|
public class RSEFileSystem extends FileSystem
|
||||||
{
|
{
|
||||||
|
private static RSEFileSystem _instance = new RSEFileSystem();
|
||||||
|
private HashMap _fileStoreMap;
|
||||||
|
|
||||||
|
public RSEFileSystem()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
_fileStoreMap = new HashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RSEFileSystem getInstance()
|
||||||
|
{
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canDelete()
|
public boolean canDelete()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,7 +57,7 @@ public class RSEFileSystem extends FileSystem
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHost getConnectionFor(String hostName)
|
public static IHost getConnectionFor(String hostName)
|
||||||
{
|
{
|
||||||
ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
|
ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
|
||||||
IHost[] connections = sr.getHosts();
|
IHost[] connections = sr.getHosts();
|
||||||
|
@ -54,8 +72,24 @@ public class RSEFileSystem extends FileSystem
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IRemoteFileSubSystem getRemoteFileSubSystem(IHost host)
|
||||||
|
{
|
||||||
|
return RemoteFileUtility.getFileSubSystem(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
public URI getURIFor(IRemoteFile file)
|
||||||
|
{
|
||||||
|
IFileStore fstore = FileStoreConversionUtility.convert(null, file);
|
||||||
|
return fstore.toURI();
|
||||||
|
}
|
||||||
|
|
||||||
public IFileStore getStore(URI uri)
|
public IFileStore getStore(URI uri)
|
||||||
{
|
{
|
||||||
|
Object obj = _fileStoreMap.get(uri);
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
return (IFileStore)obj;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String path = uri.getPath();
|
String path = uri.getPath();
|
||||||
|
@ -63,10 +97,38 @@ public class RSEFileSystem extends FileSystem
|
||||||
IHost con = getConnectionFor(hostName);
|
IHost con = getConnectionFor(hostName);
|
||||||
if (con != null)
|
if (con != null)
|
||||||
{
|
{
|
||||||
IRemoteFileSubSystem fs = RemoteFileUtility.getFileSubSystem(con);
|
IRemoteFileSubSystem fs = getRemoteFileSubSystem(con);
|
||||||
if (fs != null)
|
if (fs != null)
|
||||||
{
|
{
|
||||||
return FileStoreConversionUtility.convert(null, fs.getRemoteFileObject(path));
|
|
||||||
|
if (!fs.isConnected())
|
||||||
|
{
|
||||||
|
|
||||||
|
Shell shell = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
shell = RSEUIPlugin.getActiveWorkbenchShell();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shell == null)
|
||||||
|
{
|
||||||
|
shell = new Shell();
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.getConnectorService().promptForPassword(shell, false);
|
||||||
|
fs.getConnectorService().connect(new NullProgressMonitor());
|
||||||
|
//fs.connect(shell);
|
||||||
|
}
|
||||||
|
if (fs.isConnected())
|
||||||
|
{
|
||||||
|
IFileStore fstore = FileStoreConversionUtility.convert(null, fs.getRemoteFileObject(path));
|
||||||
|
_fileStoreMap.put(uri, fstore);
|
||||||
|
return fstore;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package org.eclipse.rse.eclipse.filesystem;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
|
import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog;
|
||||||
|
import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog;
|
||||||
|
import org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog;
|
||||||
|
import org.eclipse.rse.model.IHost;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.ide.fileSystem.FileSystemContributor;
|
||||||
|
import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils;
|
||||||
|
|
||||||
|
public class RSEFileSystemContributor extends FileSystemContributor {
|
||||||
|
|
||||||
|
|
||||||
|
public URI browseFileSystem(String initialPath, Shell shell)
|
||||||
|
{
|
||||||
|
SystemRemoteFolderDialog dlg = new SystemRemoteFolderDialog(shell, "Select Folder");
|
||||||
|
|
||||||
|
|
||||||
|
//SystemSelectRemoteFileOrFolderDialog dlg = new SystemSelectRemoteFileOrFolderDialog(shell, "Select File", false);
|
||||||
|
/*
|
||||||
|
DirectoryDialog dialog = new DirectoryDialog(shell);
|
||||||
|
dialog
|
||||||
|
.setMessage(IDEWorkbenchMessages.ProjectLocationSelectionDialog_directoryLabel);
|
||||||
|
*/
|
||||||
|
if (!initialPath.equals(IDEResourceInfoUtils.EMPTY_STRING))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
URI uri = new URI(initialPath);
|
||||||
|
IHost host = RSEFileSystem.getConnectionFor(uri.getHost());
|
||||||
|
IRemoteFileSubSystem fs = RSEFileSystem.getRemoteFileSubSystem(host);
|
||||||
|
dlg.setInputObject(fs.getRemoteFileObject(uri.getPath()));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg.setNeedsProgressMonitor(true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
String selectedDirectory = dialog.open();
|
||||||
|
if (selectedDirectory == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new File(selectedDirectory).toURI();
|
||||||
|
*/
|
||||||
|
if (dlg.open() == dlg.OK)
|
||||||
|
{
|
||||||
|
IRemoteFile file = (IRemoteFile)dlg.getSelectedObject();
|
||||||
|
String path = file.getAbsolutePath();
|
||||||
|
IHost host = dlg.getSelectedConnection();
|
||||||
|
String hostName = host.getHostName();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return new URI("rse", hostName, path, null);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public URI getURI(String string){
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return new URI(string);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,181 @@
|
||||||
|
package org.eclipse.rse.eclipse.filesystem.ui.actions;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.core.internal.resources.ProjectDescription;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.rse.core.SystemBasePlugin;
|
||||||
|
import org.eclipse.rse.eclipse.filesystem.RSEFileSystem;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.IActionDelegate;
|
||||||
|
import org.eclipse.ui.IWorkbench;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class CreateRemoteProjectActionDelegate implements IActionDelegate {
|
||||||
|
|
||||||
|
protected IStructuredSelection fSelection;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||||
|
*/
|
||||||
|
public void run(IAction action)
|
||||||
|
{
|
||||||
|
IRemoteFile directory = (IRemoteFile)fSelection.getFirstElement();
|
||||||
|
createRemoteProject(directory, new NullProgressMonitor());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private IProject createRemoteProject(IRemoteFile directory, IProgressMonitor monitor)
|
||||||
|
{
|
||||||
|
|
||||||
|
IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot();
|
||||||
|
|
||||||
|
IProject editProject = root.getProject(directory.getName());
|
||||||
|
|
||||||
|
if ((editProject != null) && (editProject.exists()) && (editProject.isOpen()))
|
||||||
|
{
|
||||||
|
return editProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editProject == null)
|
||||||
|
{
|
||||||
|
// log error and throw an exception
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IProjectDescription description = root.getWorkspace().newProjectDescription(directory.getName());
|
||||||
|
URI location = RSEFileSystem.getInstance().getURIFor(directory);
|
||||||
|
description.setLocationURI(location);
|
||||||
|
|
||||||
|
editProject.create(description, monitor);
|
||||||
|
|
||||||
|
editProject.open(monitor);
|
||||||
|
|
||||||
|
editProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (CoreException e)
|
||||||
|
{
|
||||||
|
SystemBasePlugin.logError("Error creating temp project", e);
|
||||||
|
}
|
||||||
|
return editProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the selection. The selection is only set if given a structured selection, otherwise it is set to an
|
||||||
|
* empty structured selection.
|
||||||
|
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
||||||
|
*/
|
||||||
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
|
|
||||||
|
if (selection instanceof IStructuredSelection) {
|
||||||
|
fSelection = (IStructuredSelection)selection;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fSelection = StructuredSelection.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the remote file in the selection.
|
||||||
|
* Use this method if this action allows only a single remote file selection.
|
||||||
|
* @return the single remote file.
|
||||||
|
*/
|
||||||
|
protected IRemoteFile getRemoteFile(IStructuredSelection selection) {
|
||||||
|
return (IRemoteFile)selection.getFirstElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the remote files in the selection.
|
||||||
|
* Use this method if this action allows multiple remote file selection.
|
||||||
|
* @return an array of remote files.
|
||||||
|
*/
|
||||||
|
protected IRemoteFile[] getRemoteFiles(IStructuredSelection selection) {
|
||||||
|
|
||||||
|
IRemoteFile[] files = new IRemoteFile[selection.size()];
|
||||||
|
Iterator iter = selection.iterator();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
files[i++] = (IRemoteFile)iter.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the description file for the first description file in
|
||||||
|
* the selection. Use this method if this action allows only
|
||||||
|
* a single file selection.
|
||||||
|
* @return the single description file.
|
||||||
|
*/
|
||||||
|
protected IFile getDescriptionFile(IStructuredSelection selection) {
|
||||||
|
return (IFile)selection.getFirstElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a description file for each description file in
|
||||||
|
* the selection. Use this method if this action allows multiple
|
||||||
|
* selection.
|
||||||
|
* @return an array of description files.
|
||||||
|
*/
|
||||||
|
protected IFile[] getDescriptionFiles(IStructuredSelection selection) {
|
||||||
|
IFile[] files = new IFile[selection.size()];
|
||||||
|
Iterator iter = selection.iterator();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
files[i++] = (IFile)iter.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the workbench.
|
||||||
|
* @return the workbench.
|
||||||
|
*/
|
||||||
|
protected IWorkbench getWorkbench() {
|
||||||
|
return PlatformUI.getWorkbench();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the active shell.
|
||||||
|
* @return the active shell.
|
||||||
|
*/
|
||||||
|
protected Shell getShell() {
|
||||||
|
return Display.getDefault().getActiveShell();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the selection.
|
||||||
|
* @return the selection.
|
||||||
|
*/
|
||||||
|
protected IStructuredSelection getSelection() {
|
||||||
|
return fSelection;
|
||||||
|
}
|
||||||
|
}
|
|
@ -192,6 +192,10 @@ public class SystemIFileProperties implements ISystemTextEditorConstants, ISyste
|
||||||
catch( NumberFormatException ex ){
|
catch( NumberFormatException ex ){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,10 +32,12 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.rse.core.SystemBasePlugin;
|
import org.eclipse.rse.core.SystemBasePlugin;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
||||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
|
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
|
||||||
|
@ -309,6 +311,8 @@ public class SystemRemoteEditManager
|
||||||
|
|
||||||
description.setNatureIds(newNatures);
|
description.setNatureIds(newNatures);
|
||||||
editProject.setDescription(description, null);
|
editProject.setDescription(description, null);
|
||||||
|
editProject.setDefaultCharset(SystemEncodingUtil.ENCODING_UTF_8, new NullProgressMonitor());
|
||||||
|
|
||||||
|
|
||||||
// add java support
|
// add java support
|
||||||
//addJavaSupport(editProject);
|
//addJavaSupport(editProject);
|
||||||
|
|
|
@ -136,9 +136,10 @@ public class UniversalFileTransferUtility
|
||||||
// copy remote file to workspace
|
// copy remote file to workspace
|
||||||
srcFS.download(srcFileOrFolder, tempFile, SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
srcFS.download(srcFileOrFolder, tempFile, SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
||||||
|
|
||||||
if (!tempFile.exists())
|
if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
|
||||||
{
|
{
|
||||||
tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
|
tempFile.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||||
|
//tempFile.refreshLocal(IResource.DEPTH_ZERO, null/*monitor*/);
|
||||||
}
|
}
|
||||||
if (tempFile.exists())
|
if (tempFile.exists())
|
||||||
{
|
{
|
||||||
|
@ -153,7 +154,14 @@ public class UniversalFileTransferUtility
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tempFile.setCharset(SystemEncodingUtil.ENCODING_UTF_8, null/*monitor*/);
|
String cset = tempFile.getCharset();
|
||||||
|
if (!cset.equals(SystemEncodingUtil.ENCODING_UTF_8))
|
||||||
|
{
|
||||||
|
|
||||||
|
//System.out.println("charset ="+cset);
|
||||||
|
//System.out.println("tempfile ="+tempFile.getFullPath());
|
||||||
|
tempFile.setCharset(SystemEncodingUtil.ENCODING_UTF_8, monitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -206,10 +206,18 @@ public class SystemViewRemoteFileAdapter
|
||||||
xlatedSize = SystemViewResources.RESID_PROPERTY_FILE_SIZE_VALUE;
|
xlatedSize = SystemViewResources.RESID_PROPERTY_FILE_SIZE_VALUE;
|
||||||
xlatedCompressedSize = SystemViewResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE;
|
xlatedCompressedSize = SystemViewResources.RESID_PROPERTY_VIRTUALFILE_COMPRESSEDSIZE_VALUE;
|
||||||
xlatedExpandedSize = SystemViewResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE;
|
xlatedExpandedSize = SystemViewResources.RESID_PROPERTY_ARCHIVE_EXPANDEDSIZE_VALUE;
|
||||||
|
|
||||||
IWorkbench workbench = RSEUIPlugin.getDefault().getWorkbench();
|
}
|
||||||
if (workbench != null)
|
|
||||||
registry = workbench.getEditorRegistry();
|
private IEditorRegistry getEditorRegistry()
|
||||||
|
{
|
||||||
|
if (registry == null)
|
||||||
|
{
|
||||||
|
IWorkbench workbench = RSEUIPlugin.getDefault().getWorkbench();
|
||||||
|
if (workbench != null)
|
||||||
|
registry = workbench.getEditorRegistry();
|
||||||
|
}
|
||||||
|
return registry;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Constructor for folders or files only
|
* Constructor for folders or files only
|
||||||
|
@ -503,8 +511,8 @@ public class SystemViewRemoteFileAdapter
|
||||||
{
|
{
|
||||||
IRemoteFile file = (IRemoteFile) element;
|
IRemoteFile file = (IRemoteFile) element;
|
||||||
if (file.isFile() || file.isArchive()) // hack to show zips without folder icons
|
if (file.isFile() || file.isArchive()) // hack to show zips without folder icons
|
||||||
{
|
{
|
||||||
return registry.getImageDescriptor(file.getName());
|
return getEditorRegistry().getImageDescriptor(file.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -574,29 +574,19 @@ public class FileClassifier extends Thread
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
byte[] readBytes = new byte[1024];
|
||||||
|
|
||||||
// find out how many bytes are available to be read
|
// find out how many bytes are available to be read
|
||||||
int available = stream.available();
|
int available = stream.available();
|
||||||
while (available > -1)
|
while (available > -1)
|
||||||
{
|
{
|
||||||
// if there's none, wait a bit and return true to continue
|
|
||||||
if (available == 0)
|
|
||||||
{
|
|
||||||
sleep(100);
|
|
||||||
available = stream.available();
|
|
||||||
if (available == 0)
|
|
||||||
return _lines;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] readBytes = new byte[available];
|
|
||||||
|
|
||||||
// read the available bytes
|
// read the available bytes
|
||||||
int numRead = stream.read(readBytes, 0, available);
|
int numRead = stream.read(readBytes, 0, 1024);
|
||||||
|
|
||||||
// if we've reached end of stream, quit
|
// if we've reached end of stream, quit
|
||||||
if (numRead == -1)
|
if (numRead == -1)
|
||||||
{
|
{
|
||||||
return null;
|
return _lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -623,28 +613,28 @@ public class FileClassifier extends Thread
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i< tokens.length; i++)
|
for (int i = 0; i< tokens.length; i++)
|
||||||
{
|
{
|
||||||
_lines.add(tokens[i]);
|
_lines.add(tokens[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
e.printStackTrace();
|
||||||
available = stream.available();
|
}
|
||||||
|
available = stream.available();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _lines;
|
return _lines;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String readLine(DataInputStream stream, String encoding) throws Exception
|
protected String readLine(DataInputStream stream, String encoding) throws Exception
|
||||||
{
|
{
|
||||||
if (_lines.size() == 0)
|
if (_lines.size() == 0)
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.dstore.core.model.DataElement;
|
||||||
import org.eclipse.dstore.core.model.DataStore;
|
import org.eclipse.dstore.core.model.DataStore;
|
||||||
import org.eclipse.dstore.core.model.DataStoreAttributes;
|
import org.eclipse.dstore.core.model.DataStoreAttributes;
|
||||||
import org.eclipse.dstore.core.model.DataStoreResources;
|
import org.eclipse.dstore.core.model.DataStoreResources;
|
||||||
|
import org.eclipse.dstore.core.model.IDataStoreConstants;
|
||||||
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
||||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||||
import org.eclipse.rse.dstore.universal.miners.filesystem.UniversalByteStreamHandler;
|
import org.eclipse.rse.dstore.universal.miners.filesystem.UniversalByteStreamHandler;
|
||||||
|
@ -604,6 +605,12 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
||||||
String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile;
|
String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile;
|
||||||
|
|
||||||
DataElement de = getElementFor(remotePath);
|
DataElement de = getElementFor(remotePath);
|
||||||
|
if (de.getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
|
||||||
|
{
|
||||||
|
// need to refetch
|
||||||
|
DStoreHostFile hostFile = (DStoreHostFile)getFile(monitor, remoteParent, remoteFile);
|
||||||
|
de = hostFile._element;
|
||||||
|
}
|
||||||
long fileLength = DStoreHostFile.getFileLength(de.getSource());
|
long fileLength = DStoreHostFile.getFileLength(de.getSource());
|
||||||
|
|
||||||
|
|
||||||
|
@ -1127,6 +1134,11 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
||||||
|
|
||||||
String normalizedPath = PathUtility.normalizeUnknown(path);
|
String normalizedPath = PathUtility.normalizeUnknown(path);
|
||||||
DataElement element = (DataElement)_fileElementMap.get(normalizedPath);
|
DataElement element = (DataElement)_fileElementMap.get(normalizedPath);
|
||||||
|
if (element != null && element.isDeleted())
|
||||||
|
{
|
||||||
|
_fileElementMap.remove(normalizedPath);
|
||||||
|
element = null;
|
||||||
|
}
|
||||||
if (element == null || element.isDeleted())
|
if (element == null || element.isDeleted())
|
||||||
{
|
{
|
||||||
DataElement universaltemp = getMinerElement();
|
DataElement universaltemp = getMinerElement();
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class DStoreHostFile implements IHostFile
|
||||||
String type = _element.getType();
|
String type = _element.getType();
|
||||||
if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
|
if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
|
||||||
{
|
{
|
||||||
return parentPath;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length() == 0)
|
if (name.length() == 0)
|
||||||
|
|
|
@ -101,11 +101,13 @@ public class DStoreStatusMonitor implements IDomainListener
|
||||||
_workingStatuses = new ArrayList();
|
_workingStatuses = new ArrayList();
|
||||||
_doneStatuses = new ArrayList();
|
_doneStatuses = new ArrayList();
|
||||||
_cancelledStatuses = new ArrayList();
|
_cancelledStatuses = new ArrayList();
|
||||||
|
if (_dataStore != null)
|
||||||
|
{
|
||||||
IDomainNotifier notifier = _dataStore.getDomainNotifier();
|
IDomainNotifier notifier = _dataStore.getDomainNotifier();
|
||||||
if (notifier != null)
|
if (notifier != null)
|
||||||
{
|
{
|
||||||
notifier.addDomainListener(this);
|
notifier.addDomainListener(this);
|
||||||
}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataStore getDataStore()
|
public DataStore getDataStore()
|
||||||
|
|
|
@ -38,7 +38,10 @@ import org.eclipse.ui.IEditorRegistry;
|
||||||
import org.eclipse.ui.IFileEditorMapping;
|
import org.eclipse.ui.IFileEditorMapping;
|
||||||
import org.eclipse.ui.IMemento;
|
import org.eclipse.ui.IMemento;
|
||||||
import org.eclipse.ui.IPropertyListener;
|
import org.eclipse.ui.IPropertyListener;
|
||||||
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.XMLMemento;
|
import org.eclipse.ui.XMLMemento;
|
||||||
|
import org.eclipse.ui.activities.WorkbenchActivityHelper;
|
||||||
|
import org.eclipse.ui.internal.Workbench;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,10 +108,14 @@ public class SystemFileTransferModeRegistry
|
||||||
// editor registry. We can be out of sync because we may not have
|
// editor registry. We can be out of sync because we may not have
|
||||||
// been listening for editor registry changes (e.g. if our plugin wasn't
|
// been listening for editor registry changes (e.g. if our plugin wasn't
|
||||||
// started while those changes were made).
|
// started while those changes were made).
|
||||||
IEditorRegistry registry = RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
|
IWorkbench wb = Workbench.getInstance();
|
||||||
syncWithEditorRegistry(registry);
|
if (wb != null)
|
||||||
|
{
|
||||||
|
IEditorRegistry registry = wb.getEditorRegistry();
|
||||||
|
syncWithEditorRegistry(registry);
|
||||||
|
|
||||||
registry.addPropertyListener(this);
|
registry.addPropertyListener(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ Contributors:
|
||||||
{Name} (company) - description of contribution.
|
{Name} (company) - description of contribution.
|
||||||
-->
|
-->
|
||||||
<?eclipse version="3.1"?>
|
<?eclipse version="3.1"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
@ -31,7 +31,7 @@ Contributors:
|
||||||
vendor="IBM Corp"
|
vendor="IBM Corp"
|
||||||
id="dstore.files">
|
id="dstore.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
<!--
|
|
||||||
<configuration
|
<configuration
|
||||||
systemTypes="Windows"
|
systemTypes="Windows"
|
||||||
name="%Files"
|
name="%Files"
|
||||||
|
@ -43,7 +43,7 @@ Contributors:
|
||||||
vendor="IBM Corp"
|
vendor="IBM Corp"
|
||||||
id="dstore.windows.files">
|
id="dstore.windows.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
-->
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
|
@ -70,7 +70,7 @@ public class RSEUIPlugin extends SystemBasePlugin
|
||||||
{
|
{
|
||||||
public static final String PLUGIN_ID = "org.eclipse.rse.ui";
|
public static final String PLUGIN_ID = "org.eclipse.rse.ui";
|
||||||
public static final String HELPPREFIX = "org.eclipse.rse.ui.";
|
public static final String HELPPREFIX = "org.eclipse.rse.ui.";
|
||||||
|
|
||||||
public static final boolean INCLUDE_LOCAL_YES = true;
|
public static final boolean INCLUDE_LOCAL_YES = true;
|
||||||
public static final boolean INCLUDE_LOCAL_NO = false;
|
public static final boolean INCLUDE_LOCAL_NO = false;
|
||||||
private static RSEUIPlugin inst = null;
|
private static RSEUIPlugin inst = null;
|
||||||
|
|
|
@ -352,9 +352,12 @@ public class RemoteSystemsPreferencePage
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IRSESystemType sysType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemType);
|
IRSESystemType sysType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemType);
|
||||||
RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)(sysType.getAdapter(IRSESystemType.class));
|
Object adapter = sysType.getAdapter(IRSESystemType.class);
|
||||||
if (sysTypeAdapter != null)
|
if (adapter instanceof RSESystemTypeAdapter)
|
||||||
|
{
|
||||||
|
RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)adapter;
|
||||||
return sysTypeAdapter.getDefaultUserId(sysType);
|
return sysTypeAdapter.getDefaultUserId(sysType);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,8 @@ public class SystemRegistry implements ISystemRegistry, ISystemModelChangeEvents
|
||||||
preferenceListManager = new SystemPreferenceChangeManager();
|
preferenceListManager = new SystemPreferenceChangeManager();
|
||||||
|
|
||||||
// get initial shell
|
// get initial shell
|
||||||
getShell(); // will quietly fail in headless mode. Phil
|
//FIXME - this can cause problems - don't think we should do this here anyway
|
||||||
|
//getShell(); // will quietly fail in headless mode. Phil
|
||||||
|
|
||||||
registry = this;
|
registry = this;
|
||||||
restore();
|
restore();
|
||||||
|
|
|
@ -356,7 +356,8 @@ public class RSEPersistenceManager implements IRSEPersistenceManager
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
project.refreshLocal(IResource.DEPTH_ONE, null);
|
if (!project.isSynchronized(IResource.DEPTH_ONE))
|
||||||
|
project.refreshLocal(IResource.DEPTH_ONE, null);
|
||||||
IResource[] folders = project.members();
|
IResource[] folders = project.members();
|
||||||
for (int f = 0; f < folders.length; f++)
|
for (int f = 0; f < folders.length; f++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -564,12 +564,14 @@ Contributors:
|
||||||
<property name="icon" value="icons/full/obj16/system400_obj.gif"/>
|
<property name="icon" value="icons/full/obj16/system400_obj.gif"/>
|
||||||
<property name="iconLive" value="icons/full/obj16/system400live_obj.gif"/>
|
<property name="iconLive" value="icons/full/obj16/system400live_obj.gif"/>
|
||||||
</systemType>
|
</systemType>
|
||||||
|
-->
|
||||||
<systemType id="org.eclipse.rse.systemtype.windows"
|
<systemType id="org.eclipse.rse.systemtype.windows"
|
||||||
name="Windows"
|
name="Windows"
|
||||||
description="%systemType.windows">
|
description="%systemType.windows">
|
||||||
<property name="icon" value="icons/full/obj16/systemwin_obj.gif"/>
|
<property name="icon" value="icons/full/obj16/systemwin_obj.gif"/>
|
||||||
<property name="iconLive" value="icons/full/obj16/systemwinlive_obj.gif"/>
|
<property name="iconLive" value="icons/full/obj16/systemwinlive_obj.gif"/>
|
||||||
</systemType>
|
</systemType>
|
||||||
|
<!--
|
||||||
<systemType id="org.eclipse.rse.systemtype.zseries"
|
<systemType id="org.eclipse.rse.systemtype.zseries"
|
||||||
name="z/OS"
|
name="z/OS"
|
||||||
description="%systemType.zseries">
|
description="%systemType.zseries">
|
||||||
|
|
|
@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
@ -248,11 +249,22 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
if (headlessSet && headless) // already been here?
|
if (headlessSet && headless) // already been here?
|
||||||
return wb;
|
return wb;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
wb = super.getWorkbench();
|
wb = super.getWorkbench();
|
||||||
headless = false;
|
headless = false;
|
||||||
} catch (Exception exc)
|
} catch (Exception exc)
|
||||||
{
|
{
|
||||||
headless = true;
|
IDEWorkbenchAdvisor advisor = new IDEWorkbenchAdvisor();
|
||||||
|
PlatformUI.createAndRunWorkbench(Display.getDefault(), advisor);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
wb = super.getWorkbench();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
headless = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
headlessSet = true;
|
headlessSet = true;
|
||||||
return wb;
|
return wb;
|
||||||
|
|
Loading…
Add table
Reference in a new issue