|
Lines 37-42
Link Here
|
| 37 |
import org.eclipse.swt.events.SelectionEvent; |
37 |
import org.eclipse.swt.events.SelectionEvent; |
| 38 |
import org.eclipse.swt.events.TraverseEvent; |
38 |
import org.eclipse.swt.events.TraverseEvent; |
| 39 |
import org.eclipse.swt.events.TraverseListener; |
39 |
import org.eclipse.swt.events.TraverseListener; |
|
|
40 |
import org.eclipse.swt.graphics.Image; |
| 40 |
import org.eclipse.swt.layout.GridData; |
41 |
import org.eclipse.swt.layout.GridData; |
| 41 |
import org.eclipse.swt.layout.GridLayout; |
42 |
import org.eclipse.swt.layout.GridLayout; |
| 42 |
import org.eclipse.swt.widgets.Button; |
43 |
import org.eclipse.swt.widgets.Button; |
|
Lines 45-50
Link Here
|
| 45 |
import org.eclipse.swt.widgets.FileDialog; |
46 |
import org.eclipse.swt.widgets.FileDialog; |
| 46 |
import org.eclipse.swt.widgets.Label; |
47 |
import org.eclipse.swt.widgets.Label; |
| 47 |
import org.eclipse.swt.widgets.Text; |
48 |
import org.eclipse.swt.widgets.Text; |
|
|
49 |
import org.eclipse.swt.widgets.Tree; |
| 50 |
import org.eclipse.swt.widgets.TreeColumn; |
| 48 |
|
51 |
|
| 49 |
import org.eclipse.core.runtime.CoreException; |
52 |
import org.eclipse.core.runtime.CoreException; |
| 50 |
import org.eclipse.core.runtime.IPath; |
53 |
import org.eclipse.core.runtime.IPath; |
|
Lines 71-78
Link Here
|
| 71 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
74 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
| 72 |
import org.eclipse.jface.viewers.CheckboxTreeViewer; |
75 |
import org.eclipse.jface.viewers.CheckboxTreeViewer; |
| 73 |
import org.eclipse.jface.viewers.ICheckStateListener; |
76 |
import org.eclipse.jface.viewers.ICheckStateListener; |
|
|
77 |
import org.eclipse.jface.viewers.ILabelProviderListener; |
| 74 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
78 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
| 75 |
import org.eclipse.jface.viewers.LabelProvider; |
79 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
| 76 |
import org.eclipse.jface.viewers.Viewer; |
80 |
import org.eclipse.jface.viewers.Viewer; |
| 77 |
import org.eclipse.jface.viewers.ViewerComparator; |
81 |
import org.eclipse.jface.viewers.ViewerComparator; |
| 78 |
import org.eclipse.jface.wizard.WizardPage; |
82 |
import org.eclipse.jface.wizard.WizardPage; |
|
Lines 118-123
Link Here
|
| 118 |
String projectName; |
122 |
String projectName; |
| 119 |
|
123 |
|
| 120 |
Object parent; |
124 |
Object parent; |
|
|
125 |
|
| 126 |
String parentName; |
| 121 |
|
127 |
|
| 122 |
int level; |
128 |
int level; |
| 123 |
|
129 |
|
|
Lines 156-161
Link Here
|
| 156 |
IProjectDescription newDescription = null; |
162 |
IProjectDescription newDescription = null; |
| 157 |
try { |
163 |
try { |
| 158 |
if (projectArchiveFile != null) { |
164 |
if (projectArchiveFile != null) { |
|
|
165 |
String label = structureProvider.getFullPath(projectArchiveFile); |
| 166 |
int sepIndex = label.lastIndexOf('/'); |
| 167 |
if (sepIndex == -1) { |
| 168 |
// there is no parent, so we will just use the empty string |
| 169 |
parentName = ""; //$NON-NLS-1$ |
| 170 |
} else { |
| 171 |
parentName = label.substring(0, sepIndex); |
| 172 |
} |
| 173 |
|
| 159 |
InputStream stream = structureProvider |
174 |
InputStream stream = structureProvider |
| 160 |
.getContents(projectArchiveFile); |
175 |
.getContents(projectArchiveFile); |
| 161 |
if (stream != null) { |
176 |
if (stream != null) { |
|
Lines 165-170
Link Here
|
| 165 |
stream.close(); |
180 |
stream.close(); |
| 166 |
} |
181 |
} |
| 167 |
} else { |
182 |
} else { |
|
|
183 |
parentName = projectSystemFile.getParent(); |
| 184 |
|
| 168 |
IPath path = new Path(projectSystemFile.getPath()); |
185 |
IPath path = new Path(projectSystemFile.getPath()); |
| 169 |
// if the file is in the default location, use the directory |
186 |
// if the file is in the default location, use the directory |
| 170 |
// name as the project name |
187 |
// name as the project name |
|
Lines 219-224
Link Here
|
| 219 |
public String getProjectName() { |
236 |
public String getProjectName() { |
| 220 |
return projectName; |
237 |
return projectName; |
| 221 |
} |
238 |
} |
|
|
239 |
|
| 240 |
/** |
| 241 |
* Gets the name of the project's containing parent. |
| 242 |
* |
| 243 |
* @return the project's container |
| 244 |
*/ |
| 245 |
public String getParentName() { |
| 246 |
return parentName; |
| 247 |
} |
| 222 |
} |
248 |
} |
| 223 |
|
249 |
|
| 224 |
// dialog store id constants |
250 |
// dialog store id constants |
|
Lines 354-359
Link Here
|
| 354 |
| GridData.GRAB_VERTICAL | GridData.FILL_BOTH); |
380 |
| GridData.GRAB_VERTICAL | GridData.FILL_BOTH); |
| 355 |
projectsList.getControl().setLayoutData(listData); |
381 |
projectsList.getControl().setLayoutData(listData); |
| 356 |
|
382 |
|
|
|
383 |
Tree projectsTree = projectsList.getTree(); |
| 384 |
// create a column for the project and its parent container |
| 385 |
TreeColumn projectColumn = new TreeColumn(projectsTree, SWT.LEAD); |
| 386 |
projectColumn.setWidth(150); |
| 387 |
projectColumn.setText(DataTransferMessages.WizardProjectsImportPage_ProjectNameColumnHeader); |
| 388 |
|
| 389 |
TreeColumn parentColumn = new TreeColumn(projectsTree, SWT.LEAD); |
| 390 |
parentColumn.setWidth(150); |
| 391 |
parentColumn.setText(DataTransferMessages.WizardProjectsImportPage_ProjectParentColumnHeader); |
| 392 |
|
| 357 |
projectsList.setContentProvider(new ITreeContentProvider() { |
393 |
projectsList.setContentProvider(new ITreeContentProvider() { |
| 358 |
|
394 |
|
| 359 |
/* |
395 |
/* |
|
Lines 413-426
Link Here
|
| 413 |
|
449 |
|
| 414 |
}); |
450 |
}); |
| 415 |
|
451 |
|
| 416 |
projectsList.setLabelProvider(new LabelProvider() { |
452 |
projectsList.setLabelProvider(new ITableLabelProvider() { |
| 417 |
/* |
453 |
public Image getColumnImage(Object element, int columnIndex) { |
| 418 |
* (non-Javadoc) |
454 |
return null; |
| 419 |
* |
455 |
} |
| 420 |
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) |
456 |
|
| 421 |
*/ |
457 |
public String getColumnText(Object element, int columnIndex) { |
| 422 |
public String getText(Object element) { |
458 |
if (columnIndex == 0) { |
| 423 |
return ((ProjectRecord) element).getProjectName(); |
459 |
return ((ProjectRecord) element).getProjectName(); |
|
|
460 |
} |
| 461 |
return ((ProjectRecord) element).getParentName(); |
| 462 |
} |
| 463 |
|
| 464 |
public void addListener(ILabelProviderListener listener) { |
| 465 |
} |
| 466 |
|
| 467 |
public void dispose() { |
| 468 |
} |
| 469 |
|
| 470 |
public boolean isLabelProperty(Object element, String property) { |
| 471 |
return false; |
| 472 |
} |
| 473 |
|
| 474 |
public void removeListener(ILabelProviderListener listener) { |
| 424 |
} |
475 |
} |
| 425 |
}); |
476 |
}); |
| 426 |
|
477 |
|