1 19 20 package org.netbeans.modules.xml.multiview.ui; 21 22 import org.openide.util.NbBundle; 23 24 31 public class RefreshSaveDialog extends org.openide.DialogDescriptor { 32 public static final Integer OPTION_FIX=new Integer (0); 33 public static final Integer OPTION_REFRESH=new Integer (1); 34 public static final Integer OPTION_SAVE=new Integer (2); 35 36 private static final String [] OPTIONS = new String [] { 37 NbBundle.getMessage(RefreshSaveDialog.class,"OPT_FixNow"), 38 NbBundle.getMessage(RefreshSaveDialog.class,"OPT_Refresh"), 39 NbBundle.getMessage(RefreshSaveDialog.class,"OPT_Save") 40 }; 41 42 43 public RefreshSaveDialog(ErrorPanel errorPanel) { 44 this (errorPanel, errorPanel.getErrorMessage()); 45 } 46 47 48 public RefreshSaveDialog(ErrorPanel errorPanel, String errorMessage ) { 49 super ( 50 NbBundle.getMessage(RefreshSaveDialog.class,"TTL_warning_message",errorMessage), 51 NbBundle.getMessage(RefreshSaveDialog.class,"TTL_warning"), 52 true, 53 OPTIONS, 54 OPTIONS[0], 55 BOTTOM_ALIGN, 56 null, 57 null 58 ); 59 setButtonListener(new DialogListener(errorPanel)); 60 setClosingOptions(null); 61 } 62 public Object getValue() { 63 Object ret = super.getValue(); 64 if (ret.equals(OPTIONS[1])) return OPTION_REFRESH; 65 else if (ret.equals(OPTIONS[2])) return OPTION_SAVE; 66 else return OPTION_FIX; 67 } 68 69 private class DialogListener implements java.awt.event.ActionListener { 70 private ErrorPanel errorPanel; 71 DialogListener(ErrorPanel errorPanel) { 72 this.errorPanel=errorPanel; 73 } 74 public void actionPerformed(java.awt.event.ActionEvent evt) { 75 if (evt.getSource().equals(OPTIONS[1]) || evt.getSource().equals(OPTIONS[2])) { 76 errorPanel.clearError(); 77 } 78 } 79 } 80 } 81 | Popular Tags |