Index: src/org/eclipse/rse/internal/efs/ui/CreateRemoteProjectActionDelegate.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.efs.ui/src/org/eclipse/rse/internal/efs/ui/CreateRemoteProjectActionDelegate.java,v retrieving revision 1.1 diff -u -r1.1 CreateRemoteProjectActionDelegate.java --- src/org/eclipse/rse/internal/efs/ui/CreateRemoteProjectActionDelegate.java 25 May 2007 17:19:15 -0000 1.1 +++ src/org/eclipse/rse/internal/efs/ui/CreateRemoteProjectActionDelegate.java 28 Aug 2007 11:32:13 -0000 @@ -21,6 +21,7 @@ * - Also remove unnecessary class RSEFileCache and obsolete branding files. * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin * Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem + * Remy Chi Jian Suen (Independent) - # Remy Chi Jian Suen - [192906] [efs] No Error when trying to Create Remote Project when project with name exists ********************************************************************************/ package org.eclipse.rse.internal.efs.ui; @@ -46,6 +47,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.osgi.util.NLS; import org.eclipse.rse.internal.efs.Activator; import org.eclipse.rse.internal.efs.RSEFileSystem; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; @@ -126,15 +128,17 @@ * Creates a remote project. * * @param directory - * the remote folder on which the EFS project should be locaed + * the remote folder on which the EFS project should be located * @return true if the copy operation completed, and * false if it was abandoned part way */ boolean performCreateRemoteProject(final IRemoteFile directory) { IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { + public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { try { createRemoteProject(directory, monitor); + } catch (InvocationTargetException e) { + throw e; } catch (Exception e) { if (e.getCause() instanceof CoreException) { recordError((CoreException)e.getCause()); @@ -172,43 +176,36 @@ // (Copyright 2000, 2006 IBM Corporation and others) //---------------------------------------------------------------------------- - private IProject createRemoteProject(IRemoteFile directory, IProgressMonitor monitor) + private IProject createRemoteProject(IRemoteFile directory, IProgressMonitor monitor) throws InvocationTargetException { IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot(); - IProject editProject = root.getProject(directory.getName()); + String directoryName = directory.getName(); + IProject editProject = root.getProject(directoryName); - if ((editProject != null) && (editProject.exists()) && (editProject.isOpen())) - { - return editProject; - } - - if (editProject == null) { - return null; - } - - try - { - IProjectDescription description = root.getWorkspace().newProjectDescription(directory.getName()); + try { + if (editProject.exists()) + { + throw new CoreException(new Status(IStatus.ERROR, + Activator.getDefault().getBundle().getSymbolicName(), + NLS.bind(Messages.CreateRemoteProjectActionDelegate_PROJECT_EXISTS, directoryName))); + } + + IProjectDescription description = root.getWorkspace().newProjectDescription(directoryName); String hostNameOrAddr = directory.getParentRemoteFileSubSystem().getHost().getHostName(); String absolutePath = directory.getAbsolutePath(); URI location = RSEFileSystem.getURIFor(hostNameOrAddr, absolutePath); description.setLocationURI(location); - + editProject.create(description, monitor); editProject.open(monitor); editProject.refreshLocal(IResource.DEPTH_ONE, monitor); + } catch (CoreException e) { + throw new InvocationTargetException(e); } - catch (CoreException e) - { - SystemBasePlugin.logError("Error creating temp project", e); //$NON-NLS-1$ - } - catch (Exception e) - { - SystemBasePlugin.logError("Error creating temp project", e); //$NON-NLS-1$ - } + return editProject; } Index: src/org/eclipse/rse/internal/efs/ui/Messages.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.efs.ui/src/org/eclipse/rse/internal/efs/ui/Messages.java,v retrieving revision 1.1 diff -u -r1.1 Messages.java --- src/org/eclipse/rse/internal/efs/ui/Messages.java 25 May 2007 17:19:15 -0000 1.1 +++ src/org/eclipse/rse/internal/efs/ui/Messages.java 28 Aug 2007 11:32:13 -0000 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem + * Remy Chi Jian Suen (Independent) - # Remy Chi Jian Suen - [192906] [efs] No Error when trying to Create Remote Project when project with name exists *******************************************************************************/ package org.eclipse.rse.internal.efs.ui; @@ -16,6 +17,7 @@ public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.rse.internal.efs.ui.messages"; //$NON-NLS-1$ public static String CreateRemoteProjectActionDelegate_CREATING_TITLE; + public static String CreateRemoteProjectActionDelegate_PROJECT_EXISTS; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); Index: src/org/eclipse/rse/internal/efs/ui/messages.properties =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.efs.ui/src/org/eclipse/rse/internal/efs/ui/messages.properties,v retrieving revision 1.1 diff -u -r1.1 messages.properties --- src/org/eclipse/rse/internal/efs/ui/messages.properties 25 May 2007 17:19:15 -0000 1.1 +++ src/org/eclipse/rse/internal/efs/ui/messages.properties 28 Aug 2007 11:32:13 -0000 @@ -7,9 +7,11 @@ # Contributors: # David Dykstal (IBM) - initial contribution # Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem +# Remy Chi Jian Suen (Independent) - # Remy Chi Jian Suen - [192906] [efs] No Error when trying to Create Remote Project when project with name exists ################################################################################ # NLS_MESSAGEFORMAT_NONE # NLS_ENCODING=UTF-8 CreateRemoteProjectActionDelegate_CREATING_TITLE=Creating Remote Project +CreateRemoteProjectActionDelegate_PROJECT_EXISTS = A project named {0} already exists.