JBoss Tools SVN: r38959 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui: src/org/jboss/tools/openshift/express/internal/ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-22 03:42:48 -0500 (Wed, 22 Feb 2012)
New Revision: 38959
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java
Log:
Fixed : JBIDE-10975 - OpenShift Wizard naming "wrong"
https://issues.jboss.org/browse/JBIDE-10975
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-02-22 08:33:02 UTC (rev 38958)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-02-22 08:42:48 UTC (rev 38959)
@@ -17,7 +17,7 @@
class="org.jboss.tools.openshift.express.internal.ui.wizard.NewOpenShiftExpressApplicationWizard"
icon="icons/openshift-logo-white-icon.png"
id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.createNewApplicationWizard"
- name="OpenShift Express Application"
+ name="OpenShift Application"
project="true">
<description>Create a new OpenShift Express Application</description>
</wizard>
@@ -33,7 +33,7 @@
class="org.jboss.tools.openshift.express.internal.ui.wizard.ImportOpenShiftExpressApplicationWizard"
icon="icons/openshift-logo-white-icon.png"
id="org.jboss.tools.openshift.express.ui.importExistingApplicationWizard"
- name="Existing OpenShift Express Application">
+ name="Existing OpenShift Application">
<description>Import an existing OpenShift Express Application</description>
</wizard>
</extension>
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java 2012-02-22 08:33:02 UTC (rev 38958)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java 2012-02-22 08:42:48 UTC (rev 38959)
@@ -18,7 +18,7 @@
* Constructor
*/
public ImportOpenShiftExpressApplicationWizard() {
- super("Import OpenShift Application");
+ super("Import OpenShift Express Application");
}
/**
@@ -28,6 +28,6 @@
* @param application
*/
public ImportOpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application) {
- super(user, project, application, "Import OpenShift Application");
+ super(user, project, application, "Import OpenShift Express Application");
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java 2012-02-22 08:33:02 UTC (rev 38958)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java 2012-02-22 08:42:48 UTC (rev 38959)
@@ -15,10 +15,10 @@
* Constructor
*/
public NewOpenShiftExpressApplicationWizard() {
- super("New OpenShift Application");
+ super("New OpenShift Express Application");
}
public NewOpenShiftExpressApplicationWizard(IUser user) {
- super(user, null, null, "New OpenShift Application");
+ super(user, null, null, "New OpenShift Express Application");
}
}
12 years, 4 months
JBoss Tools SVN: r38958 - in trunk/ws/plugins: org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-22 03:33:02 -0500 (Wed, 22 Feb 2012)
New Revision: 38958
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateCategory.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElement.java
Log:
Fixed - JBIDE-10250 - Restore error decorators on the JAX-RS endpoints icons when validation detects errors
https://issues.jboss.org/browse/JBIDE-10250
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java 2012-02-22 08:31:16 UTC (rev 38957)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java 2012-02-22 08:33:02 UTC (rev 38958)
@@ -195,11 +195,15 @@
@Override
public List<ValidatorMessage> validate() throws JavaModelException {
+ this.hasErrors(false);
final List<ValidatorMessage> messages = new ArrayList<ValidatorMessage>();
messages.addAll(validateMissingPathValueInPathParamAnnotations());
messages.addAll(validateMissingPathParamAnnotations());
messages.addAll(validateParamsWithContextAnnotation());
messages.addAll(validateSingleParamWithoutAnnotation());
+ if(messages.size() > 0) {
+ this.hasErrors(true);
+ }
return messages;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java 2012-02-22 08:31:16 UTC (rev 38957)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java 2012-02-22 08:33:02 UTC (rev 38958)
@@ -102,7 +102,6 @@
monitor.beginTask("Loading JAX-RS metamodel for project '" + project.getName() + "'...",
IProgressMonitor.UNKNOWN);
monitor.worked(1);
-
refreshViewerObject(uriPathTemplateCategory);
monitor.done();
return Status.OK_STATUS;
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateCategory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateCategory.java 2012-02-22 08:31:16 UTC (rev 38957)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateCategory.java 2012-02-22 08:33:02 UTC (rev 38958)
@@ -33,7 +33,8 @@
private final Map<IJaxrsEndpoint, UriPathTemplateElement> wrapperCache = new HashMap<IJaxrsEndpoint, UriPathTemplateElement>();
- public UriPathTemplateCategory(UriMappingsContentProvider parent, IProject project) {
+ public UriPathTemplateCategory(UriMappingsContentProvider parent,
+ IProject project) {
super();
this.parent = parent;
this.project = project;
@@ -43,10 +44,12 @@
@Override
public Object[] getChildren(Object parentElement) {
try {
- final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project);
+ final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator
+ .get(project);
if (metamodel != null) {
List<IJaxrsEndpoint> endpoints = metamodel.getAllEndpoints();
- Logger.debug("UriPathTemplateCatrogory contains {} endpoints", endpoints.size());
+ Logger.debug("UriPathTemplateCatrogory contains {} endpoints",
+ endpoints.size());
List<UriPathTemplateElement> uriPathTemplateElements = new ArrayList<UriPathTemplateElement>();
// Collections.sort(uriMappings);
for (IJaxrsEndpoint endpoint : endpoints) {
@@ -54,9 +57,16 @@
// LinkedList<IJaxrsResourceMethod> resourceMethods =
// endpoint.getResourceMethods();
if (element == null) {
- Logger.trace("Creating element for endpoint {} ('cause not found in wrapperCache)", endpoint);
+ Logger.trace(
+ "Creating element for endpoint {} ('cause not found in wrapperCache)",
+ endpoint);
element = new UriPathTemplateElement(endpoint, this);
wrapperCache.put(endpoint, element);
+ }
+ // after a clean build, the 'endpoint' reference should be updated
+ else if (element.getEndpoint() != endpoint) {
+ element.setEndpoint(endpoint);
+
}
Logger.trace("Adding element for endpoint {}", endpoint);
uriPathTemplateElements.add(element);
@@ -64,7 +74,8 @@
return uriPathTemplateElements.toArray();
}
} catch (CoreException e) {
- Logger.error("Failed to retrieve JAX-RS Metamodel in project '" + project.getName() + "'", e);
+ Logger.error("Failed to retrieve JAX-RS Metamodel in project '"
+ + project.getName() + "'", e);
}
return new Object[0];
}
@@ -84,12 +95,14 @@
@Override
public boolean hasChildren(Object element) {
try {
- final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator.get(project);
+ final IJaxrsMetamodel metamodel = JaxrsMetamodelLocator
+ .get(project);
if (metamodel != null) {
return (metamodel.getAllEndpoints().size() > 0);
}
} catch (CoreException e) {
- Logger.error("Failed to retrieve JAX-RS Metamodel in project '" + project.getName() + "'", e);
+ Logger.error("Failed to retrieve JAX-RS Metamodel in project '"
+ + project.getName() + "'", e);
}
return false;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElement.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElement.java 2012-02-22 08:31:16 UTC (rev 38957)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriPathTemplateElement.java 2012-02-22 08:33:02 UTC (rev 38958)
@@ -24,7 +24,7 @@
public class UriPathTemplateElement implements ITreeContentProvider, ILaunchable {
- private final IJaxrsEndpoint endpoint;
+ private IJaxrsEndpoint endpoint;
private final UriPathTemplateCategory uriPathTemplateCategory;
@@ -79,6 +79,10 @@
return false;
}
+ public void setEndpoint(IJaxrsEndpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
/** @return the uriMapping */
public IJaxrsEndpoint getEndpoint() {
return endpoint;
12 years, 4 months
JBoss Tools SVN: r38957 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-02-22 03:31:16 -0500 (Wed, 22 Feb 2012)
New Revision: 38957
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
Log:
https://issues.jboss.org/browse/JBIDE-10980
Added 2 null checks
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2012-02-22 05:22:02 UTC (rev 38956)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2012-02-22 08:31:16 UTC (rev 38957)
@@ -343,30 +343,31 @@
private void formatGeneratedCode(IProgressMonitor monitor, Map<String, File[]> generatedFiles) {
final TextFileBufferOperation operation = new FormatGeneratedCode( HibernateConsoleMessages.CodeGenerationLaunchDelegate_formate_generated_code );
- File[] javaFiles = generatedFiles.get("java"); //$NON-NLS-1$
- if(javaFiles.length>0) {
+ if (generatedFiles != null){
+ File[] javaFiles = generatedFiles.get("java"); //$NON-NLS-1$
+ if(javaFiles != null && javaFiles.length>0) {
- IPath[] locations = new IPath[javaFiles.length];
+ IPath[] locations = new IPath[javaFiles.length];
- for (int i = 0; i < javaFiles.length; i++) {
- File file = javaFiles[i];
- locations[i] = new Path(file.getPath());
- }
+ for (int i = 0; i < javaFiles.length; i++) {
+ File file = javaFiles[i];
+ locations[i] = new Path(file.getPath());
+ }
- FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), HibernateConsolePlugin.getShell());
- try {
- runner.execute(locations, operation, monitor);
+ FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), HibernateConsolePlugin.getShell());
+ try {
+ runner.execute(locations, operation, monitor);
+ }
+ catch (OperationCanceledException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CodeGenerationLaunchDelegate_java_format_cancelled, e);
+ }
+ catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CodeGenerationLaunchDelegate_exception_during_java_format, e);
+ } catch (Throwable e) { // full guard since the above operation seem to be able to fail with IllegalArugmentException and SWT Invalid thread access while users are editing.
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CodeGenerationLaunchDelegate_exception_during_java_format, e);
+ }
}
- catch (OperationCanceledException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CodeGenerationLaunchDelegate_java_format_cancelled, e);
- }
- catch (CoreException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CodeGenerationLaunchDelegate_exception_during_java_format, e);
- } catch (Throwable e) { // full guard since the above operation seem to be able to fail with IllegalArugmentException and SWT Invalid thread access while users are editing.
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.CodeGenerationLaunchDelegate_exception_during_java_format, e);
- }
}
-
}
private ArtifactCollector runExporters (final ExporterAttributes attributes, final ExporterFactory[] exporterFactories, final Set<String> outputDirectories, final IProgressMonitor monitor)
12 years, 4 months
JBoss Tools SVN: r38956 - trunk/jsf/docs/userguide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-02-22 00:22:02 -0500 (Wed, 22 Feb 2012)
New Revision: 38956
Modified:
trunk/jsf/docs/userguide/en-US/Book_Info.xml
Log:
updated for brew
Modified: trunk/jsf/docs/userguide/en-US/Book_Info.xml
===================================================================
--- trunk/jsf/docs/userguide/en-US/Book_Info.xml 2012-02-22 05:20:57 UTC (rev 38955)
+++ trunk/jsf/docs/userguide/en-US/Book_Info.xml 2012-02-22 05:22:02 UTC (rev 38956)
@@ -7,7 +7,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>5.0</productnumber>
<edition>5.0.0</edition>
-<pubsnumber>5</pubsnumber>
+<pubsnumber>6</pubsnumber>
<abstract>
<para>The Visual Web Tools Reference Guide explains extensive collection of specialized wizards, editors and views that can be used in various scenarios while developing Web applications.</para>
</abstract>
12 years, 4 months
JBoss Tools SVN: r38955 - trunk/jsf/docs/userguide/en-US/images/browsers.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-02-22 00:20:57 -0500 (Wed, 22 Feb 2012)
New Revision: 38955
Modified:
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_08.png
Log:
updated image to show redhat website rather than amazon
Modified: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_08.png
===================================================================
(Binary files differ)
12 years, 4 months
JBoss Tools SVN: r38954 - in trunk/jsf/docs/userguide/en-US: images/browsers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-02-22 00:08:51 -0500 (Wed, 22 Feb 2012)
New Revision: 38954
Added:
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_03.png
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_04.png
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_05.png
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_06.png
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_07.png
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_08.png
trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_icon_01.png
Modified:
trunk/jsf/docs/userguide/en-US/browsers.xml
Log:
updated with Beta1 information for browsersim
Modified: trunk/jsf/docs/userguide/en-US/browsers.xml
===================================================================
--- trunk/jsf/docs/userguide/en-US/browsers.xml 2012-02-22 03:02:02 UTC (rev 38953)
+++ trunk/jsf/docs/userguide/en-US/browsers.xml 2012-02-22 05:08:51 UTC (rev 38954)
@@ -48,5 +48,91 @@
<para>
A new window will launch, displaying the contents of the page you selected as it will appear on mobile devices.
</para>
+ <para>
+ You are able to select the type of mobile device to simulate the browser on by right-clicking on part of the theme and selecting from the context menu.
+ </para>
+ <figure>
+ <title>Mobile web browser device selection</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_03.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ To open the <guilabel>BrowserSim</guilabel> without using a context menu, click on the <guibutton>BrowserSim</guibutton> button <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_icon_01.png"/>
+ </imageobject>
+ <textobject>
+ <phrase>BrowserSim toolbar icon</phrase>
+ </textobject>
+</inlinemediaobject> in your toolbar. If the button is not in your toolbar you can add it by undertaking the following:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Right-click on the toolbar at the top of your workspace and select <guilabel>Customize Perspective</guilabel> from the context menu.
+ </para>
+ <figure>
+ <title>Toolbar context menu</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_04.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>
+ Click on the <guilabel>Command Groups Availability</guilabel> tab and ensure the <guilabel>BrowserSim</guilabel> command group is checked.
+ </para>
+ <figure>
+ <title>Command Groups Availability tab</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_05.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>
+ Click on the <guilabel>Tool Bar Visibility</guilabel> tab and select the <guilabel>BrowserSim</guilabel> toolbar items menu and click the <guibutton>OK</guibutton> button.
+ </para>
+ <figure>
+ <title>Tool Bar Visibility tab</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_06.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>
+ The <guilabel>BrowserSim</guilabel> toolbar button will now be present in the toolbar for your current perspective.
+ </para>
+ <figure>
+ <title>Tool Bar Visibility tab</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_07.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Launching <guilabel>BrowserSim</guilabel> from the toolbar will either present you with the simulator and a blank webpage or the webpage currently open in the <guilabel>Internal Web Browser</guilabel>.
+ </para>
+ <figure>
+ <title>Tool Bar Visibility tab</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/browsers/mobile_browser_08.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
</section>
</chapter>
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_03.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_03.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_04.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_04.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_05.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_05.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_06.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_06.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_07.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_07.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_08.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_08.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_icon_01.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en-US/images/browsers/mobile_browser_icon_01.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
12 years, 4 months
JBoss Tools SVN: r38953 - branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-02-21 22:02:02 -0500 (Tue, 21 Feb 2012)
New Revision: 38953
Modified:
branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
Log:
JBIDE-10787
https://issues.jboss.org/browse/JBIDE-10787
Merged to Beta1: Driver filled with jar name.
Modified: branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
===================================================================
--- branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-02-22 03:00:26 UTC (rev 38952)
+++ branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-02-22 03:02:02 UTC (rev 38953)
@@ -280,7 +280,7 @@
String jarname = (String)model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_NAME);
if(jarname != null) {
IPath container = getContainerFullPath();
- IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IPath target = container.append(jarname);
IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
if(!targetFile.exists()) {
return targetFile;
@@ -296,7 +296,7 @@
File jarSource = new File(jars[0]);
if(jarSource.isFile()) {
IPath container = getContainerFullPath();
- IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IPath target = container.append(jarname);
IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
if(!targetFile.exists()) {
try {
@@ -550,7 +550,7 @@
String DATATOOLS_JDBC_DRIVER_JAR_PATH = "org.eclipse.datatools.connectivity.driverDefinitionID"; //$NON-NLS-1$
String JDBC_CONNECTION_NAME = "datasource.name"; //$NON-NLS-1$
- String JDBC_DRIVER_JAR_NAME = "driver.jar.name.without.dot.jar"; //$NON-NLS-1$
+ String JDBC_DRIVER_JAR_NAME = "driver.jar.name"; //$NON-NLS-1$
}
class DSDataModelProvider extends AbstractDataModelProvider implements IDSDataModelProperties {
@@ -676,7 +676,7 @@
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);
+ 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);
@@ -963,7 +963,7 @@
JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("datasourcename","${datasource.name}"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBC_TEMPLATE.addFilter("driverjarnamewithoutdotjar","${driver.jar.name.without.dot.jar}"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBC_TEMPLATE.addFilter("driverjarnamewithoutdotjar","${driver.jar.name}"); //$NON-NLS-1$ //$NON-NLS-2$
PROJECT_TEMPLATE = new FilterSet();
PROJECT_TEMPLATE.addFilter("projectName","${project.name}"); //$NON-NLS-1$ //$NON-NLS-2$
12 years, 4 months
JBoss Tools SVN: r38952 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-02-21 22:00:26 -0500 (Tue, 21 Feb 2012)
New Revision: 38952
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
Log:
JBIDE-10787
https://issues.jboss.org/browse/JBIDE-10787
Driver filled with jar name.
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-02-22 02:35:47 UTC (rev 38951)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-02-22 03:00:26 UTC (rev 38952)
@@ -280,7 +280,7 @@
String jarname = (String)model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_NAME);
if(jarname != null) {
IPath container = getContainerFullPath();
- IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IPath target = container.append(jarname);
IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
if(!targetFile.exists()) {
return targetFile;
@@ -296,7 +296,7 @@
File jarSource = new File(jars[0]);
if(jarSource.isFile()) {
IPath container = getContainerFullPath();
- IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IPath target = container.append(jarname);
IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
if(!targetFile.exists()) {
try {
@@ -550,7 +550,7 @@
String DATATOOLS_JDBC_DRIVER_JAR_PATH = "org.eclipse.datatools.connectivity.driverDefinitionID"; //$NON-NLS-1$
String JDBC_CONNECTION_NAME = "datasource.name"; //$NON-NLS-1$
- String JDBC_DRIVER_JAR_NAME = "driver.jar.name.without.dot.jar"; //$NON-NLS-1$
+ String JDBC_DRIVER_JAR_NAME = "driver.jar.name"; //$NON-NLS-1$
}
class DSDataModelProvider extends AbstractDataModelProvider implements IDSDataModelProperties {
@@ -676,7 +676,7 @@
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);
+ 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);
@@ -963,7 +963,7 @@
JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("datasourcename","${datasource.name}"); //$NON-NLS-1$ //$NON-NLS-2$
- JDBC_TEMPLATE.addFilter("driverjarnamewithoutdotjar","${driver.jar.name.without.dot.jar}"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBC_TEMPLATE.addFilter("driverjarnamewithoutdotjar","${driver.jar.name}"); //$NON-NLS-1$ //$NON-NLS-2$
PROJECT_TEMPLATE = new FilterSet();
PROJECT_TEMPLATE.addFilter("projectName","${project.name}"); //$NON-NLS-1$ //$NON-NLS-2$
12 years, 4 months
JBoss Tools SVN: r38951 - in branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui: templates/Datasource and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-02-21 21:35:47 -0500 (Tue, 21 Feb 2012)
New Revision: 38951
Modified:
branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml
Log:
JBIDE-10787
https://issues.jboss.org/browse/JBIDE-10787
Merge to Beta1 of new version of New JBoss Datasource wizard.
Modified: branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
===================================================================
--- branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-02-22 02:11:44 UTC (rev 38950)
+++ branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-02-22 02:35:47 UTC (rev 38951)
@@ -12,9 +12,12 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.BufferedInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -27,12 +30,20 @@
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.StringResource;
import org.apache.tools.ant.util.ResourceUtils;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.datatools.connectivity.ConnectionProfileException;
import org.eclipse.datatools.connectivity.IConnectionProfile;
@@ -42,10 +53,18 @@
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.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -54,10 +73,15 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.ide.undo.CreateFileOperation;
+import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
import org.eclipse.ui.internal.dialogs.DialogUtil;
import org.eclipse.ui.internal.dialogs.PropertyDialog;
+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
import org.eclipse.ui.internal.wizards.newresource.ResourceMessages;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
@@ -101,9 +125,9 @@
mainPage = new WizardNewDSXMLFileCreationPage("newFilePage1", getSelection()); //$NON-NLS-1$
mainPage.setTitle(Messages.NewDSXMLWizard_TITLE);
mainPage.setDescription(Messages.NewDSXMLWizard_DESCRIPTION);
+
+ mainPage.setFileName("ds.xml"); //$NON-NLS-1$
- mainPage.setFileName("ds.xml");
-
addPage(mainPage);
}
@@ -132,14 +156,73 @@
return true;
}
- class WizardNewDSXMLFileCreationPage extends WizardNewFileCreationPage {
+ static String toDatasourceName(String connectionProfile) {
+ connectionProfile = connectionProfile.trim();
+ StringBuilder result = new StringBuilder();
+ StringBuilder special = new StringBuilder();
+ for (int i = 0; i < connectionProfile.length(); i++) {
+ char c = connectionProfile.charAt(i);
+ if(!Character.isJavaIdentifierPart(c)) {
+ special.append('_');
+ } else {
+ if(special.length() > 0) {
+ result.append(special.toString());
+ special.setLength(0);
+ }
+ result.append(c);
+ }
+ }
+ return result.toString();
+ }
+
+ IContainer getInitialContainer() {
+ ISelection s = getSelection();
+ if(s instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection)s).getFirstElement();
+ IResource r = null;
+ if(o instanceof IResource) {
+ r = (IResource) o;
+ } else if(o instanceof IAdaptable) {
+ r = (IResource)((IAdaptable)o).getAdapter(IResource.class);
+ }
+ if(r instanceof IFile) {
+ return r.getParent();
+ } else if(r instanceof IContainer) {
+ return (IContainer)r;
+ }
+ }
+ return null;
+
+ }
+
+ class WizardNewDSXMLFileCreationPage extends WizardPage {
private IFieldEditor connProfileSelEditor;
private IFieldEditor templateSelEditor;
+ private IFieldEditor folderEditor;
+ private String initialFileName = "";
+ private IFieldEditor fileNameEditor;
+ IDataModel model;
+
+
public WizardNewDSXMLFileCreationPage(String pageName, IStructuredSelection selection) {
- super(pageName, selection);
+ super(pageName);
+ setPageComplete(false);
}
-
+
+ public IPath getContainerFullPath() {
+ String path = folderEditor.getValueAsString();
+ return new Path(path).makeAbsolute();
+ }
+
+ public void setFileName(String value) {
+ if(fileNameEditor == null) {
+ initialFileName = value;
+ } else {
+ fileNameEditor.setValue(value);
+ }
+ }
+
protected InputStream getInitialContents() {
String connection = connProfileSelEditor.getValueAsString();
String templateName = templateSelEditor.getValueAsString();
@@ -147,10 +230,12 @@
try {
// 1. Find template. For Seam project it is done by its runtime.
IPath containerPath = getContainerFullPath();
- IProject currentProject = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath).getProject();
+ IProject currentProject = containerPath.segmentCount() == 1
+ ? ResourcesPlugin.getWorkspace().getRoot().getProject(containerPath.segment(0))
+ : ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath).getProject();
File homePath = DSDataModelProvider.getTemplatesFolder();
- String templatePath = (NewDSXMLWizardFactory.TEMPLATE_LIST[1].equals(templateName))
+ String templatePath = (NewDSXMLWizardFactory.AS_7_TEMPLATE.equals(templateName))
? "/Datasource/datasource-ds-as7.xml" //$NON-NLS-1$
: "/Datasource/datasource-ds-default.xml"; //$NON-NLS-1$
File dataSourceDsFile = new File(homePath, templatePath);
@@ -159,9 +244,10 @@
FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
// Do it by reusing data model provider.
- IDataModel model = DataModelFactory.createDataModel(new DSDataModelProvider());
+ model = DataModelFactory.createDataModel(new DSDataModelProvider());
model.setProperty(IDSDataModelProperties.PROJECT_NAME, currentProject.getName());
model.setProperty(IDSDataModelProperties.CONNECTION_PROFILE, connection);
+ model.setProperty(IDSDataModelProperties.JDBC_CONNECTION_NAME, toDatasourceName(connection));
IConnectionProfile connProfile = ProfileManager.getInstance().getProfileByName(connection.toString());
if(connProfile == null) {
return null;
@@ -187,12 +273,61 @@
}
}
+ IFile getJarTarget() {
+ if(!NewDSXMLWizardFactory.AS_7_TEMPLATE.equals(templateSelEditor.getValueAsString())) {
+ return null;
+ }
+ String jarname = (String)model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_NAME);
+ if(jarname != null) {
+ IPath container = getContainerFullPath();
+ IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
+ if(!targetFile.exists()) {
+ return targetFile;
+ }
+ }
+ return null;
+ }
+
+ InputStream getJarContents() {
+ String[] jars = (String[])model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ String jarname = (String)model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_NAME);
+ if(jars != null && jarname != null) {
+ File jarSource = new File(jars[0]);
+ if(jarSource.isFile()) {
+ IPath container = getContainerFullPath();
+ IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
+ if(!targetFile.exists()) {
+ try {
+ return new BufferedInputStream(new FileInputStream(jarSource));
+ } catch (IOException e) {
+ WebUiPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ CreateFileOperation getJarFileOperation(IFile targetFile, InputStream jarContents) {
+ return new CreateFileOperation(targetFile, null, jarContents, "Copy driver jar file.");
+ }
+
public void createControl(Composite parent) {
- super.createControl(parent);
- Composite topLevel = (Composite)getControl();
+ initializeDialogUnits(parent);
+ // top level group
+ Composite topLevel = new Composite(parent, SWT.NONE);
+ topLevel.setLayout(new GridLayout());
+ topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ topLevel.setFont(parent.getFont());
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(topLevel,
+ IIDEHelpContextIds.NEW_FILE_WIZARD_PAGE);
+
connProfileSelEditor = NewDSXMLWizardFactory.createConnectionProfileSelectionFieldEditor(getConnectionProfileDefaultValue(), new IValidator() {
public Map<String, IStatus> validate(Object value, Object context) {
- validatePage();
+ setPageComplete(validatePage());
return ValidatorFactory.NO_ERRORS;
}
}, false);
@@ -204,24 +339,150 @@
templateSelEditor.doFillIntoGrid(q);
connProfileSelEditor.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
- validatePage();
+ String prefix = toDatasourceName(connProfileSelEditor.getValueAsString());
+ setFileName(prefix + "-ds.xml"); //$NON-NLS-1$
+ setPageComplete(validatePage());
}
});
- validatePage();
+
+ String defaultFolder = "";
+ IContainer c = getInitialContainer();
+ if(c != null) {
+ defaultFolder = c.getFullPath().toString();
+ }
+ folderEditor = IFieldEditorFactory.INSTANCE.createBrowseWorkspaceFolderEditor("folder", "Parent fold&er:", defaultFolder);
+ folderEditor.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ setPageComplete(validatePage());
+ }
+ });
+ folderEditor.doFillIntoGrid(q);
+
+ String prefix = toDatasourceName(mainPage.connProfileSelEditor.getValueAsString());
+ String defaultFileName = prefix + "-ds.xml"; //$NON-NLS-1$
+
+ fileNameEditor = IFieldEditorFactory.INSTANCE.createTextEditor("name", "File na&me:", defaultFileName);
+ fileNameEditor.doFillIntoGrid(q);
+ fileNameEditor.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ setPageComplete(validatePage());
+ }
+ });
+
+ setControl(topLevel);
+ setPageComplete(validatePage());
}
protected boolean validatePage() {
- boolean valid = super.validatePage();
- if(valid && connProfileSelEditor != null) {
+ IPath path = getContainerFullPath();
+ String fileName = fileNameEditor.getValueAsString();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ IStatus result = workspace.validateName(fileName, IResource.FILE);
+ if (!result.isOK()) {
+ setErrorMessage(result.getMessage());
+ return false;
+ }
+ for (int i = 0; i < path.segmentCount(); i++) {
+ String s = path.segment(i);
+ result = workspace.validateName(s, IResource.FOLDER);
+ if (!result.isOK()) {
+ setErrorMessage(result.getMessage());
+ return false;
+ }
+ }
+ IPath filePath = path.append(fileName);
+ if(workspace.getRoot().getFile(filePath).exists()) {
+ setErrorMessage("'" + fileName + "'" + " already exists.");
+ return false;
+ }
+
+ if(connProfileSelEditor != null) {
String p = connProfileSelEditor.getValueAsString();
if(p == null || p.length() == 0) {
- valid = false;
setErrorMessage("Connenction profile must be set.");
+ return false;
}
}
- return valid;
+ setErrorMessage(null);
+ return true;
}
+
+ IFile newFile = null;
+ protected IFile createFileHandle(IPath filePath) {
+ return IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFile(
+ filePath);
+ }
+ public IFile createNewFile() {
+ if (newFile != null) {
+ return newFile;
+ }
+
+ // create the new file and cache it if successful
+
+ final IPath containerPath = getContainerFullPath();
+ IPath newFilePath = containerPath.append(fileNameEditor.getValueAsString());
+ final IFile newFileHandle = createFileHandle(newFilePath);
+ final InputStream initialContents = getInitialContents();
+
+ final IFile jarTarget = getJarTarget();
+ final InputStream jarContents = jarTarget == null ? null : getJarContents();
+
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ CreateFileOperation op = new CreateFileOperation(newFileHandle,
+ null, initialContents, IDEWorkbenchMessages.WizardNewFileCreationPage_title);
+ try {
+ op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
+ if(jarContents != null) {
+ CreateFileOperation jar = getJarFileOperation(jarTarget, jarContents);
+ jar.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
+ }
+ } catch (final ExecutionException e) {
+ getContainer().getShell().getDisplay().syncExec(
+ new Runnable() {
+ public void run() {
+ if (e.getCause() instanceof CoreException) {
+ ErrorDialog.openError(getContainer().getShell(), // Was
+ // Utilities.getFocusShell()
+ IDEWorkbenchMessages.WizardNewFileCreationPage_errorTitle,
+ null, // no special
+ // message
+ ((CoreException) e.getCause()).getStatus());
+ } else {
+ IDEWorkbenchPlugin.log(getClass(), "createNewFile()", e.getCause()); //$NON-NLS-1$
+ MessageDialog.openError(getContainer().getShell(),
+ IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle,
+ NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage,
+ e.getCause().getMessage()));
+ }
+ }
+ });
+ }
+ }
+ };
+ try {
+ getContainer().run(true, true, op);
+ } catch (InterruptedException e) {
+ return null;
+ } catch (InvocationTargetException e) {
+ // Execution Exceptions are handled above but we may still get
+ // unexpected runtime errors.
+ IDEWorkbenchPlugin.log(getClass(),
+ "createNewFile()", e.getTargetException()); //$NON-NLS-1$
+ MessageDialog.open(MessageDialog.ERROR,
+ getContainer().getShell(),
+ IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle,
+ NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage,
+ e.getTargetException().getMessage()), SWT.SHEET);
+ return null;
+ }
+ newFile = newFileHandle;
+ return newFile;
+ }
+
+
}
/**
@@ -287,6 +548,9 @@
*/
String JDBC_DRIVER_JAR_PATH = "driver.file"; //$NON-NLS-1$
String DATATOOLS_JDBC_DRIVER_JAR_PATH = "org.eclipse.datatools.connectivity.driverDefinitionID"; //$NON-NLS-1$
+
+ String JDBC_CONNECTION_NAME = "datasource.name"; //$NON-NLS-1$
+ String JDBC_DRIVER_JAR_NAME = "driver.jar.name.without.dot.jar"; //$NON-NLS-1$
}
class DSDataModelProvider extends AbstractDataModelProvider implements IDSDataModelProperties {
@@ -320,6 +584,8 @@
// names.add(RECREATE_TABLES_AND_DATA_ON_DEPLOY);
names.add(JDBC_DRIVER_JAR_PATH);
+ names.add(JDBC_CONNECTION_NAME);
+ names.add(JDBC_DRIVER_JAR_NAME);
return names;
}
@@ -406,6 +672,15 @@
.getDriverInstanceByID(
props.get(DATATOOLS_JDBC_DRIVER_JAR_PATH).toString()).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);
+ int b = jar.replace('\\', '/').lastIndexOf('/');
+ String jarName = jar.substring(b + 1);
+ model.setProperty(JDBC_DRIVER_JAR_NAME, jarName);
+ }
}
}
@@ -427,9 +702,12 @@
class NewDSXMLWizardFactory {
static String EMPTY_PROFILE = " "; //$NON-NLS-1$
-
+
+ static String AS_5_TEMPLATE = "Format: JBoss AS 5"; //$NON-NLS-1$
+ static String AS_7_TEMPLATE = "Format: JBoss AS 7"; //$NON-NLS-1$
+
public static String[] TEMPLATE_LIST = {
- "Format: JBoss AS 5", "Format: JBoss AS 7" //$NON-NLS-1$ //$NON-NLS-2$
+ AS_5_TEMPLATE, AS_7_TEMPLATE
};
public static IFieldEditor createTemplateFieldEditor(Object defaultValue) {
@@ -684,6 +962,8 @@
JDBC_TEMPLATE.addFilter("password","${hibernate.connection.password}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBC_TEMPLATE.addFilter("datasourcename","${datasource.name}"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBC_TEMPLATE.addFilter("driverjarnamewithoutdotjar","${driver.jar.name.without.dot.jar}"); //$NON-NLS-1$ //$NON-NLS-2$
PROJECT_TEMPLATE = new FilterSet();
PROJECT_TEMPLATE.addFilter("projectName","${project.name}"); //$NON-NLS-1$ //$NON-NLS-2$
Modified: branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml
===================================================================
--- branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml 2012-02-22 02:11:44 UTC (rev 38950)
+++ branches/jbosstools-3.3.0.Beta1/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml 2012-02-22 02:35:47 UTC (rev 38951)
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
- <xa-datasource jndi-name="java:/JPADS" pool-name="JPADS">
- <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
- <xa-datasource-property name="URL">jdbc:h2:mem:test</xa-datasource-property>
- <driver>h2</driver>
+ <datasource jndi-name="java:jboss/datasources/@datasourcename@" enabled="true"
+ use-java-context="true" pool-name="@datasourcename@">
+ <connection-url>@jdbcUrl@</connection-url>
+ <driver>@driverjarnamewithoutdotjar@</driver>
+ <pool></pool>
<security>
- <user-name>@username@</user-name>
- <password>@password@</password>
- </security>
- </xa-datasource>
+ <user-name>@username@</user-name>
+ <password>@password@</password>
+ </security>
+ </datasource>
</datasources>
12 years, 4 months
JBoss Tools SVN: r38950 - in trunk/jst/plugins/org.jboss.tools.jst.web.ui: templates/Datasource and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-02-21 21:11:44 -0500 (Tue, 21 Feb 2012)
New Revision: 38950
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/templates/Datasource/datasource-ds-as7.xml
Log:
JBIDE-10787
https://issues.jboss.org/browse/JBIDE-10787
New version of New JBoss Datasource wizard.
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-02-22 01:27:56 UTC (rev 38949)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-02-22 02:11:44 UTC (rev 38950)
@@ -12,9 +12,12 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.BufferedInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -27,12 +30,20 @@
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.StringResource;
import org.apache.tools.ant.util.ResourceUtils;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.datatools.connectivity.ConnectionProfileException;
import org.eclipse.datatools.connectivity.IConnectionProfile;
@@ -42,10 +53,18 @@
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.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -54,10 +73,15 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.ide.undo.CreateFileOperation;
+import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
import org.eclipse.ui.internal.dialogs.DialogUtil;
import org.eclipse.ui.internal.dialogs.PropertyDialog;
+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
import org.eclipse.ui.internal.wizards.newresource.ResourceMessages;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
@@ -101,9 +125,9 @@
mainPage = new WizardNewDSXMLFileCreationPage("newFilePage1", getSelection()); //$NON-NLS-1$
mainPage.setTitle(Messages.NewDSXMLWizard_TITLE);
mainPage.setDescription(Messages.NewDSXMLWizard_DESCRIPTION);
+
+ mainPage.setFileName("ds.xml"); //$NON-NLS-1$
- mainPage.setFileName("ds.xml");
-
addPage(mainPage);
}
@@ -132,14 +156,73 @@
return true;
}
- class WizardNewDSXMLFileCreationPage extends WizardNewFileCreationPage {
+ static String toDatasourceName(String connectionProfile) {
+ connectionProfile = connectionProfile.trim();
+ StringBuilder result = new StringBuilder();
+ StringBuilder special = new StringBuilder();
+ for (int i = 0; i < connectionProfile.length(); i++) {
+ char c = connectionProfile.charAt(i);
+ if(!Character.isJavaIdentifierPart(c)) {
+ special.append('_');
+ } else {
+ if(special.length() > 0) {
+ result.append(special.toString());
+ special.setLength(0);
+ }
+ result.append(c);
+ }
+ }
+ return result.toString();
+ }
+
+ IContainer getInitialContainer() {
+ ISelection s = getSelection();
+ if(s instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection)s).getFirstElement();
+ IResource r = null;
+ if(o instanceof IResource) {
+ r = (IResource) o;
+ } else if(o instanceof IAdaptable) {
+ r = (IResource)((IAdaptable)o).getAdapter(IResource.class);
+ }
+ if(r instanceof IFile) {
+ return r.getParent();
+ } else if(r instanceof IContainer) {
+ return (IContainer)r;
+ }
+ }
+ return null;
+
+ }
+
+ class WizardNewDSXMLFileCreationPage extends WizardPage {
private IFieldEditor connProfileSelEditor;
private IFieldEditor templateSelEditor;
+ private IFieldEditor folderEditor;
+ private String initialFileName = "";
+ private IFieldEditor fileNameEditor;
+ IDataModel model;
+
+
public WizardNewDSXMLFileCreationPage(String pageName, IStructuredSelection selection) {
- super(pageName, selection);
+ super(pageName);
+ setPageComplete(false);
}
-
+
+ public IPath getContainerFullPath() {
+ String path = folderEditor.getValueAsString();
+ return new Path(path).makeAbsolute();
+ }
+
+ public void setFileName(String value) {
+ if(fileNameEditor == null) {
+ initialFileName = value;
+ } else {
+ fileNameEditor.setValue(value);
+ }
+ }
+
protected InputStream getInitialContents() {
String connection = connProfileSelEditor.getValueAsString();
String templateName = templateSelEditor.getValueAsString();
@@ -147,10 +230,12 @@
try {
// 1. Find template. For Seam project it is done by its runtime.
IPath containerPath = getContainerFullPath();
- IProject currentProject = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath).getProject();
+ IProject currentProject = containerPath.segmentCount() == 1
+ ? ResourcesPlugin.getWorkspace().getRoot().getProject(containerPath.segment(0))
+ : ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath).getProject();
File homePath = DSDataModelProvider.getTemplatesFolder();
- String templatePath = (NewDSXMLWizardFactory.TEMPLATE_LIST[1].equals(templateName))
+ String templatePath = (NewDSXMLWizardFactory.AS_7_TEMPLATE.equals(templateName))
? "/Datasource/datasource-ds-as7.xml" //$NON-NLS-1$
: "/Datasource/datasource-ds-default.xml"; //$NON-NLS-1$
File dataSourceDsFile = new File(homePath, templatePath);
@@ -159,9 +244,10 @@
FilterSetCollection viewFilterSetCollection = new FilterSetCollection();
// Do it by reusing data model provider.
- IDataModel model = DataModelFactory.createDataModel(new DSDataModelProvider());
+ model = DataModelFactory.createDataModel(new DSDataModelProvider());
model.setProperty(IDSDataModelProperties.PROJECT_NAME, currentProject.getName());
model.setProperty(IDSDataModelProperties.CONNECTION_PROFILE, connection);
+ model.setProperty(IDSDataModelProperties.JDBC_CONNECTION_NAME, toDatasourceName(connection));
IConnectionProfile connProfile = ProfileManager.getInstance().getProfileByName(connection.toString());
if(connProfile == null) {
return null;
@@ -187,12 +273,61 @@
}
}
+ IFile getJarTarget() {
+ if(!NewDSXMLWizardFactory.AS_7_TEMPLATE.equals(templateSelEditor.getValueAsString())) {
+ return null;
+ }
+ String jarname = (String)model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_NAME);
+ if(jarname != null) {
+ IPath container = getContainerFullPath();
+ IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
+ if(!targetFile.exists()) {
+ return targetFile;
+ }
+ }
+ return null;
+ }
+
+ InputStream getJarContents() {
+ String[] jars = (String[])model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ String jarname = (String)model.getProperty(IDSDataModelProperties.JDBC_DRIVER_JAR_NAME);
+ if(jars != null && jarname != null) {
+ File jarSource = new File(jars[0]);
+ if(jarSource.isFile()) {
+ IPath container = getContainerFullPath();
+ IPath target = container.append(jarname + ".jar"); //$NON-NLS-1$
+ IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(target);
+ if(!targetFile.exists()) {
+ try {
+ return new BufferedInputStream(new FileInputStream(jarSource));
+ } catch (IOException e) {
+ WebUiPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ CreateFileOperation getJarFileOperation(IFile targetFile, InputStream jarContents) {
+ return new CreateFileOperation(targetFile, null, jarContents, "Copy driver jar file.");
+ }
+
public void createControl(Composite parent) {
- super.createControl(parent);
- Composite topLevel = (Composite)getControl();
+ initializeDialogUnits(parent);
+ // top level group
+ Composite topLevel = new Composite(parent, SWT.NONE);
+ topLevel.setLayout(new GridLayout());
+ topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ topLevel.setFont(parent.getFont());
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(topLevel,
+ IIDEHelpContextIds.NEW_FILE_WIZARD_PAGE);
+
connProfileSelEditor = NewDSXMLWizardFactory.createConnectionProfileSelectionFieldEditor(getConnectionProfileDefaultValue(), new IValidator() {
public Map<String, IStatus> validate(Object value, Object context) {
- validatePage();
+ setPageComplete(validatePage());
return ValidatorFactory.NO_ERRORS;
}
}, false);
@@ -204,24 +339,150 @@
templateSelEditor.doFillIntoGrid(q);
connProfileSelEditor.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
- validatePage();
+ String prefix = toDatasourceName(connProfileSelEditor.getValueAsString());
+ setFileName(prefix + "-ds.xml"); //$NON-NLS-1$
+ setPageComplete(validatePage());
}
});
- validatePage();
+
+ String defaultFolder = "";
+ IContainer c = getInitialContainer();
+ if(c != null) {
+ defaultFolder = c.getFullPath().toString();
+ }
+ folderEditor = IFieldEditorFactory.INSTANCE.createBrowseWorkspaceFolderEditor("folder", "Parent fold&er:", defaultFolder);
+ folderEditor.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ setPageComplete(validatePage());
+ }
+ });
+ folderEditor.doFillIntoGrid(q);
+
+ String prefix = toDatasourceName(mainPage.connProfileSelEditor.getValueAsString());
+ String defaultFileName = prefix + "-ds.xml"; //$NON-NLS-1$
+
+ fileNameEditor = IFieldEditorFactory.INSTANCE.createTextEditor("name", "File na&me:", defaultFileName);
+ fileNameEditor.doFillIntoGrid(q);
+ fileNameEditor.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ setPageComplete(validatePage());
+ }
+ });
+
+ setControl(topLevel);
+ setPageComplete(validatePage());
}
protected boolean validatePage() {
- boolean valid = super.validatePage();
- if(valid && connProfileSelEditor != null) {
+ IPath path = getContainerFullPath();
+ String fileName = fileNameEditor.getValueAsString();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ IStatus result = workspace.validateName(fileName, IResource.FILE);
+ if (!result.isOK()) {
+ setErrorMessage(result.getMessage());
+ return false;
+ }
+ for (int i = 0; i < path.segmentCount(); i++) {
+ String s = path.segment(i);
+ result = workspace.validateName(s, IResource.FOLDER);
+ if (!result.isOK()) {
+ setErrorMessage(result.getMessage());
+ return false;
+ }
+ }
+ IPath filePath = path.append(fileName);
+ if(workspace.getRoot().getFile(filePath).exists()) {
+ setErrorMessage("'" + fileName + "'" + " already exists.");
+ return false;
+ }
+
+ if(connProfileSelEditor != null) {
String p = connProfileSelEditor.getValueAsString();
if(p == null || p.length() == 0) {
- valid = false;
setErrorMessage("Connenction profile must be set.");
+ return false;
}
}
- return valid;
+ setErrorMessage(null);
+ return true;
}
+
+ IFile newFile = null;
+ protected IFile createFileHandle(IPath filePath) {
+ return IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFile(
+ filePath);
+ }
+ public IFile createNewFile() {
+ if (newFile != null) {
+ return newFile;
+ }
+
+ // create the new file and cache it if successful
+
+ final IPath containerPath = getContainerFullPath();
+ IPath newFilePath = containerPath.append(fileNameEditor.getValueAsString());
+ final IFile newFileHandle = createFileHandle(newFilePath);
+ final InputStream initialContents = getInitialContents();
+
+ final IFile jarTarget = getJarTarget();
+ final InputStream jarContents = jarTarget == null ? null : getJarContents();
+
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ CreateFileOperation op = new CreateFileOperation(newFileHandle,
+ null, initialContents, IDEWorkbenchMessages.WizardNewFileCreationPage_title);
+ try {
+ op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
+ if(jarContents != null) {
+ CreateFileOperation jar = getJarFileOperation(jarTarget, jarContents);
+ jar.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
+ }
+ } catch (final ExecutionException e) {
+ getContainer().getShell().getDisplay().syncExec(
+ new Runnable() {
+ public void run() {
+ if (e.getCause() instanceof CoreException) {
+ ErrorDialog.openError(getContainer().getShell(), // Was
+ // Utilities.getFocusShell()
+ IDEWorkbenchMessages.WizardNewFileCreationPage_errorTitle,
+ null, // no special
+ // message
+ ((CoreException) e.getCause()).getStatus());
+ } else {
+ IDEWorkbenchPlugin.log(getClass(), "createNewFile()", e.getCause()); //$NON-NLS-1$
+ MessageDialog.openError(getContainer().getShell(),
+ IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle,
+ NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage,
+ e.getCause().getMessage()));
+ }
+ }
+ });
+ }
+ }
+ };
+ try {
+ getContainer().run(true, true, op);
+ } catch (InterruptedException e) {
+ return null;
+ } catch (InvocationTargetException e) {
+ // Execution Exceptions are handled above but we may still get
+ // unexpected runtime errors.
+ IDEWorkbenchPlugin.log(getClass(),
+ "createNewFile()", e.getTargetException()); //$NON-NLS-1$
+ MessageDialog.open(MessageDialog.ERROR,
+ getContainer().getShell(),
+ IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle,
+ NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage,
+ e.getTargetException().getMessage()), SWT.SHEET);
+ return null;
+ }
+ newFile = newFileHandle;
+ return newFile;
+ }
+
+
}
/**
@@ -287,6 +548,9 @@
*/
String JDBC_DRIVER_JAR_PATH = "driver.file"; //$NON-NLS-1$
String DATATOOLS_JDBC_DRIVER_JAR_PATH = "org.eclipse.datatools.connectivity.driverDefinitionID"; //$NON-NLS-1$
+
+ String JDBC_CONNECTION_NAME = "datasource.name"; //$NON-NLS-1$
+ String JDBC_DRIVER_JAR_NAME = "driver.jar.name.without.dot.jar"; //$NON-NLS-1$
}
class DSDataModelProvider extends AbstractDataModelProvider implements IDSDataModelProperties {
@@ -320,6 +584,8 @@
// names.add(RECREATE_TABLES_AND_DATA_ON_DEPLOY);
names.add(JDBC_DRIVER_JAR_PATH);
+ names.add(JDBC_CONNECTION_NAME);
+ names.add(JDBC_DRIVER_JAR_NAME);
return names;
}
@@ -406,6 +672,15 @@
.getDriverInstanceByID(
props.get(DATATOOLS_JDBC_DRIVER_JAR_PATH).toString()).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);
+ int b = jar.replace('\\', '/').lastIndexOf('/');
+ String jarName = jar.substring(b + 1);
+ model.setProperty(JDBC_DRIVER_JAR_NAME, jarName);
+ }
}
}
@@ -427,9 +702,12 @@
class NewDSXMLWizardFactory {
static String EMPTY_PROFILE = " "; //$NON-NLS-1$
-
+
+ static String AS_5_TEMPLATE = "Format: JBoss AS 5"; //$NON-NLS-1$
+ static String AS_7_TEMPLATE = "Format: JBoss AS 7"; //$NON-NLS-1$
+
public static String[] TEMPLATE_LIST = {
- "Format: JBoss AS 5", "Format: JBoss AS 7" //$NON-NLS-1$ //$NON-NLS-2$
+ AS_5_TEMPLATE, AS_7_TEMPLATE
};
public static IFieldEditor createTemplateFieldEditor(Object defaultValue) {
@@ -684,6 +962,8 @@
JDBC_TEMPLATE.addFilter("password","${hibernate.connection.password}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("catalogProperty","${catalog.property}"); //$NON-NLS-1$ //$NON-NLS-2$
JDBC_TEMPLATE.addFilter("schemaProperty","${schema.property}"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBC_TEMPLATE.addFilter("datasourcename","${datasource.name}"); //$NON-NLS-1$ //$NON-NLS-2$
+ JDBC_TEMPLATE.addFilter("driverjarnamewithoutdotjar","${driver.jar.name.without.dot.jar}"); //$NON-NLS-1$ //$NON-NLS-2$
PROJECT_TEMPLATE = new FilterSet();
PROJECT_TEMPLATE.addFilter("projectName","${project.name}"); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml 2012-02-22 01:27:56 UTC (rev 38949)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/templates/Datasource/datasource-ds-as7.xml 2012-02-22 02:11:44 UTC (rev 38950)
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
- <xa-datasource jndi-name="java:/JPADS" pool-name="JPADS">
- <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
- <xa-datasource-property name="URL">jdbc:h2:mem:test</xa-datasource-property>
- <driver>h2</driver>
+ <datasource jndi-name="java:jboss/datasources/@datasourcename@" enabled="true"
+ use-java-context="true" pool-name="@datasourcename@">
+ <connection-url>@jdbcUrl@</connection-url>
+ <driver>@driverjarnamewithoutdotjar@</driver>
+ <pool></pool>
<security>
- <user-name>@username@</user-name>
- <password>@password@</password>
- </security>
- </xa-datasource>
+ <user-name>@username@</user-name>
+ <password>@password@</password>
+ </security>
+ </datasource>
</datasources>
12 years, 4 months