View | Details | Raw Unified | Return to bug 83240 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties (+1 lines)
Lines 50-55 Link Here
50
FileImport_fromDirectory = From director&y:
50
FileImport_fromDirectory = From director&y:
51
FileImport_importFileSystem = Import resources from the local file system.
51
FileImport_importFileSystem = Import resources from the local file system.
52
FileImport_overwriteExisting = &Overwrite existing resources without warning
52
FileImport_overwriteExisting = &Overwrite existing resources without warning
53
FileImport_configuredProject = &Import as a configured project
53
FileImport_createComplete = &Create complete folder structure
54
FileImport_createComplete = &Create complete folder structure
54
FileImport_createSelectedFolders = Create s&elected folders only
55
FileImport_createSelectedFolders = Create s&elected folders only
55
FileImport_noneSelected = There are no resources currently selected for import.
56
FileImport_noneSelected = There are no resources currently selected for import.
(-)src/org/eclipse/ui/internal/wizards/datatransfer/WizardFileSystemResourceImportPage1.java (-7 / +139 lines)
Lines 20-25 Link Here
20
import java.util.Map;
20
import java.util.Map;
21
21
22
import org.eclipse.core.resources.IContainer;
22
import org.eclipse.core.resources.IContainer;
23
import org.eclipse.core.resources.IProject;
24
import org.eclipse.core.resources.IResource;
25
import org.eclipse.core.resources.IResourceChangeEvent;
26
import org.eclipse.core.resources.IResourceChangeListener;
27
import org.eclipse.core.resources.IResourceDelta;
28
import org.eclipse.core.resources.ResourcesPlugin;
23
import org.eclipse.core.runtime.IPath;
29
import org.eclipse.core.runtime.IPath;
24
import org.eclipse.core.runtime.IProgressMonitor;
30
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IStatus;
31
import org.eclipse.core.runtime.IStatus;
Lines 54-61 Link Here
54
import org.eclipse.swt.widgets.Shell;
60
import org.eclipse.swt.widgets.Shell;
55
import org.eclipse.ui.IWorkbench;
61
import org.eclipse.ui.IWorkbench;
56
import org.eclipse.ui.PlatformUI;
62
import org.eclipse.ui.PlatformUI;
63
import org.eclipse.ui.actions.NewProjectAction;
57
import org.eclipse.ui.dialogs.FileSystemElement;
64
import org.eclipse.ui.dialogs.FileSystemElement;
58
import org.eclipse.ui.dialogs.WizardResourceImportPage;
65
import org.eclipse.ui.dialogs.WizardResourceImportPage;
66
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
67
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
59
import org.eclipse.ui.internal.ide.dialogs.IElementFilter;
68
import org.eclipse.ui.internal.ide.dialogs.IElementFilter;
60
import org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog;
69
import org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog;
61
import org.eclipse.ui.model.WorkbenchContentProvider;
70
import org.eclipse.ui.model.WorkbenchContentProvider;
Lines 73-78 Link Here
73
82
74
    protected Button overwriteExistingResourcesCheckbox;
83
    protected Button overwriteExistingResourcesCheckbox;
75
84
85
    protected Button importAsConfiguredProjectCheckbox;
86
    
76
    protected Button createContainerStructureButton;
87
    protected Button createContainerStructureButton;
77
88
78
    protected Button createOnlySelectedButton;
89
    protected Button createOnlySelectedButton;
Lines 93-98 Link Here
93
104
94
    private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "WizardFileSystemResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID";//$NON-NLS-1$
105
    private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "WizardFileSystemResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID";//$NON-NLS-1$
95
106
107
    private final static String STORE_IMPORT_CONFIGURED_PROJECT = "WizardFileSystemResourceImportPage1.STORE_IMPORT_CONFIGURED_PROJECT"; //$NON-NLS-1$
108
96
    private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID = "WizardFileSystemResourceImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID";//$NON-NLS-1$
109
    private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID = "WizardFileSystemResourceImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID";//$NON-NLS-1$
97
110
98
    private static final String SELECT_TYPES_TITLE = DataTransferMessages.DataTransfer_selectTypes;
111
    private static final String SELECT_TYPES_TITLE = DataTransferMessages.DataTransfer_selectTypes;
Lines 106-112 Link Here
106
    private static final String SELECT_SOURCE_MESSAGE = DataTransferMessages.FileImport_selectSource;
119
    private static final String SELECT_SOURCE_MESSAGE = DataTransferMessages.FileImport_selectSource;
107
120
108
    protected static final String SOURCE_EMPTY_MESSAGE = DataTransferMessages.FileImport_sourceEmpty;
121
    protected static final String SOURCE_EMPTY_MESSAGE = DataTransferMessages.FileImport_sourceEmpty;
109
122
	
123
    /**
124
     * This is copied from {@link org.eclipse.team.internal.ccvs.ui.wizards.CheckoutAsWizard}
125
     */ 
126
    class NewProjectListener implements IResourceChangeListener {
127
		private IProject newProject = null;
128
		/**
129
		 * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
130
		 */
131
		public void resourceChanged(IResourceChangeEvent event) {
132
			IResourceDelta root = event.getDelta();
133
			IResourceDelta[] projectDeltas = root.getAffectedChildren();
134
			for (int i = 0; i < projectDeltas.length; i++) {							
135
				IResourceDelta delta = projectDeltas[i];
136
				IResource resource = delta.getResource();
137
				if (delta.getKind() == IResourceDelta.ADDED) {
138
					newProject = (IProject)resource;
139
				}
140
			}
141
		}
142
		/**
143
		 * Gets the newProject.
144
		 * @return Returns a IProject
145
		 */
146
		public IProject getNewProject() {
147
			return newProject;
148
		}
149
	}
150
	
110
    /**
151
    /**
111
     *	Creates an instance of this class
152
     *	Creates an instance of this class
112
     */
153
     */
Lines 239-253 Link Here
239
    }
280
    }
240
281
241
    /**
282
    /**
242
     *	Create the import options specification widgets.
283
     *	Create the options specification widgets. There is only one
284
     * in this case so create no group.
285
     *
286
     *	@param parent org.eclipse.swt.widgets.Composite
243
     */
287
     */
244
    protected void createOptionsGroupButtons(Group optionsGroup) {
288
    protected void createBaseOptionsGroup(Composite parent) {
289
290
    	// create import as configured project checkbox
291
    	importAsConfiguredProjectCheckbox = new Button(parent, SWT.CHECK);
292
        importAsConfiguredProjectCheckbox.setText(DataTransferMessages.FileImport_configuredProject);
293
        importAsConfiguredProjectCheckbox.setFont(parent.getFont());
294
        importAsConfiguredProjectCheckbox.addSelectionListener(new SelectionAdapter() {
295
        	public void widgetSelected(SelectionEvent e)
296
        	{	// if the configured project checkbox is checked the name field and browse button should be disabled, and vice-versa 
297
        		boolean newState = importAsConfiguredProjectCheckbox.getSelection();
298
        		containerNameField.setEnabled(!newState);
299
        		containerBrowseButton.setEnabled(!newState);
300
        		updateWidgetEnablements();
301
        	}
302
        });
245
303
246
        // overwrite... checkbox
304
        // overwrite... checkbox
247
        overwriteExistingResourcesCheckbox = new Button(optionsGroup, SWT.CHECK);
305
        overwriteExistingResourcesCheckbox = new Button(parent, SWT.CHECK);
248
        overwriteExistingResourcesCheckbox.setFont(optionsGroup.getFont());
249
        overwriteExistingResourcesCheckbox.setText(DataTransferMessages.FileImport_overwriteExisting);
306
        overwriteExistingResourcesCheckbox.setText(DataTransferMessages.FileImport_overwriteExisting);
307
        overwriteExistingResourcesCheckbox.setFont(parent.getFont());
308
    }
309
    
310
    /**
311
     *	Create the import options specification widgets.
312
     */
313
    protected void createOptionsGroupButtons(Group optionsGroup) {
250
314
315
    	createBaseOptionsGroup(optionsGroup);
316
    	
251
        // create containers radio
317
        // create containers radio
252
        createContainerStructureButton = new Button(optionsGroup, SWT.RADIO);
318
        createContainerStructureButton = new Button(optionsGroup, SWT.RADIO);
253
        createContainerStructureButton.setFont(optionsGroup.getFont());
319
        createContainerStructureButton.setFont(optionsGroup.getFont());
Lines 434-439 Link Here
434
        return true;
500
        return true;
435
    }
501
    }
436
502
503
    /*
504
     * @see WizardDataTransferPage.determinePageCompletion.
505
     */
506
    protected boolean determinePageCompletion() {
507
        //Check for valid projects before making the user do anything 
508
        if (noOpenProjects() && !importAsConfiguredProjectCheckbox.getSelection()) {
509
            setErrorMessage(IDEWorkbenchMessages.WizardImportPage_noOpenProjects);
510
            return false;
511
        }
512
        return super.determinePageCompletion();
513
    }
514
515
    /**
516
     * Returns whether or not the passed workspace has any 
517
     * open projects
518
     * @return boolean
519
     */
520
    protected boolean noOpenProjects() {
521
        IProject[] projects = IDEWorkbenchPlugin.getPluginWorkspace().getRoot()
522
                .getProjects();
523
        for (int i = 0; i < projects.length; i++) {
524
            if (projects[i].isOpen())
525
                return false;
526
        }
527
        return true;
528
    }
529
437
    /**
530
    /**
438
     *	The Finish button was pressed.  Try to do the required work now and answer
531
     *	The Finish button was pressed.  Try to do the required work now and answer
439
     *	a boolean indicating success.  If false is returned then the wizard will
532
     *	a boolean indicating success.  If false is returned then the wizard will
Lines 634-640 Link Here
634
     *  Import the resources with extensions as specified by the user
727
     *  Import the resources with extensions as specified by the user
635
     */
728
     */
636
    protected boolean importResources(List fileSystemObjects) {
729
    protected boolean importResources(List fileSystemObjects) {
637
        ImportOperation operation = new ImportOperation(getContainerFullPath(),
730
    	IPath containerPath;
731
    	if (importAsConfiguredProjectCheckbox.getSelection())
732
    	{	// Create a new configured project than import into there
733
    		IProject newProject = getNewProject();
734
    		if (newProject == null) return false;
735
    		containerPath = newProject.getFullPath();
736
    	}
737
    	else
738
    	{
739
    		containerPath = getContainerFullPath();
740
    	}
741
    	ImportOperation operation = new ImportOperation(containerPath,
638
                getSourceDirectory(), FileSystemStructureProvider.INSTANCE,
742
                getSourceDirectory(), FileSystemStructureProvider.INSTANCE,
639
                this, fileSystemObjects);
743
                this, fileSystemObjects);
640
744
Lines 643-648 Link Here
643
    }
747
    }
644
748
645
    /**
749
    /**
750
	 * Get a new project that is configured by the new project wizard.
751
	 * This is currently the only way to do this.
752
	 */
753
	protected IProject getNewProject() {
754
		NewProjectListener listener = new NewProjectListener();
755
		ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
756
		(new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run();
757
		ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
758
		IProject project = listener.getNewProject();
759
		return project;
760
	}
761
762
    
763
    /**
646
     * Initializes the specified operation appropriately.
764
     * Initializes the specified operation appropriately.
647
     */
765
     */
648
    protected void initializeOperation(ImportOperation op) {
766
    protected void initializeOperation(ImportOperation op) {
Lines 701-707 Link Here
701
            // radio buttons and checkboxes	
819
            // radio buttons and checkboxes	
702
            overwriteExistingResourcesCheckbox.setSelection(settings
820
            overwriteExistingResourcesCheckbox.setSelection(settings
703
                    .getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
821
                    .getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
704
822
            boolean configureSelection = settings.getBoolean(STORE_IMPORT_CONFIGURED_PROJECT);
823
            importAsConfiguredProjectCheckbox.setSelection(configureSelection);
824
            containerBrowseButton.setEnabled(!configureSelection);
825
            containerNameField.setEnabled(!configureSelection);
826
            	
827
            
705
            boolean createStructure = settings
828
            boolean createStructure = settings
706
                    .getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID);
829
                    .getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID);
707
            createContainerStructureButton.setSelection(createStructure);
830
            createContainerStructureButton.setSelection(createStructure);
Lines 726-731 Link Here
726
            settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
849
            settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
727
850
728
            // radio buttons and checkboxes	
851
            // radio buttons and checkboxes	
852
            settings.put(STORE_IMPORT_CONFIGURED_PROJECT,
853
                    importAsConfiguredProjectCheckbox.getSelection());
854
729
            settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID,
855
            settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID,
730
                    overwriteExistingResourcesCheckbox.getSelection());
856
                    overwriteExistingResourcesCheckbox.getSelection());
731
857
Lines 934-939 Link Here
934
        return true;
1060
        return true;
935
    }
1061
    }
936
1062
1063
    	protected boolean validateDestinationGroup() {
1064
    	if (importAsConfiguredProjectCheckbox.getSelection())
1065
    		return true;
1066
		return super.validateDestinationGroup();
1067
    }
1068
937
    /**
1069
    /**
938
     * Returns whether the source location conflicts
1070
     * Returns whether the source location conflicts
939
     * with the destination resource. This will occur if
1071
     * with the destination resource. This will occur if
(-)src/org/eclipse/ui/internal/wizards/datatransfer/WizardArchiveFileResourceImportPage1.java (-12 / +27 lines)
Lines 17-28 Link Here
17
import java.util.zip.ZipException;
17
import java.util.zip.ZipException;
18
import java.util.zip.ZipFile;
18
import java.util.zip.ZipFile;
19
19
20
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.jface.dialogs.IDialogSettings;
22
import org.eclipse.jface.dialogs.IDialogSettings;
21
import org.eclipse.jface.viewers.IStructuredSelection;
23
import org.eclipse.jface.viewers.IStructuredSelection;
22
import org.eclipse.jface.viewers.ITreeContentProvider;
24
import org.eclipse.jface.viewers.ITreeContentProvider;
23
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.osgi.util.NLS;
24
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.widgets.Button;
26
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.FileDialog;
28
import org.eclipse.swt.widgets.FileDialog;
28
import org.eclipse.swt.widgets.Listener;
29
import org.eclipse.swt.widgets.Listener;
Lines 56-61 Link Here
56
57
57
    private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "WizardZipFileResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"; //$NON-NLS-1$
58
    private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "WizardZipFileResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"; //$NON-NLS-1$
58
59
60
    private final static String STORE_IMPORT_CONFIGURED_PROJECT = "WizardZipFileResourceImportPage1.STORE_IMPORT_CONFIGURED_PROJECT"; //$NON-NLS-1$
61
    
59
    private final static String STORE_SELECTED_TYPES_ID = "WizardZipFileResourceImportPage1.STORE_SELECTED_TYPES_ID"; //$NON-NLS-1$
62
    private final static String STORE_SELECTED_TYPES_ID = "WizardZipFileResourceImportPage1.STORE_SELECTED_TYPES_ID"; //$NON-NLS-1$
60
63
61
    /**
64
    /**
Lines 113-129 Link Here
113
    }
116
    }
114
117
115
    /**
118
    /**
116
     *	Create the options specification widgets. There is only one
119
     *	Create the options specification widgets using just the base group.
117
     * in this case so create no group.
118
     *
120
     *
119
     *	@param parent org.eclipse.swt.widgets.Composite
121
     *	@param parent org.eclipse.swt.widgets.Composite
120
     */
122
     */
121
    protected void createOptionsGroup(Composite parent) {
123
    protected void createOptionsGroup(Composite parent) {
122
124
    	super.createBaseOptionsGroup(parent);
123
        // overwrite... checkbox
124
        overwriteExistingResourcesCheckbox = new Button(parent, SWT.CHECK);
125
        overwriteExistingResourcesCheckbox.setText(DataTransferMessages.FileImport_overwriteExisting);
126
        overwriteExistingResourcesCheckbox.setFont(parent.getFont());
127
    }
125
    }
128
126
129
    private boolean validateSourceFile(String fileName) {
127
    private boolean validateSourceFile(String fileName) {
Lines 366-371 Link Here
366
     */
364
     */
367
    protected boolean importResources(List fileSystemObjects) {
365
    protected boolean importResources(List fileSystemObjects) {
368
    	boolean result = false;
366
    	boolean result = false;
367
    	IPath containerPath;
368
    	if (importAsConfiguredProjectCheckbox.getSelection())
369
    	{	// Create a new configured project than import into there
370
    		IProject newProject = getNewProject();
371
    		if (newProject == null) return false;
372
    		containerPath = newProject.getFullPath();
373
    	}
374
    	else
375
    	{
376
    		containerPath = getContainerFullPath();
377
    	}
369
378
370
    	if (ArchiveFileManipulations.isTarFile(sourceNameField.getText())) {
379
    	if (ArchiveFileManipulations.isTarFile(sourceNameField.getText())) {
371
    		if( ensureTarSourceIsValid()) {
380
    		if( ensureTarSourceIsValid()) {
Lines 373-379 Link Here
373
	    		TarLeveledStructureProvider structureProvider = ArchiveFileManipulations
382
	    		TarLeveledStructureProvider structureProvider = ArchiveFileManipulations
374
						.getTarStructureProvider(tarFile, getContainer()
383
						.getTarStructureProvider(tarFile, getContainer()
375
								.getShell());
384
								.getShell());
376
	    		ImportOperation operation = new ImportOperation(getContainerFullPath(),
385
	    		ImportOperation operation = new ImportOperation(containerPath,
377
	    				structureProvider.getRoot(), structureProvider, this,
386
	    				structureProvider.getRoot(), structureProvider, this,
378
						fileSystemObjects);
387
						fileSystemObjects);
379
	
388
	
Lines 386-394 Link Here
386
    		ZipFile zipFile = getSpecifiedZipSourceFile();
395
    		ZipFile zipFile = getSpecifiedZipSourceFile();
387
            ZipLeveledStructureProvider structureProvider = ArchiveFileManipulations
396
            ZipLeveledStructureProvider structureProvider = ArchiveFileManipulations
388
					.getZipStructureProvider(zipFile, getContainer().getShell());
397
					.getZipStructureProvider(zipFile, getContainer().getShell());
389
			ImportOperation operation = new ImportOperation(
398
			ImportOperation operation = new ImportOperation(containerPath,
390
					getContainerFullPath(), structureProvider.getRoot(),
399
					structureProvider.getRoot(), structureProvider, this, fileSystemObjects);
391
					structureProvider, this, fileSystemObjects);
392
400
393
    		operation.setContext(getShell());
401
    		operation.setContext(getShell());
394
    		result = executeImportOperation(operation);
402
    		result = executeImportOperation(operation);
Lines 450-455 Link Here
450
                sourceNameField.add(sourceNames[i]);
458
                sourceNameField.add(sourceNames[i]);
451
459
452
            // radio buttons and checkboxes	
460
            // radio buttons and checkboxes	
461
            boolean configureSelection = settings.getBoolean(STORE_IMPORT_CONFIGURED_PROJECT);
462
            importAsConfiguredProjectCheckbox.setSelection(configureSelection);
463
            containerBrowseButton.setEnabled(!configureSelection);
464
            containerNameField.setEnabled(!configureSelection);
465
453
            overwriteExistingResourcesCheckbox.setSelection(settings
466
            overwriteExistingResourcesCheckbox.setSelection(settings
454
                    .getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
467
                    .getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
455
        }
468
        }
Lines 481-486 Link Here
481
494
482
            settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID,
495
            settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID,
483
                    overwriteExistingResourcesCheckbox.getSelection());
496
                    overwriteExistingResourcesCheckbox.getSelection());
497
            settings.put(STORE_IMPORT_CONFIGURED_PROJECT,
498
                    importAsConfiguredProjectCheckbox.getSelection());
484
        }
499
        }
485
    }
500
    }
486
501
(-)src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java (+1 lines)
Lines 51-56 Link Here
51
	public static String FileImport_fromDirectory;
51
	public static String FileImport_fromDirectory;
52
	public static String FileImport_importFileSystem;
52
	public static String FileImport_importFileSystem;
53
	public static String FileImport_overwriteExisting;
53
	public static String FileImport_overwriteExisting;
54
	public static String FileImport_configuredProject;
54
	public static String FileImport_createComplete;
55
	public static String FileImport_createComplete;
55
	public static String FileImport_createSelectedFolders;
56
	public static String FileImport_createSelectedFolders;
56
	public static String FileImport_noneSelected;
57
	public static String FileImport_noneSelected;
(-)extensions/org/eclipse/ui/dialogs/WizardResourceImportPage.java (-31 / +3 lines)
Lines 14-20 Link Here
14
import java.util.Map;
14
import java.util.Map;
15
15
16
import org.eclipse.core.resources.IContainer;
16
import org.eclipse.core.resources.IContainer;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.resources.IWorkspace;
18
import org.eclipse.core.resources.IWorkspace;
20
import org.eclipse.core.resources.IWorkspaceRoot;
19
import org.eclipse.core.resources.IWorkspaceRoot;
Lines 78-86 Link Here
78
    protected java.util.List selectedTypes = new ArrayList();
77
    protected java.util.List selectedTypes = new ArrayList();
79
78
80
    // widgets
79
    // widgets
81
    private Text containerNameField;
80
    protected Text containerNameField;
82
81
83
    private Button containerBrowseButton;
82
    protected Button containerBrowseButton;
84
83
85
    protected ResourceTreeAndListGroup selectionGroup;
84
    protected ResourceTreeAndListGroup selectionGroup;
86
85
Lines 470-476 Link Here
470
    /* (non-Javadoc)
469
    /* (non-Javadoc)
471
     * Method declared on WizardDataTransferPage.
470
     * Method declared on WizardDataTransferPage.
472
     */
471
     */
473
    protected final boolean validateDestinationGroup() {
472
    protected boolean validateDestinationGroup() {
474
473
475
        IPath containerPath = getContainerFullPath();
474
        IPath containerPath = getContainerFullPath();
476
        if (containerPath == null) {
475
        if (containerPath == null) {
Lines 542-572 Link Here
542
    protected boolean sourceConflictsWithDestination(IPath sourcePath) {
541
    protected boolean sourceConflictsWithDestination(IPath sourcePath) {
543
        return false;
542
        return false;
544
    }
543
    }
545
546
    /*
547
     * @see WizardDataTransferPage.determinePageCompletion.
548
     */
549
    protected boolean determinePageCompletion() {
550
        //Check for valid projects before making the user do anything 
551
        if (noOpenProjects()) {
552
            setErrorMessage(IDEWorkbenchMessages.WizardImportPage_noOpenProjects);
553
            return false;
554
        }
555
        return super.determinePageCompletion();
556
    }
557
558
    /**
559
     * Returns whether or not the passed workspace has any 
560
     * open projects
561
     * @return boolean
562
     */
563
    private boolean noOpenProjects() {
564
        IProject[] projects = IDEWorkbenchPlugin.getPluginWorkspace().getRoot()
565
                .getProjects();
566
        for (int i = 0; i < projects.length; i++) {
567
            if (projects[i].isOpen())
568
                return false;
569
        }
570
        return true;
571
    }
572
}
544
}

Return to bug 83240