01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards;
11:
12: import org.eclipse.jface.viewers.ISelectionChangedListener;
13: import org.eclipse.jface.wizard.IWizardNode;
14: import org.eclipse.jface.wizard.WizardSelectionPage;
15: import org.eclipse.pde.internal.ui.PDEUIMessages;
16: import org.eclipse.pde.internal.ui.parts.FormBrowser;
17: import org.eclipse.swt.SWT;
18: import org.eclipse.swt.layout.GridData;
19: import org.eclipse.swt.widgets.Composite;
20: import org.eclipse.swt.widgets.Control;
21:
22: public abstract class BaseWizardSelectionPage extends
23: WizardSelectionPage implements ISelectionChangedListener {
24: private String label;
25: private FormBrowser descriptionBrowser;
26:
27: public BaseWizardSelectionPage(String name, String label) {
28: super (name);
29: this .label = label;
30: descriptionBrowser = new FormBrowser(SWT.BORDER | SWT.V_SCROLL);
31: descriptionBrowser.setText(""); //$NON-NLS-1$
32: }
33:
34: public void createDescriptionIn(Composite composite) {
35: descriptionBrowser.createControl(composite);
36: Control c = descriptionBrowser.getControl();
37: GridData gd = new GridData(GridData.FILL_BOTH);
38: gd.widthHint = 200;
39: c.setLayoutData(gd);
40: }
41:
42: protected abstract IWizardNode createWizardNode(
43: WizardElement element);
44:
45: public String getLabel() {
46: return label;
47: }
48:
49: public void setDescriptionText(String text) {
50: if (text == null)
51: text = PDEUIMessages.BaseWizardSelectionPage_noDesc;
52: descriptionBrowser.setText(text);
53: }
54:
55: public void setDescriptionEnabled(boolean enabled) {
56: Control dcontrol = descriptionBrowser.getControl();
57: if (dcontrol != null)
58: dcontrol.setEnabled(enabled);
59: }
60: }
|