Fixes of User Interface behaviour.
1.1 --- a/jndi/src/org/netbeans/modules/jndi/Bundle.properties Sun Oct 14 14:37:02 2001 +0000
1.2 +++ b/jndi/src/org/netbeans/modules/jndi/Bundle.properties Sun Oct 14 19:13:22 2001 +0000
1.3 @@ -44,7 +44,7 @@
1.4 EXC_Template_IOError=Can not create file!
1.5 EXC_Template_Bad_Property_Format=Invalid property format. Its format should be key=value.
1.6 EXC_Template_Provider_Exists=A provider factory with the same name already exists!
1.7 -EXC_TimeoutToShort=Timeout value is to short to start connection thread!
1.8 +EXC_TimeoutToShort=Timeout value is to short to connect to service.
1.9 EXC_ParseError=Invalid property format\:
1.10 EXC_ParseError2=The format should be key\=value;key\=value.
1.11 FILE_COMMENT="JNDI Provider file"
1.12 @@ -60,7 +60,7 @@
1.13 TIP_Additional=Provider specific properties
1.14 TIP_Root=Root of context
1.15 TIP_TimeOut=Timeout for connecting in milliseconds
1.16 -TIP_Installation=Note: The package (probably a zip file or a JAR file) containing the factory code must be in the IDE's classpath (add to the bin/ext directory).
1.17 +TIP_Installation=Note: The package (probably a zip file or a JAR file) containing the factory code must be in the IDE's classpath (add to the lib/ext directory).
1.18 TIP_Name=Name of the object
1.19 TIP_Class=Class of the object
1.20 TIP_Path=Path to the object from root
2.1 --- a/jndi/src/org/netbeans/modules/jndi/JndiDataType.java Sun Oct 14 14:37:02 2001 +0000
2.2 +++ b/jndi/src/org/netbeans/modules/jndi/JndiDataType.java Sun Oct 14 19:13:22 2001 +0000
2.3 @@ -144,9 +144,6 @@
2.4 new ActionListener() {
2.5 public void actionPerformed(ActionEvent event) {
2.6 if (event.getSource() == okButton) {
2.7 - okButton.setEnabled (false); // Disable buttons for this transient time
2.8 - cancelButton.setEnabled (false);
2.9 - org.openide.TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TITLE_WaitOnConnect"));
2.10
2.11 Runnable controller = new Runnable () {
2.12 public void run () {
2.13 @@ -208,16 +205,12 @@
2.14 }
2.15 }
2.16 }
2.17 - catch (NullPointerException npe){
2.18 + catch (Exception generalExc){
2.19 // Thrown by some providers when bad url is given
2.20 synchronized (this) {
2.21 - this.status = new ConnectOperationStatus (OTHER_EXCEPTION, npe);
2.22 + this.status = new ConnectOperationStatus (OTHER_EXCEPTION, generalExc);
2.23 }
2.24 }
2.25 - finally {
2.26 - okButton.setEnabled (true); // Enable buttons
2.27 - cancelButton.setEnabled (true);
2.28 - }
2.29 }
2.30
2.31 public synchronized ConnectOperationStatus getOperationStatus () {
2.32 @@ -225,66 +218,76 @@
2.33 }
2.34
2.35 };
2.36 - Connector connector = new Connector();
2.37 - Thread t = new Thread(connector);
2.38 - t.start();
2.39 try {
2.40 - int waitTime;
2.41 - JndiSystemOption option = (JndiSystemOption) JndiSystemOption.findObject (JndiSystemOption.class, true);
2.42 - if (option != null)
2.43 - waitTime = option.getTimeOut();
2.44 - else
2.45 - waitTime = JndiSystemOption.DEFAULT_TIMEOUT;
2.46 - t.join(waitTime);
2.47 - }catch (InterruptedException ie){}
2.48 - if (t.isAlive()){
2.49 - t.interrupt();
2.50 - }
2.51 - ConnectOperationStatus status = connector.getOperationStatus ();
2.52 - int statusCode = TIMEOUT_TO_SHORT; // By default we suppose that time was to short to start connector thread
2.53 - if (status != null)
2.54 - statusCode = status.getOperationStatus();
2.55 - switch (statusCode) {
2.56 - case SUCCESSFULL:
2.57 - org.openide.TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_Connected"));
2.58 - dlg.setVisible (false);
2.59 - dlg.dispose();
2.60 - break;
2.61 - case CLASS_NOT_FOUND_EXCEPTION:
2.62 - TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.63 - NotFoundPanel errdescriptor = new NotFoundPanel (panel.getFactory());
2.64 - TopManager.getDefault().notify(new NotifyDescriptor.Message(errdescriptor,NotifyDescriptor.ERROR_MESSAGE));
2.65 - break;
2.66 - case JNDI_EXCEPTION:
2.67 - TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.68 - TopManager.getDefault().notify(new NotifyDescriptor.Message(JndiRootNode.getLocalizedString("EXC_Items"), NotifyDescriptor.Message.ERROR_MESSAGE));
2.69 - break;
2.70 - case TIMEOUT_TO_SHORT:
2.71 - TopManager.getDefault().notify (new NotifyDescriptor.Message(JndiRootNode.getLocalizedString("EXC_TimeoutToShort"), NotifyDescriptor.Message.ERROR_MESSAGE));
2.72 - break;
2.73 - case INTERRUPTED_EXCEPTION:
2.74 - case NAMING_INTERRUPTED_EXCEPTION:
2.75 - Throwable e = status.getException();
2.76 - String msg;
2.77 - if ((e.getMessage() == null) || e.getMessage().equals(""))
2.78 - msg = e.getClass().getName();
2.79 - else
2.80 - msg = e.getClass().getName() + ": " + e.getMessage();
2.81 - TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.82 - TopManager.getDefault().notify (new NotifyDescriptor.Exception(e,new TimeOutPanel(msg,JndiRootNode.getLocalizedString("NOTE_TimeOut"))));
2.83 - break;
2.84 - case NAMING_EXCEPTION:
2.85 - TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.86 - JndiRootNode.notifyForeignException(status.getException());
2.87 - break;
2.88 - case OTHER_EXCEPTION:
2.89 - TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.90 - JndiRootNode.notifyForeignException(status.getException());
2.91 - break;
2.92 + okButton.setEnabled (false); // Disable buttons for this transient time
2.93 + cancelButton.setEnabled (false);
2.94 + org.openide.TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TITLE_WaitOnConnect"));
2.95 + Connector connector = new Connector();
2.96 + Thread t = new Thread(connector);
2.97 + t.start();
2.98 + try {
2.99 + int waitTime;
2.100 + JndiSystemOption option = (JndiSystemOption) JndiSystemOption.findObject (JndiSystemOption.class, true);
2.101 + if (option != null)
2.102 + waitTime = option.getTimeOut();
2.103 + else
2.104 + waitTime = JndiSystemOption.DEFAULT_TIMEOUT;
2.105 + t.join(waitTime);
2.106 + }catch (InterruptedException ie){}
2.107 + if (t.isAlive()){
2.108 + t.interrupt();
2.109 + if (t.isAlive()) // If provider does not test isInterrupted
2.110 + t.stop (); // cancel it by ThreadDeath
2.111 + }
2.112 + ConnectOperationStatus status = connector.getOperationStatus ();
2.113 + int statusCode = TIMEOUT_TO_SHORT; // By default we suppose that time was to short to start connector thread
2.114 + if (status != null)
2.115 + statusCode = status.getOperationStatus();
2.116 + switch (statusCode) {
2.117 + case SUCCESSFULL:
2.118 + org.openide.TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_Connected"));
2.119 + dlg.setVisible(false);
2.120 + dlg.dispose();
2.121 + break;
2.122 + case CLASS_NOT_FOUND_EXCEPTION:
2.123 + TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.124 + NotFoundPanel errdescriptor = new NotFoundPanel(panel.getFactory());
2.125 + TopManager.getDefault().notify(new NotifyDescriptor.Message(errdescriptor,NotifyDescriptor.ERROR_MESSAGE));
2.126 + break;
2.127 + case JNDI_EXCEPTION:
2.128 + TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.129 + TopManager.getDefault().notify(new NotifyDescriptor.Message(JndiRootNode.getLocalizedString("EXC_Items"), NotifyDescriptor.Message.ERROR_MESSAGE));
2.130 + break;
2.131 + case TIMEOUT_TO_SHORT:
2.132 + TopManager.getDefault().notify(new NotifyDescriptor.Message(JndiRootNode.getLocalizedString("EXC_TimeoutToShort"), NotifyDescriptor.Message.ERROR_MESSAGE));
2.133 + break;
2.134 + case INTERRUPTED_EXCEPTION:
2.135 + case NAMING_INTERRUPTED_EXCEPTION:
2.136 + Throwable e = status.getException();
2.137 + String msg;
2.138 + if ((e.getMessage() == null) || e.getMessage().equals(""))
2.139 + msg = e.getClass().getName();
2.140 + else
2.141 + msg = e.getClass().getName() + ": " + e.getMessage();
2.142 + TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.143 + TopManager.getDefault().notify(new NotifyDescriptor.Exception(e,new TimeOutPanel(msg,JndiRootNode.getLocalizedString("NOTE_TimeOut"))));
2.144 + break;
2.145 + case NAMING_EXCEPTION:
2.146 + TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.147 + JndiRootNode.notifyForeignException(status.getException());
2.148 + break;
2.149 + case OTHER_EXCEPTION:
2.150 + TopManager.getDefault().setStatusText(JndiRootNode.getLocalizedString("TXT_ConnectFailed"));
2.151 + JndiRootNode.notifyForeignException(status.getException());
2.152 + break;
2.153 + }
2.154 + }finally {
2.155 + okButton.setEnabled (true);
2.156 + cancelButton.setEnabled (true);
2.157 }
2.158 } // run outher
2.159 }; // Runnable Outher
2.160 - new Thread (controller).start();
2.161 + new Thread (controller).start();
2.162 }
2.163 else if (event.getSource () == cancelButton) {
2.164 dlg.setVisible (false);