|
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.IColorProvider; |
60 |
import org.eclipse.jface.viewers.IColorProvider; |
| 60 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
61 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
| 61 |
import org.eclipse.jface.viewers.LabelProvider; |
62 |
import org.eclipse.jface.viewers.LabelProvider; |
|
Lines 78-85
Link Here
|
| 78 |
import org.eclipse.swt.widgets.FileDialog; |
79 |
import org.eclipse.swt.widgets.FileDialog; |
| 79 |
import org.eclipse.swt.widgets.Label; |
80 |
import org.eclipse.swt.widgets.Label; |
| 80 |
import org.eclipse.swt.widgets.Text; |
81 |
import org.eclipse.swt.widgets.Text; |
|
|
82 |
import org.eclipse.ui.IWorkingSet; |
| 83 |
import org.eclipse.ui.IWorkingSetManager; |
| 84 |
import org.eclipse.ui.PlatformUI; |
| 81 |
import org.eclipse.ui.actions.WorkspaceModifyOperation; |
85 |
import org.eclipse.ui.actions.WorkspaceModifyOperation; |
| 82 |
import org.eclipse.ui.dialogs.IOverwriteQuery; |
86 |
import org.eclipse.ui.dialogs.IOverwriteQuery; |
|
|
87 |
import org.eclipse.ui.dialogs.WorkingSetGroup; |
| 83 |
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; |
88 |
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; |
| 84 |
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; |
89 |
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; |
| 85 |
import org.eclipse.ui.internal.ide.StatusUtil; |
90 |
import org.eclipse.ui.internal.ide.StatusUtil; |
|
Lines 335-346
Link Here
|
| 335 |
// to mimize searches |
340 |
// to mimize searches |
| 336 |
private long lastModified; |
341 |
private long lastModified; |
| 337 |
|
342 |
|
|
|
343 |
private WorkingSetGroup workingSetGroup; |
| 344 |
|
| 345 |
private IStructuredSelection currentSelection; |
| 346 |
|
| 338 |
/** |
347 |
/** |
| 339 |
* Creates a new project creation wizard page. |
348 |
* Creates a new project creation wizard page. |
| 340 |
* |
349 |
* |
| 341 |
*/ |
350 |
*/ |
| 342 |
public WizardProjectsImportPage() { |
351 |
public WizardProjectsImportPage() { |
| 343 |
this("wizardExternalProjectsPage"); //$NON-NLS-1$ |
352 |
this("wizardExternalProjectsPage", null, null); //$NON-NLS-1$ |
| 344 |
} |
353 |
} |
| 345 |
|
354 |
|
| 346 |
/** |
355 |
/** |
|
Lines 349-360
Link Here
|
| 349 |
* @param pageName |
358 |
* @param pageName |
| 350 |
*/ |
359 |
*/ |
| 351 |
public WizardProjectsImportPage(String pageName) { |
360 |
public WizardProjectsImportPage(String pageName) { |
| 352 |
this(pageName,null); |
361 |
this(pageName,null, null); |
| 353 |
} |
362 |
} |
| 354 |
|
363 |
|
| 355 |
public WizardProjectsImportPage(String pageName,String initialPath) { |
364 |
/** |
|
|
365 |
* More (many more) parameters. |
| 366 |
* |
| 367 |
* @param pageName |
| 368 |
* @param initialPath |
| 369 |
* @param currentSelection |
| 370 |
* @since 3.5 |
| 371 |
*/ |
| 372 |
public WizardProjectsImportPage(String pageName,String initialPath, |
| 373 |
IStructuredSelection currentSelection) { |
| 356 |
super(pageName); |
374 |
super(pageName); |
| 357 |
this.initialPath = initialPath; |
375 |
this.initialPath = initialPath; |
|
|
376 |
this.currentSelection = currentSelection; |
| 358 |
setPageComplete(false); |
377 |
setPageComplete(false); |
| 359 |
setTitle(DataTransferMessages.WizardProjectsImportPage_ImportProjectsTitle); |
378 |
setTitle(DataTransferMessages.WizardProjectsImportPage_ImportProjectsTitle); |
| 360 |
setDescription(DataTransferMessages.WizardProjectsImportPage_ImportProjectsDescription); |
379 |
setDescription(DataTransferMessages.WizardProjectsImportPage_ImportProjectsDescription); |
|
Lines 381-392
Link Here
|
| 381 |
createProjectsRoot(workArea); |
400 |
createProjectsRoot(workArea); |
| 382 |
createProjectsList(workArea); |
401 |
createProjectsList(workArea); |
| 383 |
createOptionsArea(workArea); |
402 |
createOptionsArea(workArea); |
|
|
403 |
createWorkingSetGroup(workArea); |
| 384 |
restoreWidgetValues(); |
404 |
restoreWidgetValues(); |
| 385 |
Dialog.applyDialogFont(workArea); |
405 |
Dialog.applyDialogFont(workArea); |
| 386 |
|
406 |
|
| 387 |
} |
407 |
} |
| 388 |
|
408 |
|
| 389 |
/** |
409 |
/** |
|
|
410 |
* @param workArea |
| 411 |
*/ |
| 412 |
private void createWorkingSetGroup(Composite workArea) { |
| 413 |
String[] workingSetIds = new String[] {"org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$ |
| 414 |
"org.eclipse.jdt.ui.JavaWorkingSetPage"}; //$NON-NLS-1$ |
| 415 |
workingSetGroup = new WorkingSetGroup(workArea, currentSelection, workingSetIds); |
| 416 |
} |
| 417 |
|
| 418 |
/** |
| 390 |
* Create the area with the extra options. |
419 |
* Create the area with the extra options. |
| 391 |
* |
420 |
* |
| 392 |
* @param workArea |
421 |
* @param workArea |
|
Lines 1205-1211
Link Here
|
| 1205 |
*/ |
1234 |
*/ |
| 1206 |
public boolean createProjects() { |
1235 |
public boolean createProjects() { |
| 1207 |
saveWidgetValues(); |
1236 |
saveWidgetValues(); |
|
|
1237 |
|
| 1208 |
final Object[] selected = projectsList.getCheckedElements(); |
1238 |
final Object[] selected = projectsList.getCheckedElements(); |
|
|
1239 |
createdProjects = new ArrayList(); |
| 1209 |
WorkspaceModifyOperation op = new WorkspaceModifyOperation() { |
1240 |
WorkspaceModifyOperation op = new WorkspaceModifyOperation() { |
| 1210 |
protected void execute(IProgressMonitor monitor) |
1241 |
protected void execute(IProgressMonitor monitor) |
| 1211 |
throws InvocationTargetException, InterruptedException { |
1242 |
throws InvocationTargetException, InterruptedException { |
|
Lines 1244-1252
Link Here
|
| 1244 |
} |
1275 |
} |
| 1245 |
ArchiveFileManipulations.closeStructureProvider(structureProvider, |
1276 |
ArchiveFileManipulations.closeStructureProvider(structureProvider, |
| 1246 |
getShell()); |
1277 |
getShell()); |
|
|
1278 |
|
| 1279 |
// Adds the projects to the working sets |
| 1280 |
addToWorkingSets(); |
| 1281 |
|
| 1247 |
return true; |
1282 |
return true; |
| 1248 |
} |
1283 |
} |
| 1249 |
|
1284 |
|
|
|
1285 |
List createdProjects; |
| 1286 |
|
| 1287 |
private void addToWorkingSets() { |
| 1288 |
|
| 1289 |
IWorkingSet[] selectedWorkingSets = workingSetGroup.getSelectedWorkingSets(); |
| 1290 |
if(selectedWorkingSets == null || selectedWorkingSets.length == 0) |
| 1291 |
return; // no Working set is selected |
| 1292 |
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); |
| 1293 |
for (Iterator i = createdProjects.iterator(); i.hasNext();) { |
| 1294 |
IProject project = (IProject) i.next(); |
| 1295 |
workingSetManager.addToWorkingSets(project, selectedWorkingSets); |
| 1296 |
} |
| 1297 |
} |
| 1298 |
|
| 1250 |
/** |
1299 |
/** |
| 1251 |
* Performs clean-up if the user cancels the wizard without doing anything |
1300 |
* Performs clean-up if the user cancels the wizard without doing anything |
| 1252 |
*/ |
1301 |
*/ |
|
Lines 1268-1273
Link Here
|
| 1268 |
String projectName = record.getProjectName(); |
1317 |
String projectName = record.getProjectName(); |
| 1269 |
final IWorkspace workspace = ResourcesPlugin.getWorkspace(); |
1318 |
final IWorkspace workspace = ResourcesPlugin.getWorkspace(); |
| 1270 |
final IProject project = workspace.getRoot().getProject(projectName); |
1319 |
final IProject project = workspace.getRoot().getProject(projectName); |
|
|
1320 |
createdProjects.add(project); |
| 1271 |
if (record.description == null) { |
1321 |
if (record.description == null) { |
| 1272 |
// error case |
1322 |
// error case |
| 1273 |
record.description = workspace.newProjectDescription(projectName); |
1323 |
record.description = workspace.newProjectDescription(projectName); |