[jbosstools-commits] JBoss Tools SVN: r39393 - in trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui: wizards/newfile and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Mar 8 18:54:52 EST 2012
Author: scabanovich
Date: 2012-03-08 18:54:51 -0500 (Thu, 08 Mar 2012)
New Revision: 39393
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
Log:
JBIDE-11204
https://issues.jboss.org/browse/JBIDE-11204
Open editor on finish.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java 2012-03-08 23:49:54 UTC (rev 39392)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java 2012-03-08 23:54:51 UTC (rev 39393)
@@ -99,7 +99,9 @@
public static String NewDSXMLWizard_FOLDER_NOT_SET;
public static String NewDSXMLWizard_PARENT_FOLDER_LABEL;
public static String NewDSXMLWizard_FILE_NAME_LABEL;
-
+ public static String NewDSXMLWizard_PROFILE_NOT_FOUND;
+ public static String NewDSXMLWizard_DRIVER_NOT_FOUND;
+ public static String NewDSXMLWizard_JAR_LIST_NOT_SET;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2012-03-08 23:49:54 UTC (rev 39392)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2012-03-08 23:54:51 UTC (rev 39393)
@@ -88,7 +88,10 @@
NewDSXMLWizard_FILE_EXISTS=''{0}'' already exists.
NewDSXMLWizard_PROJECT_NOT_EXISTS=Selected project does not exist.
NewDSXMLWizard_PROJECT_NOT_ACCESSIBLE=Selected project is not accessible.
-NewDSXMLWizard_PROFILE_NOT_SET=Select connenction profile.
+NewDSXMLWizard_PROFILE_NOT_SET=Select connection profile.
NewDSXMLWizard_FOLDER_NOT_SET=Select parent folder.
+NewDSXMLWizard_PROFILE_NOT_FOUND=Cannot find the connection profile.
+NewDSXMLWizard_DRIVER_NOT_FOUND=Cannot find driver for the connection profile.
+NewDSXMLWizard_JAR_LIST_NOT_SET=Jar list for the connection profile is not set.
NewDSXMLWizard_PARENT_FOLDER_LABEL=Parent fold&er:
NewDSXMLWizard_FILE_NAME_LABEL=File na&me:
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-03-08 23:49:54 UTC (rev 39392)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-03-08 23:54:51 UTC (rev 39393)
@@ -50,10 +50,12 @@
import org.eclipse.datatools.connectivity.IProfileListener;
import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
+import org.eclipse.datatools.connectivity.drivers.DriverInstance;
import org.eclipse.datatools.connectivity.drivers.DriverManager;
import org.eclipse.datatools.connectivity.internal.ui.wizards.NewCPWizard;
import org.eclipse.datatools.connectivity.internal.ui.wizards.NewCPWizardCategoryFilter;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
@@ -413,11 +415,33 @@
if(connProfileSelEditor != null) {
String p = connProfileSelEditor.getValueAsString();
- if(p == null || p.length() == 0) {
+ if(p == null || p.trim().length() == 0) {
setErrorMessage(Messages.NewDSXMLWizard_PROFILE_NOT_SET);
return false;
}
+ String profileName = p.trim();
+ IConnectionProfile connProfile = ProfileManager.getInstance().getProfileByName(profileName);
+ if(connProfile == null) {
+ setErrorMessage(Messages.NewDSXMLWizard_PROFILE_NOT_FOUND);
+ return false;
+ }
+ Properties props = connProfile.getBaseProperties();
+ Object q = props.get(IDSDataModelProperties.DATATOOLS_JDBC_DRIVER_JAR_PATH);
+ if(q == null || DriverManager.getInstance().getDriverInstanceByID(q.toString()) == null) {
+ setMessage(Messages.NewDSXMLWizard_DRIVER_NOT_FOUND, IMessageProvider.WARNING);
+ setErrorMessage(null);
+ return true;
+ }
+
+ String jarList = props.getProperty("jarList"); //$NON-NLS-1$
+ if(jarList == null) {
+ setMessage(Messages.NewDSXMLWizard_JAR_LIST_NOT_SET, IMessageProvider.WARNING);
+ setErrorMessage(null);
+ return true;
+ }
+
}
+ setMessage(null, IMessageProvider.WARNING);
setErrorMessage(null);
return true;
}
@@ -675,21 +699,24 @@
? EMPTY_STRING : props.get(DATATOOLS_JDBC_URL_FOR_DB).toString());
if(props.get(DATATOOLS_JDBC_DRIVER_JAR_PATH) != null) {
- model.setProperty(
+ DriverInstance driverInstance = DriverManager.getInstance()
+ .getDriverInstanceByID(props.get(DATATOOLS_JDBC_DRIVER_JAR_PATH).toString());
+ if(driverInstance != null) {
+ model.setProperty(
JDBC_DRIVER_JAR_PATH,
- DriverManager
- .getInstance()
- .getDriverInstanceByID(
- props.get(DATATOOLS_JDBC_DRIVER_JAR_PATH).toString()).getJarListAsArray());
+ driverInstance.getJarListAsArray());
+ }
}
String jarList = props.getProperty("jarList"); //$NON-NLS-1$
- int q = jarList.indexOf(".jar"); //$NON-NLS-1$
- if(q >= 0) {
- String jar = jarList.substring(0, q + 4);
- int b = jar.replace('\\', '/').lastIndexOf('/');
- String jarName = jar.substring(b + 1);
- model.setProperty(JDBC_DRIVER_JAR_NAME, jarName);
+ if(jarList != null) {
+ int q = jarList.indexOf(".jar"); //$NON-NLS-1$
+ if(q >= 0) {
+ String jar = jarList.substring(0, q + 4);
+ int b = jar.replace('\\', '/').lastIndexOf('/');
+ String jarName = jar.substring(b + 1);
+ model.setProperty(JDBC_DRIVER_JAR_NAME, jarName);
+ }
}
}
}
More information about the jbosstools-commits
mailing list