mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
added some useful methods for creating UI controls
This commit is contained in:
parent
83852ed86c
commit
db68d20348
1 changed files with 32 additions and 0 deletions
|
@ -10,10 +10,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.dialogs;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.util.SWTUtil;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public abstract class AbstractCOptionPage extends DialogPage implements ICOptionPage {
|
||||
|
@ -22,6 +27,33 @@ public abstract class AbstractCOptionPage extends DialogPage implements ICOption
|
|||
private ICOptionContainer fContainer;
|
||||
|
||||
|
||||
protected Button createPushButton(Composite parent, String label, Image image) {
|
||||
Button button = new Button(parent, SWT.PUSH);
|
||||
button.setFont(parent.getFont());
|
||||
if (image != null) {
|
||||
button.setImage(image);
|
||||
}
|
||||
if (label != null) {
|
||||
button.setText(label);
|
||||
}
|
||||
GridData gd = new GridData();
|
||||
button.setLayoutData(gd);
|
||||
SWTUtil.setButtonDimensionHint(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
protected Button createRadioButton(Composite parent, String label) {
|
||||
Button button = new Button(parent, SWT.RADIO);
|
||||
button.setFont(parent.getFont());
|
||||
if (label != null) {
|
||||
button.setText(label);
|
||||
}
|
||||
GridData gd = new GridData();
|
||||
button.setLayoutData(gd);
|
||||
SWTUtil.setButtonDimensionHint(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
protected AbstractCOptionPage() {
|
||||
super();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue