|
Lines 17-22
Link Here
|
| 17 |
import org.eclipse.jface.wizard.*; |
17 |
import org.eclipse.jface.wizard.*; |
| 18 |
import org.eclipse.pde.core.plugin.*; |
18 |
import org.eclipse.pde.core.plugin.*; |
| 19 |
import org.eclipse.pde.internal.core.*; |
19 |
import org.eclipse.pde.internal.core.*; |
|
|
20 |
import org.eclipse.pde.internal.core.iproduct.IProduct; |
| 20 |
import org.eclipse.pde.internal.ui.*; |
21 |
import org.eclipse.pde.internal.ui.*; |
| 21 |
import org.eclipse.pde.internal.ui.search.*; |
22 |
import org.eclipse.pde.internal.ui.search.*; |
| 22 |
import org.eclipse.pde.internal.ui.util.*; |
23 |
import org.eclipse.pde.internal.ui.util.*; |
|
Lines 31-40
Link Here
|
| 31 |
|
32 |
|
| 32 |
public class ProductDefinitonWizardPage extends WizardPage implements IHyperlinkListener { |
33 |
public class ProductDefinitonWizardPage extends WizardPage implements IHyperlinkListener { |
| 33 |
|
34 |
|
|
|
35 |
private Text fProductName; |
| 34 |
private Text fPluginText; |
36 |
private Text fPluginText; |
| 35 |
private Text fProductText; |
37 |
private Text fProductText; |
| 36 |
private Set fProductSet; |
38 |
private Set fProductSet; |
| 37 |
private Combo fApplicationCombo; |
39 |
private Combo fApplicationCombo; |
|
|
40 |
private IProduct fProduct; |
| 38 |
|
41 |
|
| 39 |
private ModifyListener fListener = new ModifyListener() { |
42 |
private ModifyListener fListener = new ModifyListener() { |
| 40 |
public void modifyText(ModifyEvent e) { |
43 |
public void modifyText(ModifyEvent e) { |
|
Lines 49-54
Link Here
|
| 49 |
setDescription(PDEUIMessages.ProductDefinitonWizardPage_desc); |
52 |
setDescription(PDEUIMessages.ProductDefinitonWizardPage_desc); |
| 50 |
} |
53 |
} |
| 51 |
|
54 |
|
|
|
55 |
public ProductDefinitonWizardPage(String string, IProduct product) { |
| 56 |
super(string); |
| 57 |
fProduct = product; |
| 58 |
} |
| 59 |
|
| 52 |
public void createControl(Composite parent) { |
60 |
public void createControl(Composite parent) { |
| 53 |
Composite comp = new Composite(parent, SWT.NONE); |
61 |
Composite comp = new Composite(parent, SWT.NONE); |
| 54 |
GridLayout layout = new GridLayout(); |
62 |
GridLayout layout = new GridLayout(); |
|
Lines 64-70
Link Here
|
| 64 |
Dialog.applyDialogFont(comp); |
72 |
Dialog.applyDialogFont(comp); |
| 65 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.PRODUCT_DEFINITIONS_WIZARD); |
73 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.PRODUCT_DEFINITIONS_WIZARD); |
| 66 |
} |
74 |
} |
| 67 |
|
75 |
|
| 68 |
private void createFormText(FormToolkit toolkit, Composite parent, String content, int span) { |
76 |
private void createFormText(FormToolkit toolkit, Composite parent, String content, int span) { |
| 69 |
FormText text = toolkit.createFormText(parent, false); |
77 |
FormText text = toolkit.createFormText(parent, false); |
| 70 |
text.setText(content, true, false); |
78 |
text.setText(content, true, false); |
|
Lines 83-89
Link Here
|
| 83 |
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
91 |
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 84 |
|
92 |
|
| 85 |
createFormText(toolkit, group, PDEUIMessages.ProductDefinitonWizardPage_productDefinition, 3); |
93 |
createFormText(toolkit, group, PDEUIMessages.ProductDefinitonWizardPage_productDefinition, 3); |
| 86 |
Label label = new Label(group, SWT.NONE); |
94 |
|
|
|
95 |
Label label; |
| 96 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
| 97 |
gd.horizontalSpan = 2; |
| 98 |
|
| 99 |
if (fProduct.getName() == null || fProduct.getName().equals("")) { //$NON-NLS-1$ |
| 100 |
label = new Label(group, SWT.NONE); |
| 101 |
label.setText(PDEUIMessages.ProductDefinitonWizardPage_productName); |
| 102 |
|
| 103 |
fProductName = new Text(group, SWT.SINGLE|SWT.BORDER); |
| 104 |
fProductName.setLayoutData(gd); |
| 105 |
fProductName.addModifyListener(fListener); |
| 106 |
} |
| 107 |
|
| 108 |
label = new Label(group, SWT.NONE); |
| 87 |
label.setText(PDEUIMessages.ProductDefinitonWizardPage_plugin); |
109 |
label.setText(PDEUIMessages.ProductDefinitonWizardPage_plugin); |
| 88 |
|
110 |
|
| 89 |
fPluginText = new Text(group, SWT.SINGLE|SWT.BORDER); |
111 |
fPluginText = new Text(group, SWT.SINGLE|SWT.BORDER); |
|
Lines 103-110
Link Here
|
| 103 |
label.setText(PDEUIMessages.ProductDefinitonWizardPage_productId); |
125 |
label.setText(PDEUIMessages.ProductDefinitonWizardPage_productId); |
| 104 |
|
126 |
|
| 105 |
fProductText = new Text(group, SWT.SINGLE|SWT.BORDER); |
127 |
fProductText = new Text(group, SWT.SINGLE|SWT.BORDER); |
| 106 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
|
|
| 107 |
gd.horizontalSpan = 2; |
| 108 |
fProductText.setLayoutData(gd); |
128 |
fProductText.setLayoutData(gd); |
| 109 |
fProductText.addModifyListener(fListener); |
129 |
fProductText.addModifyListener(fListener); |
| 110 |
|
130 |
|
|
Lines 130-151
Link Here
|
| 130 |
|
150 |
|
| 131 |
public void setVisible(boolean visible) { |
151 |
public void setVisible(boolean visible) { |
| 132 |
if (visible) { |
152 |
if (visible) { |
| 133 |
fPluginText.setFocus(); |
153 |
if (fProductName != null) |
|
|
154 |
fProductName.setFocus(); |
| 155 |
else |
| 156 |
fPluginText.setFocus(); |
| 134 |
} |
157 |
} |
| 135 |
super.setVisible(visible); |
158 |
super.setVisible(visible); |
| 136 |
} |
159 |
} |
| 137 |
|
160 |
|
| 138 |
private void validatePage() { |
161 |
private void validatePage() { |
| 139 |
String error = null; |
162 |
String error = null; |
| 140 |
String pluginId = fPluginText.getText().trim(); |
163 |
String productName = getProductName(); |
| 141 |
if (pluginId.length() == 0) { |
164 |
String pluginId = getDefiningPlugin(); |
|
|
165 |
IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(pluginId); |
| 166 |
if (productName != null && productName.length() == 0) { |
| 167 |
error = PDEUIMessages.ProductDefinitonWizardPage_noProductName; |
| 168 |
} else if (model == null){ |
| 169 |
error = PDEUIMessages.ProductDefinitonWizardPage_noPlugin; |
| 170 |
} else if (model.getUnderlyingResource() == null) { |
| 171 |
error = PDEUIMessages.ProductDefinitonWizardPage_notInWorkspace; |
| 172 |
} else if (pluginId.length() == 0) { |
| 142 |
error = PDEUIMessages.ProductDefinitonWizardPage_noPluginId; |
173 |
error = PDEUIMessages.ProductDefinitonWizardPage_noPluginId; |
| 143 |
} else { |
|
|
| 144 |
IPluginModelBase model = PDECore.getDefault().getModelManager().findModel(pluginId); |
| 145 |
if (model == null) |
| 146 |
error = PDEUIMessages.ProductDefinitonWizardPage_noPlugin; |
| 147 |
else if (model.getUnderlyingResource() == null) |
| 148 |
error = PDEUIMessages.ProductDefinitonWizardPage_notInWorkspace; |
| 149 |
} |
174 |
} |
| 150 |
if (error == null) |
175 |
if (error == null) |
| 151 |
error = validateId(); |
176 |
error = validateId(); |
|
Lines 207-210
Link Here
|
| 207 |
return fApplicationCombo.getText(); |
232 |
return fApplicationCombo.getText(); |
| 208 |
} |
233 |
} |
| 209 |
|
234 |
|
|
|
235 |
public String getProductName() { |
| 236 |
return (fProductName == null) ? null : fProductName.getText().trim(); |
| 237 |
} |
| 210 |
} |
238 |
} |