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

(-)Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportExistingProjectsWizardTest.java (-1 / +1 lines)
Lines 946-952 Link Here
946
		wizard.setDialogSettings(wizardSettings);
946
		wizard.setDialogSettings(wizardSettings);
947
		wizard.setForcePreviousAndNextButtons(true);
947
		wizard.setForcePreviousAndNextButtons(true);
948
948
949
		WizardProjectsImportPage wpip = new WizardProjectsImportPage();
949
		WizardProjectsImportPage wpip = new WizardProjectsImportPage("WizardProjectsImportPage");
950
950
951
		Shell shell = getShell();
951
		Shell shell = getShell();
952
952
(-)src/org/eclipse/ui/wizards/datatransfer/ExternalProjectImportWizard.java (-2 / +4 lines)
Lines 45-50 Link Here
45
        IImportWizard {
45
        IImportWizard {
46
    private static final String EXTERNAL_PROJECT_SECTION = "ExternalProjectImportWizard";//$NON-NLS-1$
46
    private static final String EXTERNAL_PROJECT_SECTION = "ExternalProjectImportWizard";//$NON-NLS-1$
47
	private WizardProjectsImportPage mainPage;
47
	private WizardProjectsImportPage mainPage;
48
	private IStructuredSelection currentSelection;
48
	
49
	
49
    /**
50
    /**
50
     * Constructor for ExternalProjectImportWizard.
51
     * Constructor for ExternalProjectImportWizard.
Lines 69-75 Link Here
69
     */
70
     */
70
    public void addPages() {
71
    public void addPages() {
71
        super.addPages();
72
        super.addPages();
72
        mainPage = new WizardProjectsImportPage();
73
        mainPage = new WizardProjectsImportPage(currentSelection);
73
        addPage(mainPage);
74
        addPage(mainPage);
74
    }
75
    }
75
76
Lines 77-83 Link Here
77
     * Method declared on IWorkbenchWizard.
78
     * Method declared on IWorkbenchWizard.
78
     */
79
     */
79
    public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
80
    public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
80
        setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
81
        this.currentSelection = currentSelection;
82
		setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
81
        setDefaultPageImageDescriptor(
83
        setDefaultPageImageDescriptor(
82
				IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importproj_wiz.png")); //$NON-NLS-1$
84
				IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importproj_wiz.png")); //$NON-NLS-1$
83
85
(-)src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java (-1 / +42 lines)
Lines 56-61 Link Here
56
import org.eclipse.jface.viewers.CheckStateChangedEvent;
56
import org.eclipse.jface.viewers.CheckStateChangedEvent;
57
import org.eclipse.jface.viewers.CheckboxTreeViewer;
57
import org.eclipse.jface.viewers.CheckboxTreeViewer;
58
import org.eclipse.jface.viewers.ICheckStateListener;
58
import org.eclipse.jface.viewers.ICheckStateListener;
59
import org.eclipse.jface.viewers.IStructuredSelection;
59
import org.eclipse.jface.viewers.ITreeContentProvider;
60
import org.eclipse.jface.viewers.ITreeContentProvider;
60
import org.eclipse.jface.viewers.LabelProvider;
61
import org.eclipse.jface.viewers.LabelProvider;
61
import org.eclipse.jface.viewers.Viewer;
62
import org.eclipse.jface.viewers.Viewer;
Lines 76-83 Link Here
76
import org.eclipse.swt.widgets.FileDialog;
77
import org.eclipse.swt.widgets.FileDialog;
77
import org.eclipse.swt.widgets.Label;
78
import org.eclipse.swt.widgets.Label;
78
import org.eclipse.swt.widgets.Text;
79
import org.eclipse.swt.widgets.Text;
80
import org.eclipse.ui.IWorkingSet;
81
import org.eclipse.ui.IWorkingSetManager;
82
import org.eclipse.ui.PlatformUI;
79
import org.eclipse.ui.actions.WorkspaceModifyOperation;
83
import org.eclipse.ui.actions.WorkspaceModifyOperation;
80
import org.eclipse.ui.dialogs.IOverwriteQuery;
84
import org.eclipse.ui.dialogs.IOverwriteQuery;
85
import org.eclipse.ui.dialogs.WorkingSetGroup;
81
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
86
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
82
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
87
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
83
import org.eclipse.ui.internal.ide.StatusUtil;
88
import org.eclipse.ui.internal.ide.StatusUtil;
Lines 290-301 Link Here
290
	// to mimize searches
295
	// to mimize searches
291
	private long lastModified;
296
	private long lastModified;
292
297
298
	private WorkingSetGroup workingSetGroup;
299
300
	private IStructuredSelection currentSelection;
301
293
	/**
302
	/**
294
	 * Creates a new project creation wizard page.
303
	 * Creates a new project creation wizard page.
295
	 * 
304
	 * 
296
	 */
305
	 */
297
	public WizardProjectsImportPage() {
306
	public WizardProjectsImportPage(IStructuredSelection currentSelection) {
298
		this("wizardExternalProjectsPage"); //$NON-NLS-1$
307
		this("wizardExternalProjectsPage"); //$NON-NLS-1$
308
		this.currentSelection = currentSelection;
299
	}
309
	}
300
310
301
	/**
311
	/**
Lines 331-342 Link Here
331
		createProjectsRoot(workArea);
341
		createProjectsRoot(workArea);
332
		createProjectsList(workArea);
342
		createProjectsList(workArea);
333
		createOptionsArea(workArea);
343
		createOptionsArea(workArea);
344
		createWorkingSetGroup(workArea);
334
		restoreWidgetValues();
345
		restoreWidgetValues();
335
		Dialog.applyDialogFont(workArea);
346
		Dialog.applyDialogFont(workArea);
336
347
337
	}
348
	}
338
349
339
	/**
350
	/**
351
	 * @param workArea
352
	 */
353
	private void createWorkingSetGroup(Composite workArea) {
354
		String[] workingSetIds = new String[] {"org.eclipse.ui.resourceWorkingSetPage",  //$NON-NLS-1$
355
				"org.eclipse.jdt.ui.JavaWorkingSetPage"};  //$NON-NLS-1$
356
		workingSetGroup = new WorkingSetGroup(workArea, currentSelection, workingSetIds);
357
	}
358
359
	/**
340
	 * Create the area with the extra options.
360
	 * Create the area with the extra options.
341
	 * 
361
	 * 
342
	 * @param workArea
362
	 * @param workArea
Lines 1147-1153 Link Here
1147
	 */
1167
	 */
1148
	public boolean createProjects() {
1168
	public boolean createProjects() {
1149
		saveWidgetValues();
1169
		saveWidgetValues();
1170
		
1150
		final Object[] selected = projectsList.getCheckedElements();
1171
		final Object[] selected = projectsList.getCheckedElements();
1172
		createdProjects = new ArrayList();
1151
		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
1173
		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
1152
			protected void execute(IProgressMonitor monitor)
1174
			protected void execute(IProgressMonitor monitor)
1153
					throws InvocationTargetException, InterruptedException {
1175
					throws InvocationTargetException, InterruptedException {
Lines 1186-1194 Link Here
1186
		}
1208
		}
1187
		ArchiveFileManipulations.closeStructureProvider(structureProvider,
1209
		ArchiveFileManipulations.closeStructureProvider(structureProvider,
1188
				getShell());
1210
				getShell());
1211
1212
		// Adds the projects to the working sets
1213
		addToWorkingSets();
1214
		
1189
		return true;
1215
		return true;
1190
	}
1216
	}
1191
1217
1218
	List createdProjects;
1219
	
1220
	private void addToWorkingSets() {
1221
		
1222
		IWorkingSet[] selectedWorkingSets = workingSetGroup.getSelectedWorkingSets();
1223
		if(selectedWorkingSets == null || selectedWorkingSets.length == 0)
1224
			return; // no Working set is selected
1225
		IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
1226
		for (Iterator i = createdProjects.iterator(); i.hasNext();) {
1227
			IProject project = (IProject) i.next();
1228
			workingSetManager.addToWorkingSets(project, selectedWorkingSets);
1229
		}
1230
	}
1231
1192
	/**
1232
	/**
1193
	 * Performs clean-up if the user cancels the wizard without doing anything
1233
	 * Performs clean-up if the user cancels the wizard without doing anything
1194
	 */
1234
	 */
Lines 1210-1215 Link Here
1210
		String projectName = record.getProjectName();
1250
		String projectName = record.getProjectName();
1211
		final IWorkspace workspace = ResourcesPlugin.getWorkspace();
1251
		final IWorkspace workspace = ResourcesPlugin.getWorkspace();
1212
		final IProject project = workspace.getRoot().getProject(projectName);
1252
		final IProject project = workspace.getRoot().getProject(projectName);
1253
		createdProjects.add(project);
1213
		if (record.description == null) {
1254
		if (record.description == null) {
1214
			// error case
1255
			// error case
1215
			record.description = workspace.newProjectDescription(projectName);
1256
			record.description = workspace.newProjectDescription(projectName);

Return to bug 150626