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 150626 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java (+37 lines)
Lines 76-83 Link Here
76
import org.eclipse.swt.widgets.FileDialog;
76
import org.eclipse.swt.widgets.FileDialog;
77
import org.eclipse.swt.widgets.Label;
77
import org.eclipse.swt.widgets.Label;
78
import org.eclipse.swt.widgets.Text;
78
import org.eclipse.swt.widgets.Text;
79
import org.eclipse.ui.IWorkingSet;
80
import org.eclipse.ui.IWorkingSetManager;
81
import org.eclipse.ui.PlatformUI;
79
import org.eclipse.ui.actions.WorkspaceModifyOperation;
82
import org.eclipse.ui.actions.WorkspaceModifyOperation;
80
import org.eclipse.ui.dialogs.IOverwriteQuery;
83
import org.eclipse.ui.dialogs.IOverwriteQuery;
84
import org.eclipse.ui.dialogs.WorkingSetGroup;
81
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
85
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
82
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
86
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
83
import org.eclipse.ui.internal.ide.StatusUtil;
87
import org.eclipse.ui.internal.ide.StatusUtil;
Lines 290-295 Link Here
290
	// to mimize searches
294
	// to mimize searches
291
	private long lastModified;
295
	private long lastModified;
292
296
297
	private WorkingSetGroup workingSetGroup;
298
293
	/**
299
	/**
294
	 * Creates a new project creation wizard page.
300
	 * Creates a new project creation wizard page.
295
	 * 
301
	 * 
Lines 331-342 Link Here
331
		createProjectsRoot(workArea);
337
		createProjectsRoot(workArea);
332
		createProjectsList(workArea);
338
		createProjectsList(workArea);
333
		createOptionsArea(workArea);
339
		createOptionsArea(workArea);
340
		createWorkingSetGroup(workArea);
334
		restoreWidgetValues();
341
		restoreWidgetValues();
335
		Dialog.applyDialogFont(workArea);
342
		Dialog.applyDialogFont(workArea);
336
343
337
	}
344
	}
338
345
339
	/**
346
	/**
347
	 * @param workArea
348
	 */
349
	private void createWorkingSetGroup(Composite workArea) {
350
		String[] workingSetIds = new String[] {"org.eclipse.ui.resourceWorkingSetPage",  //$NON-NLS-1$
351
				"org.eclipse.jdt.ui.JavaWorkingSetPage"};  //$NON-NLS-1$
352
		workingSetGroup = new WorkingSetGroup(workArea, null, workingSetIds);
353
	}
354
355
	/**
340
	 * Create the area with the extra options.
356
	 * Create the area with the extra options.
341
	 * 
357
	 * 
342
	 * @param workArea
358
	 * @param workArea
Lines 1147-1153 Link Here
1147
	 */
1163
	 */
1148
	public boolean createProjects() {
1164
	public boolean createProjects() {
1149
		saveWidgetValues();
1165
		saveWidgetValues();
1166
		
1150
		final Object[] selected = projectsList.getCheckedElements();
1167
		final Object[] selected = projectsList.getCheckedElements();
1168
		createdProjects = new ArrayList();
1151
		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
1169
		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
1152
			protected void execute(IProgressMonitor monitor)
1170
			protected void execute(IProgressMonitor monitor)
1153
					throws InvocationTargetException, InterruptedException {
1171
					throws InvocationTargetException, InterruptedException {
Lines 1186-1194 Link Here
1186
		}
1204
		}
1187
		ArchiveFileManipulations.closeStructureProvider(structureProvider,
1205
		ArchiveFileManipulations.closeStructureProvider(structureProvider,
1188
				getShell());
1206
				getShell());
1207
1208
		// Adds the projects to the working sets
1209
		addToWorkingSets();
1210
		
1189
		return true;
1211
		return true;
1190
	}
1212
	}
1191
1213
1214
	List createdProjects;
1215
	
1216
	private void addToWorkingSets() {
1217
		
1218
		IWorkingSet[] selectedWorkingSets = workingSetGroup.getSelectedWorkingSets();
1219
		if(selectedWorkingSets == null || selectedWorkingSets.length == 0)
1220
			return; // no Working set is selected
1221
		IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
1222
		for (Iterator i = createdProjects.iterator(); i.hasNext();) {
1223
			IProject project = (IProject) i.next();
1224
			workingSetManager.addToWorkingSets(project, selectedWorkingSets);
1225
		}
1226
	}
1227
1192
	/**
1228
	/**
1193
	 * Performs clean-up if the user cancels the wizard without doing anything
1229
	 * Performs clean-up if the user cancels the wizard without doing anything
1194
	 */
1230
	 */
Lines 1210-1215 Link Here
1210
		String projectName = record.getProjectName();
1246
		String projectName = record.getProjectName();
1211
		final IWorkspace workspace = ResourcesPlugin.getWorkspace();
1247
		final IWorkspace workspace = ResourcesPlugin.getWorkspace();
1212
		final IProject project = workspace.getRoot().getProject(projectName);
1248
		final IProject project = workspace.getRoot().getProject(projectName);
1249
		createdProjects.add(project);
1213
		if (record.description == null) {
1250
		if (record.description == null) {
1214
			// error case
1251
			// error case
1215
			record.description = workspace.newProjectDescription(projectName);
1252
			record.description = workspace.newProjectDescription(projectName);

Return to bug 150626