View | Details | Raw Unified | Return to bug 192906
Collapse All | Expand All

(-)src/org/eclipse/rse/internal/efs/ui/CreateRemoteProjectActionDelegate.java (-25 / +22 lines)
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
	
(-)src/org/eclipse/rse/internal/efs/ui/Messages.java (+2 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem
10
 * Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem
11
 * Remy Chi Jian Suen (Independent) - # Remy Chi Jian Suen - [192906] [efs] No Error when trying to Create Remote Project when project with name exists
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.rse.internal.efs.ui;
13
package org.eclipse.rse.internal.efs.ui;
13
14
Lines 16-21 Link Here
16
public class Messages extends NLS {
17
public class Messages extends NLS {
17
	private static final String BUNDLE_NAME = "org.eclipse.rse.internal.efs.ui.messages"; //$NON-NLS-1$
18
	private static final String BUNDLE_NAME = "org.eclipse.rse.internal.efs.ui.messages"; //$NON-NLS-1$
18
	public static String CreateRemoteProjectActionDelegate_CREATING_TITLE;
19
	public static String CreateRemoteProjectActionDelegate_CREATING_TITLE;
20
	public static String CreateRemoteProjectActionDelegate_PROJECT_EXISTS;
19
	static {
21
	static {
20
// initialize resource bundle
22
// initialize resource bundle
21
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
23
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
(-)src/org/eclipse/rse/internal/efs/ui/messages.properties (+2 lines)
Lines 7-15 Link Here
7
# Contributors:
7
# Contributors:
8
# David Dykstal (IBM) - initial contribution
8
# David Dykstal (IBM) - initial contribution
9
# Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem
9
# Martin Oberhuber (Wind River) - [188360] renamed from plugin org.eclipse.rse.eclipse.filesystem
10
# Remy Chi Jian Suen (Independent) - # Remy Chi Jian Suen - [192906] [efs] No Error when trying to Create Remote Project when project with name exists
10
################################################################################
11
################################################################################
11
12
12
# NLS_MESSAGEFORMAT_NONE
13
# NLS_MESSAGEFORMAT_NONE
13
# NLS_ENCODING=UTF-8
14
# NLS_ENCODING=UTF-8
14
15
15
CreateRemoteProjectActionDelegate_CREATING_TITLE=Creating Remote Project
16
CreateRemoteProjectActionDelegate_CREATING_TITLE=Creating Remote Project
17
CreateRemoteProjectActionDelegate_PROJECT_EXISTS = A project named {0} already exists.

Return to bug 192906