Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 122772 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizardsAuto.java (-25 / +41 lines)
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
(-)Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java (-1 / +29 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 67-72 Link Here
67
     */
67
     */
68
    private String categoryId = null;
68
    private String categoryId = null;
69
69
70
	/**
71
	 * The title of the wizard window or <code>null</code> to use the default
72
	 * wizard window title.
73
	 */
74
	private String windowTitle = null;
75
70
    /**
76
    /**
71
     * The workbench window; or <code>null</code> if this
77
     * The workbench window; or <code>null</code> if this
72
     * action has been <code>dispose</code>d.
78
     * action has been <code>dispose</code>d.
Lines 128-133 Link Here
128
        categoryId = id;
134
        categoryId = id;
129
    }
135
    }
130
136
137
	/**
138
	 * <p>
139
	 * Sets the title of the wizard window
140
	 * <p>
141
	 * 
142
	 * <p>
143
	 * If the title of the wizard window is <code>null</code>, the default
144
	 * wizard window title will be used.
145
	 * </p>
146
	 * 
147
	 * @param windowTitle
148
	 *            The title of the wizard window, otherwise <code>null</code>
149
	 *            (default wizard window title).
150
	 * 
151
	 * @since 3.6
152
	 */
153
	public void setWizardWindowTitle(String windowTitle) {
154
		this.windowTitle = windowTitle;
155
	}
156
131
    /* (non-Javadoc)
157
    /* (non-Javadoc)
132
     * Method declared on IAction.
158
     * Method declared on IAction.
133
     */
159
     */
Lines 138-143 Link Here
138
        }
164
        }
139
        NewWizard wizard = new NewWizard();
165
        NewWizard wizard = new NewWizard();
140
        wizard.setCategoryId(categoryId);
166
        wizard.setCategoryId(categoryId);
167
		wizard.setWindowTitle(windowTitle);
141
168
142
        ISelection selection = workbenchWindow.getSelectionService()
169
        ISelection selection = workbenchWindow.getSelectionService()
143
                .getSelection();
170
                .getSelection();
Lines 162-167 Link Here
162
        }
189
        }
163
190
164
        wizard.init(workbenchWindow.getWorkbench(), selectionToPass);
191
        wizard.init(workbenchWindow.getWorkbench(), selectionToPass);
192
165
        IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
193
        IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
166
                .getDialogSettings();
194
                .getDialogSettings();
167
        IDialogSettings wizardSettings = workbenchSettings
195
        IDialogSettings wizardSettings = workbenchSettings
(-)Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java (-6 / +9 lines)
Lines 11-17 Link Here
11
package org.eclipse.ui.internal.dialogs;
11
package org.eclipse.ui.internal.dialogs;
12
12
13
import java.util.StringTokenizer;
13
import java.util.StringTokenizer;
14
15
import org.eclipse.jface.viewers.IStructuredSelection;
14
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.jface.wizard.IWizard;
15
import org.eclipse.jface.wizard.IWizard;
17
import org.eclipse.jface.wizard.Wizard;
16
import org.eclipse.jface.wizard.Wizard;
Lines 105-115 Link Here
105
        this.workbench = aWorkbench;
104
        this.workbench = aWorkbench;
106
        this.selection = currentSelection;
105
        this.selection = currentSelection;
107
106
108
        if (projectsOnly) {
107
		if (getWindowTitle() == null) {
109
			setWindowTitle(WorkbenchMessages.NewProject_title);
108
			// No title supplied. Set the default title
110
		} else {
109
			if (projectsOnly) {
111
			setWindowTitle(WorkbenchMessages.NewWizard_title);
110
				setWindowTitle(WorkbenchMessages.NewProject_title);
112
		} 
111
			} else {
112
				setWindowTitle(WorkbenchMessages.NewWizard_title);
113
			}
114
		}
113
        setDefaultPageImageDescriptor(WorkbenchImages
115
        setDefaultPageImageDescriptor(WorkbenchImages
114
                .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_NEW_WIZ));
116
                .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_NEW_WIZ));
115
        setNeedsProgressMonitor(true);
117
        setNeedsProgressMonitor(true);
Lines 167-170 Link Here
167
	    	}
169
	    	}
168
	    	return super.canFinish();
170
	    	return super.canFinish();
169
    }
171
    }
172
170
}
173
}

Return to bug 122772