JBoss Tools SVN: r15327 - in trunk/jsf/docs: jsf_tools_tutorial/en/images/jsf_application and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-05-18 10:21:59 -0400 (Mon, 18 May 2009)
New Revision: 15327
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_5.png
trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_6.png
trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_8.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 - All of the screens with out-of-date Visual/Source Editor view were updated in all JSF docs.</p>
</body></html>
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_5.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_6.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_8.png
===================================================================
(Binary files differ)
15 years, 4 months
JBoss Tools SVN: r15326 - trunk/struts/docs/struts_tools_tutorial/en/images/struts_application.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-05-18 10:21:01 -0400 (Mon, 18 May 2009)
New Revision: 15326
Modified:
trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_4.png
trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_5.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 - All of the screens with out-of-date Visual/Source Editor view were updated in all Struts docs.</p>
</body></html>
Modified: trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_4.png
===================================================================
(Binary files differ)
Modified: trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_5.png
===================================================================
(Binary files differ)
15 years, 4 months
JBoss Tools SVN: r15325 - in trunk/seam/docs/reference/en/images: crud_database_application and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-05-18 10:16:34 -0400 (Mon, 18 May 2009)
New Revision: 15325
Modified:
trunk/seam/docs/reference/en/images/adding_seam_support_to_project/added_seam_support_to_ear_project.png
trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_15.png
trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_11.png
trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_14.png
trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_15.png
trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_5.png
trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_8.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 - All of the screens with out-of-date Visual/Source Editor view were updated in the Seam guide.</p>
</body></html>
Modified: trunk/seam/docs/reference/en/images/adding_seam_support_to_project/added_seam_support_to_ear_project.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/crud_database_application/crud_database_application_15.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_11.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_14.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_15.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_5.png
===================================================================
(Binary files differ)
Modified: trunk/seam/docs/reference/en/images/seam_wizards/seam_wizards_8.png
===================================================================
(Binary files differ)
15 years, 4 months
JBoss Tools SVN: r15324 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-05-18 09:59:35 -0400 (Mon, 18 May 2009)
New Revision: 15324
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-05-18 10:18:49 UTC (rev 15323)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-05-18 13:59:35 UTC (rev 15324)
@@ -118,8 +118,8 @@
SeamProjectsSet projectsSet = new SeamProjectsSet(declarationFile.getProject());
IProject[] projects = projectsSet.getAllProjects();
- for (int i = 0; i < projects.length; i++) {
- scan(projects[i]);
+ for (IProject project : projects) {
+ scan(project);
}
}
@@ -180,7 +180,7 @@
declarationFile = (IFile)xmlDecl.getResource();
if(declarationFile != null && !coreHelper.isJar(xmlDecl)){
ITextSourceReference location = ((SeamComponentDeclaration)xmlDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
- if(location != null)
+ if(location != null && !isBadLocation(location))
changeXMLNode(location, declarationFile);
}
}
15 years, 4 months
JBoss Tools SVN: r15323 - in branches/jbosstools-3.0.x/archives: tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-05-18 06:18:49 -0400 (Mon, 18 May 2009)
New Revision: 15323
Modified:
branches/jbosstools-3.0.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
branches/jbosstools-3.0.x/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
Log:
JBIDE-4330 in branch
Modified: branches/jbosstools-3.0.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- branches/jbosstools-3.0.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-05-18 09:21:04 UTC (rev 15322)
+++ branches/jbosstools-3.0.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-05-18 10:18:49 UTC (rev 15323)
@@ -112,7 +112,7 @@
protected File getChild(File file, String element) {
if( !fs.inWorkspace)
- return super.getChild(file, element);
+ return new FileWrapper(file, new Path(file.getAbsolutePath()));
FileWrapper pWrapper = (FileWrapper)file;
File child = super.getChild(file, element);
FileWrapper childWrapper = new FileWrapper(child, pWrapper.getWrapperPath().append(element));
Modified: branches/jbosstools-3.0.x/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
===================================================================
--- branches/jbosstools-3.0.x/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2009-05-18 09:21:04 UTC (rev 15322)
+++ branches/jbosstools-3.0.x/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2009-05-18 10:18:49 UTC (rev 15323)
@@ -15,6 +15,7 @@
import org.jboss.ide.eclipse.archives.test.core.ArchivesCoreTest;
import org.jboss.ide.eclipse.archives.test.core.ant.SimpleAntTest;
+import org.jboss.ide.eclipse.archives.test.model.DirectoryScannerTest;
import org.jboss.ide.eclipse.archives.test.model.ModelCreationTest;
import org.jboss.ide.eclipse.archives.test.model.ModelTruezipBridgeTest;
import org.jboss.ide.eclipse.archives.test.model.ModelUtilTest;
@@ -40,7 +41,8 @@
suite.addTestSuite(ModelCreationTest.class);
suite.addTestSuite(ModelTruezipBridgeTest.class);
suite.addTestSuite(SimpleAntTest.class);
-
+ suite.addTestSuite(DirectoryScannerTest.class);
+
// jiras
suite.addTestSuite(JBIDE1406Test.class);
suite.addTestSuite(JBIDE2099Test.class);
15 years, 4 months
JBoss Tools SVN: r15322 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-05-18 05:21:04 -0400 (Mon, 18 May 2009)
New Revision: 15322
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3457
Messages added and externalized, code refactored,
Next and Finish validation added.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2009-05-18 08:36:28 UTC (rev 15321)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2009-05-18 09:21:04 UTC (rev 15322)
@@ -192,6 +192,8 @@
public static String NewConfigurationWizardPage_session_factory_name;
public static String NewConfigurationWizardPage_this_wizard_creates;
public static String NewConfigurationWizardPage_user_name;
+ public static String NewHibernateMappingElementsSelectionPage_select;
+
public static String NewHibernateMappingFilePage_browse;
public static String NewHibernateMappingFilePage_class_to_map;
public static String NewHibernateMappingFilePage_container;
@@ -209,7 +211,13 @@
public static String NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file;
public static String NewHibernateMappingFileWizard_create_new_xml_mapping_file;
public static String NewHibernateMappingFileWizard_creating;
+
+ public static String NewHibernateMappingFileWizard_error;
+
+ public static String NewHibernateMappingFileWizard_finding_dependent_cu;
public static String NewHibernateMappingFileWizard_opening_file_for_editing;
+
+ public static String NewHibernateMappingFileWizard_selection_cant_be_empty;
public static String NewReverseEngineeringFileWizard_create_hibernate_reverse_engineering_file;
public static String NewReverseEngineeringFileWizard_create_new_hibernate_reveng_xml;
public static String NewReverseEngineeringFileWizard_creating;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-05-18 08:36:28 UTC (rev 15321)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-05-18 09:21:04 UTC (rev 15322)
@@ -188,6 +188,7 @@
NewConfigurationWizardPage_session_factory_name=&Session factory name:
NewConfigurationWizardPage_this_wizard_creates=This wizard creates a new configuration file to use with Hibernate.
NewConfigurationWizardPage_user_name=User&name:
+NewHibernateMappingElementsSelectionPage_select=Select compilation units or containers.
NewHibernateMappingFilePage_browse=Browse...
NewHibernateMappingFilePage_class_to_map=Class to &map:
NewHibernateMappingFilePage_container=&Container:
@@ -203,9 +204,12 @@
NewHibernateMappingFilePage_the_class_will_be_used_when=The class will be used when generating the hbm.xml file
NewHibernateMappingFilePage_this_wizard_creates=This wizard creates a new Hibernate XML Mapping file
NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file=Create Hibernate XML Mapping file (hbm.xml)
-NewHibernateMappingFileWizard_create_new_xml_mapping_file=Create a new XML Mapping file.
+NewHibernateMappingFileWizard_create_new_xml_mapping_file=Create new XML Mapping files.
NewHibernateMappingFileWizard_creating=Creating
+NewHibernateMappingFileWizard_error=Must use WizardDialog implementation as WizardContainer
+NewHibernateMappingFileWizard_finding_dependent_cu=Finding dependent compilation units...
NewHibernateMappingFileWizard_opening_file_for_editing=Opening file for editing...
+NewHibernateMappingFileWizard_selection_cant_be_empty=Selection can't be empty
NewReverseEngineeringFileWizard_create_hibernate_reverse_engineering_file=Create Hibernate Reverse Engineering file (reveng.xml)
NewReverseEngineeringFileWizard_create_new_hibernate_reveng_xml=Create a new hibernate.reveng.xml.
NewReverseEngineeringFileWizard_creating=Creating
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-05-18 08:36:28 UTC (rev 15321)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-05-18 09:21:04 UTC (rev 15322)
@@ -20,7 +20,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
public class NewHibernateMappingElementsSelectionPage extends WizardPage {
@@ -31,12 +31,8 @@
private boolean fAllowMultiple = true;
- private int fWidth = 50;
-
- private int fHeight = 18;
-
public NewHibernateMappingElementsSelectionPage(IStructuredSelection selection) {
- super("", "", null);
+ super("", "", null); //$NON-NLS-1$ //$NON-NLS-2$
fCurrentSelection = selection;
}
@@ -44,31 +40,53 @@
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
createTreeViewer(composite);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
-
- Tree treeWidget = fViewer.getTree();
- treeWidget.setLayoutData(data);
+ fViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
setControl(composite);
}
+
+ public IStructuredSelection getSelection(){
+ return fCurrentSelection;
+ }
+
+ public void setAllowMultiple(boolean isAllowMultiple){
+ fAllowMultiple = isAllowMultiple;
+ }
+
protected TreeViewer createTreeViewer(Composite composite) {
int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
- fViewer = new TreeViewer(new Tree(composite, style));
+ fViewer = new TreeViewer(composite, style);
fViewer.setContentProvider(new StandardJavaElementContentProvider());
fViewer.setLabelProvider(new JavaElementLabelProvider());
fViewer.setFilters(getFilters());
- fViewer.addSelectionChangedListener(getSelectionChangedListener());
+ fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ fCurrentSelection = (IStructuredSelection) event.getSelection();
+ updateStatus();
+ }
+ });
fViewer.setInput(getInput());
fViewer.setSelection(fCurrentSelection, true);
return fViewer;
}
protected ViewerFilter[] getFilters(){
- return new ViewerFilter[] { new ViewerFilter() {
+ return new ViewerFilter[] { new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (element instanceof JarPackageFragmentRoot) {
+ return false;
+ } else if (element instanceof ICompilationUnit) {
+ return true;
+ } else if (element instanceof IParent) {
+ return hasCompilationUnits((IParent)element);
+ } else {
+ return false;
+ }
+ }
+
public boolean hasCompilationUnits(IParent parent){
IJavaElement[] elements;
try {
@@ -89,20 +107,6 @@
return false;
}
- @Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
- if (element instanceof JarPackageFragmentRoot) {
- return false;
- } else if (element instanceof ICompilationUnit) {
- return true;
- } else if (element instanceof IParent) {
- return hasCompilationUnits((IParent)element);
- } else {
- return false;
- }
- }
-
} };
}
@@ -110,24 +114,13 @@
return JavaCore.create( ResourcesPlugin.getWorkspace().getRoot() );
}
- public IStructuredSelection getSelection(){
- return fCurrentSelection;
- }
-
- protected ISelectionChangedListener getSelectionChangedListener() {
- return new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fCurrentSelection = (IStructuredSelection) event.getSelection();
- updateStatus();
- }
- };
- }
-
- public void setAllowMultiple(boolean isAllowMultiple){
- fAllowMultiple = isAllowMultiple;
- }
-
protected void updateStatus() {
- // TODO Auto-generated method stub
+ setPageComplete((fCurrentSelection != null && !fCurrentSelection.isEmpty()));
+ if (isPageComplete()){
+ setMessage(null);
+ } else {
+ setMessage(HibernateConsoleMessages.NewHibernateMappingElementsSelectionPage_select);
+ }
}
+
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-05-18 08:36:28 UTC (rev 15321)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-05-18 09:21:04 UTC (rev 15322)
@@ -54,7 +54,7 @@
* @param pageName
*/
protected NewHibernateMappingFilePage() {
- super("");
+ super(""); //$NON-NLS-1$
setTitle(HibernateConsoleMessages.NewHibernateMappingFilePage_hibernate_xml_mapping_file);
setDescription(HibernateConsoleMessages.NewHibernateMappingFilePage_this_wizard_creates);
}
@@ -83,6 +83,12 @@
sc.setMinSize(container.computeSize(SWT.DEFAULT, SWT.DEFAULT));
setControl(container);
}
+
+ public void setInput(Map<IJavaProject, Collection<EntityInfo>> project_infos){
+ viewer.setInput(project_infos);
+ //Hide "project" column if only 1 project's CUs selected
+ viewer.getTable().getColumn(1).setWidth(project_infos.size() == 1 ? 0 : 120);
+ }
private void createTableColumns(Table table){
int coulmnIndex = 0;
@@ -109,23 +115,16 @@
private TableViewer createTableViewer(Table table) {
TableViewer result = new TableViewer( table );
result.setUseHashlookup( true );
- //if (project_infos.keySet().size() > 1){
- result.setColumnProperties( new String[] {"create", "project", //$NON-NLS-1$//$NON-NLS-2$
- "class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
- /*} else {
- result.setColumnProperties( new String[] {"create", //$NON-NLS-1$
- "class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
- }*/
+ result.setColumnProperties( new String[] {Columns.CREATE.toString(),
+ Columns.PROJECT.toString(), Columns.CLASS.toString(), Columns.FILE.toString()} );
+
CellEditor[] editors = new CellEditor[result.getColumnProperties().length];
editors[0] = new CheckboxCellEditor( result.getTable() );
editors[1] = new TextCellEditor( result.getTable() );
editors[2] = new TextCellEditor( result.getTable() );
- //if (project_infos.keySet().size() > 1){
editors[3] = new TextCellEditor( result.getTable() );
- //}
-
result.setCellEditors( editors );
result.setCellModifier( new TableCellModifier(result) );
result.setLabelProvider(new TableLableProvider(result));
@@ -133,10 +132,6 @@
return result;
}
- public void setInput(Map<IJavaProject, Collection<EntityInfo>> project_infos){
- viewer.setInput(project_infos);
- }
-
private class TableLine {
public String projectName;
@@ -159,6 +154,13 @@
}
}
+
+ private enum Columns {
+ PROJECT,
+ CLASS,
+ FILE,
+ CREATE
+ }
private class TableContentProvider implements IStructuredContentProvider {
@@ -194,7 +196,7 @@
public Image getColumnImage(Object element, int columnIndex) {
String property = (String) tv.getColumnProperties()[columnIndex];
- if("create".equals(property)) {
+ if(Columns.CREATE.toString().equals(property)) {
TableLine tl = (TableLine) element;
String key = tl.isCreate ? null : ImageConstants.CLOSE ; // TODO: find a better image
return EclipseImages.getImage(key);
@@ -206,14 +208,14 @@
String property = (String) tv.getColumnProperties()[columnIndex];
TableLine tl = (TableLine) element;
- if ("class".equals(property)){
+ if (Columns.CLASS.toString().equals(property)){
return tl.className;
- } else if ("project".equals(property)){
+ } else if (Columns.PROJECT.toString().equals(property)){
return tl.projectName;
- } else if ("file".equals(property)){
+ } else if (Columns.FILE.toString().equals(property)){
return tl.fileName;
} else {
- return "";
+ return "";//$NON-NLS-1$
}
}
}
@@ -231,13 +233,13 @@
}
public Object getValue(Object element, String property) {
- if ("class".equals(property)){
+ if (Columns.CLASS.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).className;
- } else if ("project".equals(property)){
+ } else if (Columns.PROJECT.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).projectName;
- } else if ("file".equals(property)){
+ } else if (Columns.FILE.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).fileName;
- } else if ("create".equals(property)){
+ } else if (Columns.CREATE.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).isCreate;
}
return null;
@@ -245,13 +247,13 @@
public void modify(Object element, String property, Object value) {
TableLine tl = (TableLine)((TableItem)element).getData();
- if ("class".equals(property)){
+ if (Columns.CLASS.toString().equals(property)){
tl.className = (String)value;
- } else if ("project".equals(property)){
+ } else if (Columns.PROJECT.toString().equals(property)){
tl.projectName = (String)value;
- } else if ("file".equals(property)){
+ } else if (Columns.FILE.toString().equals(property)){
tl.fileName = (String)value;
- } else if ("create".equals(property)){
+ } else if (Columns.CREATE.toString().equals(property)){
tl.isCreate = (Boolean)value;
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-05-18 08:36:28 UTC (rev 15321)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-05-18 09:21:04 UTC (rev 15322)
@@ -19,15 +19,14 @@
import java.util.Set;
import java.util.Map.Entry;
-import org.eclipse.core.internal.resources.File;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.JavaElementInfo;
@@ -49,7 +48,6 @@
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
-import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
import org.hibernate.tool.hbm2x.HibernateMappingExporter;
import org.hibernate.tool.hbm2x.HibernateMappingGlobalSettings;
@@ -63,16 +61,16 @@
* Selected compilation units for startup processing,
* result of processing selection
*/
- private Set<ICompilationUnit> selectionCU = new HashSet<ICompilationUnit>();
+ private Set<ICompilationUnit> selectionCU = null;
private Map<IJavaProject, Collection<EntityInfo>> project_infos = new HashMap<IJavaProject, Collection<EntityInfo>>();
- private IStructuredSelection selection;
+ private IStructuredSelection selection;
+ private NewHibernateMappingElementsSelectionPage page1 = null;
+
private NewHibernateMappingFilePage page2 = null;
- private NewHibernateMappingElementsSelectionPage page1 = null;
-
public NewHibernateMappingFileWizard(){
setDefaultPageImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.NEW_WIZARD) );
setNeedsProgressMonitor(true);
@@ -90,41 +88,14 @@
if (getContainer() instanceof WizardDialog) {
((WizardDialog) getContainer()).addPageChangingListener(this);
} else {
- throw new IllegalArgumentException("Must use WizardDialog implementation as WizardContainer");
+ throw new IllegalArgumentException(HibernateConsoleMessages.NewHibernateMappingFileWizard_error);
}
}
public void handlePageChanging(PageChangingEvent event) {
if (event.getTargetPage() == page2){
- selection = page1.getSelection();
- try {
- getContainer().run(false, false, new IRunnableWithProgress(){
-
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- monitor.beginTask("Find dependent compilation units", selection.size() + 1);
- Iterator it = selection.iterator();
- int done = 1;
- while (it.hasNext()) {
- Object obj = it.next();
- processJavaElements(obj);
- monitor.worked(done++);
- Thread.currentThread();
- Thread.sleep(1000);
- }
- initEntitiesInfo();
- monitor.worked(1);
- monitor.done();
- }
- });
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- page2.setInput(project_infos);
+ updateCompilationUnits();
+ page2.setInput(project_infos);
}
}
@@ -134,6 +105,7 @@
@Override
public boolean performFinish() {
+ updateCompilationUnits();
Map<IJavaProject, Configuration> configs = createConfigurations();
for (Entry<IJavaProject, Configuration> entry : configs.entrySet()) {
Configuration config = entry.getValue();
@@ -198,81 +170,44 @@
collector.collect(icu);
}
collector.resolveRelations();
- //I don't check here if any non abstract class selected
project_infos.put(javaProject, collector.getMapCUs_Info().values());
}
}
protected void processJavaElements(Object obj) {
- if (obj instanceof ICompilationUnit) {
- ICompilationUnit cu = (ICompilationUnit)obj;
- selectionCU.add(cu);
- }
- else if (obj instanceof File) {
- File file = (File)obj;
- if (file != null && file.getProject() != null) {
- IJavaProject javaProject = JavaCore.create(file.getProject());
- ICompilationUnit[] cus = Utils.findCompilationUnits(javaProject,
- file.getFullPath());
- if (cus != null) {
- for (ICompilationUnit cu : cus) {
- selectionCU.add(cu);
- }
- }
- }
- }
- else if (obj instanceof JavaProject) {
- JavaProject javaProject = (JavaProject)obj;
- IPackageFragmentRoot[] pfr = null;
- try {
- pfr = javaProject.getAllPackageFragmentRoots();
- } catch (JavaModelException e) {
- // just ignore it!
- //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
- }
- if (pfr != null) {
+ try {
+ if (obj instanceof ICompilationUnit) {
+ ICompilationUnit cu = (ICompilationUnit) obj;
+ selectionCU.add(cu);
+ } else if (obj instanceof JavaProject) {
+ JavaProject javaProject = (JavaProject) obj;
+ IPackageFragmentRoot[] pfr = javaProject.getAllPackageFragmentRoots();
for (IPackageFragmentRoot element : pfr) {
processJavaElements(element);
}
- }
- }
- else if (obj instanceof PackageFragment) {
- PackageFragment packageFragment = (PackageFragment)obj;
- ICompilationUnit[] cus = null;
- try {
- cus = packageFragment.getCompilationUnits();
- } catch (JavaModelException e) {
- // just ignore it!
- //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
- }
- if (cus != null) {
+ } else if (obj instanceof PackageFragment) {
+ PackageFragment packageFragment = (PackageFragment) obj;
+ ICompilationUnit[] cus = packageFragment.getCompilationUnits();
for (ICompilationUnit cu : cus) {
selectionCU.add(cu);
}
- }
- }
- else if (obj instanceof PackageFragmentRoot) {
- JavaElement javaElement = (JavaElement)obj;
- JavaElementInfo javaElementInfo = null;
- try {
- javaElementInfo = (JavaElementInfo)javaElement.getElementInfo();
- } catch (JavaModelException e) {
- // just ignore it!
- //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
- }
- if (javaElementInfo != null) {
+ } else if (obj instanceof PackageFragmentRoot) {
+ JavaElement javaElement = (JavaElement) obj;
+ JavaElementInfo javaElementInfo = (JavaElementInfo) javaElement.getElementInfo();
IJavaElement[] je = javaElementInfo.getChildren();
for (IJavaElement element : je) {
processJavaElements(element);
}
+ } else if (obj instanceof JavaElement) {
+ JavaElement javaElement = (JavaElement) obj;
+ ICompilationUnit cu = javaElement.getCompilationUnit();
+ selectionCU.add(cu);
}
+ } catch (JavaModelException e) {
+ // just ignore it!
+ //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ", e); //$NON-NLS-1$
}
- else if (obj instanceof JavaElement) {
- JavaElement javaElement = (JavaElement)obj;
- ICompilationUnit cu = javaElement.getCompilationUnit();
- selectionCU.add(cu);
- }
}
@@ -282,4 +217,37 @@
return configs;
}
+
+ protected void updateCompilationUnits(){
+ Assert.isNotNull(page1.getSelection(), HibernateConsoleMessages.NewHibernateMappingFileWizard_selection_cant_be_empty);
+ if ((selectionCU == null) || !page1.getSelection().equals(selection)) {
+ selectionCU = new HashSet<ICompilationUnit>();
+ project_infos.clear();
+ selection = page1.getSelection();
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(HibernateConsoleMessages.NewHibernateMappingFileWizard_finding_dependent_cu, selection.size() + 1);
+ Iterator it = selection.iterator();
+ int done = 1;
+ while (it.hasNext()) {
+ Object obj = it.next();
+ processJavaElements(obj);
+ monitor.worked(done++);
+ }
+ initEntitiesInfo();
+ monitor.worked(1);
+ monitor.done();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ HibernateConsolePlugin.getDefault().log(e);
+ } catch (InterruptedException e) {
+ HibernateConsolePlugin.getDefault().log(e);
+ }
+ }
+ }
}
15 years, 4 months
JBoss Tools SVN: r15321 - in trunk/archives: tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-05-18 04:36:28 -0400 (Mon, 18 May 2009)
New Revision: 15321
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java
Log:
JBIDE-4330 - ISsue Tracker 291358 - single file matching failed
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-05-18 06:14:54 UTC (rev 15320)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2009-05-18 08:36:28 UTC (rev 15321)
@@ -112,7 +112,7 @@
protected File getChild(File file, String element) {
if( !fs.inWorkspace)
- return super.getChild(file, element);
+ return new FileWrapper(file, new Path(file.getAbsolutePath()), fs.rootArchiveRelativePath);
FileWrapper pWrapper = (FileWrapper)file;
File child = super.getChild(file, element);
FileWrapper childWrapper = new FileWrapper(child, pWrapper.getWrapperPath().append(element), fs.rootArchiveRelativePath);
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java 2009-05-18 06:14:54 UTC (rev 15320)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/DirectoryScannerTest.java 2009-05-18 08:36:28 UTC (rev 15321)
@@ -45,7 +45,7 @@
ResourcesUtils.deleteProject(proj.getName());
}
- public void testScanner() {
+ public void testScannerIterator() {
DirectoryScannerExtension scanner1 =
DirectoryScannerFactory.createDirectoryScanner(
proj.getLocation().toOSString(), null,
@@ -75,4 +75,24 @@
assertEquals(results.length, iterated.size());
}
+
+ public void testSingleFileScanner() {
+ DirectoryScannerExtension scanner1 =
+ DirectoryScannerFactory.createDirectoryScanner(
+ proj.getLocation().append("Resources").append("images").toOSString(), null,
+ "multiple_files.gif", "", null,
+ false, 1.2, false);
+ scanner1.scan();
+ FileWrapper[] results = scanner1.getMatchedArray();
+ assertTrue(results != null && results.length == 1);
+
+ DirectoryScannerExtension scanner2 =
+ DirectoryScannerFactory.createDirectoryScanner(
+ proj.getLocation().toOSString(), null,
+ "Resources/images/multiple_files.gif", "", null,
+ false, 1.2, false);
+ scanner2.scan();
+ FileWrapper[] results2 = scanner2.getMatchedArray();
+ assertTrue(results2 != null && results2.length == 1);
+ }
}
15 years, 4 months
JBoss Tools SVN: r15320 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-18 02:14:54 -0400 (Mon, 18 May 2009)
New Revision: 15320
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/jboss_about.png
trunk/smooks/plugins/org.jboss.tools.smooks.ui/jboss_about.png
Removed:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/jboss_about.png
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.properties
Log:
JBIDE-4280
Change the smooks ui plugin's name and provider's name.
Change the "jboss_about.png"
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-05-18 05:22:25 UTC (rev 15319)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-05-18 06:14:54 UTC (rev 15320)
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
+Bundle-Name: Smooks Tools UI Plug-in
Bundle-SymbolicName: org.jboss.tools.smooks.ui;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.smooks.configuration.SmooksConfigurationActivator
@@ -21,6 +21,6 @@
org.eclipse.jdt.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: %providerName
+Bundle-Vendor: JBoss, a division of Red Hat
Bundle-ClassPath: libs/dom4j-1.6.1.jar,
.
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/icons/jboss_about.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/smooks/plugins/org.jboss.tools.smooks.ui/jboss_about.png
===================================================================
(Binary files differ)
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/jboss_about.png
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/jboss_about.png (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/jboss_about.png 2009-05-18 06:14:54 UTC (rev 15320)
@@ -0,0 +1,9 @@
+�PNG
+
+
+IHDR
+a+d(^*ga%e"d`1^54W=
+k4m"n*@[Ck("g5*d<GU�s !j-5bDn1q&o+s/.j;3k6mS�vS�rT�oW�mW�uV�nY�6rET�p[�sX�sZ�|U�m\�wV�f`�rX�EoQvZ�wX�Hh�l`�t\�|Y�v[�oa�yZ�q`�s\�{[�s^�w\�q^�p_�Wi�tb�Nk�[h�rd��\�ud�Sl�]k�Zj��^�ya�zb�~b�wc�`�yd�Wm�cm�Yl�~b�bl�wh�Qp�Tn�}f�4�PSp�Vr�zh�fq�\r�Yr�_q�Ts�\q�cq�Su�V|`aq��h�L�YXt�^s�du��h�}n�kt�Zx�_x��q�ix�S�bg{�rz�g{��qr��v�n~��}�g�oz��}�����]�p���x���ɚ��l�{���������������u��������������}�����r�y��Ŗ����˩�ս�ͭ����ϐ����ċ����ڷ�˹�ݡ����Ӧ��Ūۉȕ�ġ���ß��ӡĪ���Ŷ�Ƹ���Ȼ�Ǿ�̿���գҭ���������ý������ݽ������������������������������̽������������������������������������������������������������������������������������������������������������������������������_��
+������hf��q��*C�2�����cn��j_�*@x<�\�1>�ǹy-�ڇ�
+"O!��
+��<��N+5��S�hࢠ����Q����hh�y�<I}�7�z૨��~�N<���5R�aD.�q�Vf��Lh��:�c��p�{0_��w2*k�5?% �e���Ao��P�*�w/Kŭ
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.properties 2009-05-18 05:22:25 UTC (rev 15319)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.properties 2009-05-18 06:14:54 UTC (rev 15320)
@@ -4,8 +4,8 @@
#
# $Id$
-pluginName = Smooks Tools
providerName = JBoss, a division of Red Hat
+pluginName = Smooks Tools UI Plug-in
_UI_EdiEditor_menu = &Edi Editor
_UI_CommonEditor_menu = &Common Editor
15 years, 4 months
JBoss Tools SVN: r15319 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui: src/org/jboss/tools/smooks/configuration/editors and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-18 01:22:25 -0400 (Mon, 18 May 2009)
New Revision: 15319
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java
Log:
JBIDE-4232
Mark problem image on treeitem when validating.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2009-05-15 18:11:38 UTC (rev 15318)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2009-05-18 05:22:25 UTC (rev 15319)
@@ -60,9 +60,17 @@
Decorate smooks configuration page viewer
</description>
<enablement>
- <objectClass
- name="org.jboss.tools.smooks.model.common.AbstractAnyType">
- </objectClass>
+ <or>
+ <objectClass
+ name="org.eclipse.emf.edit.provider.IWrapperItemProvider">
+ </objectClass>
+ <objectClass
+ name="org.jboss.tools.smooks.model.common.AbstractAnyType">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.emf.ecore.util.FeatureMap$Entry">
+ </objectClass>
+ </or>
</enablement>
</decorator>
</extension>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-15 18:11:38 UTC (rev 15318)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-18 05:22:25 UTC (rev 15319)
@@ -252,6 +252,10 @@
final Object cmodel = model;
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
+ if(combo.getText() == null || combo.getText().length() ==0){
+ ip.setPropertyValue(cmodel, null);
+ return;
+ }
Object editValue = SmooksUIUtils.getEditValue(ip, cmodel);
if (combo.getText().equals(editValue)) {
return;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-05-15 18:11:38 UTC (rev 15318)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-05-18 05:22:25 UTC (rev 15319)
@@ -55,10 +55,10 @@
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 1, 2009
*/
-public class SmooksConfigurationFormPage extends FormPage implements ISmooksModelValidateListener{
+public class SmooksConfigurationFormPage extends FormPage implements ISmooksModelValidateListener {
private SmooksMasterDetailBlock masterDetailBlock = null;
-
+
private TableViewer inputDataViewer;
public SmooksConfigurationFormPage(FormEditor editor, String id, String title) {
@@ -78,10 +78,10 @@
EObject smooksModel = ((SmooksMultiFormEditor) getEditor()).getSmooksModel();
if (smooksModel != null) {
EObject parent = smooksModel;
- while(parent != null){
+ while (parent != null) {
EObject old = parent;
parent = parent.eContainer();
- if(parent == null){
+ if (parent == null) {
parent = old;
break;
}
@@ -106,8 +106,8 @@
}
protected void createMasterDetailBlock(IManagedForm managedForm) {
- masterDetailBlock = new SmooksMasterDetailBlock(getEditor(), (AdapterFactoryEditingDomain) ((SmooksMultiFormEditor) getEditor())
- .getEditingDomain());
+ masterDetailBlock = new SmooksMasterDetailBlock(getEditor(),
+ (AdapterFactoryEditingDomain) ((SmooksMultiFormEditor) getEditor()).getEditingDomain());
masterDetailBlock.createContent(managedForm);
}
@@ -215,7 +215,8 @@
wizard.setInput(getEditorInput());
wizard.setSite(getEditorSite());
wizard.setForcePreviousAndNextButtons(true);
- StructuredDataSelectionWizardDailog dialog = new StructuredDataSelectionWizardDailog(getEditorSite().getShell(), wizard);
+ StructuredDataSelectionWizardDailog dialog = new StructuredDataSelectionWizardDailog(
+ getEditorSite().getShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
IStructuredDataSelectionWizard wizard1 = dialog.getCurrentCreationWizard();
String type = wizard1.getInputDataTypeID();
@@ -287,10 +288,12 @@
}
public void validateEnd(List<Diagnostic> diagnosticResult) {
+ if (masterDetailBlock != null)
+ masterDetailBlock.refreshSmooksTreeViewer();
}
public void validateStart() {
-
+
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-15 18:11:38 UTC (rev 15318)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-18 05:22:25 UTC (rev 15319)
@@ -133,6 +133,10 @@
detailsPart.registerPage(EObject.class, new SmooksStuffPropertyDetailPage(
(SmooksMultiFormEditor) this.formEditor));
}
+
+ protected void refreshSmooksTreeViewer(){
+ smooksTreeViewer.refresh();
+ }
protected void createSmooksTreeViewer(FormToolkit tool, final IManagedForm managedForm,
Composite rootMainControl) {
@@ -159,6 +163,8 @@
smooksTreeViewer = new TreeViewer(tableComposite, SWT.NONE);
smooksTreeViewer.addSelectionChangedListener(this);
+
+
smooksTreeViewer.setContentProvider(new AdapterFactoryContentProvider(editingDomain
.getAdapterFactory()));
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java 2009-05-15 18:11:38 UTC (rev 15318)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java 2009-05-18 05:22:25 UTC (rev 15319)
@@ -26,7 +26,9 @@
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.jface.viewers.LabelDecorator;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
@@ -106,7 +108,7 @@
protected int markErrorWarningPropertyUI(Diagnostic diagnostic, Object model) {
if (diagnostic == null || diagnostic.getSeverity() == Diagnostic.OK) {
- return Diagnostic.OK;
+ return -1;
}
List<?> data = diagnostic.getData();
for (Object object : data) {
@@ -128,36 +130,66 @@
return i;
}
}
-
return -1;
+ }
+ protected int markErrorWarningPropertyUI(List<Diagnostic> Listdiagnostic, Object model) {
+ int type = -1;
+ for (Iterator<?> iterator = Listdiagnostic.iterator(); iterator.hasNext();) {
+ Diagnostic diagnostic = (Diagnostic) iterator.next();
+ type = markErrorWarningPropertyUI(diagnostic, model);
+ if (type == -1) {
+ continue;
+ }
+ if (type == Diagnostic.ERROR) {
+ return type;
+ }
+ }
+ return type;
}
- public void decorate(Object element, IDecoration decoration) {
+ public void decorate(Object element, IDecoration d) {
try {
element = AdapterFactoryEditingDomain.unwrap(element);
if (element instanceof AbstractAnyType) {
- IResource resource = SmooksUIUtils.getResource((EObject) element);
- IWorkbenchWindow window = SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return;
- }
- SmooksMultiFormEditor editor = (SmooksMultiFormEditor) window.getActivePage().findEditor(
- new FileEditorInput((IFile) resource));
- int type = -1;
-// int type = markErrorWarningPropertyUI(editor.getDiagnosticList(), element);
- decoration.addOverlay(null, IDecoration.BOTTOM_RIGHT);
- if (type == Diagnostic.ERROR) {
- decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry().getDescriptor(
- GraphicsConstants.IMAGE_OVR_ERROR), IDecoration.BOTTOM_RIGHT);
- }
- if (type == Diagnostic.WARNING) {
- decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry().getDescriptor(
- GraphicsConstants.IMAGE_OVR_WARING), IDecoration.BOTTOM_RIGHT);
- }
+ final IResource resource = SmooksUIUtils.getResource((EObject) element);
+ final IDecoration decoration = d;
+ final Object fm = element;
+ Display.getDefault().syncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ return;
+ }
+ SmooksMultiFormEditor editor = (SmooksMultiFormEditor) window.getActivePage().findEditor(
+ new FileEditorInput((IFile) resource));
+ if (editor == null)
+ return;
+ int type = -1;
+ type = markErrorWarningPropertyUI(editor.getDiagnosticList(), fm);
+ if (type == -1)
+ return;
+ decoration.addOverlay(null, IDecoration.BOTTOM_RIGHT);
+ if (type == Diagnostic.ERROR) {
+ decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry()
+ .getDescriptor(GraphicsConstants.IMAGE_OVR_ERROR), IDecoration.BOTTOM_RIGHT);
+ }
+ if (type == Diagnostic.WARNING) {
+ decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry()
+ .getDescriptor(GraphicsConstants.IMAGE_OVR_WARING), IDecoration.BOTTOM_RIGHT);
+ }
+ }
+
+ });
}
} catch (Exception e) {
- // e.printStackTrace();
+ e.printStackTrace();
}
}
15 years, 4 months
JBoss Tools SVN: r15318 - in trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda: impl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-05-15 14:11:38 -0400 (Fri, 15 May 2009)
New Revision: 15318
Added:
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java
Removed:
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java
Modified:
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java
trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4149 Hibernate ODA errors on subreport on subsequent calls to Dataset
Modified: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/IOdaFactory.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -10,11 +10,11 @@
************************************************************************************/
package org.jboss.tools.birt.oda;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
import org.jboss.tools.birt.oda.impl.HibernateOdaQuery;
+import org.jboss.tools.birt.oda.impl.HibernateResult;
import org.jboss.tools.birt.oda.impl.HibernateResultSetMetaData;
/**
@@ -31,12 +31,9 @@
void close();
boolean isOpen();
- HibernateResultSetMetaData prepare(String queryText) throws OdaException;
+ HibernateResultSetMetaData prepare(String queryText,Session session) throws OdaException;
void setMaxRows(int max);
int getMaxRows();
- void executeQuery(HibernateOdaQuery query) throws OdaException;
- Iterator getIterator();
- List getResult();
- Object getResult(int rstcol) throws OdaException;
- void next();
+ HibernateResult executeQuery(HibernateOdaQuery query,Session session) throws OdaException;
+ SessionFactory getSessionFactory();
}
Modified: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/AbstractOdaFactory.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -2,22 +2,17 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
-import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.osgi.util.NLS;
-import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.engine.query.HQLQueryPlan;
import org.hibernate.impl.SessionFactoryImpl;
-import org.hibernate.metadata.ClassMetadata;
import org.hibernate.type.Type;
import org.jboss.tools.birt.oda.IOdaFactory;
import org.jboss.tools.birt.oda.Messages;
@@ -26,40 +21,41 @@
protected SessionFactory sessionFactory;
private int maxRows;
- private List result;
- private Iterator iterator;
- private Type[] queryReturnTypes;
- private Object currentRow;
- private HibernateOdaQuery query;
- private Session session;
+ //private List result;
+ //private Iterator iterator;
+ //private Type[] queryReturnTypes;
+ //private Object currentRow;
+ //private HibernateOdaQuery query;
+ //private Session session;
private String queryText;
public void close() {
- sessionFactory = null;
- if (session != null) {
- session.close();
- session = null;
- }
+// if (session != null) {
+// session.close();
+// session = null;
+// }
}
+
+ public boolean isOpen() {
+ return getSessionFactory() != null;
+ }
public SessionFactory getSessionFactory() {
return sessionFactory;
}
- public HibernateResultSetMetaData prepare(String queryText) throws OdaException {
+ public HibernateResultSetMetaData prepare(String queryText,Session session) throws OdaException {
this.queryText = queryText;
- return parseQuery();
+ return parseQuery(session);
}
- private HibernateResultSetMetaData parseQuery()
+ private HibernateResultSetMetaData parseQuery(Session session)
throws OdaException {
List arColsType = new ArrayList();
List arCols = new ArrayList();
List arColClass = new ArrayList();
String[] props = null;
- Session session = null;
try {
- session = getSessionFactory().openSession();
Query query = session.createQuery(queryText);
int maxRows = getMaxRows();
if (maxRows > 0) {
@@ -112,10 +108,6 @@
.toArray(new String[arColClass.size()]));
} catch (Exception e) {
throw new OdaException(e.getLocalizedMessage());
- } finally {
- if (session != null) {
- session.close();
- }
}
}
@@ -156,10 +148,8 @@
this.maxRows = maxRows;
}
- public void executeQuery(HibernateOdaQuery query) throws OdaException {
- this.query = query;
+ public HibernateResult executeQuery(HibernateOdaQuery query,Session session) throws OdaException {
try {
- session = getSessionFactory().openSession();
Query q = session.createQuery(queryText);
HibernateParameterMetaData parameterMetaData = (HibernateParameterMetaData) query.getParameterMetaData();
List<Parameter> parameters = parameterMetaData.getParameters();
@@ -174,58 +164,11 @@
break;
}
}
- result = q.list();
- iterator = result.iterator();
- this.queryReturnTypes = q.getReturnTypes();
+ HibernateResult hibernateResult = new HibernateResult(q,this, query);
+ return hibernateResult;
} catch (HibernateException e) {
throw new OdaException(e.getLocalizedMessage());
}
}
-
- public Iterator getIterator() {
- return iterator;
- }
-
- public List getResult() {
- return result;
- }
-
- public Object getResult(int rstcol) throws OdaException {
- Object obj = this.currentRow;
- Object value = null;
- try {
- if (queryReturnTypes.length > 0
- && queryReturnTypes[0].isEntityType()) {
- String checkClass = ((HibernateResultSetMetaData) getMetaData())
- .getColumnClass(rstcol);
- SessionFactory sf = getSessionFactory();
- ClassMetadata metadata = sf.getClassMetadata(checkClass);
- if (metadata == null) {
- metadata = sf.getClassMetadata(obj.getClass());
- }
- value = metadata.getPropertyValue(obj, getMetaData()
- .getColumnName(rstcol), EntityMode.POJO);
- } else {
- if (getMetaData().getColumnCount() == 1) {
- value = obj;
- } else {
- Object[] values = (Object[]) obj;
- value = values[rstcol - 1];
- }
- }
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- }
- return (value);
- }
-
- private IResultSetMetaData getMetaData() throws OdaException {
- return query.getMetaData();
- }
-
- public void next() {
- currentRow = getIterator().next();
- }
-
}
Modified: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ConsoleConfigurationOdaFactory.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -29,7 +29,7 @@
public class ConsoleConfigurationOdaFactory extends AbstractOdaFactory {
ConsoleConfiguration consoleConfiguration;
-
+
public ConsoleConfigurationOdaFactory(Properties properties) throws OdaException {
getSessionFactory(properties);
String maxRowString = properties.getProperty(IOdaFactory.MAX_ROWS);
@@ -49,7 +49,7 @@
break;
}
}
- if (isOpen()) {
+ if (!isOpen()) {
try {
sessionFactory = consoleConfiguration.getSessionFactory();
if (sessionFactory == null) {
@@ -65,14 +65,5 @@
}
return sessionFactory;
}
-
- @Override
- public void close() {
- consoleConfiguration = null;
- super.close();
- }
- public boolean isOpen() {
- return consoleConfiguration != null;
- }
}
Modified: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateConnection.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -16,6 +16,7 @@
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.hibernate.Session;
import org.jboss.tools.birt.oda.IOdaFactory;
import org.jboss.tools.birt.oda.Messages;
import org.osgi.framework.Bundle;
@@ -29,8 +30,10 @@
*/
public class HibernateConnection implements IConnection {
private IOdaFactory odaSessionFactory;
- private Map appContext;
+ private Session session;
+ //private Map appContext;
+
/*
* @see
* org.eclipse.datatools.connectivity.oda.IConnection#open(java.util.Properties
@@ -45,6 +48,7 @@
} else {
odaSessionFactory = new ServerOdaFactory(connProperties);
}
+ session = odaSessionFactory.getSessionFactory().openSession();
}
/*
@@ -56,21 +60,28 @@
if (!(context instanceof Map)) {
throw new OdaException(Messages.HibernateConnection_Invalid_AppContext);
}
- this.appContext = (Map) context;
+ //this.appContext = (Map) context;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#close()
*/
public void close() throws OdaException {
- odaSessionFactory.close();
+ if (odaSessionFactory != null) {
+ odaSessionFactory.close();
+ odaSessionFactory = null;
+ }
+ if (session != null) {
+ session.close();
+ session = null;
+ }
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#isOpen()
*/
public boolean isOpen() throws OdaException {
- return odaSessionFactory != null && odaSessionFactory.isOpen();
+ return session != null && session.isOpen();
}
/*
@@ -116,15 +127,15 @@
// do nothing; assumes no transaction support needed
}
- /*
- * public SessionFactory getSessionFactory() { return
- * odaSessionFactory.getSessionFactory(); }
- */
-
public IOdaFactory getOdaSessionFactory() {
return odaSessionFactory;
}
+ public Session getSession() {
+ return session;
+ }
+
+
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IConnection#setLocale(com.ibm.icu.util.ULocale)
*/
Modified: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateOdaQuery.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -21,6 +21,7 @@
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
import org.eclipse.datatools.connectivity.oda.spec.QuerySpecification;
+import org.hibernate.Session;
/**
* Implementation class of IQuery for an ODA runtime driver.
@@ -31,9 +32,11 @@
private HibernateConnection connection;
private HibernateResultSetMetaData resultSetMetaData;
private HibernateParameterMetaData parameterMetaData = new HibernateParameterMetaData();
+ private Session session;
public HibernateOdaQuery(HibernateConnection connection) {
this.connection = connection;
+ this.session = connection.getSession();
}
/*
@@ -42,7 +45,7 @@
*/
public void prepare(String queryText) throws OdaException {
this.resultSetMetaData = getConnection().getOdaSessionFactory()
- .prepare(queryText);
+ .prepare(queryText,session);
}
/*
Added: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java (rev 0)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResult.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -0,0 +1,82 @@
+package org.jboss.tools.birt.oda.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.hibernate.EntityMode;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.type.Type;
+import org.jboss.tools.birt.oda.IOdaFactory;
+
+public class HibernateResult {
+
+ private List result;
+ private Iterator iterator;
+ private Type[] queryReturnTypes;
+ private Object currentRow;
+ private IOdaFactory odaFactory;
+ private HibernateOdaQuery query;
+
+ public HibernateResult(Query q, IOdaFactory odaFactory, HibernateOdaQuery query) {
+ this.result = q.list();
+ this.iterator = result.iterator();
+ this.queryReturnTypes = q.getReturnTypes();
+ this.odaFactory = odaFactory;
+ this.query = query;
+ }
+
+ public Iterator getIterator() {
+ return iterator;
+ }
+
+ public List getResult() {
+ return result;
+ }
+
+ public Object getResult(int rstcol) throws OdaException {
+ Object obj = this.currentRow;
+ Object value = null;
+ try {
+ if (queryReturnTypes.length > 0
+ && queryReturnTypes[0].isEntityType()) {
+ String checkClass = ((HibernateResultSetMetaData) getMetaData())
+ .getColumnClass(rstcol);
+ SessionFactory sf = odaFactory.getSessionFactory();
+ ClassMetadata metadata = sf.getClassMetadata(checkClass);
+ if (metadata == null) {
+ metadata = sf.getClassMetadata(obj.getClass());
+ }
+ value = metadata.getPropertyValue(obj, getMetaData()
+ .getColumnName(rstcol), EntityMode.POJO);
+ } else {
+ if (getMetaData().getColumnCount() == 1) {
+ value = obj;
+ } else {
+ Object[] values = (Object[]) obj;
+ value = values[rstcol - 1];
+ }
+ }
+ } catch (Exception e) {
+ throw new OdaException(e.getLocalizedMessage());
+ }
+ return (value);
+ }
+
+ public void next() {
+ currentRow = getIterator().next();
+ }
+
+ private IResultSetMetaData getMetaData() throws OdaException {
+ return query.getMetaData();
+ }
+
+ public void close() {
+ if (result != null) {
+ result.clear();
+ }
+ }
+}
Modified: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/HibernateResultSet.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -25,6 +25,8 @@
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.osgi.util.NLS;
+import org.hibernate.Session;
+import org.jboss.tools.birt.oda.IOdaFactory;
import org.jboss.tools.birt.oda.Messages;
/**
@@ -38,12 +40,16 @@
private int rowNumber = -1;
private boolean wasNull;
+ private HibernateResult hibernateResult;
private static DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); //$NON-NLS-1$
public HibernateResultSet(HibernateOdaQuery query) throws OdaException {
this.query = query;
- query.getConnection().getOdaSessionFactory().executeQuery(query);
+ HibernateConnection connection = query.getConnection();
+ IOdaFactory odaSessionFactory = connection.getOdaSessionFactory();
+ Session session = connection.getSession();
+ hibernateResult = odaSessionFactory.executeQuery(query,session);
}
/*
@@ -75,7 +81,7 @@
*/
public boolean next() throws OdaException {
if (getIterator().hasNext()) {
- query.getConnection().getOdaSessionFactory().next();
+ hibernateResult.next();
rowNumber++;
return true;
}
@@ -84,22 +90,18 @@
}
private Iterator getIterator() {
- return query.getConnection().getOdaSessionFactory().getIterator();
+ return hibernateResult.getIterator();
}
/*
* @see org.eclipse.datatools.connectivity.oda.IResultSet#close()
*/
public void close() throws OdaException {
- List result = getResult();
- if (result != null)
- result.clear();
- query.getConnection().getOdaSessionFactory().close();
- result = null;
+ hibernateResult.close();
}
private List getResult() {
- return query.getConnection().getOdaSessionFactory().getResult();
+ return hibernateResult.getResult();
}
/*
@@ -111,7 +113,7 @@
}
private Object getResult(int rstcol) throws OdaException {
- return query.getConnection().getOdaSessionFactory().getResult(rstcol);
+ return hibernateResult.getResult(rstcol);
}
/*
Deleted: trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java
===================================================================
--- trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java 2009-05-15 17:52:33 UTC (rev 15317)
+++ trunk/birt/plugins/org.jboss.tools.birt.oda/src/org/jboss/tools/birt/oda/impl/ReflectServerOdaFactory.java 2009-05-15 18:11:38 UTC (rev 15318)
@@ -1,336 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008 JBoss, a division of Red Hat and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss, a division of Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.birt.oda.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.naming.InitialContext;
-
-import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
-import org.eclipse.datatools.connectivity.oda.OdaException;
-import org.eclipse.osgi.util.NLS;
-import org.hibernate.SessionFactory;
-import org.jboss.tools.birt.oda.Activator;
-import org.jboss.tools.birt.oda.IOdaFactory;
-import org.jboss.tools.birt.oda.Messages;
-
-/**
- *
- * @author snjeza
- *
- */
-public class ReflectServerOdaFactory implements IOdaFactory {
-
- private static final Integer INTZERO = new Integer(0);
- private static Class[] emptyClassArg = new Class[0];
- private static Object[] emptyObjectArg = new Object[0];
- private Object sessionFactory;
- private Integer maxRows;
- private String queryText;
- private List result;
- private Iterator iterator;
- private Object currentRow;
- private HibernateOdaQuery query;
- private Object session;
- private Object[] queryReturnTypes;
-
- public ReflectServerOdaFactory(Properties properties) throws OdaException {
- getSessionFactory(properties);
- String maxRowString = properties.getProperty(IOdaFactory.MAX_ROWS);
- try {
- maxRows = new Integer(maxRowString);
- } catch (NumberFormatException e) {
- // ignore
- }
- }
-
- public Object getSessionFactory(Properties properties)
- throws OdaException {
- String configurationName = properties.getProperty(CONFIGURATION);
- if (sessionFactory == null) {
- InitialContext ctx = null;
- try {
- ctx = new InitialContext();
- Object obj = ctx.lookup("java:/" + configurationName); //$NON-NLS-1$
- sessionFactory = obj;
- SessionFactory sf = (SessionFactory) obj;
- System.out.println(sf);
- } catch (Exception e) {
- e.printStackTrace();
- throw new OdaException(
- Messages.ReflectServerOdaFactory_Cannot_create_Hibernate_session_factory);
- }
-
- }
- return sessionFactory;
- }
-
- public Object getSessionFactory() {
- return sessionFactory;
- }
-
- public void close() {
- closeSession(session);
- }
-
- public boolean isOpen() {
- if (sessionFactory == null)
- return false;
- boolean isClosed = true;
- try {
- Method method = sessionFactory.getClass().getMethod("isClosed", new Class[0]); //$NON-NLS-1$
- if (method != null) {
- Object closed = method.invoke(sessionFactory, new Object[0]);
- isClosed = ((Boolean) closed).booleanValue();
- }
- } catch (Exception e) {
- // ignore
- }
- return !isClosed;
- }
-
- public int getMaxRows() {
- return maxRows;
- }
-
- public HibernateResultSetMetaData prepare(String queryText)
- throws OdaException {
- this.queryText = queryText;
- List arColsType = new ArrayList();
- List arCols = new ArrayList();
- List arColClass = new ArrayList();
- String[] props = null;
- Object session = null;
-
- try {
- session = openSession();
- Object query = createQuery(session, queryText);
- if (maxRows > 0) {
- Method setFirstResult = query.getClass().getMethod("setFirstResult", new Class[] {Integer.TYPE}); //$NON-NLS-1$
- setFirstResult.invoke(query, new Object[] {INTZERO});
- Method setMaxResults = query.getClass().getMethod("setMaxResults", new Class[] {Integer.TYPE}); //$NON-NLS-1$
- setMaxResults.invoke(query, new Object[] {new Integer(maxRows)});
- }
- Method getReturnTypes = query.getClass().getMethod("getReturnTypes", emptyClassArg); //$NON-NLS-1$
- Object returnType = getReturnTypes.invoke(query, emptyObjectArg);
- Object[] qryReturnTypes = (Object[]) returnType;
- if (checkEntityType(qryReturnTypes)) {
- for (int j = 0; j < qryReturnTypes.length; j++) {
- String clsName = getReturnTypeName(qryReturnTypes[j]);
- props = getHibernateProp(clsName);
- for (int x = 0; x < props.length; x++) {
- String propType = getHibernatePropTypes(clsName,
- props[x]);
- if (DataTypes.isValidType(propType)) {
- arColsType.add(propType);
- arCols.add(props[x]);
- arColClass.add(clsName);
- } else {
- arColsType.add(DataTypes.UNKNOWN);
- arCols.add(props[x]);
- arColClass.add("java.lang.String"); //$NON-NLS-1$
- }
- }
- }
- } else {
- props = extractColumns(queryText);
- for (int t = 0; t < qryReturnTypes.length; t++) {
- String typeName = getReturnTypeName(qryReturnTypes[t]);
- if (DataTypes.isValidType(typeName)) {
- arColsType.add(typeName);
- arCols.add(props[t]);
- } else {
- throw new OdaException(NLS.bind(Messages.ReflectServerOdaFactory_The_type_is_not_valid, typeName));
- }
- }
- }
- String[] arLabels = (String[]) arCols.toArray(new String[arCols
- .size()]);
- for (int j = 0; j < arLabels.length; j++) {
- arLabels[j] = arLabels[j].replace('.', ':');
- }
-
- return new HibernateResultSetMetaData(arLabels,
- (String[]) arColsType
- .toArray(new String[arColsType.size()]), arLabels,
- (String[]) arColClass
- .toArray(new String[arColClass.size()]));
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- } finally {
- closeSession(session);
- }
- }
-
- private void closeSession(Object session) {
- if (session != null) {
- try {
- Method close = session.getClass().getMethod("close", emptyClassArg); //$NON-NLS-1$
- close.invoke(session, emptyObjectArg);
- session = null;
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- private boolean checkEntityType(Object[] qryReturnTypes) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
- Object first = qryReturnTypes[0];
- Method isEntityType = first.getClass().getMethod("isEntityType", emptyClassArg); //$NON-NLS-1$
- Object ret = isEntityType.invoke(first, emptyObjectArg);
- boolean isEntity = ((Boolean)ret).booleanValue();
- return qryReturnTypes.length > 0 && isEntity;
- }
-
- private Object createQuery(Object session, String queryText)
- throws NoSuchMethodException, IllegalAccessException,
- InvocationTargetException {
- Method createQuery = session.getClass().getMethod("createQuery", new Class[] {String.class}); //$NON-NLS-1$
- Object query = createQuery.invoke(session, new Object[] {queryText});
- return query;
- }
-
- private Object openSession() throws NoSuchMethodException,
- IllegalAccessException, InvocationTargetException {
- Object session;
- Method openSession = sessionFactory.getClass().getMethod("openSession", emptyClassArg); //$NON-NLS-1$
- session = openSession.invoke(sessionFactory, emptyObjectArg);
- return session;
- }
-
- private static String[] extractColumns(final String query) {
- int fromPosition = query.toLowerCase().indexOf("from"); //$NON-NLS-1$
- int selectPosition = query.toLowerCase().indexOf("select"); //$NON-NLS-1$
- if (selectPosition >= 0) {
- String columns = query.substring(selectPosition + 6, fromPosition);
- StringTokenizer st = new StringTokenizer(columns, ","); //$NON-NLS-1$
- List columnList = new ArrayList();
- while (st.hasMoreTokens()) {
- columnList.add(st.nextToken().trim());
- }
- return (String[]) columnList.toArray(new String[0]);
- } else {
- return null;
- }
- }
-
- private String getReturnTypeName(Object returnType) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
- Method getName = returnType.getClass().getMethod("getName", emptyClassArg); //$NON-NLS-1$
- Object name = getName.invoke(returnType, emptyObjectArg);
- return (String) name;
- }
-
- private String[] getHibernateProp(String className) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException{
- Object classMetadata = getClassMetadata(className);
- Method getPropertyNames = classMetadata.getClass().getMethod("getPropertyNames", emptyClassArg); //$NON-NLS-1$
- String[] properties = (String[]) getPropertyNames.invoke(classMetadata, emptyObjectArg);
- return properties;
- }
-
- private Object getClassMetadata(String className)
- throws NoSuchMethodException, IllegalAccessException,
- InvocationTargetException {
- Method getClassMetadata = sessionFactory.getClass().getMethod("getClassMetadata", new Class[] {String.class}); //$NON-NLS-1$
- Object classMetadata = getClassMetadata.invoke(sessionFactory, new Object[] {className});
- return classMetadata;
- }
-
- private Object getClassMetadata(Class clazz) throws NoSuchMethodException,
- IllegalAccessException, InvocationTargetException {
- Method getClassMetadata = sessionFactory.getClass().getMethod(
- "getClassMetadata", new Class[] { Class.class }); //$NON-NLS-1$
- Object classMetadata = getClassMetadata.invoke(sessionFactory,
- new Object[] { clazz });
- return classMetadata;
- }
-
- private String getHibernatePropTypes(String className, String property) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException{
- Object classMetadata = getClassMetadata(className);
- Method getPropertyType = classMetadata.getClass().getMethod("getPropertyType", new Class[] {String.class}); //$NON-NLS-1$
- Object type = getPropertyType.invoke(classMetadata, new Object[] {property});
- return getReturnTypeName(type);
- }
-
- public void setMaxRows(int max) {
- maxRows = max;
- }
-
- public void executeQuery(HibernateOdaQuery query) throws OdaException {
- this.query = query;
- try {
- session = openSession();
- Object q = createQuery(session,queryText);
- Method list = q.getClass().getMethod("list", emptyClassArg); //$NON-NLS-1$
- result = (List) list.invoke(q, emptyObjectArg);
- iterator = result.iterator();
- Method getReturnTypes = q.getClass().getMethod("getReturnTypes", emptyClassArg); //$NON-NLS-1$
- this.queryReturnTypes = (Object[]) getReturnTypes.invoke(q, emptyObjectArg);
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- }
- }
-
- public Iterator getIterator() {
- return iterator;
- }
-
- public List getResult() {
- return result;
- }
-
- public Object getResult(int rstcol) throws OdaException {
- Object obj = this.currentRow;
- Object value = null;
- try {
- if (checkEntityType(queryReturnTypes)) {
- String checkClass = ((HibernateResultSetMetaData) getMetaData())
- .getColumnClass(rstcol);
- Object metadata = getClassMetadata(checkClass);
- if (metadata == null) {
- metadata = getClassMetadata(obj.getClass());
- }
- String className = "org.hibernate.EntityMode"; //$NON-NLS-1$
- Class pojo = Activator.classForName(className, getClass());
- Field pojoField = pojo.getField("POJO"); //$NON-NLS-1$
- Object POJO = pojoField.get(null);
- Class[] parameterTypes = new Class[] {Object.class,String.class, POJO.getClass()};
- Method getPropertyValue = metadata.getClass().getMethod("getPropertyValue", parameterTypes); //$NON-NLS-1$
- Object[] args = new Object[] {obj,getMetaData().getColumnName(rstcol),POJO};
- value = getPropertyValue.invoke(metadata, args);
- } else {
- if (getMetaData().getColumnCount() == 1) {
- value = obj;
- } else {
- Object[] values = (Object[]) obj;
- value = values[rstcol - 1];
- }
- }
- } catch (Exception e) {
- throw new OdaException(e.getLocalizedMessage());
- }
- return (value);
- }
-
- public void next() {
- currentRow = getIterator().next();
- }
-
- private IResultSetMetaData getMetaData() throws OdaException {
- return query.getMetaData();
- }
-}
15 years, 4 months