|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.ui.dialogs.WizardNewProjectReferencePage; |
28 |
import org.eclipse.ui.dialogs.WizardNewProjectReferencePage; |
| 29 |
import org.eclipse.ui.help.WorkbenchHelp; |
29 |
import org.eclipse.ui.help.WorkbenchHelp; |
| 30 |
import org.eclipse.ui.internal.IWorkbenchHelpContextIds; |
30 |
import org.eclipse.ui.internal.IWorkbenchHelpContextIds; |
|
|
31 |
import org.eclipse.ui.internal.WorkbenchMessages; |
| 31 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
32 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
| 32 |
import org.eclipse.ui.internal.dialogs.ExportWizard; |
33 |
import org.eclipse.ui.internal.dialogs.ExportWizard; |
| 33 |
import org.eclipse.ui.internal.dialogs.ImportWizard; |
34 |
import org.eclipse.ui.internal.dialogs.ImportWizard; |
|
Lines 264-285
Link Here
|
| 264 |
// Create wizard selection wizard. |
265 |
// Create wizard selection wizard. |
| 265 |
NewWizard wizard = new NewWizard(); |
266 |
NewWizard wizard = new NewWizard(); |
| 266 |
wizard.setProjectsOnly(true); |
267 |
wizard.setProjectsOnly(true); |
| 267 |
ISelection selection = getWorkbench().getActiveWorkbenchWindow() |
268 |
initNewWizard(wizard); |
| 268 |
.getSelectionService().getSelection(); |
|
|
| 269 |
IStructuredSelection selectionToPass = null; |
| 270 |
if (selection instanceof IStructuredSelection) |
| 271 |
selectionToPass = (IStructuredSelection) selection; |
| 272 |
else |
| 273 |
selectionToPass = StructuredSelection.EMPTY; |
| 274 |
wizard.init(getWorkbench(), selectionToPass); |
| 275 |
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault() |
| 276 |
.getDialogSettings(); |
| 277 |
IDialogSettings wizardSettings = workbenchSettings |
| 278 |
.getSection("NewWizardAction");//$NON-NLS-1$ |
| 279 |
if (wizardSettings == null) |
| 280 |
wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$ |
| 281 |
wizard.setDialogSettings(wizardSettings); |
| 282 |
wizard.setForcePreviousAndNextButtons(true); |
| 283 |
|
269 |
|
| 284 |
// Create wizard dialog. |
270 |
// Create wizard dialog. |
| 285 |
WizardDialog dialog = new WizardDialog(getShell(), wizard); |
271 |
WizardDialog dialog = new WizardDialog(getShell(), wizard); |
|
Lines 294-300
Link Here
|
| 294 |
|
280 |
|
| 295 |
public void testNewResource() { |
281 |
public void testNewResource() { |
| 296 |
NewWizard wizard = new NewWizard(); |
282 |
NewWizard wizard = new NewWizard(); |
| 297 |
ISelection selection = getWorkbench().getActiveWorkbenchWindow() |
283 |
initNewWizard(wizard); |
|
|
284 |
|
| 285 |
WizardDialog dialog = new WizardDialog(getShell(), wizard); |
| 286 |
dialog.create(); |
| 287 |
dialog.getShell().setSize( |
| 288 |
Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), |
| 289 |
SIZING_WIZARD_HEIGHT_2); |
| 290 |
WorkbenchHelp.setHelp(dialog.getShell(), IWorkbenchHelpContextIds.NEW_WIZARD); |
| 291 |
DialogCheck.assertDialogTexts(dialog, this); |
| 292 |
} |
| 293 |
|
| 294 |
public void testWizardWindowTitle() { |
| 295 |
|
| 296 |
checkWizardWindowTitle(null); |
| 297 |
checkWizardWindowTitle("My New Wizard"); //$NON-NLS-1$ |
| 298 |
|
| 299 |
} |
| 300 |
|
| 301 |
private void checkWizardWindowTitle(String windowTitle) { |
| 302 |
|
| 303 |
NewWizard newWizard = new NewWizard(); |
| 304 |
newWizard.setWindowTitle(windowTitle); |
| 305 |
|
| 306 |
initNewWizard(newWizard); |
| 307 |
|
| 308 |
WizardDialog dialog = new WizardDialog(getShell(), newWizard); |
| 309 |
dialog.create(); |
| 310 |
|
| 311 |
if(windowTitle == null) |
| 312 |
windowTitle = WorkbenchMessages.NewWizard_title; |
| 313 |
|
| 314 |
assertEquals(windowTitle, dialog.getShell().getText()); |
| 315 |
|
| 316 |
dialog.close(); |
| 317 |
} |
| 318 |
|
| 319 |
private void initNewWizard(NewWizard wizard) { |
| 320 |
ISelection selection = getWorkbench().getActiveWorkbenchWindow() |
| 298 |
.getSelectionService().getSelection(); |
321 |
.getSelectionService().getSelection(); |
| 299 |
IStructuredSelection selectionToPass = null; |
322 |
IStructuredSelection selectionToPass = null; |
| 300 |
if (selection instanceof IStructuredSelection) |
323 |
if (selection instanceof IStructuredSelection) |
|
Lines 310-324
Link Here
|
| 310 |
wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$ |
333 |
wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$ |
| 311 |
wizard.setDialogSettings(wizardSettings); |
334 |
wizard.setDialogSettings(wizardSettings); |
| 312 |
wizard.setForcePreviousAndNextButtons(true); |
335 |
wizard.setForcePreviousAndNextButtons(true); |
|
|
336 |
} |
| 313 |
|
337 |
|
| 314 |
WizardDialog dialog = new WizardDialog(getShell(), wizard); |
|
|
| 315 |
dialog.create(); |
| 316 |
dialog.getShell().setSize( |
| 317 |
Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), |
| 318 |
SIZING_WIZARD_HEIGHT_2); |
| 319 |
WorkbenchHelp.setHelp(dialog.getShell(), IWorkbenchHelpContextIds.NEW_WIZARD); |
| 320 |
DialogCheck.assertDialogTexts(dialog, this); |
| 321 |
} |
| 322 |
|
338 |
|
| 323 |
} |
339 |
} |
| 324 |
|
340 |
|