|
Lines 18-23
Link Here
|
| 18 |
import org.eclipse.core.resources.IProject; |
18 |
import org.eclipse.core.resources.IProject; |
| 19 |
import org.eclipse.core.runtime.CoreException; |
19 |
import org.eclipse.core.runtime.CoreException; |
| 20 |
import org.eclipse.jface.dialogs.Dialog; |
20 |
import org.eclipse.jface.dialogs.Dialog; |
|
|
21 |
import org.eclipse.jface.dialogs.IDialogSettings; |
| 21 |
import org.eclipse.jface.resource.ImageDescriptor; |
22 |
import org.eclipse.jface.resource.ImageDescriptor; |
| 22 |
import org.eclipse.jface.viewers.*; |
23 |
import org.eclipse.jface.viewers.*; |
| 23 |
import org.eclipse.jface.wizard.*; |
24 |
import org.eclipse.jface.wizard.*; |
|
Lines 51-56
Link Here
|
| 51 |
|
52 |
|
| 52 |
private IWizard selectedWizard; |
53 |
private IWizard selectedWizard; |
| 53 |
|
54 |
|
|
|
55 |
private IDialogSettings settings; |
| 56 |
private final static String SELECTED_WIZARD_ID = "selectedWizardId"; //$NON-NLS-1$ |
| 57 |
private String selectedWizardId; |
| 58 |
|
| 54 |
/** |
59 |
/** |
| 55 |
* Create a new ConfigureProjectWizardMainPage |
60 |
* Create a new ConfigureProjectWizardMainPage |
| 56 |
* |
61 |
* |
|
Lines 122-139
Link Here
|
| 122 |
ISelection selection = event.getSelection(); |
127 |
ISelection selection = event.getSelection(); |
| 123 |
if (selection == null || !(selection instanceof IStructuredSelection)) { |
128 |
if (selection == null || !(selection instanceof IStructuredSelection)) { |
| 124 |
selectedWizard = null; |
129 |
selectedWizard = null; |
|
|
130 |
selectedWizardId = null; |
| 125 |
setPageComplete(false); |
131 |
setPageComplete(false); |
| 126 |
return; |
132 |
return; |
| 127 |
} |
133 |
} |
| 128 |
IStructuredSelection ss = (IStructuredSelection)selection; |
134 |
IStructuredSelection ss = (IStructuredSelection)selection; |
| 129 |
if (ss.size() != 1) { |
135 |
if (ss.size() != 1) { |
| 130 |
selectedWizard = null; |
136 |
selectedWizard = null; |
|
|
137 |
selectedWizardId = null; |
| 131 |
setPageComplete(false); |
138 |
setPageComplete(false); |
| 132 |
return; |
139 |
return; |
| 133 |
} |
140 |
} |
| 134 |
ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement(); |
141 |
ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement(); |
| 135 |
try { |
142 |
try { |
| 136 |
selectedWizard = (IWizard)selectedElement.createExecutableExtension(getUnsharedProjects()); |
143 |
selectedWizard = (IWizard)selectedElement.createExecutableExtension(getUnsharedProjects()); |
|
|
144 |
selectedWizardId = selectedElement.getID(); |
| 137 |
} catch (CoreException e) { |
145 |
} catch (CoreException e) { |
| 138 |
return; |
146 |
return; |
| 139 |
} |
147 |
} |
|
Lines 181-186
Link Here
|
| 181 |
} else { |
189 |
} else { |
| 182 |
viewer.setInput(wizards); |
190 |
viewer.setInput(wizards); |
| 183 |
} |
191 |
} |
|
|
192 |
initializeWizardSelection(); |
| 184 |
Dialog.applyDialogFont(parent); |
193 |
Dialog.applyDialogFont(parent); |
| 185 |
} |
194 |
} |
| 186 |
|
195 |
|
|
Lines 223-226
Link Here
|
| 223 |
table.setFocus(); |
232 |
table.setFocus(); |
| 224 |
} |
233 |
} |
| 225 |
} |
234 |
} |
|
|
235 |
|
| 236 |
private void initializeWizardSelection() { |
| 237 |
String selectedWizardId = null; |
| 238 |
|
| 239 |
IDialogSettings dialogSettings = TeamUIPlugin.getPlugin().getDialogSettings(); |
| 240 |
this.settings = dialogSettings.getSection("ConfigureProjectWizard"); //$NON-NLS-1$ |
| 241 |
if (this.settings == null) { |
| 242 |
this.settings = dialogSettings.addNewSection("ConfigureProjectWizard"); //$NON-NLS-1$ |
| 243 |
} |
| 244 |
if (settings != null) |
| 245 |
selectedWizardId = settings.get(SELECTED_WIZARD_ID); |
| 246 |
|
| 247 |
if (selectedWizardId==null) |
| 248 |
return; |
| 249 |
|
| 250 |
// TODO: any checks here? |
| 251 |
Object[] children = ((AdaptableList) viewer.getInput()).getChildren(); |
| 252 |
|
| 253 |
for (int i = 0; i < children.length; i++) { |
| 254 |
try { |
| 255 |
ConfigurationWizardElement element = (ConfigurationWizardElement)children[i]; |
| 256 |
if (element.getID().equals(selectedWizardId)) { |
| 257 |
viewer.setSelection(new StructuredSelection(element)); |
| 258 |
return; |
| 259 |
} |
| 260 |
} catch(ClassCastException e) { |
| 261 |
// ignore |
| 262 |
} |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
/*package*/ void performFinish() { |
| 267 |
settings.put(SELECTED_WIZARD_ID, selectedWizardId); |
| 268 |
} |
| 226 |
} |
269 |
} |