1 19 package org.netbeans.modules.localhistory.ui.revert; 20 21 import java.awt.Dialog ; 22 import java.io.File ; 23 import javax.swing.JButton ; 24 import javax.swing.JPanel ; 25 import org.openide.DialogDescriptor; 26 import org.openide.DialogDisplayer; 27 import org.openide.util.HelpCtx; 28 import org.openide.util.NbBundle; 29 30 34 public abstract class RevertChanges { 35 36 private DialogDescriptor dialogDescriptor; 37 38 abstract void show(File roots); 39 40 protected boolean show(JPanel panel) { 41 dialogDescriptor = new DialogDescriptor (panel, NbBundle.getMessage(this.getClass(), "LBL_RevertToAction")); 43 JButton okButton = new JButton (NbBundle.getMessage(this.getClass(), "CTL_Revert")); okButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(this.getClass(), "CTL_Revert")); JButton cancelButton = new JButton (NbBundle.getMessage(this.getClass(), "CTL_Cancel")); cancelButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(this.getClass(), "CTL_Cancel")); dialogDescriptor.setOptions(new Object [] {okButton, cancelButton}); 48 49 dialogDescriptor.setModal(true); 50 dialogDescriptor.setHelpCtx(new HelpCtx(this.getClass())); 51 Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor); 52 dialog.getAccessibleContext().setAccessibleDescription("LBL_RevertToAction"); dialog.setVisible(true); 54 55 return dialogDescriptor.getValue()==okButton; 56 } 57 58 protected void setValid(boolean valid) { 59 dialogDescriptor.setValid(valid); 60 } 61 } 62 | Popular Tags |