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 SaveBatTips extends Dialog { private String title; private String message; private Button proceed; private Button ok; private Button automatic; private Button noAskAgain; private boolean runVmode; private boolean dontAskBool; private int bPressed = -1; public SaveBatTips(Shell parentShell){ super(parentShell); title = "Saving BAT file tip..."; message = "To automate naming of BAT files, follow these instructions:" +"\n\n" + " -- Select this file in 'Save As' window and click button." +"\n\n" + " -- When prompted to select action, click button" +"\n\n" + "The created vesrion of the *.bat file will be as follows:" +"\n\n" + " \"[file_name].bat\" will be renamed to \"[file_name]_[id].bat\""; } public int buttonPressed() { return bPressed; } protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.CANCEL_ID) { bPressed = 0; dontAskBool = noAskAgain.getSelection(); close(); } /* if (buttonId == 88) { bPressed = 1; dontAskBool = noAskAgain.getSelection(); close(); } if (buttonId == 99) { bPressed = 2; dontAskBool = noAskAgain.getSelection(); close(); }*/ } protected void configureShell(Shell shell) { super.configureShell(shell); if (title != null) shell.setText(title); } protected void createButtonsForButtonBar(Composite parent) { //proceed = createButton(parent, 88, "Proceed", true); ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); //automatic = createButton(parent, 99, "Automatic", 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 runInVMode() { return runVmode; } public boolean noAskAgain() { return dontAskBool; } }