1.1 --- a/corba/src/org/netbeans/modules/corba/poasupport/tools/POAChecker.java Wed Apr 23 08:31:04 2003 +0000
1.2 +++ b/corba/src/org/netbeans/modules/corba/poasupport/tools/POAChecker.java Wed Apr 23 14:06:57 2003 +0000
1.3 @@ -17,8 +17,10 @@
1.4 import java.util.*;
1.5 import java.awt.Dialog;
1.6
1.7 +import javax.swing.SwingUtilities;
1.8 +
1.9 import org.openide.src.Type;
1.10 -import org.openide.TopManager;
1.11 +import org.openide.DialogDisplayer;
1.12 import org.openide.NotifyDescriptor;
1.13 import org.openide.util.Utilities;
1.14 import org.netbeans.modules.corba.poasupport.*;
1.15 @@ -39,8 +41,11 @@
1.16 }
1.17 catch (IllegalArgumentException e) {
1.18 if (notify) {
1.19 - String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.20 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.21 + final String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.22 + SwingUtilities.invokeLater (new Runnable () {
1.23 + public void run () {
1.24 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.25 + }});
1.26 }
1.27 return false;
1.28 }
1.29 @@ -50,8 +55,11 @@
1.30 public static boolean checkPOAName(String name, POAElement element, boolean notify) {
1.31 if (name.equals("") || !element.canUseAsPOAName( name )) { // NOI18N
1.32 if (notify) {
1.33 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.34 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.35 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.36 + SwingUtilities.invokeLater (new Runnable () {
1.37 + public void run () {
1.38 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.39 + }});
1.40 }
1.41 return false;
1.42 }
1.43 @@ -61,15 +69,21 @@
1.44 public static boolean checkPOAVarName(String name, POAElement element, boolean notify) {
1.45 if ( !Utilities.isJavaIdentifier( name ) ) {
1.46 if (notify) {
1.47 - String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.48 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.49 + final String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.50 + SwingUtilities.invokeLater (new Runnable () {
1.51 + public void run () {
1.52 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.53 + }});
1.54 }
1.55 return false;
1.56 }
1.57 if (!element.canUseAsNewVarName( name )) {
1.58 if (notify) {
1.59 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.60 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.61 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.62 + SwingUtilities.invokeLater (new Runnable () {
1.63 + public void run () {
1.64 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.65 + }});
1.66 }
1.67 return false;
1.68 }
1.69 @@ -79,16 +93,22 @@
1.70 public static boolean checkPOAMemberVarName(String name, POAMemberElement element, boolean generateInstanceCode, boolean notify) {
1.71 if ( !Utilities.isJavaIdentifier( name ) ) {
1.72 if (notify) {
1.73 - String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.74 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.75 + final String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.76 + SwingUtilities.invokeLater (new Runnable () {
1.77 + public void run () {
1.78 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.79 + }});
1.80 }
1.81 return false;
1.82 }
1.83 if (generateInstanceCode) {
1.84 if ( !element.canUseAsNewVarName(name) ) {
1.85 if (notify) {
1.86 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.87 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.88 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.89 + SwingUtilities.invokeLater (new Runnable () {
1.90 + public void run () {
1.91 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.92 + }});
1.93 }
1.94 return false;
1.95 }
1.96 @@ -96,16 +116,22 @@
1.97 else {
1.98 if ( !element.canUseAsVarName(name) ) {
1.99 if (notify) {
1.100 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.101 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.102 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.103 + SwingUtilities.invokeLater (new Runnable () {
1.104 + public void run () {
1.105 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.106 + }});
1.107 }
1.108 return false;
1.109 }
1.110 }
1.111 if (element instanceof ServantElement && name.equals(((ServantElement)element).getIDVarName())) {
1.112 if (notify) {
1.113 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.114 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.115 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.116 + SwingUtilities.invokeLater (new Runnable () {
1.117 + public void run () {
1.118 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.119 + }});
1.120 }
1.121 return false;
1.122 }
1.123 @@ -115,8 +141,11 @@
1.124 public static boolean checkServantID(String id, ServantElement element, boolean notify) {
1.125 if (!element.canUseAsServantID( id )) {
1.126 if (notify) {
1.127 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {id});
1.128 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.129 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {id});
1.130 + SwingUtilities.invokeLater (new Runnable () {
1.131 + public void run () {
1.132 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.133 + }});
1.134 }
1.135 return false;
1.136 }
1.137 @@ -126,22 +155,31 @@
1.138 public static boolean checkServantIDVarName(String name, ServantElement element, boolean notify) {
1.139 if ( !Utilities.isJavaIdentifier( name ) ) {
1.140 if (notify) {
1.141 - String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.142 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.143 + final String msg = MessageFormat.format(POASupport.getString("MSG_Not_Valid_Identifier"), new Object[] {name});
1.144 + SwingUtilities.invokeLater (new Runnable () {
1.145 + public void run () {
1.146 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.147 + }});
1.148 }
1.149 return false;
1.150 }
1.151 if (name.equals("") || !element.canUseAsNewVarName( name )) { // NOI18N
1.152 if (notify) {
1.153 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.154 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.155 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.156 + SwingUtilities.invokeLater (new Runnable () {
1.157 + public void run () {
1.158 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.159 + }});
1.160 }
1.161 return false;
1.162 }
1.163 if (name.equals(element.getVarName())) {
1.164 if (notify) {
1.165 - String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.166 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.167 + final String msg = MessageFormat.format(POASupport.getString("MSG_Identifier_Already_Exists"), new Object[] {name});
1.168 + SwingUtilities.invokeLater (new Runnable () {
1.169 + public void run () {
1.170 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.171 + }});
1.172 }
1.173 return false;
1.174 }
1.175 @@ -154,7 +192,7 @@
1.176 (element.getServantManager() != null)) {
1.177 String msg = MessageFormat.format(POASupport.getString("MSG_Confirm_Delete_Non_Empty_POA"), new Object[] {element.getPOAName()});
1.178 NotifyDescriptor desc = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.YES_NO_OPTION);
1.179 - return (NotifyDescriptor.YES_OPTION.equals (TopManager.getDefault().notify(desc))) ? true : false;
1.180 + return (NotifyDescriptor.YES_OPTION.equals (DialogDisplayer.getDefault().notify(desc))) ? true : false;
1.181 }
1.182 return true;
1.183 }
1.184 @@ -189,8 +227,11 @@
1.185 }
1.186 if (!addRequiredPolicyValue(settings, newPolicyValues, oldPolicyValues, name, value)) {
1.187 if (notify) {
1.188 - String msg = MessageFormat.format(POASupport.getString("MSG_Invalid_POA_Policy_Dependencies"), new Object[] {name, value});
1.189 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.190 + final String msg = MessageFormat.format(POASupport.getString("MSG_Invalid_POA_Policy_Dependencies"), new Object[] {name, value});
1.191 + SwingUtilities.invokeLater (new Runnable () {
1.192 + public void run () {
1.193 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.194 + }});
1.195 }
1.196 return false;
1.197 }
1.198 @@ -218,15 +259,18 @@
1.199 else {
1.200 String msg = MessageFormat.format(POASupport.getString("MSG_Change_POA_Policy_Value_Due_To_Dependencies"), new Object[] {name, value});
1.201 ComboBoxSelector selector = new ComboBoxSelector(msg, confName, availableValues);
1.202 - if (NotifyDescriptor.OK_OPTION.equals (TopManager.getDefault().notify(selector)))
1.203 + if (NotifyDescriptor.OK_OPTION.equals (DialogDisplayer.getDefault().notify(selector)))
1.204 newValue = (String)selector.getSelectedItem();
1.205 else
1.206 return false;
1.207 }
1.208 if (!addRequiredPolicyValue(settings, newPolicyValues, oldPolicyValues, confName, newValue)) {
1.209 if (notify) {
1.210 - String msg = MessageFormat.format(POASupport.getString("MSG_Invalid_POA_Policy_Dependencies"), new Object[] {name, value});
1.211 - TopManager.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.212 + final String msg = MessageFormat.format(POASupport.getString("MSG_Invalid_POA_Policy_Dependencies"), new Object[] {name, value});
1.213 + SwingUtilities.invokeLater (new Runnable () {
1.214 + public void run () {
1.215 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
1.216 + }});
1.217 }
1.218 return false;
1.219 }
1.220 @@ -249,19 +293,19 @@
1.221 if ((element.getServantManager() != null) && (!isServantManagerEnabled(element, policies))) {
1.222 String msg = MessageFormat.format(POASupport.getString("MSG_Confirm_Delete_ServantManager"), new Object[] {name, value});
1.223 NotifyDescriptor desc = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.OK_CANCEL_OPTION);
1.224 - if (!NotifyDescriptor.OK_OPTION.equals (TopManager.getDefault().notify(desc)))
1.225 + if (!NotifyDescriptor.OK_OPTION.equals (DialogDisplayer.getDefault().notify(desc)))
1.226 return false;
1.227 }
1.228 if ((element.getDefaultServant() != null) && (!isDefaultServantEnabled(element, policies))) {
1.229 String msg = MessageFormat.format(POASupport.getString("MSG_Confirm_Delete_DefaultServant"), new Object[] {name, value});
1.230 NotifyDescriptor desc = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.OK_CANCEL_OPTION);
1.231 - if (!NotifyDescriptor.OK_OPTION.equals (TopManager.getDefault().notify(desc)))
1.232 + if (!NotifyDescriptor.OK_OPTION.equals (DialogDisplayer.getDefault().notify(desc)))
1.233 return false;
1.234 }
1.235 if ((element.getServants().size() > 0) && (checkDisabledServantActivation(element, policies).equals(POASettings.ALL_SERVANTS))) {
1.236 String msg = MessageFormat.format(POASupport.getString("MSG_Confirm_Delete_Servants"), new Object[] {name, value});
1.237 NotifyDescriptor desc = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.OK_CANCEL_OPTION);
1.238 - if (!NotifyDescriptor.OK_OPTION.equals (TopManager.getDefault().notify(desc)))
1.239 + if (!NotifyDescriptor.OK_OPTION.equals (DialogDisplayer.getDefault().notify(desc)))
1.240 return false;
1.241 }
1.242 return true;