|
Lines 29-51
Link Here
|
| 29 |
import java.util.zip.ZipException; |
29 |
import java.util.zip.ZipException; |
| 30 |
import java.util.zip.ZipFile; |
30 |
import java.util.zip.ZipFile; |
| 31 |
|
31 |
|
| 32 |
import org.eclipse.osgi.util.NLS; |
32 |
import org.eclipse.core.resources.IProject; |
| 33 |
|
33 |
import org.eclipse.core.resources.IProjectDescription; |
| 34 |
import org.eclipse.swt.SWT; |
34 |
import org.eclipse.core.resources.IResource; |
| 35 |
import org.eclipse.swt.events.FocusAdapter; |
35 |
import org.eclipse.core.resources.IWorkspace; |
| 36 |
import org.eclipse.swt.events.SelectionAdapter; |
36 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 37 |
import org.eclipse.swt.events.SelectionEvent; |
|
|
| 38 |
import org.eclipse.swt.events.TraverseEvent; |
| 39 |
import org.eclipse.swt.events.TraverseListener; |
| 40 |
import org.eclipse.swt.layout.GridData; |
| 41 |
import org.eclipse.swt.layout.GridLayout; |
| 42 |
import org.eclipse.swt.widgets.Button; |
| 43 |
import org.eclipse.swt.widgets.Composite; |
| 44 |
import org.eclipse.swt.widgets.DirectoryDialog; |
| 45 |
import org.eclipse.swt.widgets.FileDialog; |
| 46 |
import org.eclipse.swt.widgets.Label; |
| 47 |
import org.eclipse.swt.widgets.Text; |
| 48 |
|
| 49 |
import org.eclipse.core.runtime.CoreException; |
37 |
import org.eclipse.core.runtime.CoreException; |
| 50 |
import org.eclipse.core.runtime.IPath; |
38 |
import org.eclipse.core.runtime.IPath; |
| 51 |
import org.eclipse.core.runtime.IProgressMonitor; |
39 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
Lines 55-67
Link Here
|
| 55 |
import org.eclipse.core.runtime.Platform; |
43 |
import org.eclipse.core.runtime.Platform; |
| 56 |
import org.eclipse.core.runtime.Status; |
44 |
import org.eclipse.core.runtime.Status; |
| 57 |
import org.eclipse.core.runtime.SubProgressMonitor; |
45 |
import org.eclipse.core.runtime.SubProgressMonitor; |
| 58 |
|
|
|
| 59 |
import org.eclipse.core.resources.IProject; |
| 60 |
import org.eclipse.core.resources.IProjectDescription; |
| 61 |
import org.eclipse.core.resources.IResource; |
| 62 |
import org.eclipse.core.resources.IWorkspace; |
| 63 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 64 |
|
| 65 |
import org.eclipse.jface.dialogs.Dialog; |
46 |
import org.eclipse.jface.dialogs.Dialog; |
| 66 |
import org.eclipse.jface.dialogs.ErrorDialog; |
47 |
import org.eclipse.jface.dialogs.ErrorDialog; |
| 67 |
import org.eclipse.jface.dialogs.IDialogConstants; |
48 |
import org.eclipse.jface.dialogs.IDialogConstants; |
|
Lines 71-82
Link Here
|
| 71 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
52 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
| 72 |
import org.eclipse.jface.viewers.CheckboxTreeViewer; |
53 |
import org.eclipse.jface.viewers.CheckboxTreeViewer; |
| 73 |
import org.eclipse.jface.viewers.ICheckStateListener; |
54 |
import org.eclipse.jface.viewers.ICheckStateListener; |
|
|
55 |
import org.eclipse.jface.viewers.ILabelProviderListener; |
| 56 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
| 74 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
57 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
| 75 |
import org.eclipse.jface.viewers.LabelProvider; |
|
|
| 76 |
import org.eclipse.jface.viewers.Viewer; |
58 |
import org.eclipse.jface.viewers.Viewer; |
| 77 |
import org.eclipse.jface.viewers.ViewerComparator; |
59 |
import org.eclipse.jface.viewers.ViewerComparator; |
| 78 |
import org.eclipse.jface.wizard.WizardPage; |
60 |
import org.eclipse.jface.wizard.WizardPage; |
| 79 |
|
61 |
import org.eclipse.osgi.util.NLS; |
|
|
62 |
import org.eclipse.swt.SWT; |
| 63 |
import org.eclipse.swt.events.FocusAdapter; |
| 64 |
import org.eclipse.swt.events.SelectionAdapter; |
| 65 |
import org.eclipse.swt.events.SelectionEvent; |
| 66 |
import org.eclipse.swt.events.TraverseEvent; |
| 67 |
import org.eclipse.swt.events.TraverseListener; |
| 68 |
import org.eclipse.swt.graphics.Image; |
| 69 |
import org.eclipse.swt.layout.GridData; |
| 70 |
import org.eclipse.swt.layout.GridLayout; |
| 71 |
import org.eclipse.swt.widgets.Button; |
| 72 |
import org.eclipse.swt.widgets.Composite; |
| 73 |
import org.eclipse.swt.widgets.DirectoryDialog; |
| 74 |
import org.eclipse.swt.widgets.FileDialog; |
| 75 |
import org.eclipse.swt.widgets.Label; |
| 76 |
import org.eclipse.swt.widgets.Text; |
| 77 |
import org.eclipse.swt.widgets.Tree; |
| 78 |
import org.eclipse.swt.widgets.TreeColumn; |
| 80 |
import org.eclipse.ui.actions.WorkspaceModifyOperation; |
79 |
import org.eclipse.ui.actions.WorkspaceModifyOperation; |
| 81 |
import org.eclipse.ui.dialogs.IOverwriteQuery; |
80 |
import org.eclipse.ui.dialogs.IOverwriteQuery; |
| 82 |
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; |
81 |
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; |
|
Lines 118-123
Link Here
|
| 118 |
String projectName; |
117 |
String projectName; |
| 119 |
|
118 |
|
| 120 |
Object parent; |
119 |
Object parent; |
|
|
120 |
|
| 121 |
String parentName; |
| 121 |
|
122 |
|
| 122 |
int level; |
123 |
int level; |
| 123 |
|
124 |
|
|
Lines 156-161
Link Here
|
| 156 |
IProjectDescription newDescription = null; |
157 |
IProjectDescription newDescription = null; |
| 157 |
try { |
158 |
try { |
| 158 |
if (projectArchiveFile != null) { |
159 |
if (projectArchiveFile != null) { |
|
|
160 |
String label = structureProvider.getFullPath(projectArchiveFile); |
| 161 |
int sepIndex = label.lastIndexOf('/'); |
| 162 |
if (sepIndex == -1) { |
| 163 |
// there is no parent, so we will just use the empty string |
| 164 |
parentName = ""; //$NON-NLS-1$ |
| 165 |
} else { |
| 166 |
parentName = label.substring(0, sepIndex); |
| 167 |
} |
| 168 |
|
| 159 |
InputStream stream = structureProvider |
169 |
InputStream stream = structureProvider |
| 160 |
.getContents(projectArchiveFile); |
170 |
.getContents(projectArchiveFile); |
| 161 |
if (stream != null) { |
171 |
if (stream != null) { |
|
Lines 165-170
Link Here
|
| 165 |
stream.close(); |
175 |
stream.close(); |
| 166 |
} |
176 |
} |
| 167 |
} else { |
177 |
} else { |
|
|
178 |
parentName = projectSystemFile.getParent(); |
| 179 |
|
| 168 |
IPath path = new Path(projectSystemFile.getPath()); |
180 |
IPath path = new Path(projectSystemFile.getPath()); |
| 169 |
// if the file is in the default location, use the directory |
181 |
// if the file is in the default location, use the directory |
| 170 |
// name as the project name |
182 |
// name as the project name |
|
Lines 219-224
Link Here
|
| 219 |
public String getProjectName() { |
231 |
public String getProjectName() { |
| 220 |
return projectName; |
232 |
return projectName; |
| 221 |
} |
233 |
} |
|
|
234 |
|
| 235 |
/** |
| 236 |
* Gets the name of the project's containing parent. |
| 237 |
* |
| 238 |
* @return the project's container |
| 239 |
*/ |
| 240 |
public String getParentName() { |
| 241 |
return parentName; |
| 242 |
} |
| 222 |
} |
243 |
} |
| 223 |
|
244 |
|
| 224 |
// dialog store id constants |
245 |
// dialog store id constants |
|
Lines 354-359
Link Here
|
| 354 |
| GridData.GRAB_VERTICAL | GridData.FILL_BOTH); |
375 |
| GridData.GRAB_VERTICAL | GridData.FILL_BOTH); |
| 355 |
projectsList.getControl().setLayoutData(listData); |
376 |
projectsList.getControl().setLayoutData(listData); |
| 356 |
|
377 |
|
|
|
378 |
Tree projectsTree = projectsList.getTree(); |
| 379 |
projectsTree.setHeaderVisible(true); |
| 380 |
// create a column for the project and its parent container |
| 381 |
TreeColumn projectColumn = new TreeColumn(projectsTree, SWT.LEAD); |
| 382 |
projectColumn.setWidth(150); |
| 383 |
projectColumn.setText(DataTransferMessages.WizardProjectsImportPage_ProjectNameColumnHeader); |
| 384 |
|
| 385 |
TreeColumn parentColumn = new TreeColumn(projectsTree, SWT.LEAD); |
| 386 |
parentColumn.setWidth(150); |
| 387 |
parentColumn.setText(DataTransferMessages.WizardProjectsImportPage_ProjectParentColumnHeader); |
| 388 |
|
| 357 |
projectsList.setContentProvider(new ITreeContentProvider() { |
389 |
projectsList.setContentProvider(new ITreeContentProvider() { |
| 358 |
|
390 |
|
| 359 |
/* |
391 |
/* |
|
Lines 413-426
Link Here
|
| 413 |
|
445 |
|
| 414 |
}); |
446 |
}); |
| 415 |
|
447 |
|
| 416 |
projectsList.setLabelProvider(new LabelProvider() { |
448 |
projectsList.setLabelProvider(new ITableLabelProvider() { |
| 417 |
/* |
449 |
public Image getColumnImage(Object element, int columnIndex) { |
| 418 |
* (non-Javadoc) |
450 |
return null; |
| 419 |
* |
451 |
} |
| 420 |
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) |
452 |
|
| 421 |
*/ |
453 |
public String getColumnText(Object element, int columnIndex) { |
| 422 |
public String getText(Object element) { |
454 |
if (columnIndex == 0) { |
| 423 |
return ((ProjectRecord) element).getProjectName(); |
455 |
return ((ProjectRecord) element).getProjectName(); |
|
|
456 |
} |
| 457 |
return ((ProjectRecord) element).getParentName(); |
| 458 |
} |
| 459 |
|
| 460 |
public void addListener(ILabelProviderListener listener) { |
| 461 |
} |
| 462 |
|
| 463 |
public void dispose() { |
| 464 |
} |
| 465 |
|
| 466 |
public boolean isLabelProperty(Object element, String property) { |
| 467 |
return false; |
| 468 |
} |
| 469 |
|
| 470 |
public void removeListener(ILabelProviderListener listener) { |
| 424 |
} |
471 |
} |
| 425 |
}); |
472 |
}); |
| 426 |
|
473 |
|