mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 04:55:22 +02:00
[209828] fix: Need to move the Create operation to a job.
This commit is contained in:
parent
ee4f4bb453
commit
e525f4b1a4
6 changed files with 225 additions and 84 deletions
|
@ -14,14 +14,18 @@
|
||||||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||||
* Rupen Mardirossian (IBM) - [187530] Commented out line 192, in order to stop logging of SystemMessageException
|
* Rupen Mardirossian (IBM) - [187530] Commented out line 192, in order to stop logging of SystemMessageException
|
||||||
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
* Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
|
||||||
|
* Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.wizards;
|
package org.eclipse.rse.internal.files.ui.wizards;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.WorkspaceJob;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
||||||
|
@ -62,6 +66,75 @@ public class SystemNewFileWizard
|
||||||
|
|
||||||
private static final String CLASSNAME = "SystemNewFileWizard"; //$NON-NLS-1$
|
private static final String CLASSNAME = "SystemNewFileWizard"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private class CreateNewFileJob extends WorkspaceJob
|
||||||
|
{
|
||||||
|
IRemoteFile parentFolder = null;
|
||||||
|
String name = null;
|
||||||
|
String absName = null;
|
||||||
|
String message = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CreateNewFileJob job.
|
||||||
|
* @param message text used as the title of the job
|
||||||
|
*/
|
||||||
|
public CreateNewFileJob(IRemoteFile parentFolder, String name, String absName, String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
this.parentFolder = parentFolder;
|
||||||
|
this.name = name;
|
||||||
|
this.absName = absName;
|
||||||
|
this.message = message;
|
||||||
|
setUser(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IStatus runInWorkspace(IProgressMonitor monitor)
|
||||||
|
{
|
||||||
|
boolean ok = true;
|
||||||
|
IStatus status = Status.OK_STATUS;
|
||||||
|
SystemMessage msg;
|
||||||
|
IRemoteFileSubSystem rfss = parentFolder.getParentRemoteFileSubSystem();
|
||||||
|
|
||||||
|
// ok, proceed with actual creation...
|
||||||
|
IRemoteFile newFile = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile newFilePath = rfss.getRemoteFileObject(parentFolder, name, monitor);
|
||||||
|
newFile = rfss.createFile(newFilePath, monitor);
|
||||||
|
}
|
||||||
|
catch (RemoteFileIOException exc )
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FILE_FAILED_EXIST)).makeSubstitution(absName);
|
||||||
|
SystemMessageDialog.displayErrorMessage(null, msg);
|
||||||
|
}
|
||||||
|
catch (RemoteFileSecurityException e)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FILE_FAILED)).makeSubstitution(absName);
|
||||||
|
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileSecurityException "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
SystemMessageDialog.displayErrorMessage(null, msg);
|
||||||
|
}
|
||||||
|
catch (SystemMessageException exc)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
|
status = Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
SystemMessageDialog.displayErrorMessage(null, exc.getSystemMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
updateGUI(parentFolder, newFile, getViewer(), isInputAFilter(), getSelectedFilterReference());
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -128,7 +201,6 @@ public class SystemNewFileWizard
|
||||||
IRemoteFile parentFolder = mainPage.getParentFolder();
|
IRemoteFile parentFolder = mainPage.getParentFolder();
|
||||||
String name = mainPage.getfileName();
|
String name = mainPage.getfileName();
|
||||||
String absName = getNewAbsoluteName(parentFolder, name);
|
String absName = getNewAbsoluteName(parentFolder, name);
|
||||||
IRemoteFileSubSystem rfss = parentFolder.getParentRemoteFileSubSystem();
|
|
||||||
if (!parentFolder.exists())
|
if (!parentFolder.exists())
|
||||||
{
|
{
|
||||||
/* Be nice to do this someday...
|
/* Be nice to do this someday...
|
||||||
|
@ -172,39 +244,12 @@ public class SystemNewFileWizard
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// ok, proceed with actual creation...
|
// ok, proceed with actual creation...
|
||||||
IRemoteFile newFile = null;
|
SystemMessage createMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CREATEFILEGENERIC_PROGRESS);
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
createMessage.makeSubstitution(name);
|
||||||
try {
|
CreateNewFileJob createNewFileJob = new CreateNewFileJob(parentFolder, name, absName, createMessage.getLevelOneText());
|
||||||
IRemoteFile newFilePath = rfss.getRemoteFileObject(parentFolder, name, monitor);
|
createNewFileJob.schedule();
|
||||||
newFile = rfss.createFile(newFilePath, monitor);
|
|
||||||
} catch (RemoteFileIOException exc ) {
|
|
||||||
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FILE_FAILED_EXIST)).makeSubstitution(absName);
|
|
||||||
mainPage.setMessage(msg);
|
|
||||||
ok = false;
|
|
||||||
//DY } catch (Exception RemoteFileSecurityException) {
|
|
||||||
} catch (RemoteFileSecurityException e) {
|
|
||||||
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FILE_FAILED)).makeSubstitution(absName);
|
|
||||||
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileSecurityException "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
//SystemMessage.displayErrorMessage(SystemMessage.getDefaultShell(), msg);
|
|
||||||
mainPage.setMessage(msg);
|
|
||||||
ok = false;
|
|
||||||
} catch (SystemMessageException e) {
|
|
||||||
//SystemBasePlugin.logError(CLASSNAME+ ":", e); //$NON-NLS-1$
|
|
||||||
mainPage.setMessage(e.getSystemMessage());
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return ok;
|
|
||||||
if (ok)
|
|
||||||
updateGUI(parentFolder, newFile, getViewer(), isInputAFilter(), getSelectedFilterReference());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
return ok;
|
||||||
ok = false;
|
|
||||||
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,12 +13,15 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||||
* David Dykstal (IBM) - [188718] fix error messages showing up as info messages on wizard page
|
* David Dykstal (IBM) - [188718] fix error messages showing up as info messages on wizard page
|
||||||
|
* Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.wizards;
|
package org.eclipse.rse.internal.files.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.WorkspaceJob;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||||
import org.eclipse.rse.internal.files.ui.FileResources;
|
import org.eclipse.rse.internal.files.ui.FileResources;
|
||||||
|
@ -46,6 +49,75 @@ public class SystemNewFolderWizard
|
||||||
|
|
||||||
private static final String CLASSNAME = "SystemNewFolderWizard"; //$NON-NLS-1$
|
private static final String CLASSNAME = "SystemNewFolderWizard"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private class CreateNewFolderJob extends WorkspaceJob
|
||||||
|
{
|
||||||
|
IRemoteFile parentFolder = null;
|
||||||
|
String name = null;
|
||||||
|
String absName = null;
|
||||||
|
String message = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CreateNewFileJob job.
|
||||||
|
* @param message text used as the title of the job
|
||||||
|
*/
|
||||||
|
public CreateNewFolderJob(IRemoteFile parentFolder, String name, String absName, String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
this.parentFolder = parentFolder;
|
||||||
|
this.name = name;
|
||||||
|
this.absName = absName;
|
||||||
|
this.message = message;
|
||||||
|
setUser(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IStatus runInWorkspace(IProgressMonitor monitor)
|
||||||
|
{
|
||||||
|
boolean ok = true;
|
||||||
|
IStatus status = Status.OK_STATUS;
|
||||||
|
SystemMessage msg;
|
||||||
|
IRemoteFileSubSystem rfss = parentFolder.getParentRemoteFileSubSystem();
|
||||||
|
|
||||||
|
// ok, proceed with actual creation...
|
||||||
|
IRemoteFile newFolder = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile newFolderPath = rfss.getRemoteFileObject(absName, monitor);
|
||||||
|
newFolder = rfss.createFolder(newFolderPath, monitor);
|
||||||
|
}
|
||||||
|
catch (RemoteFileIOException exc )
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote file "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FOLDER_FAILED_EXIST)).makeSubstitution(absName);
|
||||||
|
SystemMessageDialog.displayErrorMessage(null, msg);
|
||||||
|
}
|
||||||
|
catch (RemoteFileSecurityException e)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FOLDER_FAILED)).makeSubstitution(absName);
|
||||||
|
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileSecurityException "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
SystemMessageDialog.displayErrorMessage(null, msg);
|
||||||
|
}
|
||||||
|
catch (SystemMessageException exc)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
{
|
||||||
|
status = Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
SystemMessageDialog.displayErrorMessage(null, exc.getSystemMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
SystemNewFileWizard.updateGUI(parentFolder, newFolder, getViewer(), isInputAFilter(), getSelectedFilterReference());
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -111,7 +183,6 @@ public class SystemNewFolderWizard
|
||||||
IRemoteFile parentFolder = mainPage.getParentFolder();
|
IRemoteFile parentFolder = mainPage.getParentFolder();
|
||||||
String name = mainPage.getfolderName();
|
String name = mainPage.getfolderName();
|
||||||
String absName = SystemNewFileWizard.getNewAbsoluteName(parentFolder, name);
|
String absName = SystemNewFileWizard.getNewAbsoluteName(parentFolder, name);
|
||||||
IRemoteFileSubSystem rfss = parentFolder.getParentRemoteFileSubSystem();
|
|
||||||
if (!parentFolder.exists())
|
if (!parentFolder.exists())
|
||||||
{
|
{
|
||||||
/* Be nice to do this someday...
|
/* Be nice to do this someday...
|
||||||
|
@ -154,44 +225,16 @@ public class SystemNewFolderWizard
|
||||||
if (!meetsFilterCriteria(getSelectedFilterReference(), parentFolder, absName))
|
if (!meetsFilterCriteria(getSelectedFilterReference(), parentFolder, absName))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IRemoteFile newFolder = null;
|
|
||||||
//IRemoteFile newFolderPath = null;
|
// ok, proceed with actual creation...
|
||||||
try {
|
SystemMessage createMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CREATEFOLDERGENERIC_PROGRESS);
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
createMessage.makeSubstitution(name);
|
||||||
IRemoteFile newFolderPath = rfss.getRemoteFileObject(absName, monitor);
|
CreateNewFolderJob createNewFolderJob = new CreateNewFolderJob(parentFolder, name, absName, createMessage.getLevelOneText());
|
||||||
newFolder = rfss.createFolder(newFolderPath, monitor);
|
createNewFolderJob.schedule();
|
||||||
} catch (RemoteFileIOException exc ) {
|
|
||||||
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileIOException " ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
if (exc.getRemoteException() instanceof SystemMessageException)
|
|
||||||
{
|
|
||||||
msg = ((SystemMessageException)exc.getRemoteException()).getSystemMessage();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FOLDER_FAILED_EXIST)).makeSubstitution(absName);
|
|
||||||
}
|
|
||||||
mainPage.setErrorMessage(msg);
|
|
||||||
ok = false;
|
|
||||||
// DY } catch (Exception RemoteFileSecurityException) {
|
|
||||||
} catch (RemoteFileSecurityException e) {
|
|
||||||
SystemBasePlugin.logDebugMessage(CLASSNAME+ ":", " Creating remote folder "+ absName + " failed with RemoteFileSecurityException "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
msg = (RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_FOLDER_FAILED)).makeSubstitution(absName);
|
|
||||||
//SystemMessage.displayErrorMessage(SystemMessage.getDefaultShell(), msg);
|
|
||||||
mainPage.setErrorMessage(msg);
|
|
||||||
ok = false;
|
|
||||||
} catch (SystemMessageException e) {
|
|
||||||
SystemBasePlugin.logError(CLASSNAME+ ":", e); //$NON-NLS-1$
|
|
||||||
mainPage.setErrorMessage(e.getSystemMessage());
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok)
|
|
||||||
SystemNewFileWizard.updateGUI(parentFolder, newFolder, getViewer(), isInputAFilter(), getSelectedFilterReference());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
return ok;
|
||||||
ok = false;
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Test if the new file/folder will meet the filtering criteria of the selected filter.
|
* Test if the new file/folder will meet the filtering criteria of the selected filter.
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
||||||
* Kevin Doyle (IBM) - [209355] Retrieving list of FILE_TYPE_FOLDERS should return Archive's
|
* Kevin Doyle (IBM) - [209355] Retrieving list of FILE_TYPE_FOLDERS should return Archive's
|
||||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||||
|
* Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.local.files;
|
package org.eclipse.rse.internal.services.local.files;
|
||||||
|
@ -204,7 +205,6 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
int a = 0;
|
|
||||||
while(!monitor.isCanceled() && !archiveOperationMonitor.isDone())
|
while(!monitor.isCanceled() && !archiveOperationMonitor.isDone())
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -866,7 +866,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
{
|
{
|
||||||
if (ArchiveHandlerManager.isVirtual(fileToCreate.getAbsolutePath()))
|
if (ArchiveHandlerManager.isVirtual(fileToCreate.getAbsolutePath()))
|
||||||
{
|
{
|
||||||
return createFileInArchive(fileToCreate);
|
return createFileInArchive(fileToCreate, monitor);
|
||||||
}
|
}
|
||||||
else if (!parentFile.exists())
|
else if (!parentFile.exists())
|
||||||
{
|
{
|
||||||
|
@ -899,7 +899,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
return new LocalHostFile(fileToCreate);
|
return new LocalHostFile(fileToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LocalVirtualHostFile createFileInArchive(File newFile) throws SystemMessageException
|
protected LocalVirtualHostFile createFileInArchive(File newFile, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
VirtualChild child = ArchiveHandlerManager.getInstance().getVirtualObject(newFile.getAbsolutePath());
|
VirtualChild child = ArchiveHandlerManager.getInstance().getVirtualObject(newFile.getAbsolutePath());
|
||||||
ISystemArchiveHandler handler = child.getHandler();
|
ISystemArchiveHandler handler = child.getHandler();
|
||||||
|
@ -907,10 +907,25 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
throwCorruptArchiveException(this.getClass() + ".createFileInArchive()"); //$NON-NLS-1$
|
throwCorruptArchiveException(this.getClass() + ".createFileInArchive()"); //$NON-NLS-1$
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!handler.createFile(child.fullName, null))
|
ISystemOperationMonitor archiveOperationMonitor = null;
|
||||||
|
if (null != monitor)
|
||||||
{
|
{
|
||||||
//SystemPlugin.logError("LocalFileSubSystemImpl.createFileInArchive(): Archive Handler's createFile method returned false. Couldn't create virtual object.");
|
archiveOperationMonitor = new SystemOperationMonitor();
|
||||||
throw new SystemMessageException(getMessage("RSEG1124").makeSubstitution(newFile)); //$NON-NLS-1$
|
CheckArchiveOperationStatusThread checkArchiveOperationStatusThread = new CheckArchiveOperationStatusThread(archiveOperationMonitor, monitor);
|
||||||
|
checkArchiveOperationStatusThread.start();
|
||||||
|
}
|
||||||
|
boolean ok = handler.createFile(child.fullName, archiveOperationMonitor);
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
if (null != monitor && monitor.isCanceled())
|
||||||
|
{
|
||||||
|
//This operation has been canceled by the user.
|
||||||
|
throw new SystemMessageException(getMessage("RSEG1067")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
SystemMessage msg = getMessage("RSEG1124"); //$NON-NLS-1$
|
||||||
|
msg.makeSubstitution(newFile);
|
||||||
|
throw new SystemMessageException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new LocalVirtualHostFile(child);
|
return new LocalVirtualHostFile(child);
|
||||||
|
@ -942,7 +957,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
{
|
{
|
||||||
if (ArchiveHandlerManager.isVirtual(folderToCreate.getAbsolutePath()))
|
if (ArchiveHandlerManager.isVirtual(folderToCreate.getAbsolutePath()))
|
||||||
{
|
{
|
||||||
return createFolderInArchive(folderToCreate);
|
return createFolderInArchive(folderToCreate, monitor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -957,16 +972,34 @@ public class LocalFileService extends AbstractFileService implements IFileServic
|
||||||
return new LocalHostFile(folderToCreate);
|
return new LocalHostFile(folderToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LocalVirtualHostFile createFolderInArchive(File newFolder) throws SystemMessageException
|
protected LocalVirtualHostFile createFolderInArchive(File newFolder, IProgressMonitor monitor) throws SystemMessageException
|
||||||
{
|
{
|
||||||
VirtualChild child = ArchiveHandlerManager.getInstance().getVirtualObject(newFolder.getAbsolutePath());
|
VirtualChild child = ArchiveHandlerManager.getInstance().getVirtualObject(newFolder.getAbsolutePath());
|
||||||
ISystemArchiveHandler handler = child.getHandler();
|
ISystemArchiveHandler handler = child.getHandler();
|
||||||
if (handler == null)
|
if (handler == null)
|
||||||
throwCorruptArchiveException(this.getClass() + ".createFolderInArchive()"); //$NON-NLS-1$
|
throwCorruptArchiveException(this.getClass() + ".createFolderInArchive()"); //$NON-NLS-1$
|
||||||
else if (!handler.createFolder(child.fullName, null))
|
else
|
||||||
{
|
{
|
||||||
// SystemPlugin.logError("LocalFileSubSystemImpl.createFolderInArchive(): Archive Handler's createFolder method returned false. Couldn't create virtual object.");
|
ISystemOperationMonitor archiveOperationMonitor = null;
|
||||||
throw new SystemMessageException(getMessage("RSEG1124").makeSubstitution(newFolder)); //$NON-NLS-1$
|
if (null != monitor)
|
||||||
|
{
|
||||||
|
archiveOperationMonitor = new SystemOperationMonitor();
|
||||||
|
CheckArchiveOperationStatusThread checkArchiveOperationStatusThread = new CheckArchiveOperationStatusThread(archiveOperationMonitor, monitor);
|
||||||
|
checkArchiveOperationStatusThread.start();
|
||||||
|
}
|
||||||
|
boolean ok = handler.createFolder(child.fullName, archiveOperationMonitor);
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
if (null != monitor && monitor.isCanceled())
|
||||||
|
{
|
||||||
|
//This operation has been canceled by the user.
|
||||||
|
throw new SystemMessageException(getMessage("RSEG1067")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
SystemMessage msg = getMessage("RSEG1124"); //$NON-NLS-1$
|
||||||
|
msg.makeSubstitution(newFolder);
|
||||||
|
throw new SystemMessageException(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new LocalVirtualHostFile(child);
|
return new LocalVirtualHostFile(child);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors
|
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors
|
||||||
* Xuan Chen (IBM) - [181784] [archivehandlers] zipped text files have unexpected contents
|
* Xuan Chen (IBM) - [181784] [archivehandlers] zipped text files have unexpected contents
|
||||||
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
|
||||||
|
* Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||||
|
@ -1859,10 +1860,15 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
*/
|
*/
|
||||||
protected boolean createVirtualObject(String name, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
|
protected boolean createVirtualObject(String name, boolean closeZipFile, ISystemOperationMonitor archiveOperationMonitor)
|
||||||
{
|
{
|
||||||
if (!_exists) return false;
|
if (!_exists)
|
||||||
|
{
|
||||||
|
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (exists(name, archiveOperationMonitor))
|
if (exists(name, archiveOperationMonitor))
|
||||||
{
|
{
|
||||||
// The object already exists.
|
// The object already exists.
|
||||||
|
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1908,6 +1914,7 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
replaceOldZip(outputTempFile);
|
replaceOldZip(outputTempFile);
|
||||||
|
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
|
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1917,12 +1924,14 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
System.out.println("Could not add a file."); //$NON-NLS-1$
|
System.out.println("Could not add a file."); //$NON-NLS-1$
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
if (closeZipFile) closeZipFile();
|
if (closeZipFile) closeZipFile();
|
||||||
|
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
releaseMutex(mutexLockStatus);
|
releaseMutex(mutexLockStatus);
|
||||||
}
|
}
|
||||||
|
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* Xuan Chen (IBM) - [160775] Added MSG_RENAMEGENERIC_PROGRESS, FILEMSG_MOVE_INTERRUPTED
|
* Xuan Chen (IBM) - [160775] Added MSG_RENAMEGENERIC_PROGRESS, FILEMSG_MOVE_INTERRUPTED
|
||||||
* FILEMSG_RENAME_INTERRUPTED, FILEMSG_DELETE_INTERRUPTED
|
* FILEMSG_RENAME_INTERRUPTED, FILEMSG_DELETE_INTERRUPTED
|
||||||
* FILEMSG_COPY_INTERRUPTED
|
* FILEMSG_COPY_INTERRUPTED
|
||||||
|
* Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui;
|
package org.eclipse.rse.ui;
|
||||||
|
@ -199,6 +200,8 @@ public interface ISystemMessages
|
||||||
public static final String MSG_COPYTHINGGENERIC_PROGRESS = "RSEG1117"; //$NON-NLS-1$
|
public static final String MSG_COPYTHINGGENERIC_PROGRESS = "RSEG1117"; //$NON-NLS-1$
|
||||||
public static final String MSG_MOVETHINGGENERIC_PROGRESS = "RSEG1118"; //$NON-NLS-1$
|
public static final String MSG_MOVETHINGGENERIC_PROGRESS = "RSEG1118"; //$NON-NLS-1$
|
||||||
public static final String MSG_RENAMEGENERIC_PROGRESS = "RSEG1142"; //$NON-NLS-1$
|
public static final String MSG_RENAMEGENERIC_PROGRESS = "RSEG1142"; //$NON-NLS-1$
|
||||||
|
public static final String MSG_CREATEFILEGENERIC_PROGRESS = "RSEG1143"; //$NON-NLS-1$
|
||||||
|
public static final String MSG_CREATEFOLDERGENERIC_PROGRESS = "RSEG1144"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String MSG_SAVING_PROGRESS = "RSEG1119"; //$NON-NLS-1$
|
public static final String MSG_SAVING_PROGRESS = "RSEG1119"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
|
@ -526,6 +526,14 @@ Kevin Doyle (IBM) - [160769] Added message for invalid filter when moving files
|
||||||
<LevelOne>Rename %1...</LevelOne>
|
<LevelOne>Rename %1...</LevelOne>
|
||||||
<LevelTwo></LevelTwo>
|
<LevelTwo></LevelTwo>
|
||||||
</Message>
|
</Message>
|
||||||
|
<Message ID="1143" Indicator="I">
|
||||||
|
<LevelOne>Creating file %1...</LevelOne>
|
||||||
|
<LevelTwo></LevelTwo>
|
||||||
|
</Message>
|
||||||
|
<Message ID="1144" Indicator="I">
|
||||||
|
<LevelOne>Creating folder %1...</LevelOne>
|
||||||
|
<LevelTwo></LevelTwo>
|
||||||
|
</Message>
|
||||||
<Message ID="1150" Indicator="E">
|
<Message ID="1150" Indicator="E">
|
||||||
<LevelOne>Unable to perform action as the underlying file system folder is in use</LevelOne>
|
<LevelOne>Unable to perform action as the underlying file system folder is in use</LevelOne>
|
||||||
<LevelTwo>The file system folder %1 is in use by another task and cannot be removed or modified</LevelTwo>
|
<LevelTwo>The file system folder %1 is in use by another task and cannot be removed or modified</LevelTwo>
|
||||||
|
|
Loading…
Add table
Reference in a new issue