KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > BaseWizardSelectionPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.wizards;
12
13 import org.eclipse.jface.viewers.ISelectionChangedListener;
14 import org.eclipse.jface.wizard.IWizardNode;
15 import org.eclipse.jface.wizard.WizardSelectionPage;
16 import org.eclipse.pde.internal.ui.PDEUIMessages;
17 import org.eclipse.pde.internal.ui.parts.FormBrowser;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.layout.GridData;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.swt.widgets.Control;
22
23 public abstract class BaseWizardSelectionPage extends WizardSelectionPage
24         implements
25             ISelectionChangedListener {
26     private String JavaDoc label;
27     private FormBrowser descriptionBrowser;
28
29     public BaseWizardSelectionPage(String JavaDoc name, String JavaDoc label) {
30         super(name);
31         this.label = label;
32         descriptionBrowser = new FormBrowser(SWT.BORDER | SWT.V_SCROLL);
33         descriptionBrowser.setText(""); //$NON-NLS-1$
34
}
35     public void createDescriptionIn(Composite composite) {
36         descriptionBrowser.createControl(composite);
37         Control c = descriptionBrowser.getControl();
38         GridData gd = new GridData(GridData.FILL_BOTH);
39         gd.widthHint = 200;
40         c.setLayoutData(gd);
41     }
42
43     protected abstract IWizardNode createWizardNode(WizardElement element);
44     public String JavaDoc getLabel() {
45         return label;
46     }
47     public void setDescriptionText(String JavaDoc text) {
48         if (text == null)
49             text = PDEUIMessages.BaseWizardSelectionPage_noDesc;
50         descriptionBrowser.setText(text);
51     }
52     public void setDescriptionEnabled(boolean enabled) {
53         Control dcontrol = descriptionBrowser.getControl();
54         if (dcontrol!=null)
55             dcontrol.setEnabled(enabled);
56     }
57 }
58
Popular Tags