Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 84808 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java (+2 lines)
Lines 762-767 Link Here
762
	public static String CheckoutAsMainPage_projectNameLabel;
762
	public static String CheckoutAsMainPage_projectNameLabel;
763
	public static String CheckoutAsMainPage_multipleFolders;
763
	public static String CheckoutAsMainPage_multipleFolders;
764
	public static String CheckoutAsMainPage_asProjects;
764
	public static String CheckoutAsMainPage_asProjects;
765
	public static String CheckoutAsMainPage_asProjectsWithName;
765
	public static String CheckoutAsMainPage_intoProject;
766
	public static String CheckoutAsMainPage_intoProject;
766
767
767
	public static String CheckoutAsLocationSelectionPage_title;
768
	public static String CheckoutAsLocationSelectionPage_title;
Lines 797-802 Link Here
797
	public static String WorkspaceChangeSetCapability_8;
798
	public static String WorkspaceChangeSetCapability_8;
798
799
799
	public static String HasProjectMetaFile_taskName;
800
	public static String HasProjectMetaFile_taskName;
801
	public static String FetchProjectDescription_taskName;
800
	public static String TagFromWorkspace_taskName;
802
	public static String TagFromWorkspace_taskName;
801
	public static String TagFromRepository_taskName;
803
	public static String TagFromRepository_taskName;
802
	public static String UpdateOnlyMergeable_taskName;
804
	public static String UpdateOnlyMergeable_taskName;
(-)src/org/eclipse/team/internal/ccvs/ui/messages.properties (-1 / +3 lines)
Lines 795-801 Link Here
795
CheckoutAsMainPage_asSimpleProject=Check out as a &project in the workspace
795
CheckoutAsMainPage_asSimpleProject=Check out as a &project in the workspace
796
CheckoutAsMainPage_projectNameLabel=&Project Name:
796
CheckoutAsMainPage_projectNameLabel=&Project Name:
797
CheckoutAsMainPage_multipleFolders=Choose how to check out the {0} folders
797
CheckoutAsMainPage_multipleFolders=Choose how to check out the {0} folders
798
CheckoutAsMainPage_asProjects=Check out into the &workspace as projects
798
CheckoutAsMainPage_asProjects=Check out into the &workspace as projects using module name as project name
799
CheckoutAsMainPage_asProjectsWithName=Check out into the workspace as projects using configured project &name
799
CheckoutAsMainPage_intoProject=Check out &into an existing project
800
CheckoutAsMainPage_intoProject=Check out &into an existing project
800
801
801
CheckoutAsLocationSelectionPage_title=Check Out As
802
CheckoutAsLocationSelectionPage_title=Check Out As
Lines 835-840 Link Here
835
836
836
837
837
HasProjectMetaFile_taskName=Looking for a remote meta file
838
HasProjectMetaFile_taskName=Looking for a remote meta file
839
FetchProjectDescription_taskName=Retrieving remote project meta file
838
TagFromWorkspace_taskName=Tagging from workspace
840
TagFromWorkspace_taskName=Tagging from workspace
839
TagFromRepository_taskName=Tagging from repository
841
TagFromRepository_taskName=Tagging from repository
840
UpdateOnlyMergeable_taskName=Updating mergeable changes
842
UpdateOnlyMergeable_taskName=Updating mergeable changes
(-)src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java (-3 / +45 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.team.internal.ccvs.ui.wizards;
11
package org.eclipse.team.internal.ccvs.ui.wizards;
12
12
13
import java.lang.reflect.InvocationTargetException;
14
13
import org.eclipse.core.resources.*;
15
import org.eclipse.core.resources.*;
14
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Path;
17
import org.eclipse.core.runtime.Path;
Lines 24-29 Link Here
24
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
26
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
25
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
27
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
26
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
28
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
29
import org.eclipse.team.internal.ccvs.ui.operations.FetchProjectDescriptionOperation;
30
import org.eclipse.ui.IWorkbenchPart;
27
import org.eclipse.ui.PlatformUI;
31
import org.eclipse.ui.PlatformUI;
28
32
29
/**
33
/**
Lines 41-47 Link Here
41
	private Button configuredProjectButton;
45
	private Button configuredProjectButton;
42
	private Text projectNameField;
46
	private Text projectNameField;
43
	private ICVSRemoteFolder[] folders;
47
	private ICVSRemoteFolder[] folders;
44
48
	private IWorkbenchPart part;
49
	
45
	public static final String NAME = "CheckoutAsMainPage"; //$NON-NLS-1$
50
	public static final String NAME = "CheckoutAsMainPage"; //$NON-NLS-1$
46
	
51
	
47
	/**
52
	/**
Lines 50-61 Link Here
50
	 * @param titleImage
55
	 * @param titleImage
51
	 * @param description
56
	 * @param description
52
	 */
57
	 */
53
	public CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration) {
58
	private CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration) {
54
		super(NAME, CVSUIMessages.CheckoutAsMainPage_title, titleImage, CVSUIMessages.CheckoutAsMainPage_description); //$NON-NLS-1$ //$NON-NLS-2$
59
		super(NAME, CVSUIMessages.CheckoutAsMainPage_title, titleImage, CVSUIMessages.CheckoutAsMainPage_description); //$NON-NLS-1$ //$NON-NLS-2$
55
		this.folders = folders;
60
		this.folders = folders;
56
		this.allowProjectConfiguration = allowProjectConfiguration;
61
		this.allowProjectConfiguration = allowProjectConfiguration;
57
	}
62
	}
58
	
63
	
64
	/**
65
	 * @param pageName
66
	 * @param title
67
	 * @param titleImage
68
	 * @param description
69
	 * @param part
70
	 */
71
	public CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration, IWorkbenchPart part) {
72
		this(titleImage, folders, allowProjectConfiguration);
73
		this.part = part;
74
	}
75
76
	
59
	/* (non-Javadoc)
77
	/* (non-Javadoc)
60
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
78
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
61
	 */
79
	 */
Lines 87-93 Link Here
87
	 * For the single folder case, return the name of the folder
105
	 * For the single folder case, return the name of the folder
88
	 */
106
	 */
89
	private String getFolderName() {
107
	private String getFolderName() {
90
		String name = folders[0].getName();
108
		String name ;
109
		//attempt to get the name from the project meta data if possible
110
		name = getFolderProjectName();
111
		if (name != null) {
112
			return name;
113
		}
114
		//if not just use the folder name, ie "module" name
115
		name = folders[0].getName();
91
		if (name .equals(".")) { //$NON-NLS-1$
116
		if (name .equals(".")) { //$NON-NLS-1$
92
			name = new Path(null, folders[0].getRepository().getRootDirectory()).lastSegment();
117
			name = new Path(null, folders[0].getRepository().getRootDirectory()).lastSegment();
93
		}
118
		}
Lines 95-100 Link Here
95
	}
120
	}
96
	
121
	
97
	/*
122
	/*
123
	 * For the single folder case, return the name of the project 
124
	 * from the project description 
125
	 */
126
	private String getFolderProjectName() {
127
		IProjectDescription project;
128
		try {
129
			project = FetchProjectDescriptionOperation.getProjectDescription(part, folders[0]);
130
			return project.getName();
131
		} catch (InvocationTargetException e) {
132
			//ignore
133
		} catch (InterruptedException e) {
134
			//ignore
135
		}
136
		return null;
137
	}
138
139
	/*
98
	 * Create the page contents for a single folder checkout
140
	 * Create the page contents for a single folder checkout
99
	 */
141
	 */
100
	private void createSingleFolderArea(Composite composite) {
142
	private void createSingleFolderArea(Composite composite) {
(-)src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java (-1 / +1 lines)
Lines 94-100 Link Here
94
		setNeedsProgressMonitor(true);
94
		setNeedsProgressMonitor(true);
95
		ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
95
		ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
96
		
96
		
97
		mainPage = new CheckoutAsMainPage(substImage, remoteFolders, allowProjectConfiguration);
97
		mainPage = new CheckoutAsMainPage(substImage, remoteFolders, allowProjectConfiguration, part);
98
		addPage(mainPage);
98
		addPage(mainPage);
99
		
99
		
100
		projectSelectionPage = new CheckoutAsProjectSelectionPage(substImage, remoteFolders);
100
		projectSelectionPage = new CheckoutAsProjectSelectionPage(substImage, remoteFolders);
(-)src/org/eclipse/team/internal/ccvs/ui/operations/FetchProjectDescriptionOperation.java (+126 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     nexB Inc. - implementation of patch for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=84808
11
 *******************************************************************************/
12
package org.eclipse.team.internal.ccvs.ui.operations;
13
14
import java.io.IOException;
15
import java.io.InputStream;
16
import java.lang.reflect.InvocationTargetException;
17
18
import org.eclipse.core.resources.IProjectDescription;
19
import org.eclipse.core.resources.IWorkspace;
20
import org.eclipse.core.resources.ResourcesPlugin;
21
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.IProgressMonitor;
23
import org.eclipse.team.core.TeamException;
24
import org.eclipse.team.internal.ccvs.core.CVSException;
25
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
26
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
27
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
28
import org.eclipse.ui.IWorkbenchPart;
29
30
/**
31
 * Operation which retrieves a .project file in a remote folder. The operation
32
 * can be run using the <code>getProjectDescription</code> static method 
33
 * static method or by executing the operation and then checking <code>getProjectDescription()</code>
34
 */
35
public class FetchProjectDescriptionOperation extends CVSOperation {
36
37
	private ICVSRemoteFolder remoteFolder;
38
	private IProjectDescription projectDescription;
39
40
	public static IProjectDescription getProjectDescription(IWorkbenchPart part, ICVSRemoteFolder remoteFolder)
41
			throws InvocationTargetException, InterruptedException {
42
		FetchProjectDescriptionOperation op = new FetchProjectDescriptionOperation(part, remoteFolder);
43
		op.run();
44
		return op.getProjectDescription();
45
	}
46
47
	public FetchProjectDescriptionOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) {
48
		super(part);
49
		this.remoteFolder = remoteFolder;
50
	}
51
52
	/*
53
	 * Return a Stream containing the .project file or null if retrieval failed
54
	 */
55
	private IProjectDescription fetchRemoteProjectDescription(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
56
57
		// make a copy of the folder so that we will not effect the original
58
		// folder when we refetch the members
59
		// TODO: this is a strange thing to need to do. We should fix this.
60
		// Note: This behavior was inherited from HasProjectMetaFileOperation
61
		folder = (ICVSRemoteFolder) folder.forTag(remoteFolder.getTag());
62
63
		try {
64
			folder.members(monitor);
65
		} catch (TeamException e) {
66
			throw CVSException.wrapException(e);
67
		}
68
		// Check for the existance of the .project file
69
		// and attempt to create an IProjectDescription of it. 
70
		InputStream in = null;
71
		try {
72
			ICVSRemoteFile remote = (ICVSRemoteFile) folder.getFile(".project"); //$NON-NLS-1$
73
			in = remote.getContents(monitor);
74
			if (in == null || monitor.isCanceled()) {
75
				return null;
76
			}
77
			IWorkspace workspace = ResourcesPlugin.getWorkspace();
78
			IProjectDescription projectDesc = workspace.loadProjectDescription(in);
79
			return projectDesc;
80
		} catch (TeamException e) {
81
			// We couldn't retrieve the project meta file so assume it doesn't exist
82
		} catch (CoreException e) {
83
			// We couldn't read the project description, so assume the
84
			// metafile is not a metafile, or is incorrect
85
			// which i as if it does not exist
86
		} finally {
87
			try {
88
				if (in != null)
89
					in.close();
90
			} catch (IOException e) {
91
				// ignore
92
			}
93
		}
94
		return null;
95
	}
96
97
	/*
98
	 * (non-Javadoc)
99
	 * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
100
	 */
101
	public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
102
		projectDescription= fetchRemoteProjectDescription(remoteFolder, monitor);
103
	}
104
105
	/**
106
	 * Return the project description containing the remote project meta information
107
	 * if the .project file was properly retrieved or null if not. 
108
	 * This method should only be invoked after the operation has been executed;
109
	 */
110
	public IProjectDescription getProjectDescription() {
111
		return projectDescription;
112
	}
113
114
	protected String getTaskName() {
115
		return CVSUIMessages.FetchProjectDescription_taskName; //$NON-NLS-1$
116
	}
117
118
	/*
119
	 * (non-Javadoc)
120
	 * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
121
	 */
122
	public boolean canRunAsJob() {
123
		// This operation should never be run in the background.
124
		return false;
125
	}
126
}

Return to bug 84808