Lines 21-26
Link Here
|
21 |
* - Also remove unnecessary class RSEFileCache and obsolete branding files. |
21 |
* - Also remove unnecessary class RSEFileCache and obsolete branding files. |
22 |
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin |
22 |
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin |
23 |
* Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem |
23 |
* Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem |
|
|
24 |
* Remy Chi Jian Suen (Independent) - # Remy Chi Jian Suen - [192906] [efs] No Error when trying to Create Remote Project when project with name exists |
24 |
********************************************************************************/ |
25 |
********************************************************************************/ |
25 |
|
26 |
|
26 |
package org.eclipse.rse.internal.efs.ui; |
27 |
package org.eclipse.rse.internal.efs.ui; |
Lines 46-51
Link Here
|
46 |
import org.eclipse.jface.viewers.ISelection; |
47 |
import org.eclipse.jface.viewers.ISelection; |
47 |
import org.eclipse.jface.viewers.IStructuredSelection; |
48 |
import org.eclipse.jface.viewers.IStructuredSelection; |
48 |
import org.eclipse.jface.viewers.StructuredSelection; |
49 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
|
50 |
import org.eclipse.osgi.util.NLS; |
49 |
import org.eclipse.rse.internal.efs.Activator; |
51 |
import org.eclipse.rse.internal.efs.Activator; |
50 |
import org.eclipse.rse.internal.efs.RSEFileSystem; |
52 |
import org.eclipse.rse.internal.efs.RSEFileSystem; |
51 |
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; |
53 |
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; |
Lines 126-140
Link Here
|
126 |
* Creates a remote project. |
128 |
* Creates a remote project. |
127 |
* |
129 |
* |
128 |
* @param directory |
130 |
* @param directory |
129 |
* the remote folder on which the EFS project should be locaed |
131 |
* the remote folder on which the EFS project should be located |
130 |
* @return <code>true</code> if the copy operation completed, and |
132 |
* @return <code>true</code> if the copy operation completed, and |
131 |
* <code>false</code> if it was abandoned part way |
133 |
* <code>false</code> if it was abandoned part way |
132 |
*/ |
134 |
*/ |
133 |
boolean performCreateRemoteProject(final IRemoteFile directory) { |
135 |
boolean performCreateRemoteProject(final IRemoteFile directory) { |
134 |
IRunnableWithProgress op = new IRunnableWithProgress() { |
136 |
IRunnableWithProgress op = new IRunnableWithProgress() { |
135 |
public void run(IProgressMonitor monitor) { |
137 |
public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException { |
136 |
try { |
138 |
try { |
137 |
createRemoteProject(directory, monitor); |
139 |
createRemoteProject(directory, monitor); |
|
|
140 |
} catch (InvocationTargetException e) { |
141 |
throw e; |
138 |
} catch (Exception e) { |
142 |
} catch (Exception e) { |
139 |
if (e.getCause() instanceof CoreException) { |
143 |
if (e.getCause() instanceof CoreException) { |
140 |
recordError((CoreException)e.getCause()); |
144 |
recordError((CoreException)e.getCause()); |
Lines 172-214
Link Here
|
172 |
// (Copyright 2000, 2006 IBM Corporation and others) |
176 |
// (Copyright 2000, 2006 IBM Corporation and others) |
173 |
//---------------------------------------------------------------------------- |
177 |
//---------------------------------------------------------------------------- |
174 |
|
178 |
|
175 |
private IProject createRemoteProject(IRemoteFile directory, IProgressMonitor monitor) |
179 |
private IProject createRemoteProject(IRemoteFile directory, IProgressMonitor monitor) throws InvocationTargetException |
176 |
{ |
180 |
{ |
177 |
IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot(); |
181 |
IWorkspaceRoot root = SystemBasePlugin.getWorkspaceRoot(); |
178 |
|
182 |
|
179 |
IProject editProject = root.getProject(directory.getName()); |
183 |
String directoryName = directory.getName(); |
|
|
184 |
IProject editProject = root.getProject(directoryName); |
180 |
|
185 |
|
181 |
if ((editProject != null) && (editProject.exists()) && (editProject.isOpen())) |
186 |
try { |
182 |
{ |
187 |
if (editProject.exists()) |
183 |
return editProject; |
188 |
{ |
184 |
} |
189 |
throw new CoreException(new Status(IStatus.ERROR, |
185 |
|
190 |
Activator.getDefault().getBundle().getSymbolicName(), |
186 |
if (editProject == null) { |
191 |
NLS.bind(Messages.CreateRemoteProjectActionDelegate_PROJECT_EXISTS, directoryName))); |
187 |
return null; |
192 |
} |
188 |
} |
193 |
|
189 |
|
194 |
IProjectDescription description = root.getWorkspace().newProjectDescription(directoryName); |
190 |
try |
|
|
191 |
{ |
192 |
IProjectDescription description = root.getWorkspace().newProjectDescription(directory.getName()); |
193 |
String hostNameOrAddr = directory.getParentRemoteFileSubSystem().getHost().getHostName(); |
195 |
String hostNameOrAddr = directory.getParentRemoteFileSubSystem().getHost().getHostName(); |
194 |
String absolutePath = directory.getAbsolutePath(); |
196 |
String absolutePath = directory.getAbsolutePath(); |
195 |
URI location = RSEFileSystem.getURIFor(hostNameOrAddr, absolutePath); |
197 |
URI location = RSEFileSystem.getURIFor(hostNameOrAddr, absolutePath); |
196 |
description.setLocationURI(location); |
198 |
description.setLocationURI(location); |
197 |
|
199 |
|
198 |
editProject.create(description, monitor); |
200 |
editProject.create(description, monitor); |
199 |
|
201 |
|
200 |
editProject.open(monitor); |
202 |
editProject.open(monitor); |
201 |
|
203 |
|
202 |
editProject.refreshLocal(IResource.DEPTH_ONE, monitor); |
204 |
editProject.refreshLocal(IResource.DEPTH_ONE, monitor); |
|
|
205 |
} catch (CoreException e) { |
206 |
throw new InvocationTargetException(e); |
203 |
} |
207 |
} |
204 |
catch (CoreException e) |
208 |
|
205 |
{ |
|
|
206 |
SystemBasePlugin.logError("Error creating temp project", e); //$NON-NLS-1$ |
207 |
} |
208 |
catch (Exception e) |
209 |
{ |
210 |
SystemBasePlugin.logError("Error creating temp project", e); //$NON-NLS-1$ |
211 |
} |
212 |
return editProject; |
209 |
return editProject; |
213 |
} |
210 |
} |
214 |
|
211 |
|