JBoss Tools SVN: r20924 - in trunk/ws/plugins: org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-03-19 03:29:17 -0400 (Fri, 19 Mar 2010)
New Revision: 20924
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java
Removed:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/Messages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages.properties
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCore.properties
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
Log:
JBIDE-6071: to trunk
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCore.properties 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCore.properties 2010-03-19 07:29:17 UTC (rev 20924)
@@ -1,12 +1,15 @@
-Progress_Install_JBossWS_Runtime=JBoss Web Service Runtime
-Progress_UnInstall_JBossWS_Runtime=Uninstall JBoss Web Service Runtime
+# START NON-TRANSLATABLE
Dir_Lib=lib
Dir_Client=client
-Error_Copy=Exception while copy JBossWS jars
WS_Location=jbosswsruntimelocation
JBossWS_Runtime_Lib=JBossWS_Runtime
JBossWS_Runtime=JBoss WS Runtime
-JBossWSCoreUtils_ErrorResourceNotFile=The following path is not a file: {0}.
-JBossWSCoreUtils_ErrorResourceNotFolder=Resource {0} is not a folder.
+# END NON-TRANSLATABLE
+
+Progress_Install_JBossWS_Runtime=JBoss Web Service Runtime
+Progress_UnInstall_JBossWS_Runtime=Uninstall JBoss Web Service Runtime
+Error_Copy=Exception while copy JBossWS jars
+Error_JBossWSCoreUtils_ResourceNotFile=The following path is not a file: {0}.
+Error_JBossWSCoreUtils_ResourceNotFolder=Resource {0} is not a folder.
Error_Add_Facet_JBossWS=Exception while install JBossWS facet
Error_Remove_Facet_JBossWS=Exception while uninstall JBossWS facet
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCoreMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCoreMessages.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/messages/JBossWSCoreMessages.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -28,12 +28,13 @@
public static String Progress_UnInstall_JBossWS_Runtime;
public static String Dir_Lib;
public static String Dir_Client;
- public static String Error_Copy;
public static String WS_Location;
public static String JBossWS_Runtime_Lib;
public static String JBossWS_Runtime;
- public static String JBossWSCoreUtils_ErrorResourceNotFile;
- public static String JBossWSCoreUtils_ErrorResourceNotFolder;
+
+ public static String Error_JBossWSCoreUtils_ResourceNotFile;
+ public static String Error_JBossWSCoreUtils_ResourceNotFolder;
+ public static String Error_Copy;
public static String Error_Add_Facet_JBossWS;
public static String Error_Remove_Facet_JBossWS;
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JBossWSCoreUtils.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -170,7 +170,7 @@
return (IFolder) child;
} else {
throw new CoreException(new Status(IStatus.ERROR,
- "ResourceUtils", 0, NLS.bind(JBossWSCoreMessages.JBossWSCoreUtils_ErrorResourceNotFolder, //$NON-NLS-1$ // EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FOLDER
+ "ResourceUtils", 0, NLS.bind(JBossWSCoreMessages.Error_JBossWSCoreUtils_ResourceNotFolder, //$NON-NLS-1$
new Object[] { parent.getFullPath().append(
folderName).toString() }), null));
}
@@ -200,7 +200,7 @@
} else {
throw new CoreException(new Status(IStatus.ERROR,
- "ResourceUtils", 0, NLS.bind(JBossWSCoreMessages.JBossWSCoreUtils_ErrorResourceNotFile, //$NON-NLS-1$ // EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FILE
+ "ResourceUtils", 0, NLS.bind(JBossWSCoreMessages.Error_JBossWSCoreUtils_ResourceNotFile, //$NON-NLS-1$
new Object[] { parent.getFullPath().append(
fileName) }), null));
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2010-03-19 07:29:17 UTC (rev 20924)
@@ -1,29 +1,6 @@
-Label_Custom_Package_Name=Package name
-Label_Catalog_File=Catalog file
-Label_Button_Text_Seletion= &Add
-Label_Generate_Impelemtation=Generate default Web Service Implementation classes
-Label_Generate_WSDL=Generate WSDL file
-Label_Binding_File=Binding files
-Label_JaxWS_Target=JAX-WS specification
-Label_Update_Webxml=Update the default Web.xml
-Label_EnableSOAP12_Binding_Extension=Enable SOAP 1.2 binding extension (This option is only available for JBossWS 3.0 or later)
# START NON-TRANSLATABLE
Value_Target_0=2.0
Value_Target_1=2.1
-# END NON-TRANSLATABLE
-Label_Button_Text_Remove=Remove
-
-Progress_Message_Generating=Generating Web Service resources...
-
-Error_Message_Invalid_Binding_File={0} is not a valid JAX-WS or JAXB binding file
-Error_Message_Failed_To_Generate_Code=Failed to Generate Web Service code, please check the log for more details
-Error_Message_Failed_to_Generate_Implementation=Failed to generate implementation class
-Error_Message_Command_File_Not_Found=The command file: "{0}" does not exist, please check the JBoss Web Service runtime setting to make sure the location of JBoss Web Service runtime is valid.
-Error_Message_No_Runtime_Specified=No JBoss Web Service runtime has been specified.
-
-
-Error_No_Annotation=This class has no required JAXWS Annotation!
-# START NON-TRANSLATABLE
Separator_Java=/
WebserviceClient_Annotation=@WebServiceClient
Webservice_Annotation=WebService
@@ -32,16 +9,21 @@
Client_Sample_Package_Name=.clientsample
Client_Sample_Class_Name=ClientSample
WebEndpoint=WebEndpoint
+Command=wsconsume.sh
+Bin=bin
# END NON-TRANSLATABLE
-Error_No_Class= The class {0} cannot be loaded via project {1}.Check that the project contains the class, or that the class is loadable according to the Java Build Path of the project.
-Error_WS_Location=The JBoss WS Runtime Location is NULL. Please set the location on JBoss WS preferences page.
-Error_Create_Client_Sample=When create a client sample, a error comes up. Please check the generated files.
-Error_No_Package=The service implementation selected does not follow Java naming conventions. This may result in not being able to generate your WebService.
-
-
-Error_WS_Chose_runtime=Select a JBoss Web Service runtime. If a server supplied JBoss Web Service runtime is chosen ,\n the chosen server adapter must be capable of providing the JBoss Web Service runtime
-Error_WS_No_Runtime_Specifed=A JBossWS runtime has not been chosen
+Label_Custom_Package_Name=Package name
+Label_Catalog_File=Catalog file
+Label_Button_Text_Seletion= &Add
+Label_Generate_Impelemtation=Generate default Web Service Implementation classes
+Label_Generate_WSDL=Generate WSDL file
+Label_Binding_File=Binding files
+Label_JaxWS_Target=JAX-WS specification
+Label_Update_Webxml=Update the default Web.xml
+Label_EnableSOAP12_Binding_Extension=Enable SOAP 1.2 binding extension (This option is only available for JBossWS 3.0 or later)
+Label_Button_Text_Remove=Remove
+Progress_Message_Generating=Generating Web Service resources...
JBossWSFacetInstallPage_Title=JBossWS Facet {0}
JBossWSFacetInstallPage_Description=Select JBossWS {0} Web Service runtime
JBossWSFacetInstallPage_ServerSuppliedJBossWS=Server Supplied JBossWS Runtime
@@ -52,6 +34,16 @@
JBossWSRuntimeInstallPage_NoValidJBossWSRuntime=The specified target runtime should be JBoss AS 5.0 or later.
Client_Sample_Run_Over= Call Over!
-Command=wsconsume.sh
-Bin=bin
+Error_Message_Invalid_Binding_File={0} is not a valid JAX-WS or JAXB binding file
+Error_Message_Failed_To_Generate_Code=Failed to Generate Web Service code, please check the log for more details
+Error_Message_Failed_to_Generate_Implementation=Failed to generate implementation class
+Error_Message_Command_File_Not_Found=The command file: "{0}" does not exist, please check the JBoss Web Service runtime setting to make sure the location of JBoss Web Service runtime is valid.
+Error_Message_No_Runtime_Specified=No JBoss Web Service runtime has been specified.
+Error_No_Annotation=This class has no required JAXWS Annotation!
+Error_No_Class= The class {0} cannot be loaded via project {1}.Check that the project contains the class, or that the class is loadable according to the Java Build Path of the project.
+Error_WS_Location=The JBoss WS Runtime Location is NULL. Please set the location on JBoss WS preferences page.
+Error_Create_Client_Sample=When create a client sample, a error comes up. Please check the generated files.
+Error_No_Package=The service implementation selected does not follow Java naming conventions. This may result in not being able to generate your WebService.
+Error_WS_Chose_runtime=Select a JBoss Web Service runtime. If a server supplied JBoss Web Service runtime is chosen ,\n the chosen server adapter must be capable of providing the JBoss Web Service runtime
+Error_WS_No_Runtime_Specifed=A JBossWS runtime has not been chosen
Error_JBossWS_GenerateWizard_WSName_Same=The Web Service Name has been used in the web.xml of the web project.
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -5,68 +5,55 @@
public class JBossWSCreationCoreMessages extends NLS {
private static final String BUNDLE_NAME = "org.jboss.tools.ws.creation.core.messages.JBossWSCreationCore"; //$NON-NLS-1$
+ public static String Value_Target_0;
+ public static String Value_Target_1;
+ public static String Separator_Java;
+ public static String WebserviceClient_Annotation;
+ public static String Webservice_Annotation_Check;
+ public static String Webservice_Annotation;
+ public static String Webservice_Annotation_Prefix;
+ public static String WebEndpoint;
+ public static String Client_Sample_Package_Name;
+ public static String Client_Sample_Class_Name;
+ public static String Command;
+ public static String Bin;
+
public static String JBossWSFacetInstallPage_Deploy;
-
public static String JBossWSFacetInstallPage_Description;
-
public static String JBossWSFacetInstallPage_New;
-
public static String JBossWSFacetInstallPage_ServerSuppliedJBossWS;
-
public static String JBossWSFacetInstallPage_Title;
-
public static String JBossWSRuntimeConfigBlock_Duplicated_Jar;
public static String JBossWSRuntimeInstallPage_NoTargetRuntime;
public static String JBossWSRuntimeInstallPage_NoValidJBossWSRuntime;
-
public static String Label_Custom_Package_Name;
public static String Label_Catalog_File;
public static String Label_Button_Text_Seletion;
public static String Label_Binding_File;
-
public static String Label_Generate_Impelemtation;
-
public static String Label_Generate_WSDL;
public static String Label_JaxWS_Target;
-
public static String Label_Update_Webxml;
public static String Label_EnableSOAP12_Binding_Extension;
- public static String Value_Target_0;
- public static String Value_Target_1;
public static String Label_Button_Text_Remove;
- public static String Progress_Message_Generating;
+ public static String Progress_Message_Generating;
+ public static String Client_Sample_Run_Over;
public static String Error_Message_Invalid_Binding_File;
-
- public static String Separator_Java;
public static String Error_Message_Failed_To_Generate_Code;
- public static String Error_Message_Failed_to_Generate_Implementation;
-
+ public static String Error_Message_Failed_to_Generate_Implementation;
public static String Error_Message_Command_File_Not_Found;
-
-
public static String Error_No_Annotation;
- public static String WebserviceClient_Annotation;
public static String Error_No_Class;
public static String Error_No_Package;
public static String Error_WS_Location;
public static String Error_WS_No_Runtime_Specifed;
public static String Error_WS_Chose_runtime;
- public static String Webservice_Annotation_Check;
- public static String Webservice_Annotation;
- public static String Webservice_Annotation_Prefix;
- public static String Client_Sample_Package_Name;
- public static String Client_Sample_Class_Name;
public static String Error_Create_Client_Sample;
- public static String WebEndpoint;
-
public static String Error_Message_No_Runtime_Specified;
- public static String Client_Sample_Run_Over;
-
- public static String Command;
- public static String Bin;
public static String Error_JBossWS_GenerateWizard_WSName_Same;
-
+
+
private JBossWSCreationCoreMessages() {
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/CreationUIPlugin.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -9,7 +9,7 @@
public class CreationUIPlugin extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.jbossws.creation.ui"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.jboss.tools.ws.creation.ui"; //$NON-NLS-1$
// The shared instance
private static CreationUIPlugin plugin;
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/Messages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/Messages.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/Messages.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -1,18 +0,0 @@
-package org.jboss.tools.ws.creation.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.ws.creation.ui.messages"; //$NON-NLS-1$
- public static String JBossWSConfigWidgetFactory_Description;
- public static String JBossWSConfigWidgetFactory_Title;
- public static String JBossWSProviderInvokeConfigWidgetFactory_Description;
- public static String JBossWSProviderInvokeConfigWidgetFactory_Title;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages.properties)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUI.properties 2010-03-19 07:29:17 UTC (rev 20924)
@@ -0,0 +1,4 @@
+JBossWSConfigWidgetFactory_Description=Please input the appropriate option for the code generation
+JBossWSConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
+JBossWSProviderInvokeConfigWidgetFactory_Description=Please input the appropriate option for the code generation
+JBossWSProviderInvokeConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
Copied: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java (from rev 20822, trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/Messages.java)
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages/JBossWSCreationUIMessages.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -0,0 +1,18 @@
+package org.jboss.tools.ws.creation.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JBossWSCreationUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUI"; //$NON-NLS-1$
+
+ private JBossWSCreationUIMessages() {
+ }
+ public static String JBossWSConfigWidgetFactory_Description;
+ public static String JBossWSConfigWidgetFactory_Title;
+ public static String JBossWSProviderInvokeConfigWidgetFactory_Description;
+ public static String JBossWSProviderInvokeConfigWidgetFactory_Title;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JBossWSCreationUIMessages.class);
+ }
+}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages.properties 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/messages.properties 2010-03-19 07:29:17 UTC (rev 20924)
@@ -1,4 +0,0 @@
-JBossWSConfigWidgetFactory_Description=Please input the appropriate option for the code generation
-JBossWSConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
-JBossWSProviderInvokeConfigWidgetFactory_Description=Please input the appropriate option for the code generation
-JBossWSProviderInvokeConfigWidgetFactory_Title=JBoss Web Service Code Generation Configuration
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSConfigWidgetFactory.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -10,7 +10,7 @@
import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
import org.jboss.tools.ws.creation.core.commands.InitialCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.ui.Messages;
+import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
import org.jboss.tools.ws.creation.ui.widgets.CodeGenConfigWidget;
public class JBossWSConfigWidgetFactory implements
@@ -61,8 +61,8 @@
servicesXMLSelectWidget = new CodeGenConfigWidget(model);
servicesXMLSelectWidgetContrib = createWidgetContributor(
- Messages.JBossWSConfigWidgetFactory_Title,
- Messages.JBossWSConfigWidgetFactory_Description,
+ JBossWSCreationUIMessages.JBossWSConfigWidgetFactory_Title,
+ JBossWSCreationUIMessages.JBossWSConfigWidgetFactory_Description,
servicesXMLSelectWidget);
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWSProviderInvokeConfigWidgetFactory.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -20,7 +20,7 @@
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor;
import org.jboss.tools.ws.creation.core.commands.InitialCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.ui.Messages;
+import org.jboss.tools.ws.creation.ui.messages.JBossWSCreationUIMessages;
import org.jboss.tools.ws.creation.ui.widgets.ProviderInvokeCodeGenConfigWidget;
/**
@@ -69,8 +69,8 @@
ProviderInvokeCodeGenConfigWidget java2WSDLWidget = new ProviderInvokeCodeGenConfigWidget(
model);
servicesXMLSelectWidgetContrib = createWidgetContributor(
- Messages.JBossWSProviderInvokeConfigWidgetFactory_Title,
- Messages.JBossWSProviderInvokeConfigWidgetFactory_Description,
+ JBossWSCreationUIMessages.JBossWSProviderInvokeConfigWidgetFactory_Title,
+ JBossWSCreationUIMessages.JBossWSProviderInvokeConfigWidgetFactory_Description,
java2WSDLWidget);
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-03-19 07:29:17 UTC (rev 20924)
@@ -1,5 +1,3 @@
-Label_JBossWS_Runtime_Load_Error=Error occurred while loading JBossWS Command. Select the correct JBoss Server folder.
-
# START NON-TRANSLATABLE
Command=wsconsume.sh
Bin=bin
@@ -8,9 +6,6 @@
Endorsed=endorsed
# END NON-TRANSLATABLE
-Error_JBossWS_Basic_Editor_Composite=Parent control should be Composite
-Error_JBossWS_Basic_Editor_Support=Editor supports only grid layout
-Error_JBossWS_Basic_Editor_Different=Parent for label is different
JBossRuntimeListFieldEditor_ActionAdd=&Add
JBossRuntimeListFieldEditor_ActionEdit=&Edit
JBossRuntimeListFieldEditor_ActionRemove=&Remove
@@ -18,24 +13,16 @@
JBossWS_Runtime_List_Field_Editor_Name=Name
JBossWS_Runtime_List_Field_Editor_Version=Version
JBossWS_Runtime_List_Field_Editor_Path=Path
-JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List=inputElement must be an instance of List<JBossWSRuntime>.
JBossWS_Runtime_Delete_Confirm_Title=Confirm Runtime Delete
JBossWS_Runtime_Delete_Used_Confirm=Runtime ''{0}'' is used by JBossWS projects. Are you sure you want to delete it?
JBossWS_Runtime_Delete_Not_Used_Confirm=Are you sure you want to delete runtime ''{0}''?
JBossWS_Runtime_List_Field_Editor_Edit_Runtime=Edit JBossWS Runtime
JBossWS_Runtime_List_Field_Editor_Modify_Runtime=Input new values
JBossWS_Runtime_List_Field_Editor_New_Runtime=New JBossWS Runtime
-Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty=Path to JBossWS home directory cannot be empty
JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists=JBossWS Runtime ' already exists
JBossWS_Runtime_List_Field_Editor_Runtime=JBossWS Runtime
-Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct=Runtime name is not correct
-Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty=Name cannot be empty
JBossWS_Runtime_List_Field_Editor_Create_A_Runtime=Create a JBossWS Runtime
JBossWS_Runtime_List_Field_Editor_Home_Folder=Home Folder:
-JBossWS_Composite_Editor_This_Method_Can_Be_Invoked=This metod can be invoked after getEditorControls(parent) only
-JBossWS_Button_Field_Editor_Browse=Browse...
-Error_JBossWS_Button_Field_Editor_Not_Implemented_Yet=Not implemented yet. Please setup real acion for editor.
-JBossWS_SWT_Field_Editor_Factory_Browse=Browse...
JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder=Select JBossWS Home Folder
JBossWS_Runtime_List_Field_Editor_Name2=Name:
JBossWS_Runtime_Check_Field_Default_Classpath=Customize JBoss Web Service runtime jars
@@ -52,15 +39,20 @@
JBossWS_GenerateWizard_WizardPage_CheckButton_Label=Use the default value
JBossWS_GenerateWizard_GenerateSampleClassPage_Package_Label=Package
JBossWS_GenerateWizard_GenerateSampleClassPage_ClassName_Label=Class
-Error_JBossWS_GenerateWizard_NotDynamicWebProject=The project must be a Dynamic Web Project and contain a web.xml in a right Location
-Error_JBossWS_GenerateWizard_ClassName_Same=The class name has been used in the web project.
JBossWS_GenerateWizard_MessageDialog_Title=Error
-Error_JBossWS_GenerateWizard_ServiceName_Empty=The Service Name may not be an empty string.
-Error_JBossWS_GenerateWizard_ClassName_Empty=The Class Name may not be an empty string.
-Error_JBossWS_GenerateWizard_PackageName_Empty=The Package Name may not be an empty string.
-Error_JBossWS_GenerateWizard=Problems encountered while creating the web.xml and Java class entries.
JBossWS_UI_PLUGIN_NO_MESSAGES=No message
JBossWSGenerateWebXmlWizardPage_Project_Group=Dynamic Web Project Name
JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip=If no Dynamic Web Project exists, you must create one before creating your sample web service.
JBossWSGenerateWebXmlWizardPage_Web_Service_Group=Web Service
JBossWSGenerateWizard_NoProjectSelected=No project selected. Please select a Dynamic Web Project to continue.
+
+Error_JBossWS_Label_Runtime_Load=Error occurred while loading JBossWS Command. Select the correct JBoss Server folder.
+Error_JBossWS_Basic_Editor_Composite=Parent control should be Composite
+Error_JBossWS_Basic_Editor_Support=Editor supports only Grid layout
+Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List=inputElement must be an instance of List<JBossWSRuntime>.
+Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty=Path to JBossWS home directory cannot be empty
+Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct=Runtime name is not correct
+Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty=Name cannot be empty
+Error_JBossWS_GenerateWizard_NotDynamicWebProject=The project must be a Dynamic Web Project and contain a web.xml in a right Location
+Error_JBossWS_GenerateWizard_ClassName_Same=The class name has been used in the web project.
+Error_JBossWS_GenerateWizard_ServiceName_Empty=The Service Name may not be an empty string.
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-03-19 07:25:42 UTC (rev 20923)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-03-19 07:29:17 UTC (rev 20924)
@@ -16,67 +16,44 @@
/**
* @author Grid Qian
*/
-public final class JBossWSUIMessages extends NLS {
+public class JBossWSUIMessages extends NLS {
- private static final String BUNDLE_NAME =
- "org.jboss.tools.ws.ui.messages.JBossWSUI"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.jboss.tools.ws.ui.messages.JBossWSUI"; //$NON-NLS-1$
private JBossWSUIMessages() {
// Do not instantiate
}
- public static String Label_JBossWS_Runtime_Load_Error;
-
public static String Bin;
public static String Command;
public static String Client;
public static String Lib;
public static String Endorsed;
- public static String Error_JBossWS_Basic_Editor_Composite;
- public static String Error_JBossWS_Basic_Editor_Support;
- public static String Error_JBossWS_Basic_Editor_Different;
public static String JBossRuntimeListFieldEditor_ActionAdd;
-
public static String JBossRuntimeListFieldEditor_ActionEdit;
-
public static String JBossRuntimeListFieldEditor_ActionRemove;
-
public static String JBossRuntimeListFieldEditor_ErrorMessageAtLeastOneJar;
-
public static String JBossWS_Runtime_List_Field_Editor_Name;
public static String JBossWS_Runtime_List_Field_Editor_Version;
public static String JBossWS_Runtime_List_Field_Editor_Path;
- public static String JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List;
public static String JBossWS_Runtime_Delete_Confirm_Title;
public static String JBossWS_Runtime_Delete_Used_Confirm;
public static String JBossWS_Runtime_Delete_Not_Used_Confirm;
public static String JBossWS_Runtime_List_Field_Editor_Edit_Runtime;
public static String JBossWS_Runtime_List_Field_Editor_Modify_Runtime;
public static String JBossWS_Runtime_List_Field_Editor_New_Runtime;
- public static String Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty;
public static String JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists;
public static String JBossWS_Runtime_List_Field_Editor_Runtime;
- public static String Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct;
- public static String Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty;
public static String JBossWS_Runtime_List_Field_Editor_Create_A_Runtime;
public static String JBossWS_Runtime_List_Field_Editor_Home_Folder;
- public static String JBossWS_Composite_Editor_This_Method_Can_Be_Invoked;
- public static String JBossWS_Button_Field_Editor_Browse;
- public static String Error_JBossWS_Button_Field_Editor_Not_Implemented_Yet;
- public static String JBossWS_SWT_Field_Editor_Factory_Browse;
public static String JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder;
public static String JBossWS_Runtime_List_Field_Editor_Name2;
public static String JBossWS_Runtime_Check_Field_Default_Classpath;
public static String JBossWS_Preference_Page_Runtimes;
-
-
public static String JBossWSLibraryListFieldEditor_ActionAdd;
-
public static String JBossWSLibraryListFieldEditor_ActionRemove;
-
public static String JBossWSLibraryListFieldEditor_LIBRARY_JARS;
-
public static String JBossWS_GenerateWizard_Title;
public static String JBossWS_GenerateWizard_GenerateWebXmlPage_Title;
public static String JBossWS_GenerateWizard_GenerateWebXmlPage_Description;
@@ -86,23 +63,25 @@
public static String JBossWS_GenerateWizard_WizardPage_CheckButton_Label;
public static String JBossWS_GenerateWizard_GenerateSampleClassPage_Package_Label;
public static String JBossWS_GenerateWizard_GenerateSampleClassPage_ClassName_Label;
- public static String Error_JBossWS_GenerateWizard_NotDynamicWebProject;
- public static String Error_JBossWS_GenerateWizard_ClassName_Same;
public static String JBossWS_GenerateWizard_MessageDialog_Title;
- public static String Error_JBossWS_GenerateWizard_ServiceName_Empty;
- public static String Error_JBossWS_GenerateWizard_ClassName_Empty;
- public static String Error_JBossWS_GenerateWizard_PackageName_Empty;
-
public static String JBossWS_UI_PLUGIN_NO_MESSAGES;
-
public static String JBossWSGenerateWebXmlWizardPage_Project_Group;
-
public static String JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip;
-
public static String JBossWSGenerateWebXmlWizardPage_Web_Service_Group;
-
public static String JBossWSGenerateWizard_NoProjectSelected;
-
+
+ public static String Error_JBossWS_Label_Runtime_Load;
+ public static String Error_JBossWS_Basic_Editor_Composite;
+ public static String Error_JBossWS_Basic_Editor_Support;
+ public static String Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty;
+ public static String Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct;
+ public static String Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty;
+ public static String Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List;
+ public static String Error_JBossWS_GenerateWizard_NotDynamicWebProject;
+ public static String Error_JBossWS_GenerateWizard_ClassName_Same;
+ public static String Error_JBossWS_GenerateWizard_ServiceName_Empty;
+
+
static {
NLS.initializeMessages(BUNDLE_NAME, JBossWSUIMessages.class);
}
14 years, 7 months
JBoss Tools SVN: r20923 - in trunk/ws: plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-03-19 03:25:42 -0400 (Fri, 19 Mar 2010)
New Revision: 20923
Removed:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboBoxField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ITaggedFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
trunk/ws/tests/org.jboss.tools.ws.ui.test/META-INF/MANIFEST.MF
Log:
JBIDE-6034: remove the ws preference page editor codes and reuse them from common.ui
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-03-19 07:25:42 UTC (rev 20923)
@@ -16,7 +16,8 @@
org.eclipse.jem.util,
org.jboss.tools.ws.creation.core,
org.eclipse.wst.common.frameworks,
- org.eclipse.wst.common.emfworkbench.integration
+ org.eclipse.wst.common.emfworkbench.integration,
+ org.jboss.tools.common.ui
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.ws.ui,
org.jboss.tools.ws.ui.messages,
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Grid Qian
- */
-public abstract class BaseField {
-
- public static final String PROPERTY_NAME = "value"; //$NON-NLS-1$
-
- private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- pcs.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- pcs.removePropertyChangeListener(listener);
- }
-
- public void firePropertyChange(Object oldValue, Object newValue) {
- pcs.firePropertyChange(PROPERTY_NAME, oldValue, newValue);
- }
-
- abstract public Control getControl();
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-
-/**
- * @author Grid Qian
- */
-public abstract class BaseFieldEditor implements IFieldEditor {
-
- PropertyChangeSupport pcs = new PropertyChangeSupport(this);
-
- Set<DisposeListener> disposeListeners = new HashSet<DisposeListener>();
-
- private Object value = new Object();
-
- private String labelText;
-
- private String nameText = null;
-
- Label labelControl = null;
-
- protected Map<Object, Object> data = null;
-
- private boolean enabled = true;
-
- /**
- *
- * @param name
- * @param label
- * @param defaultValue
- */
- public BaseFieldEditor(String name, String label,Object defaultValue) {
- this.value = defaultValue;
- this.labelText = label;
- this.nameText = name;
- }
-
- /**
- *
- * @param parent
- */
- public void doFillIntoGrid(Object parent) {
- Assert.isTrue(parent instanceof Composite, JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
- Assert.isTrue(((Composite)parent).getLayout() instanceof GridLayout,JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
- Composite aComposite = (Composite) parent;
- final Control[] controls = (Control[])getEditorControls(aComposite);
- GridLayout gl = (GridLayout)((Composite)parent).getLayout();
-
- doFillIntoGrid(aComposite,gl.numColumns);
- if(controls.length>0) {
- controls[0].addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- controls[0].removeDisposeListener(this);
- }
- });
- }
- }
-
- /**
- * @param composite
- * @param numColumns
- */
- protected void doFillIntoGrid(Composite composite, int numColumns) {
-
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- pcs.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- pcs.removePropertyChangeListener(listener);
- }
-
- /**
- *
- * @param parent
- * @return
- */
- public Label createLabelControl(Composite parent) {
- if(labelControl==null) {
- labelControl = new Label(parent,SWT.NO_BACKGROUND);
- labelControl.setText(this.labelText);
- } else if(parent!=null) {
- if(labelControl.getParent()!=parent)
- throw new IllegalArgumentException(JBossWSUIMessages.Error_JBossWS_Basic_Editor_Different);
- }
- return labelControl;
- }
-
- public Label getLabelControl() {
- return createLabelControl(null);
- }
-
- public abstract Object[] getEditorControls(Object composite);
-
- public abstract Object[] getEditorControls();
-
- public Control[] getSwtControls() {
- return (Control[])getEditorControls();
- }
-
- public abstract int getNumberOfControls();
-
- public Object getValue() {
- return value;
- }
-
- public String getValueAsString() {
- return getValue().toString();
- }
-
- public boolean isEnabled() {
- return this.enabled ;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- Control[] controls = getSwtControls();
- if(controls==null) {
- return;
- }
- for(int i=0;i<controls.length;i++) {
- Control control = controls[i];
- control.setEnabled(enabled);
- if(control instanceof Composite) {
- setEnabled((Composite)control, enabled);
- }
- }
- }
-
- private void setEnabled(Composite composite, boolean enabled) {
- Control[] controls = composite.getChildren();
- for(int i=0;i<controls.length;i++) {
- Control control = controls[i];
- control.setEnabled(enabled);
- if(control instanceof Composite) {
- setEnabled((Composite)control, enabled);
- }
- }
- }
-
- public boolean setFocus() {
- return true;
- }
-
- /**
- *
- * @param newValue
- */
- public void setValue(Object newValue) {
- Object oldValue = value;
- value = newValue;
- pcs.firePropertyChange(nameText,oldValue,newValue);
- }
-
- public void setValueAsString(String stringValue) {
- value = stringValue;
- }
-
- public String getName() {
- return nameText;
- }
-
- public void dispose() {
- PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners();
- for (int i = 0; i < listeners.length; i++) {
- PropertyChangeListener propertyChangeListener = listeners[i];
- pcs.removePropertyChangeListener(propertyChangeListener);
- }
- }
-
- public void dispose(DisposeEvent e) {
- dispose();
- for (DisposeListener disposeListener : disposeListeners) {
- disposeListener.widgetDisposed(e);
- }
- disposeListeners.clear();
- }
-
- public void addDisposeListener(DisposeListener listener) {
- disposeListeners.add(listener);
- }
-
- public void removeDisposeListener(DisposeListener listener) {
- disposeListeners.remove(listener);
- }
-
- public String getLabelText() {
- return labelText;
- }
-
- /**
- *
- * @param labelText
- */
- public void setLabelText(String labelText) {
- this.labelText = labelText;
- }
-
- private boolean editable = true;
-
- public boolean isEditable() {
- return editable;
- }
-
- public void setEditable(boolean aEditable) {
- this.editable = aEditable;
- }
-
- public Object getData(Object key) {
- if(data==null) {
- return null;
- }
- return data.get(key);
- }
-
- public void setData(Object key, Object value) {
- if(data==null) {
- data = new HashMap<Object, Object>();
- }
- data.put(key, value);
- }
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-
-/**
- * @author Grid Qian
- */
-public class ButtonFieldEditor extends BaseFieldEditor {
-
- PushButtonField button= null;
- int style;
-
- private ButtonPressedAction buttonAction = new ButtonPressedAction(JBossWSUIMessages.JBossWS_Button_Field_Editor_Browse) {
- @Override
- public void run() {
- throw new RuntimeException(JBossWSUIMessages.Error_JBossWS_Button_Field_Editor_Not_Implemented_Yet);
- }
- };
-
- public ButtonFieldEditor(String name, String label, int style) {
- super(name, label, new Object());
- this.style = style;
- }
-
- public ButtonFieldEditor(String name, ButtonPressedAction action, Object defaultValue) {
- super(name, action.getText(), defaultValue);
- buttonAction = action;
- buttonAction.setFieldEditor(this);
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- }
-
- @Override
- public Object[] getEditorControls() {
- if(button==null) {
- return null;
- }
- return new Control[]{button.getControl()};
- }
-
- @Override
- public boolean isEditable() {
- return false;
- }
-
- public void save(Object object) {
- }
-
- @Override
- public void setEditable(boolean ediatble) {
- }
-
- @Override
- public Object[] getEditorControls(Object composite) {
- if(button==null && composite!=null) {
- button = new PushButtonField((Composite)composite, style, buttonAction);
- setEnabled(isEnabled());
- }
- return new Control[]{button.getControl()};
- }
-
- public ButtonPressedAction getButtonaction() {
- return buttonAction;
- }
-
- public static class ButtonPressedAction extends Action implements SelectionListener{
-
- private IFieldEditor editor = null;
-
- public ButtonPressedAction(String label) {
- super(label);
- }
-
- public void setFieldEditor(IFieldEditor newEditor) {
- editor = newEditor;
- }
-
- public IFieldEditor getFieldEditor() {
- return editor;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- run();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboBoxField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboBoxField.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboBoxField.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Grid.Qian
- *
- */
-public class ComboBoxField extends BaseField implements ISelectionChangedListener {
-
- ComboViewer comboControl = null;
- List<String> values = new ArrayList<String>();
-
- public ComboBoxField(Composite parent,List<String> values, ILabelProvider labelProvider,
- Object value, boolean flatStyle) {
- this(parent, values, value, flatStyle);
- comboControl.setLabelProvider(labelProvider);
- }
-
- public ComboBoxField(Composite parent,List<String> values, Object value, boolean editable) {
- this.values = values;
- /*
- * Used combo box instead of custom combobox(CCombo),
- * CCombo looks ugly under MAC OS X
- */
- Combo combo;
- if(editable==true) {
-
- combo = new Combo(parent, SWT.DROP_DOWN);
- } else {
- combo = new Combo(parent, SWT.READ_ONLY);
- }
- combo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- comboControl = new ComboViewer(combo);
- comboControl.setContentProvider(new IStructuredContentProvider() {
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- }
-
- public Object[] getElements(Object inputElement) {
- return ComboBoxField.this.values.toArray();
- }
- });
-
- comboControl.addSelectionChangedListener(this);
- comboControl.getCombo().addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- firePropertyChange(new Object(), comboControl.getCombo().getText());
- }});
- comboControl.setLabelProvider(new ILabelProvider() {
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return element.toString();
- }
- });
- comboControl.setInput(values);
- comboControl.setSelection(new StructuredSelection(value), true);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- firePropertyChange("", ((StructuredSelection)event.getSelection()).getFirstElement()); //$NON-NLS-1$
- }
-
- public Combo getComboControl() {
- return comboControl.getCombo();
- }
-
- @Override
- public Control getControl() {
- return getComboControl();
- }
-
- public void setValue(Object newValue) {
- comboControl.setSelection(new StructuredSelection(newValue));
- comboControl.getCombo().setText(newValue.toString());
- }
-
- public void setTags(String[] tags,String value) {
- values = Arrays.asList(tags);
- comboControl.removeSelectionChangedListener(this);
- comboControl.refresh(true);
- comboControl.addPostSelectionChangedListener(this);
- comboControl.setSelection(new StructuredSelection(value));
- }
- /*
- * We can't modify combo, change style of this object,
- * if we such functionality please use CCombo
- *
- */
- public void setEditable(
- boolean ediatble) {
- //comboControl.getCCombo().setEditable(false);
- }
-}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ComboFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Grid Qian
- */
-public class ComboFieldEditor extends BaseFieldEditor implements ITaggedFieldEditor,PropertyChangeListener{
-
- List<String> values = null;
-
- boolean editable = false;
-
- public ComboFieldEditor(String name, String label, List<String> values,Object defaultValue,boolean editableSelection) {
- super(name, label, defaultValue);
- this.values = Collections.unmodifiableList(values);
- this.editable = editableSelection;
- }
-
- private ComboBoxField comboField;
-
- @Override
- public Object[] getEditorControls(Object composite) {
- return new Control[] {getComboControl((Composite)composite)};
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- }
-
- public Control getComboControl(Composite composite) {
- if(comboField == null) {
- comboField = new ComboBoxField(composite,values,getValue(),editable);
- comboField.addPropertyChangeListener(this);
- final Combo combo =comboField.getComboControl();
- combo.addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- dispose(e);
- combo.removeDisposeListener(this);
- }
- });
- } else if(composite!=null) {
- Assert.isTrue(comboField.getControl().getParent()==composite);
- }
- return comboField.getControl();
- }
-
- @Override
- public Object[] getEditorControls() {
- return new Control[]{comboField.getControl()};
- }
-
- public void save(Object object) {
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- setValue(evt.getNewValue());
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#getTags()
- */
- public String[] getTags() {
- return comboField.getComboControl().getItems();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
- */
- public void setTags(String[] tags) {
- comboField.setTags(tags,getValueAsString());
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
- */
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.CompositeEditor#setEditable(boolean)
- */
- @Override
- public void setEditable(boolean ediatble) {
- super.setEditable(ediatble);
- comboField.setEditable(ediatble);
- }
-
- public void setValue(Object newValue) {
- if(newValue==null) {
- return;
- }
- super.setValue(newValue);
- if(comboField!=null) {
- comboField.removePropertyChangeListener(this);
- comboField.setValue(newValue.toString());
- comboField.addPropertyChangeListener(this);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-
-/**
- * @author Grid Qian
- */
-public class CompositeEditor extends BaseFieldEditor implements PropertyChangeListener {
-
- public CompositeEditor(String name, String label, Object defaultValue) {
- super(name, label, defaultValue);
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- Assert.isTrue(parent instanceof Composite,
- JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
- Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
- JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
-
- Composite aComposite = (Composite) parent;
- final Control[] controls = (Control[]) getEditorControls(aComposite);
- GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
-
- for (int i = 0; i < controls.length; i++) {
- GridData gd = new GridData();
- gd.horizontalSpan = i == 1 ? gl.numColumns - controls.length + 1 : 1;
- if (controls[i] instanceof Combo && i == (controls.length - 1)) {
- gd.horizontalAlignment = SWT.BEGINNING;
- } else {
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = (i == 1);
- }
-
- controls[i].setLayoutData(gd);
- controls[i].setEnabled(isEnabled());
-
- if(i==0) {
- controls[i].addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- controls[0].removeDisposeListener(this);
- }
- });
- }
- }
- }
-
- List<Control> controls = new ArrayList<Control>();
-
- @Override
- public Object[] getEditorControls() {
- if(controls.size()>0) return controls.toArray();
- else throw new IllegalStateException(JBossWSUIMessages.JBossWS_Composite_Editor_This_Method_Can_Be_Invoked);
- }
-
- @Override
- public Object[] getEditorControls(Object parent) {
- for (IFieldEditor editor : editors) {
- controls.addAll(Arrays.asList((Control[])editor.getEditorControls(parent)));
- }
- return controls.toArray(new Control[]{});
- }
-
- @Override
- public int getNumberOfControls() {
- return editors.size();
- }
-
- @Override
- public boolean isEditable() {
- return true;
- }
-
- public void save(Object object) {
- }
-
- @Override
- public void setEditable(boolean ediatble) {
- }
-
- List<IFieldEditor> editors = new ArrayList<IFieldEditor>();
-
- public CompositeEditor addFieldEditors(IFieldEditor[] editors) {
- this.editors.addAll( Arrays.asList(editors));
- for (IFieldEditor editor : Arrays.asList(editors)) {
- editor.addPropertyChangeListener(this);
- }
- return this;
- }
-
- @Override
- public void setValue(Object newValue) {
- for (IFieldEditor editor : editors) {
- editor.removePropertyChangeListener(this);
- editor.setValue(newValue);
- editor.addPropertyChangeListener(this);
- }
- super.setValue(newValue);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- for (IFieldEditor editor : editors) {
- if(event.getSource()!=editor) {
- editor.removePropertyChangeListener(this);
- editor.setValue(event.getNewValue());
- editor.addPropertyChangeListener(this);
- }
- }
- super.setValue(event.getNewValue());
- }
-
- @Override
- public void setEnabled(boolean set) {
- for (IFieldEditor editor : editors) {
- editor.setEnabled(set);
- }
- }
-
- public List<IFieldEditor> getEditors() {
- return Collections.unmodifiableList(editors);
- }
-
- public IFieldEditor getEditorByName(String name) {
- for (IFieldEditor editor : editors) {
- if(name.equals(editor.getName())) {
- return editor;
- }
- }
- return null;
- }
-
- public void setData(Object key, Object value) {
- super.setData(key, value);
- for (IFieldEditor editor : editors) {
- editor.setData(key, value);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-
-/**
- * @author Grid Qian
- */
-public interface IFieldEditor extends INamedElement {
-
- /**
- *
- * @param composite
- */
- public Object[] getEditorControls(Object composite);
-
- public Object[] getEditorControls();
-
- public int getNumberOfControls();
-
- /**
- *
- * @param parent
- */
- public void doFillIntoGrid(Object parent);
-
- /**
- *
- * @param listener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener);
-
- /**
- *
- * @param listener
- */
- public void addDisposeListener(DisposeListener listener);
-
- /**
- *
- * @param listener
- */
- public void removeDisposeListener(DisposeListener listener);
-
- /**
- *
- * @param listener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener);
-
- public boolean isEditable();
-
- /**
- *
- * @param aEdiatble
- */
- public void setEditable(boolean aEdiatble);
-
- public boolean setFocus();
-
- public boolean isEnabled();
-
- /**
- *
- * @param enabled
- */
- public void setEnabled(boolean enabled);
-
- public void dispose();
-
- /**
- *
- * @param e
- */
- public void dispose(DisposeEvent e);
-
- /**
- * Sets the application defined property of this editor
- *
- * @param data
- * @param key
- */
- public void setData(Object key, Object data);
-
- /**
- * Gets the application defined property of this editor
- *
- * @param key
- * @return
- */
- public Object getData(Object key);
-
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-/**
- * @author Grid Qian
- */
-public interface INamedElement {
-
- public abstract String getName();
-
- public abstract Object getValue();
-
- public abstract void setValue(Object newValue);
-
- public abstract String getValueAsString();
-
- public abstract void setValueAsString(String aValue);
-
-}
\ No newline at end of file
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ITaggedFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ITaggedFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ITaggedFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.preferences;
-
-public interface ITaggedFieldEditor extends IFieldEditor {
-
- /**
- *
- * @return
- */
- public String[] getTags();
-
- /**
- *
- * @param tags
- */
- public void setTags(String[] tags);
-}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossRuntimeListFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -58,6 +58,10 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
import org.jboss.tools.ws.ui.utils.UIUtils;
import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
@@ -220,7 +224,7 @@
return ((List<JBossWSRuntime>) inputElement).toArray();
} else {
throw new IllegalArgumentException(
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
+ JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
}
}
@@ -340,7 +344,6 @@
List<JBossWSRuntime> runtimes = (List<JBossWSRuntime>) getValue();
boolean checked = false;
for (JBossWSRuntime jbossWSRuntime : runtimes) {
-
if (checkedElement == jbossWSRuntime) {
checked = true;
tableView.setChecked(checkedElement, true);
@@ -417,13 +420,13 @@
List<JBossWSRuntime> value = null;
- IFieldEditor name = createTextEditor(SRT_NAME,
+ IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(SRT_NAME,
JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name2, ""); //$NON-NLS-1$
- IFieldEditor version = createComboEditor(SRT_VERSION,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,getESBFacetVersions(), ""); //$NON-NLS-1$
+ IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(SRT_VERSION,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,getWSFacetVersions(), ""); //$NON-NLS-1$
- IFieldEditor homeDir = createBrowseFolderEditor(
+ IFieldEditor homeDir = IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
SRT_HOMEDIR,
JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,
""); //$NON-NLS-1$
@@ -547,7 +550,7 @@
}
if (!runtimeExist(homeDir.getValueAsString())) {
- setErrorMessage(JBossWSUIMessages.Label_JBossWS_Runtime_Load_Error);
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_Label_Runtime_Load);
setPageComplete(false);
return;
}
@@ -570,10 +573,10 @@
/*
* get facet version.
*/
- private List<String> getESBFacetVersions(){
+ private List<String> getWSFacetVersions(){
List<String> versions = new ArrayList<String>();
- IProjectFacet esbfacet = ProjectFacetsManager.getProjectFacet("jbossws.core"); //$NON-NLS-1$
- for(IProjectFacetVersion version: esbfacet.getVersions()){
+ IProjectFacet wsFacet = ProjectFacetsManager.getProjectFacet("jbossws.core"); //$NON-NLS-1$
+ for(IProjectFacetVersion version: wsFacet.getVersions()){
versions.add(version.getVersionString());
}
@@ -596,41 +599,6 @@
return newRt;
}
- public IFieldEditor createTextEditor(String name, String label,
- String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name, label,
- defaultValue);
- editor.addFieldEditors(new IFieldEditor[] {
- new LabelFieldEditor(name, label),
- new TextFieldEditor(name, label, defaultValue) });
- return editor;
- }
-
- public IFieldEditor createBrowseFolderEditor(String name, String label,
- String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name, label,
- defaultValue);
- editor
- .addFieldEditors(new IFieldEditor[] {
- new LabelFieldEditor(name, label),
- new TextFieldEditor(name, label, defaultValue),
- new ButtonFieldEditor(
- name,
- createSelectFolderAction(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Browse),
- defaultValue) });
- return editor;
- }
-
- public IFieldEditor createComboEditor(String name, String label,
- List<String> values, String defaultValue) {
- CompositeEditor editor = new CompositeEditor(name, label,
- defaultValue);
- editor.addFieldEditors(new IFieldEditor[] {
- new LabelFieldEditor(name, label),
- new ComboFieldEditor(name, label, values, defaultValue, false) });
- return editor;
- }
-
public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(
String buttonName) {
return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSLibraryListFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -48,6 +48,7 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
+import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
import org.jboss.tools.ws.ui.JBossWSUIPlugin;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
@@ -137,7 +138,7 @@
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
- jarGroup.setVisible(false);
+ jarGroup.setVisible(tempJbws.isUserConfigClasspath());
jarGroup.setLayoutData(gd);
jarGroup.setLayout(new FormLayout());
@@ -206,7 +207,7 @@
.toArray();
} else {
throw new IllegalArgumentException(
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
+ JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List);
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -45,8 +45,6 @@
/**
* Create contents of JBossWS preferences page. JBossWSRuntime list editor
* is created
- *
- * @return Control
*/
@Override
protected Control createContents(Composite parent) {
@@ -60,10 +58,6 @@
/**
* Inherited from IWorkbenchPreferencePage
- *
- * @param workbench
- * {@link IWorkbench}
- *
*/
public void init(IWorkbench workbench) {
}
@@ -83,15 +77,17 @@
jbossWSRuntimes.getRemoved().clear();
JBossWSRuntime defaultRuntime = jbossWSRuntimes
.getDefaultJBossWSRuntime();
+
// reset default runtime
for (JBossWSRuntime jbossWSRuntime : JBossWSRuntimeManager
.getInstance().getRuntimes()) {
jbossWSRuntime.setDefault(false);
}
- // set deafult runtime
+ // set default runtime
if (defaultRuntime != null) {
defaultRuntime.setDefault(true);
}
+
jbossWSRuntimes.setDefaultJBossWSRuntime(null);
Map<JBossWSRuntime, JBossWSRuntime> changed = jbossWSRuntimes
.getChangedJBossWSRuntimes();
@@ -126,8 +122,6 @@
/**
* See {@link PreferencePage} for details
- *
- * @return Boolean
*/
@Override
public boolean performOk() {
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Grid Qian
- */
-public class LabelFieldEditor extends BaseFieldEditor {
-
- public LabelFieldEditor(String name, String label) {
- super(name, label, ""); //$NON-NLS-1$
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Object[] getEditorControls(Object composite) {
- // TODO Auto-generated method stub
- return new Control[]{createLabelControl((Composite)composite)};
- }
-
- @Override
- public Object[] getEditorControls() {
- return getEditorControls(null);
- }
-
- @Override
- public boolean isEditable() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void save(Object object) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setEditable(boolean ediatble) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setValue(Object value) {
- }
-
- @Override
- public int getNumberOfControls() {
- // TODO Auto-generated method stub
- return 1;
- }
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.ws.ui.preferences.ButtonFieldEditor.ButtonPressedAction;
-
-/**
- * @author Grid Qian
- *
- */
-public class PushButtonField extends BaseField {
-
- Button button;
-
- /**
- *
- */
- @Override
- public Control getControl() {
- return button;
- }
-
-
- public PushButtonField(Composite composite, int style, ButtonPressedAction listener) {
- button = new Button(composite, style);
- button.setText(listener.getText());
- button.addSelectionListener(listener);
- }
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Grid Qian
- */
-public class TextField extends BaseField implements ModifyListener{
-
-
- Text textField = null;
-
- public TextField(Composite parent, int style) {
- textField = new Text(parent,style);
- textField.addModifyListener(this);
- }
-
- public void modifyText(ModifyEvent e) {
- firePropertyChange(new Object(),((Text)e.widget).getText().trim());
- }
-
- public Text getTextControl() {
- return textField;
- }
-
- public Control getControl() {
- return getTextControl();
- }
-}
Deleted: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java 2010-03-19 07:25:42 UTC (rev 20923)
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.ws.ui.preferences;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collection;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-
-/**
- *
- * @author Grid Qian
- *
- */
-public class TextFieldEditor extends BaseFieldEditor implements PropertyChangeListener{
-
- public static final int UNLIMITED = -1;
-
- protected int style = -1;
-
- /**
- *
- * @param name
- * @param aLabelText
- * @param defaultvalue
- */
- public TextFieldEditor(String name,String aLabelText,String defaultvalue) {
- super(name, aLabelText, defaultvalue);
- }
-
- /**
- *
- * @param name
- * @param aLabelText
- * @param defaultvalue
- * @param editable
- */
- public TextFieldEditor(String name,String aLabelText,String defaultvalue,boolean editable) {
- super(name, aLabelText, defaultvalue);
- setEditable(editable);
- }
-
- protected TextField fTextField = null;
-
- protected int fWidthInChars = 0;
-
- @Override
- public Object[] getEditorControls() {
- return new Control[] {getTextControl()};
- }
-
- @Override
- public void doFillIntoGrid(Object aParent) {
- Assert.isTrue(aParent instanceof Composite, JBossWSUIMessages.Error_JBossWS_Basic_Editor_Composite);
- Assert.isTrue(((Composite)aParent).getLayout() instanceof GridLayout,JBossWSUIMessages.Error_JBossWS_Basic_Editor_Support);
- Composite aComposite = (Composite) aParent;
- getEditorControls(aComposite);
- GridLayout gl = (GridLayout)((Composite)aParent).getLayout();
- getTextControl(aComposite);
-
- GridData gd = new GridData();
-
- gd.horizontalSpan = gl.numColumns - 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
-
- fTextField.getTextControl().setLayoutData(gd);
- }
-
- /**
- *
- * @param parent
- * @return
- */
- public Text getTextControl(Composite parent) {
- if (fTextField == null) {
- fTextField = new TextField(parent, getInitialStyle());
- Text textField = fTextField.getTextControl();
- textField.setFont(parent.getFont());
- textField.setText(getValue().toString());
- textField.setEditable(isEditable());
- textField.setEnabled(isEnabled());
- fTextField.addPropertyChangeListener(this);
- } else if (parent!=null){
- Assert.isTrue(parent==fTextField.getTextControl().getParent());
- }
- return fTextField.getTextControl();
- }
-
- protected void updateWidgetValues() {
- setValueAsString(getValueAsString());
- }
-
- protected int getInitialStyle() {
- if(this.style >= 0) return style;
- return SWT.SINGLE | SWT.BORDER;
- }
-
- /*
- * @param value
- * @return
- */
- @SuppressWarnings({ "unchecked", "unused" })
- private String checkCollection(Object value){
-
- return value != null && (((Collection)value).size() > 0) ? prepareCollectionToString((Collection)value) : ""; //$NON-NLS-1$
- }
-
- /*
- * @param collection
- * @return
- */
- @SuppressWarnings("unchecked")
- private String prepareCollectionToString(Collection collection)
- {
- String stringValue = ""; //$NON-NLS-1$
- Object[] objects = collection.toArray();
- for(int i = 0; i < objects.length; i++){
- stringValue += objects[i];
- if(i < objects.length - 1)
- stringValue += " "; //$NON-NLS-1$
- }
- return stringValue;
- }
-
-
- /*
- * @param value
- * @return
- */
- @SuppressWarnings("unused")
- private String checkSimple(Object value){
- return (value != null) ? value.toString() : ""; //$NON-NLS-1$
- }
-
- @Override
- public int getNumberOfControls() {
- return 2;
- }
-
- /**
- * Returns this field editor's text control.
- *
- * @return the text control, or <code>null</code> if no
- * text field is created yet
- */
- protected Text getTextControl() {
- return fTextField!=null?fTextField.getTextControl():null;
- }
-
- @Override
- public boolean setFocus() {
- boolean setfocus = false;
- if(fTextField!=null && !fTextField.getTextControl().isDisposed())
- setfocus = fTextField.getTextControl().setFocus();
- return setfocus;
- }
-
- @Override
- public Object[] getEditorControls(Object composite) {
- return new Control[]{getTextControl((Composite)composite)};
- }
-
- /**
- *
- * @param object
- */
- public void save(Object object) {
- }
-
- /**
- *
- */
- @Override
- public void setValue(Object newValue) {
- super.setValue(newValue);
- if(fTextField!=null){
- fTextField.removePropertyChangeListener(this);
- fTextField.getTextControl().setText(newValue.toString());
- fTextField.addPropertyChangeListener(this);
- }
- }
-
- @Override
- public void setEditable(boolean aEditable) {
- super.setEditable(aEditable);
- if(getTextControl()!=null) getTextControl().setEditable(aEditable);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- super.setValue(evt.getNewValue());
- }
-}
\ No newline at end of file
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.test/META-INF/MANIFEST.MF 2010-03-19 07:22:31 UTC (rev 20922)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.test/META-INF/MANIFEST.MF 2010-03-19 07:25:42 UTC (rev 20923)
@@ -9,7 +9,8 @@
org.junit,
org.jboss.tools.tests,
org.jboss.tools.ws.ui,
- org.jboss.tools.ws.core
+ org.jboss.tools.ws.core,
+ org.jboss.tools.common.ui
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
14 years, 7 months
JBoss Tools SVN: r20922 - trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-03-19 03:22:31 -0400 (Fri, 19 Mar 2010)
New Revision: 20922
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
Log:
JBIDE-5990: to trunk
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-03-19 06:31:25 UTC (rev 20921)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/AbstractGenerateCodeCommand.java 2010-03-19 07:22:31 UTC (rev 20922)
@@ -136,9 +136,7 @@
.warningStatus(
JBossWSCreationCoreMessages.Error_Message_Failed_To_Generate_Code,
new CoreException(errorStatus));
- } else {
- JBossWSCreationCore.getDefault().logInfo(resultInput);
- }
+ }
}
} catch (InterruptedException e) {
14 years, 7 months
JBoss Tools SVN: r20921 - branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-03-19 02:31:25 -0400 (Fri, 19 Mar 2010)
New Revision: 20921
Added:
branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Feedback.xml
Modified:
branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Update.xml
Log:
updated
Added: branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Feedback.xml
===================================================================
--- branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Feedback.xml (rev 0)
+++ branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Feedback.xml 2010-03-19 06:31:25 UTC (rev 20921)
@@ -0,0 +1,20 @@
+<?xml version='1.0' encoding='utf-8' ?>
+
+<section id="sect-Beginners_Guide-We_Need_Feedback" lang="en-US">
+ <title>We Need Feedback!</title>
+ <indexterm>
+ <primary>feedback</primary>
+ <secondary>contact information for this manual</secondary>
+ </indexterm>
+ <para>
+ If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in JIRA against JBoss Developer Studio: <ulink url="https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=12310500&issu...">https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=12310500&issu...</ulink>
+ </para>
+ <para>
+ When submitting a bug report, be sure to mention the manual's name and to select the "documentation" component.
+ </para>
+ <para>
+ If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.
+ </para>
+</section>
+
+
Modified: branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Update.xml
===================================================================
--- branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Update.xml 2010-03-19 06:30:54 UTC (rev 20920)
+++ branches/jbosstools-3.1.x/documentation/guides/Update_Guide/en-US/Update.xml 2010-03-19 06:31:25 UTC (rev 20921)
@@ -58,8 +58,20 @@
</listitem>
<listitem>
<para>
- Enter the <acronym>url</acronym> of the update site (<ulink url="https://devstudio.jboss.com/updates/3.0/">https://devstudio.jboss.com/updates/3.0/</ulink>) in the <guilabel>Location</guilabel> field.
- </para>
+ Enter the <acronym>url</acronym> of the update site in the <guilabel>Location</guilabel> field. The user has the option of the following two options:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ https://devstudio.jboss.com/updates/3.0/
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ http://devstudio.jboss.com/updates/3.0/
+ </para>
+ </listitem>
+ </itemizedlist>
<figure id="figure-Add-Site_01">
<title>Add Site Dialog</title>
<mediaobject>
@@ -71,11 +83,11 @@
</textobject>
</mediaobject>
</figure>
- <note><title>Note: Update site information</title>
+ <warning><title>Use the secure site where possible</title>
<para>
- Information pertaining to the update site can be obtained by entering the url in a browser.
- </para>
- </note>
+ The unsecure site, http://devstudio.jboss.com/updates/3.0/, should only be used if the user is experiencing proxy problems or the user's firewall restricts access to https sites. The password will be sent in plain text if the http site is used.
+ </para>
+ </warning>
</listitem>
</orderedlist>
14 years, 7 months
JBoss Tools SVN: r20920 - trunk/documentation/guides/Update_Guide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-03-19 02:30:54 -0400 (Fri, 19 Mar 2010)
New Revision: 20920
Added:
trunk/documentation/guides/Update_Guide/en-US/Feedback.xml
Modified:
trunk/documentation/guides/Update_Guide/en-US/Update.xml
Log:
updated
Added: trunk/documentation/guides/Update_Guide/en-US/Feedback.xml
===================================================================
--- trunk/documentation/guides/Update_Guide/en-US/Feedback.xml (rev 0)
+++ trunk/documentation/guides/Update_Guide/en-US/Feedback.xml 2010-03-19 06:30:54 UTC (rev 20920)
@@ -0,0 +1,20 @@
+<?xml version='1.0' encoding='utf-8' ?>
+
+<section id="sect-Beginners_Guide-We_Need_Feedback" lang="en-US">
+ <title>We Need Feedback!</title>
+ <indexterm>
+ <primary>feedback</primary>
+ <secondary>contact information for this manual</secondary>
+ </indexterm>
+ <para>
+ If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in JIRA against JBoss Developer Studio: <ulink url="https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=12310500&issu...">https://jira.jboss.org/jira/secure/CreateIssue.jspa?pid=12310500&issu...</ulink>
+ </para>
+ <para>
+ When submitting a bug report, be sure to mention the manual's name and to select the "documentation" component.
+ </para>
+ <para>
+ If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.
+ </para>
+</section>
+
+
Modified: trunk/documentation/guides/Update_Guide/en-US/Update.xml
===================================================================
--- trunk/documentation/guides/Update_Guide/en-US/Update.xml 2010-03-18 20:25:35 UTC (rev 20919)
+++ trunk/documentation/guides/Update_Guide/en-US/Update.xml 2010-03-19 06:30:54 UTC (rev 20920)
@@ -58,8 +58,20 @@
</listitem>
<listitem>
<para>
- Enter the <acronym>url</acronym> of the update site (<ulink url="https://devstudio.jboss.com/updates/3.0/">https://devstudio.jboss.com/updates/3.0/</ulink>) in the <guilabel>Location</guilabel> field.
- </para>
+ Enter the <acronym>url</acronym> of the update site in the <guilabel>Location</guilabel> field. The user has the option of the following two options:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ https://devstudio.jboss.com/updates/3.0/
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ http://devstudio.jboss.com/updates/3.0/
+ </para>
+ </listitem>
+ </itemizedlist>
<figure id="figure-Add-Site_01">
<title>Add Site Dialog</title>
<mediaobject>
@@ -71,11 +83,11 @@
</textobject>
</mediaobject>
</figure>
- <note><title>Note: Update site information</title>
+ <warning><title>Use the secure site where possible</title>
<para>
- Information pertaining to the update site can be obtained by entering the url in a browser.
- </para>
- </note>
+ The unsecure site, http://devstudio.jboss.com/updates/3.0/, should only be used if the user is experiencing proxy problems or the user's firewall restricts access to https sites. The password will be sent in plain text if the http site is used.
+ </para>
+ </warning>
</listitem>
</orderedlist>
14 years, 7 months
JBoss Tools SVN: r20919 - in branches/hibernatetools-multiversion/hibernatetools/tests: org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-03-18 16:25:35 -0400 (Thu, 18 Mar 2010)
New Revision: 20919
Added:
branches/hibernatetools-multiversion/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/
Modified:
branches/hibernatetools-multiversion/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - update
Copied: branches/hibernatetools-multiversion/hibernatetools/tests/org.jboss.tools.hibernate.ui.test (from rev 20855, trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.test)
Modified: branches/hibernatetools-multiversion/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java 2010-03-16 18:50:31 UTC (rev 20855)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java 2010-03-18 20:25:35 UTC (rev 20919)
@@ -15,8 +15,8 @@
import java.util.Iterator;
import java.util.List;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.mapping.RootClass;
import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
import org.jmock.Expectations;
@@ -41,7 +41,7 @@
public void testLoadAndSave() {
final ConsoleConfiguration consoleConfig = context.mock(ConsoleConfiguration.class);
- final Configuration config = context.mock(Configuration.class);
+ final ConfigurationStub config = context.mock(ConfigurationStub.class);
final RootClass ioe = context.mock(RootClass.class);
ArrayList<RootClass> rts = new ArrayList<RootClass>();
rts.add(ioe);
14 years, 7 months
JBoss Tools SVN: r20918 - in branches/hibernatetools-multiversion/hibernatetools/plugins: org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-03-18 16:11:55 -0400 (Thu, 18 Mar 2010)
New Revision: 20918
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - update
Copied: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui (from rev 20855, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui)
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2010-03-16 18:50:31 UTC (rev 20855)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2010-03-18 20:11:55 UTC (rev 20918)
@@ -16,7 +16,7 @@
import java.util.Iterator;
import java.util.Set;
-import org.hibernate.cfg.Configuration;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -42,11 +42,11 @@
*/
public class ElementsFactory {
- private final Configuration config;
+ private final ConfigurationStub config;
private final HashMap<String, OrmShape> elements;
private final ArrayList<Connection> connections;
- public ElementsFactory(Configuration config, HashMap<String, OrmShape> elements,
+ public ElementsFactory(ConfigurationStub config, HashMap<String, OrmShape> elements,
ArrayList<Connection> connections) {
this.config = config;
this.elements = elements;
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-03-16 18:50:31 UTC (rev 20855)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2010-03-18 20:11:55 UTC (rev 20918)
@@ -47,10 +47,9 @@
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.RootClass;
@@ -217,7 +216,7 @@
elements.clear();
connections.clear();
StringBuilder errorMessage = new StringBuilder();
- Configuration config = getConfig(errorMessage);
+ ConfigurationStub config = getConfig(errorMessage);
final ElementsFactory factory = new ElementsFactory(
config, elements, connections);
for (int i = 0; i < roots.size(); i++) {
@@ -363,7 +362,7 @@
}
public boolean refreshRootsFromNames() {
- final Configuration config = getConfig();
+ final ConfigurationStub config = getConfig();
if (config == null) {
return false;
}
@@ -779,20 +778,21 @@
return consoleConfigName;
}
- protected Configuration getConfig() {
+ protected ConfigurationStub getConfig() {
return getConfig(null);
}
- protected Configuration getConfig(StringBuilder error) {
+ protected ConfigurationStub getConfig(StringBuilder error) {
if (error != null) {
error.delete(0, error.length());
}
final ConsoleConfiguration consoleConfig = getConsoleConfig();
if (consoleConfig != null) {
- Configuration config = consoleConfig.getConfiguration();
+ ConfigurationStub config = consoleConfig.getConfiguration();
if (config == null) {
try {
consoleConfig.build();
+ consoleConfig.buildMappings();
} catch (HibernateException he) {
// here just ignore this
if (error != null) {
@@ -804,14 +804,6 @@
}
}
}
- consoleConfig.execute(new ExecutionContext.Command() {
- public Object execute() {
- if (consoleConfig.hasConfiguration()) {
- consoleConfig.getConfiguration().buildMappings();
- }
- return consoleConfig;
- }
- } );
config = consoleConfig.getConfiguration();
}
return config;
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2010-03-16 18:50:31 UTC (rev 20855)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2010-03-18 20:11:55 UTC (rev 20918)
@@ -27,9 +27,8 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
@@ -68,31 +67,24 @@
if (last_el instanceof PersistentClass) {
PersistentClass persClass = (PersistentClass) last_el;
setPC.add(persClass);
- } else if (last_el instanceof Configuration) {
- Configuration config = (Configuration)last_el;
+ } else if (last_el instanceof ConfigurationStub) {
+ ConfigurationStub config = (ConfigurationStub)last_el;
Iterator<PersistentClass> it = (Iterator<PersistentClass>)(config.getClassMappings());
while (it.hasNext()) {
setPC.add(it.next());
}
} else if (last_el instanceof ConsoleConfiguration) {
- Configuration config = consoleConfig.getConfiguration();
+ ConfigurationStub config = consoleConfig.getConfiguration();
if (config == null) {
try {
consoleConfig.build();
+ consoleConfig.buildMappings();
} catch (HibernateException he) {
HibernateConsolePlugin.getDefault().showError(
HibernateConsolePlugin.getShell(),
DiagramViewerMessages.OpenDiagramActionDelegate_could_not_load_configuration +
' ' + consoleConfig.getName(), he);
}
- consoleConfig.execute( new ExecutionContext.Command() {
- public Object execute() {
- if (consoleConfig.hasConfiguration()) {
- consoleConfig.getConfiguration().buildMappings();
- }
- return consoleConfig;
- }
- } );
config = consoleConfig.getConfiguration();
}
if (config != null) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2010-03-16 18:50:31 UTC (rev 20855)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2010-03-18 20:11:55 UTC (rev 20918)
@@ -24,11 +24,10 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.dialect.Dialect;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.engine.Mapping;
@@ -64,24 +63,17 @@
dialect = null;
}
- protected Configuration getConfig() {
+ protected ConfigurationStub getConfig() {
final ConsoleConfiguration consoleConfig = getConsoleConfig();
if (consoleConfig != null) {
- Configuration config = consoleConfig.getConfiguration();
+ ConfigurationStub config = consoleConfig.getConfiguration();
if (config == null) {
try {
consoleConfig.build();
+ consoleConfig.buildMappings();
} catch (HibernateException he) {
// here just ignore this
}
- consoleConfig.execute(new ExecutionContext.Command() {
- public Object execute() {
- if (consoleConfig.hasConfiguration()) {
- consoleConfig.getConfiguration().buildMappings();
- }
- return consoleConfig;
- }
- } );
config = consoleConfig.getConfiguration();
}
return config;
@@ -152,7 +144,7 @@
if (sqlType != null) {
return false;
}
- final Configuration config = getConfig();
+ final ConfigurationStub config = getConfig();
if (mapping == null && config != null) {
mapping = config.buildMapping();
}
14 years, 7 months
JBoss Tools SVN: r20917 - in branches/hibernatetools-multiversion/hibernatetools/plugins: org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-03-18 16:08:31 -0400 (Thu, 18 Mar 2010)
New Revision: 20917
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - update
Copied: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core (from rev 20855, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core)
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2010-03-16 18:50:31 UTC (rev 20855)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2010-03-18 20:08:31 UTC (rev 20917)
@@ -16,10 +16,10 @@
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.internal.AbstractJpaProject;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.properties.HibernatePropertiesConstants;
import org.osgi.service.prefs.Preferences;
@@ -41,8 +41,11 @@
if (ccName != null || "".equals(ccName)){//$NON-NLS-1$
ConsoleConfiguration cc = KnownConfigurations.getInstance().find(ccName);
if (cc != null){
+ // vitali TODO: here we use Configuration only to get NamingStrategy
+ // so NamingStrategy is a key class for org.jboss.tools.hibernate.jpt.core plugin
+ // Configuration - wrong use here!!!
if (cc.getConfiguration() != null){
- Configuration config = cc.getConfiguration();
+ ConfigurationStub config = cc.getConfiguration();
return config.getNamingStrategy();
}
}
14 years, 7 months
JBoss Tools SVN: r20916 - in branches/hibernatetools-multiversion/hibernatetools: plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs and 16 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-03-18 16:04:29 -0400 (Thu, 18 Mar 2010)
New Revision: 20916
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStubJDBCMetaData.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/.settings/
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/.settings/org.eclipse.hyades.test.tools.core.prefs
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationAdapterFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/EntityGraphView.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - update
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -52,7 +52,6 @@
import org.eclipse.osgi.util.NLS;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.cfg.Settings;
@@ -62,10 +61,14 @@
import org.hibernate.console.execution.ExecutionContext.Command;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.console.stubs.ConfigStubFactory;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.console.stubs.SessionStub;
import org.hibernate.console.stubs.SessionStubFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.resolver.DialectFactory;
+import org.hibernate.tool.ide.completion.HQLCodeAssist;
+import org.hibernate.tool.ide.completion.IHQLCodeAssist;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
@@ -79,12 +82,12 @@
private ExecutionContext executionContext;
private ConsoleConfigClassLoader classLoader = null;
- private Map<String, FakeDelegatingDriver> fakeDrivers = new HashMap<String, FakeDelegatingDriver>();
-
/* TODO: move this out to the actual users of the configuraiton/sf ? */
- private Configuration configuration;
+ private ConfigurationStub configStub;
private SessionStubFactory sessionStubFactory;
+ private ConsoleConfigurationPreferences prefs = null;
+
/** Unique name for this configuration */
public String getName() {
return prefs.getName();
@@ -98,35 +101,23 @@
return executionContext.execute(c);
}
-
- public ConsoleConfigurationPreferences prefs = null;
-
-
/**
* Reset so a new configuration or sessionfactory is needed.
*
*/
public void reset() {
// reseting state
- configuration = null;
closeSessionFactory();
if (executionContext != null) {
executionContext.execute(new ExecutionContext.Command() {
public Object execute() {
- Iterator<FakeDelegatingDriver> it = fakeDrivers.values().iterator();
- while (it.hasNext()) {
- try {
- DriverManager.deregisterDriver(it.next());
- } catch (SQLException e) {
- // ignore
- }
- }
+ configStub.cleanUp();
return null;
}
});
}
- fakeDrivers.clear();
+ configStub = null;
cleanUpClassLoader();
fireConfigurationReset();
executionContext = null;
@@ -144,78 +135,28 @@
}
public void build() {
- configuration = buildWith(null, true);
+ configStub = buildWith(null, true);
fireConfigurationBuilt();
}
- private Configuration buildJPAConfiguration(String persistenceUnit, Properties properties, String entityResolver, boolean includeMappings) {
- if(StringHelper.isEmpty( persistenceUnit )) {
- persistenceUnit = null;
+ /**
+ * @return
+ *
+ */
+ public ConfigurationStub buildWith(final ConfigurationStub cfg, final boolean includeMappings) {
+ if (classLoader == null) {
+ classLoader = createClassLoader();
}
- try {
- Map<Object,Object> overrides = new HashMap<Object,Object>();
- if(properties!=null) {
- overrides.putAll( properties );
+ executionContext = new DefaultExecutionContext(getName(), classLoader);
+ ConfigurationStub result = (ConfigurationStub) executionContext.execute(new ExecutionContext.Command() {
+ public Object execute() {
+ ConfigStubFactory csf = new ConfigStubFactory(prefs);
+ return csf.createConfiguration(cfg, includeMappings);
}
- if(StringHelper.isNotEmpty( prefs.getNamingStrategy())) {
- overrides.put( "hibernate.ejb.naming_strategy", prefs.getNamingStrategy() ); //$NON-NLS-1$
- }
-
- if(StringHelper.isNotEmpty( prefs.getDialectName())) {
- overrides.put( "hibernate.dialect", prefs.getDialectName() ); //$NON-NLS-1$
- }
-
- if(!includeMappings) {
- overrides.put( "hibernate.archive.autodetection", "none" ); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- Class<?> clazz = ReflectHelper.classForName("org.hibernate.ejb.Ejb3Configuration", ConsoleConfiguration.class); //$NON-NLS-1$
- Object ejb3cfg = clazz.newInstance();
-
- if(StringHelper.isNotEmpty(entityResolver)) {
- Class<?> resolver = ReflectHelper.classForName(entityResolver, this.getClass());
- Object object = resolver.newInstance();
- Method method = clazz.getMethod("setEntityResolver", new Class[] { EntityResolver.class });//$NON-NLS-1$
- method.invoke(ejb3cfg, new Object[] { object } );
- }
-
- Method method = clazz.getMethod("configure", new Class[] { String.class, Map.class }); //$NON-NLS-1$
- if ( method.invoke(ejb3cfg, new Object[] { persistenceUnit, overrides } ) == null ) {
- String out = NLS.bind(ConsoleMessages.ConsoleConfiguration_persistence_unit_not_found, persistenceUnit);
- throw new HibernateConsoleRuntimeException(out);
- }
-
- method = clazz.getMethod("getHibernateConfiguration", new Class[0]);//$NON-NLS-1$
- Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[])null);
- invoke = configureConnectionProfile(invoke);
-
- return invoke;
- }
- catch (HibernateConsoleRuntimeException he) {
- throw he;
- }
- catch (Exception e) {
- throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_create_jpa_based_configuration,e);
- }
+ });
+ return result;
}
- @SuppressWarnings("unchecked")
- private Configuration buildAnnotationConfiguration() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- Class<Configuration> clazz = ReflectHelper
- .classForName( "org.hibernate.cfg.AnnotationConfiguration" ); //$NON-NLS-1$
- Configuration newInstance = clazz.newInstance();
- return newInstance;
- }
-
- protected void refreshProfile(IConnectionProfile profile) {
- // refresh profile (refresh jpa connection):
- // get fresh information about current db structure and update error markers
- if (profile.getConnectionState() == IConnectionProfile.CONNECTED_STATE){
- profile.disconnect(null);
- }
- profile.connect(null);
- }
-
/*
* try get a path to the sql driver jar file from DTP connection profile
*/
@@ -228,7 +169,7 @@
if (profile == null) {
return null;
}
- refreshProfile(profile);
+ ConfigStubFactory.refreshProfile(profile);
//
Properties cpProperties = profile.getProperties(profile.getProviderId());
String driverJarPath = cpProperties.getProperty("jarList"); //$NON-NLS-1$
@@ -307,242 +248,17 @@
return classLoader;
}
- /**
- * @return
- *
- */
- public Configuration buildWith(final Configuration cfg, final boolean includeMappings) {
- if (classLoader == null) {
- classLoader = createClassLoader();
- }
- executionContext = new DefaultExecutionContext(getName(), classLoader);
-
- Configuration result = (Configuration) executionContext.execute(new ExecutionContext.Command() {
-
- public Object execute() {
- Configuration localCfg = cfg;
-
- Properties properties = prefs.getProperties();
-
- if(properties!=null) {
- // to fix: JBIDE-5839 - setup this property: false is default value
- // to make hibernate tools diff hibernate versions compatible
- if (properties.getProperty("hibernate.search.autoregister_listeners") == null) { //$NON-NLS-1$
- properties.setProperty("hibernate.search.autoregister_listeners", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- // in case the transaction manager is empty then we need to inject a faketm since hibernate will still try and instantiate it.
- String str = properties.getProperty( "hibernate.transaction.manager_lookup_class" ); //$NON-NLS-1$
- if(str != null && StringHelper.isEmpty( str )) {
- properties.setProperty( "hibernate.transaction.manager_lookup_class", "org.hibernate.console.FakeTransactionManagerLookup"); //$NON-NLS-1$ //$NON-NLS-2$
- //properties.setProperty( "hibernate.transaction.factory_class", "");
- }
- }
-
-
- if(localCfg==null) {
- localCfg = buildConfiguration( properties, includeMappings );
- } else {
- //Properties origProperties = cfg.getProperties();
- //origProperties.putAll(properties);
- //cfg.setProperties(origProperties);
- // TODO: this is actually only for jdbc reveng...
- //localCfg = configureStandardConfiguration( includeMappings, localCfg, properties );
- }
-
- // here both setProperties and configxml have had their chance to tell which databasedriver is needed.
- registerFakeDriver(localCfg.getProperty(Environment.DRIVER) );
- //autoConfigureDialect(localCfg); Disabled for now since it causes very looong timeouts for non-running databases + i havent been needed until now...
-
- // TODO: jpa configuration ?
- if(includeMappings) {
- File[] mappingFiles = prefs.getMappingFiles();
-
- for (int i = 0; i < mappingFiles.length; i++) {
- File hbm = mappingFiles[i];
- localCfg = localCfg.addFile(hbm);
- }
- }
- // TODO: HBX-
- localCfg.setProperty( "hibernate.temp.use_jdbc_metadata_defaults", "false" ); //$NON-NLS-1$//$NON-NLS-2$
- localCfg.setProperty( Environment.HBM2DDL_AUTO, "false" ); //$NON-NLS-1$
-
- return localCfg;
- }
-
- private void autoConfigureDialect(Configuration localCfg) {
- if (localCfg.getProperty(Environment.DIALECT) == null){
- String url = localCfg.getProperty(Environment.URL);
- String user = localCfg.getProperty(Environment.USER);
- String pass = localCfg.getProperty(Environment.PASS);
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(url, user, pass);
- //SQL Dialect:
- Dialect dialect = DialectFactory.buildDialect( localCfg.getProperties(), connection );
- localCfg.setProperty(Environment.DIALECT, dialect.toString());
- } catch (SQLException e) {
- //can't determine dialect
- }
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- // ignore
- }
- }
- }
- }
-
- });
-
-
- return result;
- }
-
- @SuppressWarnings("unchecked")
- private Configuration loadConfigurationXML(Configuration localCfg, boolean includeMappings, EntityResolver entityResolver) {
- File configXMLFile = prefs.getConfigXMLFile();
- if(!includeMappings) {
- org.dom4j.Document doc;
- XMLHelper xmlHelper = new XMLHelper();
- InputStream stream = null;
- String resourceName = "<unknown>"; //$NON-NLS-1$
- if(configXMLFile!=null) {
- resourceName = configXMLFile.toString();
- try {
- stream = new FileInputStream( configXMLFile );
- }
- catch (FileNotFoundException e1) {
- throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_access + configXMLFile, e1);
- }
- } else {
- resourceName = "/hibernate.cfg.xml"; //$NON-NLS-1$
- if (checkHibernateResoureExistence(resourceName)) {
- stream = ConfigHelper.getResourceAsStream( resourceName ); // simulate hibernate's default look up
- }
- else {
- return localCfg;
- }
- }
-
- try {
- List<Throwable> errors = new ArrayList<Throwable>();
-
- doc = xmlHelper.createSAXReader( resourceName, errors, entityResolver )
- .read( new InputSource( stream ) );
- if ( errors.size() != 0 ) {
- throw new MappingException(
- ConsoleMessages.ConsoleConfiguration_invalid_configuration,
- errors.get( 0 )
- );
- }
-
-
- List<Node> list = doc.getRootElement().element("session-factory").elements("mapping"); //$NON-NLS-1$ //$NON-NLS-2$
- for (Node element : list) {
- element.getParent().remove(element);
- }
-
- DOMWriter dw = new DOMWriter();
- Document document = dw.write(doc);
- return localCfg.configure( document );
-
- }
- catch (DocumentException e) {
- throw new HibernateException(
- ConsoleMessages.ConsoleConfiguration_could_not_parse_configuration + resourceName, e
- );
- }
- finally {
- try {
- if (stream!=null) stream.close();
- }
- catch (IOException ioe) {
- //log.warn( "could not close input stream for: " + resourceName, ioe );
- }
- }
- } else {
- if(configXMLFile!=null) {
- return localCfg.configure(configXMLFile);
- } else {
- Configuration resultCfg = localCfg;
- if (checkHibernateResoureExistence("/hibernate.cfg.xml")) { //$NON-NLS-1$
- resultCfg = localCfg.configure();
- }
- return resultCfg;
- }
- }
- }
-
- protected boolean checkHibernateResoureExistence(String resource) {
- InputStream is = null;
- try {
- is = ConfigHelper.getResourceAsStream(resource);
- }
- catch (HibernateException e) {
- // just ignore
- }
- finally {
- try {
- if (is != null) is.close();
- }
- catch (IOException e) {
- // ignore
- }
- }
- return (is != null);
- }
-
- /**
- * DriverManager checks what classloader a class is loaded from thus
- * we register a FakeDriver that we know is loaded "properly" which delegates all it class
- * to the real driver.
- *
- * By doing so we can convince DriverManager that we can use any dynamically loaded driver.
- *
- * @param driverClassName
- */
- @SuppressWarnings("unchecked")
- private void registerFakeDriver(String driverClassName) {
-
- if(driverClassName!=null) {
- try {
- Class<Driver> driverClass = ReflectHelper.classForName(driverClassName);
- if(!fakeDrivers.containsKey(driverClassName) ) { // To avoid "double registration"
- FakeDelegatingDriver fakeDelegatingDriver = new FakeDelegatingDriver( driverClass.newInstance() );
- DriverManager.registerDriver(fakeDelegatingDriver);
- fakeDrivers.put(driverClassName,fakeDelegatingDriver);
- }
- }
- catch (ClassNotFoundException e) {
- String out = NLS.bind(ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass, driverClassName);
- throw new HibernateConsoleRuntimeException(out, e);
- }
- catch (InstantiationException e) {
- String out = NLS.bind(ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass, driverClassName);
- throw new HibernateConsoleRuntimeException(out, e);
- }
- catch (IllegalAccessException e) {
- String out = NLS.bind(ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass, driverClassName);
- throw new HibernateConsoleRuntimeException(out, e);
- }
- catch (SQLException e) {
- String out = NLS.bind(ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass, driverClassName);
- throw new HibernateConsoleRuntimeException(out, e);
- }
- }
- }
protected ClassLoader getParentClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
- public Configuration getConfiguration() {
- return configuration;
+ public ConfigurationStub getConfiguration() {
+ return configStub;
}
/**
* @return
*/
public boolean hasConfiguration() {
- return configuration!=null;
+ return configStub != null;
}
public void buildSessionFactory() {
@@ -551,7 +267,7 @@
if (sessionStubFactory != null) {
throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_factory_not_closed_before_build_new_factory);
}
- sessionStubFactory = new SessionStubFactory(executionContext, getConfiguration());
+ sessionStubFactory = new SessionStubFactory(executionContext, configStub);
fireFactoryBuilt();
return null;
}
@@ -726,7 +442,7 @@
}
}
- public Settings getSettings(final Configuration cfg) {
+ public Settings getSettings(final ConfigurationStub cfg) {
return (Settings) execute(new Command() {
public Object execute() {
@@ -736,109 +452,54 @@
});
}
- // TODO: delegate to some extension point
- private Configuration buildConfiguration(Properties properties, boolean includeMappings) {
- Configuration localCfg = null;
- if(prefs.getConfigurationMode().equals( ConfigurationMode.ANNOTATIONS )) {
- try {
- localCfg = buildAnnotationConfiguration();
- localCfg = configureStandardConfiguration( includeMappings, localCfg, properties );
- }
- catch (HibernateConsoleRuntimeException he) {
- throw he;
- }
- catch (Exception e) {
- throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_load_annotationconfiguration,e);
- }
- } else if(prefs.getConfigurationMode().equals( ConfigurationMode.JPA )) {
- try {
- localCfg = buildJPAConfiguration( getPreferences().getPersistenceUnitName(), properties, prefs.getEntityResolverName(), includeMappings );
- }
- catch (HibernateConsoleRuntimeException he) {
- throw he;
- }
- catch (Exception e) {
- throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_load_jpa_configuration,e);
- }
- } else {
- localCfg = new Configuration();
- localCfg = configureStandardConfiguration( includeMappings, localCfg, properties );
- }
- return localCfg;
+ public Settings getSettings2() {
+ ConfigurationStub cfg = buildWith(null, false);
+ Settings settings = getSettings(cfg);
+ return settings;
}
- private Configuration configureStandardConfiguration(final boolean includeMappings, Configuration localCfg, Properties properties) {
- if(properties!=null) {
- localCfg = localCfg.setProperties(properties);
+ public EntityResolver getEntityResolver() {
+ if (configStub == null) {
+ build();
+ buildSessionFactory();
}
- EntityResolver entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
- if(StringHelper.isNotEmpty(prefs.getEntityResolverName())) {
- try {
- entityResolver = (EntityResolver) ReflectHelper.classForName(prefs.getEntityResolverName()).newInstance();
- } catch (Exception c) {
- throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_configure_entity_resolver + prefs.getEntityResolverName(), c);
- }
- }
- localCfg.setEntityResolver(entityResolver);
+ return configStub.getEntityResolver();
+ }
- if(StringHelper.isNotEmpty( prefs.getNamingStrategy())) {
- try {
- NamingStrategy ns = (NamingStrategy) ReflectHelper.classForName(prefs.getNamingStrategy()).newInstance();
- localCfg.setNamingStrategy( ns );
- } catch (Exception c) {
- throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_configure_naming_strategy + prefs.getNamingStrategy(), c);
+ public IHQLCodeAssist getHQLCodeAssist() {
+ if (configStub == null) {
+ try{
+ build();
+ buildMappings();
+ } catch (HibernateException e){
+// String mess = NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc, consoleConfiguration.getName());
+ throw e;
+ //HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
}
}
-
- localCfg = loadConfigurationXML( localCfg, includeMappings, entityResolver );
- localCfg = configureConnectionProfile(localCfg);
-
- // replace dialect if it is set in preferences
- if(StringHelper.isNotEmpty( prefs.getDialectName())) {
- localCfg.setProperty("hibernate.dialect", prefs.getDialectName()); //$NON-NLS-1$
- }
-
- return localCfg;
+ return configStub.getHQLCodeAssist();
}
-
- private Configuration configureConnectionProfile(Configuration localCfg) {
- String connectionProfile = prefs.getConnectionProfileName();
- if(connectionProfile==null) {
- return localCfg;
- }
-
- IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(connectionProfile);
- if (profile != null) {
- refreshProfile(profile);
- //
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
- Properties cpProperties = profile.getProperties(profile.getProviderId());
- // seems we should not setup dialect here
- //String dialect = "org.hibernate.dialect.HSQLDialect";//cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
- //invoke.setProperty(Environment.DIALECT, dialect);
- String driver = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass"); //$NON-NLS-1$
- localCfg.setProperty(Environment.DRIVER, driver);
- // TODO:
- String driverJarPath = cpProperties.getProperty("jarList"); //$NON-NLS-1$
- String url = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL"); //$NON-NLS-1$
- //url += "/";// + cpProperties.getProperty("org.eclipse.datatools.connectivity.db.databaseName");
- localCfg.setProperty(Environment.URL, url);
- String user = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.username"); //$NON-NLS-1$
- if (null != user && user.length() > 0) {
- localCfg.setProperty(Environment.USER, user);
+
+ public void buildMappings() {
+ execute(new ExecutionContext.Command() {
+ public Object execute() {
+ if (configStub != null) {
+ configStub.buildMappings();
+ }
+ return null;
}
- String pass = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.password"); //$NON-NLS-1$
- if (null != pass && pass.length() > 0) {
- localCfg.setProperty(Environment.PASS, pass);
- }
- } else {
- String out = NLS.bind(ConsoleMessages.ConsoleConfiguration_connection_profile_not_found, connectionProfile);
- throw new HibernateConsoleRuntimeException(out);
- }
- return localCfg;
+ } );
}
+ @SuppressWarnings("unchecked")
+ public Iterator<Throwable> doSchemaExport() {
+ return (Iterator<Throwable>)execute(new ExecutionContext.Command() {
+ public Object execute() {
+ if (configStub != null) {
+ return configStub.doSchemaExport();
+ }
+ return null;
+ }
+ } );
+ }
}
\ No newline at end of file
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigStubFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigStubFactory.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigStubFactory.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -0,0 +1,414 @@
+package org.hibernate.console.stubs;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.dom4j.DocumentException;
+import org.dom4j.Node;
+import org.dom4j.io.DOMWriter;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.osgi.util.NLS;
+import org.hibernate.HibernateException;
+import org.hibernate.MappingException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.JDBCMetaDataConfiguration;
+import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.ConsoleMessages;
+import org.hibernate.console.HibernateConsoleRuntimeException;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.resolver.DialectFactory;
+import org.hibernate.util.ConfigHelper;
+import org.hibernate.util.ReflectHelper;
+import org.hibernate.util.StringHelper;
+import org.hibernate.util.XMLHelper;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+public class ConfigStubFactory {
+
+ private ConsoleConfigurationPreferences prefs = null;
+
+ public ConfigStubFactory(ConsoleConfigurationPreferences prefs) {
+ this.prefs = prefs;
+ }
+
+ public ConfigurationStub createConfiguration() {
+ ConfigurationStub res = new ConfigurationStub(new Configuration());
+ return res;
+ }
+
+ public ConfigurationStubJDBCMetaData createConfigurationJDBCMetaData() {
+ ConfigurationStubJDBCMetaData res = new ConfigurationStubJDBCMetaData(new JDBCMetaDataConfiguration());
+ return res;
+ }
+
+ public ConfigurationStub createConfiguration(ConfigurationStub cfg, boolean includeMappings) {
+ Configuration localCfg = cfg == null ? null : cfg.getConfiguration();
+ Properties properties = prefs.getProperties();
+ if (properties != null) {
+ // to fix: JBIDE-5839 - setup this property: false is default value
+ // to make hibernate tools diff hibernate versions compatible
+ if (properties.getProperty("hibernate.search.autoregister_listeners") == null) { //$NON-NLS-1$
+ properties.setProperty("hibernate.search.autoregister_listeners", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try and instantiate it.
+ String str = properties.getProperty("hibernate.transaction.manager_lookup_class"); //$NON-NLS-1$
+ if (str != null && StringHelper.isEmpty(str)) {
+ properties
+ .setProperty(
+ "hibernate.transaction.manager_lookup_class", "org.hibernate.console.FakeTransactionManagerLookup"); //$NON-NLS-1$ //$NON-NLS-2$
+ // properties.setProperty( "hibernate.transaction.factory_class", "");
+ }
+ }
+ if (localCfg == null) {
+ localCfg = buildConfiguration(properties, includeMappings);
+ } else {
+ // Properties origProperties = cfg.getProperties();
+ // origProperties.putAll(properties);
+ // cfg.setProperties(origProperties);
+ // TODO: this is actually only for jdbc reveng...
+ // localCfg = configureStandardConfiguration( includeMappings, localCfg, properties );
+ }
+ // non-running databases + i havent been needed until now...
+ // TODO: jpa configuration ?
+ if (includeMappings) {
+ File[] mappingFiles = prefs.getMappingFiles();
+ for (int i = 0; i < mappingFiles.length; i++) {
+ File hbm = mappingFiles[i];
+ localCfg = localCfg.addFile(hbm);
+ }
+ }
+ // TODO: HBX-
+ localCfg.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false"); //$NON-NLS-1$//$NON-NLS-2$
+ localCfg.setProperty(Environment.HBM2DDL_AUTO, "false"); //$NON-NLS-1$
+ ConfigurationStub res = new ConfigurationStub(localCfg);
+ // here both setProperties and configxml have had their chance to tell which databasedriver
+ // is needed.
+ res.registerFakeDriver(localCfg.getProperty(Environment.DRIVER));
+ // autoConfigureDialect(localCfg); Disabled for now since it causes very looong timeouts for
+ return res;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Configuration buildAnnotationConfiguration() throws ClassNotFoundException,
+ InstantiationException, IllegalAccessException {
+ Class<Configuration> clazz = ReflectHelper
+ .classForName("org.hibernate.cfg.AnnotationConfiguration"); //$NON-NLS-1$
+ Configuration newInstance = clazz.newInstance();
+ return newInstance;
+ }
+
+ private Configuration buildJPAConfiguration(String persistenceUnit, Properties properties,
+ String entityResolver, boolean includeMappings) {
+ if (StringHelper.isEmpty(persistenceUnit)) {
+ persistenceUnit = null;
+ }
+ try {
+ Map<Object, Object> overrides = new HashMap<Object, Object>();
+ if (properties != null) {
+ overrides.putAll(properties);
+ }
+ if (StringHelper.isNotEmpty(prefs.getNamingStrategy())) {
+ overrides.put("hibernate.ejb.naming_strategy", prefs.getNamingStrategy()); //$NON-NLS-1$
+ }
+ if (StringHelper.isNotEmpty(prefs.getDialectName())) {
+ overrides.put("hibernate.dialect", prefs.getDialectName()); //$NON-NLS-1$
+ }
+ if (!includeMappings) {
+ overrides.put("hibernate.archive.autodetection", "none"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ Class<?> clazz = ReflectHelper.classForName(
+ "org.hibernate.ejb.Ejb3Configuration", ConsoleConfiguration.class); //$NON-NLS-1$
+ Object ejb3cfg = clazz.newInstance();
+
+ if (StringHelper.isNotEmpty(entityResolver)) {
+ Class<?> resolver = ReflectHelper.classForName(entityResolver, this.getClass());
+ Object object = resolver.newInstance();
+ Method method = clazz.getMethod(
+ "setEntityResolver", new Class[] { EntityResolver.class });//$NON-NLS-1$
+ method.invoke(ejb3cfg, new Object[] { object });
+ }
+
+ Method method = clazz.getMethod("configure", new Class[] { String.class, Map.class }); //$NON-NLS-1$
+ if (method.invoke(ejb3cfg, new Object[] { persistenceUnit, overrides }) == null) {
+ String out = NLS.bind(
+ ConsoleMessages.ConsoleConfiguration_persistence_unit_not_found,
+ persistenceUnit);
+ throw new HibernateConsoleRuntimeException(out);
+ }
+
+ method = clazz.getMethod("getHibernateConfiguration", new Class[0]);//$NON-NLS-1$
+ Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[]) null);
+ invoke = configureConnectionProfile(invoke);
+
+ return invoke;
+ } catch (HibernateConsoleRuntimeException he) {
+ throw he;
+ } catch (Exception e) {
+ throw new HibernateConsoleRuntimeException(
+ ConsoleMessages.ConsoleConfiguration_could_not_create_jpa_based_configuration,
+ e);
+ }
+ }
+
+ private Configuration buildConfiguration(Properties properties, boolean includeMappings) {
+ Configuration localCfg = null;
+ if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
+ try {
+ localCfg = buildAnnotationConfiguration();
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
+ } catch (HibernateConsoleRuntimeException he) {
+ throw he;
+ } catch (Exception e) {
+ throw new HibernateConsoleRuntimeException(
+ ConsoleMessages.ConsoleConfiguration_could_not_load_annotationconfiguration,
+ e);
+ }
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
+ try {
+ localCfg = buildJPAConfiguration(prefs.getPersistenceUnitName(), properties, prefs
+ .getEntityResolverName(), includeMappings);
+ } catch (HibernateConsoleRuntimeException he) {
+ throw he;
+ } catch (Exception e) {
+ throw new HibernateConsoleRuntimeException(
+ ConsoleMessages.ConsoleConfiguration_could_not_load_jpa_configuration, e);
+ }
+ } else {
+ localCfg = new Configuration();
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
+ }
+ return localCfg;
+ }
+
+ private Configuration configureStandardConfiguration(final boolean includeMappings,
+ Configuration localCfg, Properties properties) {
+ if (properties != null) {
+ localCfg = localCfg.setProperties(properties);
+ }
+ EntityResolver entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
+ if (StringHelper.isNotEmpty(prefs.getEntityResolverName())) {
+ try {
+ entityResolver = (EntityResolver) ReflectHelper.classForName(
+ prefs.getEntityResolverName()).newInstance();
+ } catch (Exception c) {
+ throw new HibernateConsoleRuntimeException(
+ ConsoleMessages.ConsoleConfiguration_could_not_configure_entity_resolver
+ + prefs.getEntityResolverName(), c);
+ }
+ }
+ localCfg.setEntityResolver(entityResolver);
+ if (StringHelper.isNotEmpty(prefs.getNamingStrategy())) {
+ try {
+ NamingStrategy ns = (NamingStrategy) ReflectHelper.classForName(
+ prefs.getNamingStrategy()).newInstance();
+ localCfg.setNamingStrategy(ns);
+ } catch (Exception c) {
+ throw new HibernateConsoleRuntimeException(
+ ConsoleMessages.ConsoleConfiguration_could_not_configure_naming_strategy
+ + prefs.getNamingStrategy(), c);
+ }
+ }
+ localCfg = loadConfigurationXML(localCfg, includeMappings, entityResolver);
+ localCfg = configureConnectionProfile(localCfg);
+
+ // replace dialect if it is set in preferences
+ if (StringHelper.isNotEmpty(prefs.getDialectName())) {
+ localCfg.setProperty("hibernate.dialect", prefs.getDialectName()); //$NON-NLS-1$
+ }
+
+ return localCfg;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Configuration loadConfigurationXML(Configuration localCfg, boolean includeMappings,
+ EntityResolver entityResolver) {
+ File configXMLFile = prefs.getConfigXMLFile();
+ if (!includeMappings) {
+ org.dom4j.Document doc;
+ XMLHelper xmlHelper = new XMLHelper();
+ InputStream stream = null;
+ String resourceName = "<unknown>"; //$NON-NLS-1$
+ if (configXMLFile != null) {
+ resourceName = configXMLFile.toString();
+ try {
+ stream = new FileInputStream(configXMLFile);
+ } catch (FileNotFoundException e1) {
+ throw new HibernateConsoleRuntimeException(
+ ConsoleMessages.ConsoleConfiguration_could_not_access + configXMLFile,
+ e1);
+ }
+ } else {
+ resourceName = "/hibernate.cfg.xml"; //$NON-NLS-1$
+ if (checkHibernateResoureExistence(resourceName)) {
+ stream = ConfigHelper.getResourceAsStream(resourceName); // simulate hibernate's
+ // default look up
+ } else {
+ return localCfg;
+ }
+ }
+
+ try {
+ List<Throwable> errors = new ArrayList<Throwable>();
+
+ doc = xmlHelper.createSAXReader(resourceName, errors, entityResolver).read(
+ new InputSource(stream));
+ if (errors.size() != 0) {
+ throw new MappingException(
+ ConsoleMessages.ConsoleConfiguration_invalid_configuration, errors
+ .get(0));
+ }
+
+ List<Node> list = doc.getRootElement()
+ .element("session-factory").elements("mapping"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (Node element : list) {
+ element.getParent().remove(element);
+ }
+
+ DOMWriter dw = new DOMWriter();
+ Document document = dw.write(doc);
+ return localCfg.configure(document);
+
+ } catch (DocumentException e) {
+ throw new HibernateException(
+ ConsoleMessages.ConsoleConfiguration_could_not_parse_configuration
+ + resourceName, e);
+ } finally {
+ try {
+ if (stream != null)
+ stream.close();
+ } catch (IOException ioe) {
+ // log.warn( "could not close input stream for: " + resourceName, ioe );
+ }
+ }
+ } else {
+ if (configXMLFile != null) {
+ return localCfg.configure(configXMLFile);
+ } else {
+ Configuration resultCfg = localCfg;
+ if (checkHibernateResoureExistence("/hibernate.cfg.xml")) { //$NON-NLS-1$
+ resultCfg = localCfg.configure();
+ }
+ return resultCfg;
+ }
+ }
+ }
+
+ private boolean checkHibernateResoureExistence(String resource) {
+ InputStream is = null;
+ try {
+ is = ConfigHelper.getResourceAsStream(resource);
+ } catch (HibernateException e) {
+ // just ignore
+ } finally {
+ try {
+ if (is != null)
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ return (is != null);
+ }
+
+ private Configuration configureConnectionProfile(Configuration localCfg) {
+ String connectionProfile = prefs.getConnectionProfileName();
+ if (connectionProfile == null) {
+ return localCfg;
+ }
+ IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(
+ connectionProfile);
+ if (profile != null) {
+ refreshProfile(profile);
+ //
+ final Properties invokeProperties = localCfg.getProperties();
+ // set this property to null!
+ invokeProperties.remove(Environment.DATASOURCE);
+ localCfg.setProperties(invokeProperties);
+ Properties cpProperties = profile.getProperties(profile.getProviderId());
+ // seems we should not setup dialect here
+ // String dialect =
+ // "org.hibernate.dialect.HSQLDialect";//cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
+ // invoke.setProperty(Environment.DIALECT, dialect);
+ String driver = cpProperties
+ .getProperty("org.eclipse.datatools.connectivity.db.driverClass"); //$NON-NLS-1$
+ localCfg.setProperty(Environment.DRIVER, driver);
+ // TODO:
+ @SuppressWarnings("unused")
+ String driverJarPath = cpProperties.getProperty("jarList"); //$NON-NLS-1$
+ String url = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL"); //$NON-NLS-1$
+ // url += "/";// +
+ // cpProperties.getProperty("org.eclipse.datatools.connectivity.db.databaseName");
+ localCfg.setProperty(Environment.URL, url);
+ String user = cpProperties
+ .getProperty("org.eclipse.datatools.connectivity.db.username"); //$NON-NLS-1$
+ if (null != user && user.length() > 0) {
+ localCfg.setProperty(Environment.USER, user);
+ }
+ String pass = cpProperties
+ .getProperty("org.eclipse.datatools.connectivity.db.password"); //$NON-NLS-1$
+ if (null != pass && pass.length() > 0) {
+ localCfg.setProperty(Environment.PASS, pass);
+ }
+ } else {
+ String out = NLS.bind(
+ ConsoleMessages.ConsoleConfiguration_connection_profile_not_found,
+ connectionProfile);
+ throw new HibernateConsoleRuntimeException(out);
+ }
+ return localCfg;
+ }
+
+ @SuppressWarnings("unused")
+ private void autoConfigureDialect(Configuration localCfg) {
+ if (localCfg.getProperty(Environment.DIALECT) == null) {
+ String url = localCfg.getProperty(Environment.URL);
+ String user = localCfg.getProperty(Environment.USER);
+ String pass = localCfg.getProperty(Environment.PASS);
+ Connection connection = null;
+ try {
+ connection = DriverManager.getConnection(url, user, pass);
+ // SQL Dialect:
+ Dialect dialect = DialectFactory.buildDialect(localCfg.getProperties(), connection);
+ localCfg.setProperty(Environment.DIALECT, dialect.toString());
+ } catch (SQLException e) {
+ // can't determine dialect
+ }
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ public static void refreshProfile(IConnectionProfile profile) {
+ // refresh profile (refresh jpa connection):
+ // get fresh information about current db structure and update error markers
+ if (profile.getConnectionState() == IConnectionProfile.CONNECTED_STATE) {
+ profile.disconnect(null);
+ }
+ profile.connect(null);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStub.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -0,0 +1,193 @@
+package org.hibernate.console.stubs;
+
+import java.io.File;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.osgi.util.NLS;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Mappings;
+import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.cfg.Settings;
+import org.hibernate.console.ConsoleMessages;
+import org.hibernate.console.FakeDelegatingDriver;
+import org.hibernate.console.HibernateConsoleRuntimeException;
+import org.hibernate.engine.Mapping;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.hibernate.tool.hbm2x.Exporter;
+import org.hibernate.tool.hbm2x.HibernateMappingExporter;
+import org.hibernate.tool.hbm2x.pojo.POJOClass;
+import org.hibernate.tool.ide.completion.HQLCodeAssist;
+import org.hibernate.tool.ide.completion.IHQLCodeAssist;
+import org.hibernate.util.ReflectHelper;
+import org.xml.sax.EntityResolver;
+
+public class ConfigurationStub {
+
+ private Map<String, FakeDelegatingDriver> fakeDrivers = new HashMap<String, FakeDelegatingDriver>();
+
+ // configuration != null - by default
+ protected Configuration configuration;
+
+ protected ConfigurationStub(Configuration configuration) {
+ this.configuration = configuration;
+ }
+
+ protected Configuration getConfiguration() {
+ return configuration;
+ }
+
+ public void cleanUp() {
+ Iterator<FakeDelegatingDriver> it = fakeDrivers.values().iterator();
+ while (it.hasNext()) {
+ try {
+ DriverManager.deregisterDriver(it.next());
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ fakeDrivers.clear();
+ }
+
+ public void buildMappings() {
+ configuration.buildMappings();
+ }
+
+ // TODO: temporary should be protected and/or SettingsStub?
+ public Settings buildSettings() {
+ return configuration.buildSettings();
+ }
+
+ protected SessionFactory buildSessionFactory() {
+ return configuration.buildSessionFactory();
+ }
+
+ public EntityResolver getEntityResolver() {
+ return configuration.getEntityResolver();
+ }
+
+ public IHQLCodeAssist getHQLCodeAssist() {
+ return new HQLCodeAssist(configuration);
+ }
+
+ // TODO: temporary should be protected and/or NamingStrategyStub?
+ public NamingStrategy getNamingStrategy() {
+ return configuration.getNamingStrategy();
+ }
+
+ // TODO: temporary?
+ @SuppressWarnings("unchecked")
+ public Iterator getClassMappings() {
+ return configuration.getClassMappings();
+ }
+
+ // TODO: temporary should be protected and/or PersistentClassStub?
+ public PersistentClass getClassMapping(String entityName) {
+ return configuration.getClassMapping(entityName);
+ }
+
+ // TODO: temporary should be protected and/or MappingsStub?
+ public Mappings createMappings() {
+ return configuration.createMappings();
+ }
+
+ // TODO: temporary should be protected and/or MappingsStub?
+ public Mapping buildMapping() {
+ return configuration.buildMapping();
+ }
+
+ public static interface IExporterNewOutputDir {
+ File getNewOutputDir(POJOClass element, File outputdir4FileNew);
+ }
+
+ public HibernateMappingExporter createHibernateMappingExporter(File folder2Gen, final IExporterNewOutputDir enod) {
+ return new HibernateMappingExporter(configuration, folder2Gen) {
+ @SuppressWarnings("unchecked")
+ protected void exportPOJO(Map additionalContext, POJOClass element) {
+ File outputdir4FileOld = getOutputDirectory();
+ File outputdir4FileNew = enod.getNewOutputDir(element, outputdir4FileOld);
+ if (!outputdir4FileNew.exists()) {
+ outputdir4FileNew.mkdirs();
+ }
+ setOutputDirectory(outputdir4FileNew);
+ super.exportPOJO(additionalContext, element);
+ setOutputDirectory(outputdir4FileOld);
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterator<Throwable> doSchemaExport() {
+ SchemaExport export = new SchemaExport(configuration);
+ export.create(false, true);
+ if (!export.getExceptions().isEmpty()) {
+ return (Iterator<Throwable>)export.getExceptions().iterator();
+ }
+ return null;
+ }
+
+ public void updateExporter(Exporter exporter) {
+ exporter.setConfiguration(configuration);
+ }
+
+ public Properties getProperties() {
+ return configuration.getProperties();
+ }
+
+ public String getProperty(String propertyName) {
+ return configuration.getProperty(propertyName);
+ }
+
+ /**
+ * DriverManager checks what classloader a class is loaded from thus we register a FakeDriver
+ * that we know is loaded "properly" which delegates all it class to the real driver. By doing
+ * so we can convince DriverManager that we can use any dynamically loaded driver.
+ *
+ * @param driverClassName
+ */
+ @SuppressWarnings("unchecked")
+ protected void registerFakeDriver(String driverClassName) {
+ if (driverClassName != null) {
+ try {
+ Class<Driver> driverClass = ReflectHelper.classForName(driverClassName);
+ if (!fakeDrivers.containsKey(driverClassName)) { // To avoid "double registration"
+ FakeDelegatingDriver fakeDelegatingDriver = new FakeDelegatingDriver(
+ driverClass.newInstance());
+ DriverManager.registerDriver(fakeDelegatingDriver);
+ fakeDrivers.put(driverClassName, fakeDelegatingDriver);
+ }
+ } catch (ClassNotFoundException e) {
+ String out = NLS
+ .bind(
+ ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass,
+ driverClassName);
+ throw new HibernateConsoleRuntimeException(out, e);
+ } catch (InstantiationException e) {
+ String out = NLS
+ .bind(
+ ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass,
+ driverClassName);
+ throw new HibernateConsoleRuntimeException(out, e);
+ } catch (IllegalAccessException e) {
+ String out = NLS
+ .bind(
+ ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass,
+ driverClassName);
+ throw new HibernateConsoleRuntimeException(out, e);
+ } catch (SQLException e) {
+ String out = NLS
+ .bind(
+ ConsoleMessages.ConsoleConfiguration_problems_while_loading_database_driverclass,
+ driverClassName);
+ throw new HibernateConsoleRuntimeException(out, e);
+ }
+ }
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStubJDBCMetaData.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStubJDBCMetaData.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/ConfigurationStubJDBCMetaData.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -0,0 +1,33 @@
+package org.hibernate.console.stubs;
+
+import java.util.Properties;
+
+import org.hibernate.cfg.JDBCMetaDataConfiguration;
+import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
+
+public class ConfigurationStubJDBCMetaData extends ConfigurationStub {
+
+ protected JDBCMetaDataConfiguration jdbcMetaDataConfiguration;
+
+ protected ConfigurationStubJDBCMetaData(JDBCMetaDataConfiguration configuration) {
+ super(configuration);
+ jdbcMetaDataConfiguration = configuration;
+ }
+
+ public void setProperties(Properties properties) {
+ jdbcMetaDataConfiguration.setProperties(properties);
+ }
+
+ public void setPreferBasicCompositeIds(boolean flag) {
+ jdbcMetaDataConfiguration.setPreferBasicCompositeIds(flag);
+ }
+
+ public void setReverseEngineeringStrategy(ReverseEngineeringStrategy reverseEngineeringStrategy) {
+ jdbcMetaDataConfiguration.setReverseEngineeringStrategy(reverseEngineeringStrategy);
+ }
+
+ public void readFromJDBC() {
+ jdbcMetaDataConfiguration.readFromJDBC();
+ }
+
+}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/stubs/SessionStubFactory.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -8,7 +8,6 @@
import java.util.Map;
import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleMessages;
import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.util.ELTransformer;
@@ -25,9 +24,9 @@
protected ExecutionContext executionContext;
protected SessionFactory sessionFactory;
- public SessionStubFactory(ExecutionContext executionContext, Configuration cfg) {
+ public SessionStubFactory(ExecutionContext executionContext, ConfigurationStub configStub) {
this.executionContext = executionContext;
- sessionFactory = cfg.buildSessionFactory();
+ sessionFactory = configStub.buildSessionFactory();
}
public boolean isSessionFactoryCreated() {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -15,8 +15,8 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.HibernateConsoleRuntimeException;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.hibernate.eclipse.launch.PathHelper;
@@ -166,7 +166,7 @@
* @param collector
* @throws CoreException in case of resolve variables issues.
*/
- public Exporter createConfiguredExporter(Configuration cfg, String defaultOutputDirectory,
+ public Exporter createConfiguredExporter(ConfigurationStub cfg, String defaultOutputDirectory,
String customTemplatePath, Properties globalProperties, Set<String> outputDirectories, ArtifactCollector collector) throws CoreException {
Exporter exporter = getExporterDefinition().createExporterInstance();
@@ -199,7 +199,7 @@
exporter.setOutputDirectory(new File(loc));
}
- exporter.setConfiguration(cfg);
+ cfg.updateExporter(exporter);
List<String> templatePathList = new ArrayList<String>();
if(props.containsKey("template_path")) { //$NON-NLS-1$
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -146,7 +146,7 @@
if (configXMLFile == null) {
return true;
}
- EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
+ EntityResolver entityResolver = consoleConfig.getEntityResolver();
Document doc = getDocument(configXMLFile, entityResolver);
return getElements(doc, HIBERNATE_TAG_MAPPING, HIBERNATE_TAG_CLASS, getPersistentClassName(rootClass)).hasNext();
}
@@ -185,7 +185,7 @@
* @return
*/
public static boolean rootClassInFile(ConsoleConfiguration consoleConfig, IFile file, RootClass rootClass) {
- EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
+ EntityResolver entityResolver = consoleConfig.getEntityResolver();
Document doc = getDocument(file.getLocation().toFile(), entityResolver);
final String clName = getPersistentClassName(rootClass);
final String clNameUnq = StringHelper.unqualify(clName);
@@ -219,7 +219,7 @@
* @return
*/
public static boolean subclassInFile(ConsoleConfiguration consoleConfig, IFile file, Subclass subclass) {
- EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
+ EntityResolver entityResolver = consoleConfig.getEntityResolver();
Document doc = getDocument(file.getLocation().toFile(), entityResolver);
final String clName = getPersistentClassName(subclass);
final String clNameUnq = StringHelper.unqualify(clName);
@@ -243,7 +243,7 @@
*/
@SuppressWarnings("unchecked")
public static boolean tableInFile(ConsoleConfiguration consoleConfig, IFile file, Table table) {
- EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
+ EntityResolver entityResolver = consoleConfig.getEntityResolver();
Document doc = getDocument(file.getLocation().toFile(), entityResolver);
Iterator<Element> classes = getElements(doc, HIBERNATE_TAG_CLASS);
boolean res = false;
@@ -449,11 +449,7 @@
return file;
}
java.io.File configXMLFile = consoleConfig.getConfigXMLFile();
- if (!consoleConfig.hasConfiguration()) {
- consoleConfig.build();
- consoleConfig.buildSessionFactory();
- }
- EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
+ EntityResolver entityResolver = consoleConfig.getEntityResolver();
Document doc = getDocument(configXMLFile, entityResolver);
if (doc == null) {
return file;
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -73,7 +73,7 @@
try {
metadataFiles = PersistenceXmlLoader.deploy(
url, CollectionHelper.EMPTY_MAP,
- consoleConfiguration.getConfiguration().getEntityResolver(),
+ consoleConfiguration.getEntityResolver(),
PersistenceUnitTransactionType.RESOURCE_LOCAL);
} catch (Exception e1) {
//ignore
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -67,39 +67,30 @@
Object node = i.next();
if ( node instanceof ConsoleConfiguration ) {
final ConsoleConfiguration config = (ConsoleConfiguration) node;
- config.execute( new Command() {
- @SuppressWarnings("unchecked")
- public Object execute() {
- String out = NLS.bind(HibernateConsoleMessages.SchemaExportAction_sure_run_schemaexport, config.getName());
- if ( config.getConfiguration() != null
- && MessageDialog.openConfirm( viewer.getControl().getShell(),
- HibernateConsoleMessages.SchemaExportAction_run_schemaexport,
- out ) ) {
- SchemaExport export = new SchemaExport( config
- .getConfiguration() );
- export.create( false, true );
- if ( !export.getExceptions().isEmpty() ) {
- Iterator<Throwable> iterator = export.getExceptions().iterator();
- int cnt = 1;
- while ( iterator.hasNext() ) {
- Throwable element = iterator.next();
- String outStr = NLS.bind(HibernateConsoleMessages.SchemaExportAction_errornum_while_performing_schemaexport, cnt++);
- HibernateConsolePlugin.getDefault().logErrorMessage(outStr, element );
- }
- HibernateConsolePlugin.getDefault().showError(viewer.getControl().getShell(),
- NLS.bind(HibernateConsoleMessages.SchemaExportAction_error_while_performing_schemaexport, cnt - 1),
- (Throwable)null );
+ if (config.getConfiguration() != null) {
+ String out = NLS.bind(HibernateConsoleMessages.SchemaExportAction_sure_run_schemaexport, config.getName());
+ if (MessageDialog.openConfirm(viewer.getControl().getShell(),
+ HibernateConsoleMessages.SchemaExportAction_run_schemaexport,
+ out)) {
+ Iterator<Throwable> res = config.doSchemaExport();
+ if (res.hasNext()) {
+ int cnt = 1;
+ while (res.hasNext()) {
+ Throwable element = res.next();
+ String outStr = NLS.bind(HibernateConsoleMessages.SchemaExportAction_errornum_while_performing_schemaexport, cnt++);
+ HibernateConsolePlugin.getDefault().logErrorMessage(outStr, element );
}
+ HibernateConsolePlugin.getDefault().showError(viewer.getControl().getShell(),
+ NLS.bind(HibernateConsoleMessages.SchemaExportAction_error_while_performing_schemaexport, cnt - 1),
+ (Throwable)null);
}
- return null;
}
- } );
+ }
viewer.refresh( node ); // todo: should we do it here or should
// the view just react to config being
// build ?
}
- }
- catch (HibernateException he) {
+ } catch (HibernateException he) {
HibernateConsolePlugin.getDefault().showError(
viewer.getControl().getShell(),
HibernateConsoleMessages.SchemaExportAction_exception_running_schemaexport, he );
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationAdapterFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationAdapterFactory.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationAdapterFactory.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -30,10 +30,10 @@
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.IPropertySource2;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.node.BaseNode;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.PrimaryKey;
@@ -51,7 +51,7 @@
Map<Class<?>, IDeferredWorkbenchAdapter> map = new HashMap<Class<?>, IDeferredWorkbenchAdapter>();
map.put(ConsoleConfiguration.class, new ConsoleConfigurationWorkbenchAdapter());
- map.put(Configuration.class, new ConfigurationWorkbenchAdapter());
+ map.put(ConfigurationStub.class, new ConfigurationWorkbenchAdapter());
map.put(KnownConfigurations.class, new KnownConfigurationsWorkbenchAdapter());
map.put(PersistentClass.class, new PersistentClassWorkbenchAdapter());
map.put(Property.class, new PropertyWorkbenchAdapter());
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConfigurationWorkbenchAdapter.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -25,9 +25,9 @@
import java.util.Iterator;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.mapping.PersistentClass;
@@ -36,7 +36,7 @@
@SuppressWarnings("unchecked")
public Object[] getChildren(Object o) {
- Configuration cfg = (Configuration) o;
+ ConfigurationStub cfg = (ConfigurationStub) o;
Iterator<? extends PersistentClass> classMappings = cfg.getClassMappings();
return toArray(classMappings, PersistentClass.class, new Comparator<PersistentClass>() {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/ConsoleConfigurationWorkbenchAdapter.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -23,11 +23,11 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -59,10 +59,10 @@
}*/
- Configuration configuration = ccfg.getConfiguration();
+ ConfigurationStub configStub = ccfg.getConfiguration();
Object o1;
- if(configuration!=null) {
- o1 = configuration;
+ if (configStub != null) {
+ o1 = configStub;
} else {
o1 = HibernateConsoleMessages.ConsoleConfigurationWorkbenchAdapter_empty_configuration;
}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -32,7 +32,6 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.JDBCReaderFactory;
import org.hibernate.cfg.Settings;
import org.hibernate.cfg.reveng.DefaultDatabaseCollector;
@@ -42,6 +41,7 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -102,7 +102,7 @@
}
protected void readDatabaseSchema(final IProgressMonitor monitor, final DefaultDatabaseCollector db, ConsoleConfiguration consoleConfiguration, final ReverseEngineeringStrategy strategy) {
- final Configuration configuration = consoleConfiguration.buildWith(null, false);
+ final ConfigurationStub configuration = consoleConfiguration.buildWith(null, false);
consoleConfiguration.getExecutionContext().execute(new ExecutionContext.Command() {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -58,12 +58,11 @@
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryPage;
-import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.console.stubs.SessionStub;
import org.hibernate.eclipse.console.AbstractQueryEditor;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -145,18 +144,19 @@
if (queryPage == null || !getPinToOneResTab()) {
queryPage = cfg.executeBSHQuery(getQueryString(), getQueryInputModel().getCopyForQuery() );
} else {
+ KnownConfigurations.getInstance().getQueryPageModel().remove(queryPage);
final ConsoleConfiguration cfg0 = cfg;
- cfg.execute(new Command() {
+ SessionStub sessionStub = (SessionStub)cfg.execute(new Command() {
public Object execute() {
- KnownConfigurations.getInstance().getQueryPageModel().remove(queryPage);
+ // vitali TODO: openSession should be executed in context - all other no!
SessionStub sessionStub = cfg0.getSessionStubFactory().openSession();
- queryPage.setModel(getQueryInputModel().getCopyForQuery());
- queryPage.setQueryString(getQueryString());
- queryPage.setSessionStub(sessionStub);
- KnownConfigurations.getInstance().getQueryPageModel().add(queryPage);
- return null;
+ return sessionStub;
}
});
+ queryPage.setModel(getQueryInputModel().getCopyForQuery());
+ queryPage.setQueryString(getQueryString());
+ queryPage.setSessionStub(sessionStub);
+ KnownConfigurations.getInstance().getQueryPageModel().add(queryPage);
}
}
@@ -179,14 +179,7 @@
if(consoleConfiguration.getConfiguration()==null) {
try {
consoleConfiguration.build();
- consoleConfiguration.execute( new ExecutionContext.Command() {
- public Object execute() {
- if(consoleConfiguration.hasConfiguration()) {
- consoleConfiguration.getConfiguration().buildMappings();
- }
- return consoleConfiguration;
- }
- });
+ consoleConfiguration.buildMappings();
} catch (HibernateException e) {
String mess = NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc, consoleConfiguration.getName());
HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
@@ -194,7 +187,7 @@
}
Set<String> imports = new HashSet<String>();
- Configuration configuration = consoleConfiguration.getConfiguration();
+ ConfigurationStub configuration = consoleConfiguration.getConfiguration();
if(configuration!=null) {
Iterator<PersistentClass> classMappings = configuration.getClassMappings();
while ( classMappings.hasNext() ) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/EntityGraphView.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/EntityGraphView.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/EntityGraphView.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -23,7 +23,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.hibernate.cfg.Configuration;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.ConsolePreferencesConstants;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.views.KnownConfigurationsView;
@@ -49,8 +49,8 @@
protected void selectionChanged(IStructuredSelection ss) {
Object o = ss.getFirstElement();
- if (o instanceof Configuration) {
- viewer.setContents(new ConfigurationViewAdapter((Configuration) o));
+ if (o instanceof ConfigurationStub) {
+ viewer.setContents(new ConfigurationViewAdapter((ConfigurationStub) o));
boolean b = HibernateConsolePlugin.getDefault().getPluginPreferences().getBoolean(ConsolePreferencesConstants.ENTITY_MODEL_LAYOUT);
((ConfigurationEditPart)viewer.getContents()).setManualLayoutActive(b);
}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/ConfigurationViewAdapter.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -28,18 +28,18 @@
import java.util.Map;
import java.util.Observable;
-import org.hibernate.cfg.Configuration;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.mapping.PersistentClass;
public class ConfigurationViewAdapter extends Observable {
- private final Configuration cfg;
+ private final ConfigurationStub cfg;
private Map<String, PersistentClassViewAdapter> persistentClasses; // key: name, value: PersistentClassViewAdapter
private List<TableViewAdapter> selectedTables;
//private final Map sourceAssociations; // key: name, value: List of AssociationViewAdapter
//private final Map targetAssociations; // key: name, value: List of AssociationViewAdapter
- public ConfigurationViewAdapter(Configuration cfg) {
+ public ConfigurationViewAdapter(ConfigurationStub cfg) {
this.cfg = cfg;
//sourceAssociations = new HashMap();
@@ -73,7 +73,7 @@
return selectedTables;
}
- public Configuration getConfiguration() {
+ public ConfigurationStub getConfiguration() {
return cfg;
}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -34,11 +34,7 @@
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.osgi.util.NLS;
-import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.QueryEditor;
@@ -93,7 +89,7 @@
return result;
}
- ICompletionProposal[] computeProposals(IDocument doc, int lineStart, final int currentOffset, final ConsoleConfiguration consoleConfiguration) {
+ ICompletionProposal[] computeProposals(IDocument doc, int lineStart, final int currentOffset, final ConsoleConfiguration consoleConfig) {
ICompletionProposal[] result = null;
errorMessage = null;
if (doc != null && currentOffset >= 0) {
@@ -114,26 +110,12 @@
errorMessage = HibernateConsoleMessages.HQLCompletionProcessor_could_not_get_document_contents;
return result;
}
-
- if(consoleConfiguration != null && consoleConfiguration.getConfiguration()==null) {
- try{
- consoleConfiguration.build();
- consoleConfiguration.execute( new ExecutionContext.Command() {
- public Object execute() {
- if(consoleConfiguration.hasConfiguration()) {
- consoleConfiguration.getConfiguration().buildMappings();
- }
- return consoleConfiguration;
- }
- });
- } catch (HibernateException e){
- String mess = NLS.bind(HibernateConsoleMessages.CompletionHelper_error_could_not_build_cc, consoleConfiguration.getName());
- HibernateConsolePlugin.getDefault().logErrorMessage(mess, e);
- }
+ IHQLCodeAssist hqlEval = null;
+ if (consoleConfig != null) {
+ hqlEval = consoleConfig.getHQLCodeAssist();
+ } else {
+ hqlEval = new HQLCodeAssist(null);
}
-
- Configuration configuration = consoleConfiguration!=null?consoleConfiguration.getConfiguration():null;
- IHQLCodeAssist hqlEval = new HQLCodeAssist(configuration);
EclipseHQLCompletionRequestor eclipseHQLCompletionCollector = new EclipseHQLCompletionRequestor();
hqlEval.codeComplete(doc.get(), currentOffset, eclipseHQLCompletionCollector);
proposalList.addAll(eclipseHQLCompletionCollector.getCompletionProposals());
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -59,7 +59,6 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.text.edits.TextEdit;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.JDBCMetaDataConfiguration;
import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.OverrideRepository;
@@ -69,6 +68,9 @@
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.console.stubs.ConfigStubFactory;
+import org.hibernate.console.stubs.ConfigurationStub;
+import org.hibernate.console.stubs.ConfigurationStubJDBCMetaData;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.model.impl.ExporterFactory;
@@ -211,7 +213,7 @@
if (attributes.isReverseEngineer()) {
monitor.subTask(HibernateConsoleMessages.CodeGenerationLaunchDelegate_reading_jdbc_metadata);
}
- final Configuration cfg = buildConfiguration(attributes, cc, ResourcesPlugin.getWorkspace().getRoot());
+ final ConfigurationStub cfg = buildConfiguration(attributes, cc, ResourcesPlugin.getWorkspace().getRoot());
monitor.worked(1);
@@ -257,21 +259,23 @@
}
- private Configuration buildConfiguration(final ExporterAttributes attributes, ConsoleConfiguration cc, IWorkspaceRoot root) {
+ private ConfigurationStub buildConfiguration(final ExporterAttributes attributes, ConsoleConfiguration cc, IWorkspaceRoot root) {
final boolean reveng = attributes.isReverseEngineer();
final String reverseEngineeringStrategy = attributes.getRevengStrategy();
final boolean preferBasicCompositeids = attributes.isPreferBasicCompositeIds();
final IResource revengres = PathHelper.findMember( root, attributes.getRevengSettings());
if(reveng) {
- Configuration configuration = null;
+ ConfigurationStub configuration = null;
if(cc.hasConfiguration()) {
configuration = cc.getConfiguration();
} else {
configuration = cc.buildWith( null, false );
}
- final JDBCMetaDataConfiguration cfg = new JDBCMetaDataConfiguration();
+ // vitali: TODO: use execution context
+ ConfigStubFactory configStubFactory = new ConfigStubFactory(null);
+ final ConfigurationStubJDBCMetaData cfg = configStubFactory.createConfigurationJDBCMetaData();
Properties properties = configuration.getProperties();
cfg.setProperties( properties );
cc.buildWith(cfg,false);
@@ -319,15 +323,8 @@
return cfg;
} else {
cc.build();
- final Configuration configuration = cc.getConfiguration();
-
- cc.execute(new Command() {
- public Object execute() {
-
- configuration.buildMappings();
- return configuration;
- }
- });
+ cc.buildMappings();
+ final ConfigurationStub configuration = cc.getConfiguration();
return configuration;
}
}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/nature/HibernateNature.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -41,12 +41,12 @@
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.JDBCMetaDataConfiguration;
import org.hibernate.cfg.reveng.TableIdentifier;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.builder.HibernateBuilder;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -150,7 +150,7 @@
@SuppressWarnings("unchecked")
protected IStatus run(IProgressMonitor monitor) {
- Configuration cfg = ccfg.buildWith(null, false);
+ ConfigurationStub cfg = ccfg.buildWith(null, false);
final JDBCMetaDataConfiguration jcfg = new JDBCMetaDataConfiguration();
jcfg.setProperties(cfg.getProperties());
monitor.beginTask(HibernateConsoleMessages.HibernateNature_reading_database_metadata, IProgressMonitor.UNKNOWN);
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -34,13 +34,11 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.hqleditor.EclipseHQLCompletionRequestor;
import org.hibernate.eclipse.hqleditor.HQLCompletionProcessor;
import org.hibernate.eclipse.nature.HibernateNature;
-import org.hibernate.tool.ide.completion.HQLCodeAssist;
import org.hibernate.tool.ide.completion.IHQLCodeAssist;
public class HQLJavaCompletionProposalComputer implements IJavaCompletionProposalComputer {
@@ -76,22 +74,18 @@
JavaContentAssistInvocationContext ctx = (JavaContentAssistInvocationContext)context;
try {
- ConsoleConfiguration consoleConfiguration = getConfiguration( ctx.getProject() );
- if(consoleConfiguration!=null) {
- Configuration configuration = consoleConfiguration.getConfiguration();
-
- IHQLCodeAssist hqlEval = new HQLCodeAssist(configuration);
-
- String query = ""; //$NON-NLS-1$
- int stringStart = getStringStart( ctx.getDocument(), ctx.getInvocationOffset() );
- int stringEnd = getStringEnd( ctx.getDocument(), ctx.getInvocationOffset() );
- query = ctx.getDocument().get(stringStart, stringEnd-stringStart );
- EclipseHQLCompletionRequestor eclipseHQLCompletionCollector = new EclipseHQLCompletionRequestor(stringStart);
- hqlEval.codeComplete(query, ctx.getInvocationOffset()-stringStart, eclipseHQLCompletionCollector);
- errorMessage = eclipseHQLCompletionCollector.getLastErrorMessage();
-
- proposals = eclipseHQLCompletionCollector.getCompletionProposals();
- }
+ ConsoleConfiguration consoleConfig = getConfiguration( ctx.getProject() );
+ if (consoleConfig != null) {
+ IHQLCodeAssist hqlEval = consoleConfig.getHQLCodeAssist();
+ String query = ""; //$NON-NLS-1$
+ int stringStart = getStringStart( ctx.getDocument(), ctx.getInvocationOffset() );
+ int stringEnd = getStringEnd( ctx.getDocument(), ctx.getInvocationOffset() );
+ query = ctx.getDocument().get(stringStart, stringEnd-stringStart );
+ EclipseHQLCompletionRequestor eclipseHQLCompletionCollector = new EclipseHQLCompletionRequestor(stringStart);
+ hqlEval.codeComplete(query, ctx.getInvocationOffset()-stringStart, eclipseHQLCompletionCollector);
+ errorMessage = eclipseHQLCompletionCollector.getLastErrorMessage();
+ proposals = eclipseHQLCompletionCollector.getCompletionProposals();
+ }
} catch(RuntimeException re) {
HibernateConsolePlugin.getDefault().logErrorMessage( JdtUiMessages.HQLJavaCompletionProposalComputer_errormessage, re );
}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -40,8 +40,9 @@
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.WildcardType;
import org.hibernate.FetchMode;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Mappings;
+import org.hibernate.console.stubs.ConfigStubFactory;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
@@ -88,8 +89,8 @@
*
* @return different configuration for different projects
*/
- public Map<IJavaProject, Configuration> createConfigurations(int processDepth){
- Map<IJavaProject, Configuration> configs = new HashMap<IJavaProject, Configuration>();
+ public Map<IJavaProject, ConfigurationStub> createConfigurations(int processDepth){
+ Map<IJavaProject, ConfigurationStub> configs = new HashMap<IJavaProject, ConfigurationStub>();
if (selectionCU.size() == 0) {
return configs;
}
@@ -129,9 +130,7 @@
return configs;
}
- protected Configuration createConfiguration(IJavaProject project, Map<String, EntityInfo> entities) {
- Configuration config = new Configuration();
-
+ protected ConfigurationStub createConfiguration(IJavaProject project, Map<String, EntityInfo> entities) {
ProcessEntityInfo processor = new ProcessEntityInfo();
processor.setEntities(entities);
@@ -146,6 +145,10 @@
}
}
+ // vitali: TODO: should get ConsoleConfig in association with JavaProject
+ // and create Configuration in execution context of it!
+ ConfigStubFactory configStubFactory = new ConfigStubFactory(null);
+ ConfigurationStub config = configStubFactory.createConfiguration();
Mappings mappings = config.createMappings();
Collection<PersistentClass> classesCollection = createHierarhyStructure(project, processor.getRootClasses());
for (PersistentClass persistentClass : classesCollection) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -61,8 +61,8 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.ide.IDE;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ImageConstants;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -239,80 +239,67 @@
}
this.selection = new StructuredSelection(filteredElements.toArray());
}
-
- protected class HibernateMappingExporter2 extends HibernateMappingExporter {
- protected IJavaProject proj;
- public HibernateMappingExporter2(IJavaProject proj, Configuration cfg, File outputdir) {
- super(cfg, outputdir);
- this.proj = proj;
- }
- /**
- * redefine base exportPOJO to setup right output dir in case
- * of several source folders
- */
- @SuppressWarnings("unchecked")
- @Override
- protected void exportPOJO(Map additionalContext, POJOClass element) {
- File outputdir4FileOld = getOutputDirectory();
- File outputdir4FileNew = outputdir4FileOld;
- String fullyQualifiedName = element.getQualifiedDeclarationName();
- ICompilationUnit icu = Utils.findCompilationUnit(proj, fullyQualifiedName);
- if (icu != null) {
- IResource resource = null;
- try {
- resource = icu.getCorrespondingResource();
- } catch (JavaModelException e) {
- //ignore
- }
- String[] aFQName = fullyQualifiedName.split("\\."); //$NON-NLS-1$
- int n = aFQName.length - 1;
- for ( ; n >= 0 && resource != null; n--) {
- if (n == 0 && aFQName[n].length() == 0) {
- // handle the (default package) case
- break;
- }
- resource = resource.getParent();
- }
- if (resource != null) {
- final IPath projPath = proj.getResource().getLocation();
- IPath place2Gen = previewPage.getRootPlace2Gen().append(proj.getElementName());
- //
- IPath tmpPath = resource.getLocation();
- tmpPath = tmpPath.makeRelativeTo(projPath);
- place2Gen = place2Gen.append(tmpPath);
- outputdir4FileNew = place2Gen.toFile();
- }
- }
- if (!outputdir4FileNew.exists()) {
- outputdir4FileNew.mkdirs();
- }
- setOutputDirectory(outputdir4FileNew);
- super.exportPOJO(additionalContext, element);
- setOutputDirectory(outputdir4FileOld);
- }
- }
protected Map<IJavaProject, IPath> getPlaces2Gen() {
updateCompilationUnits();
- Map<IJavaProject, Configuration> configs = createConfigurations();
+ Map<IJavaProject, ConfigurationStub> configs = createConfigurations();
Map<IJavaProject, IPath> places2Gen = new HashMap<IJavaProject, IPath>();
- for (Entry<IJavaProject, Configuration> entry : configs.entrySet()) {
- Configuration config = entry.getValue();
+ for (Entry<IJavaProject, ConfigurationStub> entry : configs.entrySet()) {
+ ConfigurationStub config = entry.getValue();
HibernateMappingGlobalSettings hmgs = new HibernateMappingGlobalSettings();
hmgs.setDefaultAccess("field"); //$NON-NLS-1$
//final IPath projPath = entry.getKey().getProject().getLocation();
- IPath place2Gen = previewPage.getRootPlace2Gen().append(entry.getKey().getElementName());
- places2Gen.put(entry.getKey(), place2Gen);
+ IPath place2GenRoot = previewPage.getRootPlace2Gen().append(entry.getKey().getElementName());
+ places2Gen.put(entry.getKey(), place2GenRoot);
- File folder2Gen = new File(place2Gen.toOSString());
+ File folder2Gen = new File(place2GenRoot.toOSString());
FileUtils.delete(folder2Gen); // cleanup folder before gen info
if (!folder2Gen.exists()) {
folder2Gen.mkdirs();
}
- HibernateMappingExporter2 hce = new HibernateMappingExporter2(
- entry.getKey(), config, folder2Gen);
+
+ final IJavaProject proj = entry.getKey();
+ ConfigurationStub.IExporterNewOutputDir nod = new ConfigurationStub.IExporterNewOutputDir() {
+ /**
+ * redefine base exportPOJO to setup right output dir in case
+ * of several source folders
+ */
+ public File getNewOutputDir(POJOClass element, File outputdir4FileNew) {
+ String fullyQualifiedName = element.getQualifiedDeclarationName();
+ ICompilationUnit icu = Utils.findCompilationUnit(proj, fullyQualifiedName);
+ if (icu != null) {
+ IResource resource = null;
+ try {
+ resource = icu.getCorrespondingResource();
+ } catch (JavaModelException e) {
+ //ignore
+ }
+ String[] aFQName = fullyQualifiedName.split("\\."); //$NON-NLS-1$
+ int n = aFQName.length - 1;
+ for ( ; n >= 0 && resource != null; n--) {
+ if (n == 0 && aFQName[n].length() == 0) {
+ // handle the (default package) case
+ break;
+ }
+ resource = resource.getParent();
+ }
+ if (resource != null) {
+ final IPath projPath = proj.getResource().getLocation();
+ IPath place2Gen = previewPage.getRootPlace2Gen().append(proj.getElementName());
+ //
+ IPath tmpPath = resource.getLocation();
+ tmpPath = tmpPath.makeRelativeTo(projPath);
+ place2Gen = place2Gen.append(tmpPath);
+ outputdir4FileNew = place2Gen.toFile();
+ }
+ }
+ return outputdir4FileNew;
+ }
+ };
+ HibernateMappingExporter hce = config.createHibernateMappingExporter(folder2Gen, nod);
+
hce.setGlobalSettings(hmgs);
//hce.setForEach("entity");
//hce.setFilePattern(file.getName());
@@ -536,9 +523,9 @@
}
- protected Map<IJavaProject, Configuration> createConfigurations() {
+ protected Map<IJavaProject, ConfigurationStub> createConfigurations() {
ConfigurationActor actor = new ConfigurationActor(selectionCU);
- Map<IJavaProject, Configuration> configs = actor.createConfigurations(processDepth);
+ Map<IJavaProject, ConfigurationStub> configs = actor.createConfigurations(processDepth);
return configs;
}
Modified: branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/HbmExportExceptionTest.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -25,10 +25,10 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.execution.ExecutionContext;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.project.ConfigurableTestProject;
import org.hibernate.eclipse.console.test.utils.ConsoleConfigUtils;
@@ -36,6 +36,7 @@
import org.hibernate.tool.hbm2x.ExporterException;
import org.hibernate.tool.hbm2x.HibernateMappingExporter;
import org.hibernate.tool.hbm2x.HibernateMappingGlobalSettings;
+import org.hibernate.tool.hbm2x.pojo.POJOClass;
/**
* @author Dmitry Geraskov
@@ -83,7 +84,7 @@
return consCFG;
}
} );
- Configuration config = consCFG.getConfiguration();
+ ConfigurationStub config = consCFG.getConfiguration();
//delete old hbm files
assertNotNull( testPackage );
@@ -101,10 +102,13 @@
HibernateMappingGlobalSettings hmgs = new HibernateMappingGlobalSettings();
+ ConfigurationStub.IExporterNewOutputDir nod = new ConfigurationStub.IExporterNewOutputDir() {
+ public File getNewOutputDir(POJOClass element, File outputdir4FileNew) {
+ return outputdir4FileNew;
+ }
+ };
+ HibernateMappingExporter hce = config.createHibernateMappingExporter(getSrcFolder(), nod);
- HibernateMappingExporter hce = new HibernateMappingExporter(config,
- getSrcFolder());
-
hce.setGlobalSettings(hmgs);
try {
hce.start();
@@ -120,15 +124,7 @@
consCFG.build();
assertTrue(consCFG.hasConfiguration());
- consCFG.execute( new ExecutionContext.Command() {
-
- public Object execute() {
- if(consCFG.hasConfiguration()) {
- consCFG.getConfiguration().buildMappings();
- }
- return consCFG;
- }
- } );
+ consCFG.buildMappings();
config = consCFG.getConfiguration();
} catch (CoreException e) {
String out = NLS.bind(ConsoleTestMessages.UpdateConfigurationTest_error_customising_file_for_package,
Modified: branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingDiagramTest.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -21,9 +21,9 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.hibernate.InvalidMappingException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.utils.Utils;
import org.hibernate.eclipse.console.workbench.ConfigurationWorkbenchAdapter;
@@ -68,7 +68,7 @@
Object[] persClasses = null;
try {
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
- assertTrue(configs[0] instanceof Configuration);
+ assertTrue(configs[0] instanceof ConfigurationStub);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
String out = NLS.bind(ConsoleTestMessages.OpenMappingDiagramTest_mapping_diagrams_for_package_cannot_be_opened,
Modified: branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenMappingFileTest.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -24,9 +24,9 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.hibernate.InvalidMappingException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.actions.OpenMappingAction;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.utils.Utils;
@@ -75,7 +75,7 @@
Object[] props = null;
try {
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
- assertTrue(configs[0] instanceof Configuration);
+ assertTrue(configs[0] instanceof ConfigurationStub);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex){
String out = NLS.bind(ConsoleTestMessages.OpenMappingFileTest_mapping_files_for_package_cannot_be_opened,
Modified: branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/OpenSourceFileTest.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -24,9 +24,9 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.hibernate.InvalidMappingException;
-import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.actions.OpenSourceAction;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.utils.Utils;
@@ -77,7 +77,7 @@
Object[] fields = null;
try {
configs = new ConsoleConfigurationWorkbenchAdapter().getChildren(consCFG);
- assertTrue(configs[0] instanceof Configuration);
+ assertTrue(configs[0] instanceof ConfigurationStub);
persClasses = new ConfigurationWorkbenchAdapter().getChildren(configs[0]);
} catch (InvalidMappingException ex) {
String out = NLS.bind(ConsoleTestMessages.OpenSourceFileTest_source_files_for_package_cannot_be_opened,
Added: branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/.settings/org.eclipse.hyades.test.tools.core.prefs
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/.settings/org.eclipse.hyades.test.tools.core.prefs (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/.settings/org.eclipse.hyades.test.tools.core.prefs 2010-03-18 20:04:29 UTC (rev 20916)
@@ -0,0 +1,3 @@
+#Tue Feb 02 14:06:59 EET 2010
+defaultJUnitTestSuiteFactory=org.eclipse.hyades.test.plugin.junit.testSuite
+eclipse.preferences.version=1
Modified: branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java 2010-03-18 19:52:20 UTC (rev 20915)
+++ branches/hibernatetools-multiversion/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/hbmexporter/HbmExporterTest.java 2010-03-18 20:04:29 UTC (rev 20916)
@@ -20,7 +20,7 @@
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.cfg.Configuration;
+import org.hibernate.console.stubs.ConfigurationStub;
import org.hibernate.eclipse.console.test.ConsoleTestMessages;
import org.hibernate.eclipse.console.test.project.TestProject;
import org.hibernate.eclipse.console.test.utils.FilesTransfer;
@@ -75,7 +75,7 @@
* Fails if configuration is null.
* @return
*/
- protected Configuration getConfigurationFor(String... cuNames){
+ protected ConfigurationStub getConfigurationFor(String... cuNames){
Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
for (int i = 0; i < cuNames.length; i++) {
ICompilationUnit icu = Utils.findCompilationUnit(project.getIJavaProject(),
@@ -84,21 +84,21 @@
selectionCU.add(icu);
}
ConfigurationActor actor = new ConfigurationActor(selectionCU);
- Map<IJavaProject, Configuration> configurations = actor.createConfigurations(Integer.MAX_VALUE);
+ Map<IJavaProject, ConfigurationStub> configurations = actor.createConfigurations(Integer.MAX_VALUE);
assertEquals(1, configurations.size());
- Configuration config = configurations.get(project.getIJavaProject());
+ ConfigurationStub config = configurations.get(project.getIJavaProject());
assertNotNull(config);
return config;
}
- protected void checkClassesMaped(Configuration config, String... classesNames){
+ protected void checkClassesMaped(ConfigurationStub config, String... classesNames){
for (int i = 0; i < classesNames.length; i++) {
assertNotNull(config.getClassMapping(classesNames[i]));
}
}
public void testId(){
- Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ ConfigurationStub config = getConfigurationFor("pack.A"); //$NON-NLS-1$
checkClassesMaped(config, "pack.A", "pack.B"); //$NON-NLS-1$ //$NON-NLS-2$
PersistentClass a = config.getClassMapping("pack.A"); //$NON-NLS-1$
PersistentClass b = config.getClassMapping("pack.B"); //$NON-NLS-1$
@@ -112,7 +112,7 @@
}
public void testProperty(){
- Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ ConfigurationStub config = getConfigurationFor("pack.A"); //$NON-NLS-1$
checkClassesMaped(config, "pack.A", "pack.B"); //$NON-NLS-1$ //$NON-NLS-2$
PersistentClass a = config.getClassMapping("pack.A"); //$NON-NLS-1$
@@ -125,7 +125,7 @@
}
public void testArray(){
- Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ ConfigurationStub config = getConfigurationFor("pack.A"); //$NON-NLS-1$
checkClassesMaped(config, "pack.A", "pack.B"); //$NON-NLS-1$ //$NON-NLS-2$
PersistentClass a = config.getClassMapping("pack.A"); //$NON-NLS-1$
PersistentClass b = config.getClassMapping("pack.B"); //$NON-NLS-1$
@@ -151,7 +151,7 @@
}
public void testList(){
- Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ ConfigurationStub config = getConfigurationFor("pack.A"); //$NON-NLS-1$
checkClassesMaped(config, "pack.A", "pack.B"); //$NON-NLS-1$ //$NON-NLS-2$
PersistentClass a = config.getClassMapping("pack.A"); //$NON-NLS-1$
PersistentClass b = config.getClassMapping("pack.B"); //$NON-NLS-1$
@@ -169,7 +169,7 @@
}
public void testSet(){
- Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ ConfigurationStub config = getConfigurationFor("pack.A"); //$NON-NLS-1$
checkClassesMaped(config, "pack.A", "pack.B"); //$NON-NLS-1$ //$NON-NLS-2$
PersistentClass a = config.getClassMapping("pack.A"); //$NON-NLS-1$
PersistentClass b = config.getClassMapping("pack.B"); //$NON-NLS-1$
@@ -186,7 +186,7 @@
}
public void testMap(){
- Configuration config = getConfigurationFor("pack.A"); //$NON-NLS-1$
+ ConfigurationStub config = getConfigurationFor("pack.A"); //$NON-NLS-1$
checkClassesMaped(config, "pack.A", "pack.B"); //$NON-NLS-1$ //$NON-NLS-2$
PersistentClass a = config.getClassMapping("pack.A"); //$NON-NLS-1$
PersistentClass b = config.getClassMapping("pack.B"); //$NON-NLS-1$
14 years, 7 months
JBoss Tools SVN: r20915 - trunk/as/docs/reference/en-US.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-03-18 15:52:20 -0400 (Thu, 18 Mar 2010)
New Revision: 20915
Modified:
trunk/as/docs/reference/en-US/master_output.xml
trunk/as/docs/reference/en-US/quick_start.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-1143 - link to Jboss5FAQ was corrected
Modified: trunk/as/docs/reference/en-US/master_output.xml
===================================================================
--- trunk/as/docs/reference/en-US/master_output.xml 2010-03-18 19:50:56 UTC (rev 20914)
+++ trunk/as/docs/reference/en-US/master_output.xml 2010-03-18 19:52:20 UTC (rev 20915)
@@ -347,7 +347,7 @@
<para>The latest documentation builds are available <ulink url="http://download.jboss.org/jbosstools/nightly-docs/"> JBoss Tools nightly builds documentation page</ulink>.</para>
<para>Find out the answers on the frequently asked questions about JBoss AS 5 usage in the
- <ulink url="http://www.jboss.org/community/wiki/jboss5faq">JBoss5FAQ</ulink>.
+ <ulink url="http://community.jboss.org/wiki/JBossAS5FAQ">JBossAS5FAQ</ulink>.
</para>
<para>The information on how to monitor a remote JBoss Server from Eclipse you can find in the following
Modified: trunk/as/docs/reference/en-US/quick_start.xml
===================================================================
--- trunk/as/docs/reference/en-US/quick_start.xml 2010-03-18 19:50:56 UTC (rev 20914)
+++ trunk/as/docs/reference/en-US/quick_start.xml 2010-03-18 19:52:20 UTC (rev 20915)
@@ -284,7 +284,7 @@
url="http://download.jboss.org/jbosstools/nightly-docs/"> JBoss Tools nightly builds documentation page</ulink>.</para>
<para>Find out the answers on the frequently asked questions about JBoss AS 5 usage in the
- <ulink url="http://www.jboss.org/community/wiki/jboss5faq">JBoss5FAQ</ulink>.
+ <ulink url="http://community.jboss.org/wiki/JBossAS5FAQ">JBossAS5FAQ</ulink>.
</para>
<para>The information on how to monitor a remote JBoss Server from Eclipse you can find in the following
14 years, 7 months