package CDBuilder.buttons; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; /** * @author ssim * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class verboseGui extends Dialog { private String title; private String message; private Button yes; private Button no; private Button noAskAgain; private boolean runVmode; private boolean dontAskBool; private boolean buttonPressed=false; public verboseGui(Shell parentShell){ super(parentShell); title = "Verbose Mode?"; message = "Would you like to run in verbose mode?"; dontAskBool=false; buttonPressed=false; runVmode = false; } protected void configureShell(Shell shell) { super.configureShell(shell); if (title != null) shell.setText(title); } protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.NO_ID) { runVmode = false; dontAskBool = noAskAgain.getSelection(); buttonPressed=true; close(); } else if(buttonId == IDialogConstants.YES_ID) { runVmode = true; dontAskBool = noAskAgain.getSelection(); buttonPressed=true; close(); } } protected void createButtonsForButtonBar(Composite parent) { yes = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); no = createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true); noAskAgain = new Button(parent,SWT.CHECK); noAskAgain.setText("Don't ask me again"); } protected Control createDialogArea(Composite parent) { Composite composite = (Composite)super.createDialogArea(parent); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; composite.setLayout(gridLayout); Label messageLabel = new Label(composite, SWT.NONE); messageLabel.setText(message); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.horizontalSpan = 3; messageLabel.setLayoutData(gridData); messageLabel.setFont(parent.getFont()); return composite; } public boolean isPressed(){ return buttonPressed; } public boolean runInVMode() { return runVmode; } public boolean noAskAgain() { return dontAskBool; } }