Author: vyemialyanchyk
Date: 2010-03-16 14:48:34 -0400 (Tue, 16 Mar 2010)
New Revision: 20852
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/
Removed:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/QLFormatHelper.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/CollectionPropertySource.java
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/QueryPagePropertySource.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.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/hqleditor/HQLEditor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLFormattingStrategy.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - initial step
Copied:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console
(from rev 20798, trunk/hibernatetools/plugins/org.hibernate.eclipse.console)
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/META-INF/MANIFEST.MF 2010-03-16
18:48:34 UTC (rev 20852)
@@ -48,13 +48,13 @@
org.eclipse.jface,
org.eclipse.ui,
org.eclipse.ui.editors,
- org.eclipse.ui.views,
org.eclipse.ui.workbench,
org.eclipse.ui.workbench.texteditor,
org.eclipse.jface.text,
org.eclipse.ui.ide,
org.eclipse.help,
org.eclipse.ui.console,
+ org.eclipse.ui.views,
org.eclipse.gef,
org.eclipse.debug.core;bundle-version="3.4.0",
org.eclipse.debug.ui,
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -8,7 +8,6 @@
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.KnownConfigurationsAdapter;
@@ -42,13 +41,10 @@
listener = new KnownConfigurationsAdapter() {
- public void sessionFactoryClosing(
- ConsoleConfiguration configuration,
- SessionFactory closingFactory) {
+ public void sessionFactoryClosing(ConsoleConfiguration configuration) {
}
- public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
- SessionFactory builtFactory) {
+ public void sessionFactoryBuilt(ConsoleConfiguration ccfg) {
}
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
Modified:
branches/hibernatetools-multiversion/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 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -125,9 +125,7 @@
public static String ConsoleConfigurationPropertySource_error;
public static String ConsoleConfigurationPropertySource_name;
public static String ConsoleConfigurationPropertySource_properties_file;
- public static String DynamicSQLPreviewView_caused_by;
public static String DynamicSQLPreviewView_empty_hql_query;
- public static String DynamicSQLPreviewView_manipulation_of;
public static String DynamicSQLPreviewView_no_console_conf_associated;
public static String DynamicSQLPreviewView_no_hql_query_editor;
public static String DynamicSQLPreviewView_no_hql_query_editor_selected;
@@ -155,8 +153,6 @@
public static String PendingNode_error_getting_images;
public static String PendingNode_pending;
//
- public static String EntityPropertySource_identifier;
- public static String EntityPropertySource_properties;
public static String QueryPagePropertySource_console_configuration;
public static String QueryPagePropertySource_millisec;
public static String QueryPagePropertySource_query_run_time;
Modified:
branches/hibernatetools-multiversion/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 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2010-03-16
18:48:34 UTC (rev 20852)
@@ -117,9 +117,7 @@
ConsoleConfigurationPropertySource_connection=Connection
ConsoleConfigurationPropertySource_mode=Type
ConsoleConfigurationPropertySource_properties_file=Properties file
-DynamicSQLPreviewView_caused_by=\nCaused by:\n
DynamicSQLPreviewView_empty_hql_query=Empty HQL query.
-DynamicSQLPreviewView_manipulation_of=Manipulation of
DynamicSQLPreviewView_no_console_conf_associated=No Console configuration associated with
HQL Editor
DynamicSQLPreviewView_no_hql_query_editor=No HQL Query editor
DynamicSQLPreviewView_no_hql_query_editor_selected=No HQL Query editor selected
@@ -148,8 +146,6 @@
PendingNode_error_getting_images=Error while getting images
PendingNode_pending=Pending
-EntityPropertySource_identifier=Identifier
-EntityPropertySource_properties=Properties
QueryPagePropertySource_console_configuration=Console configuration
# {0}=count in millisec
QueryPagePropertySource_millisec={0} millisec
Deleted:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -1,375 +0,0 @@
-package org.hibernate.eclipse.console.utils;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.hibernate.util.StringHelper;
-
-/**
- * Old formatter from previous Hibernate versions which allowed a bit more control, i.e.
we want *less* spaces not more.
- * In here to simplify migration from 3.2 to 3.3 where this class changed.
- *
- */
-@SuppressWarnings({ "unchecked", "nls" })
-public class Formatter {
-
- private static final Set BEGIN_CLAUSES = new HashSet();
- private static final Set END_CLAUSES = new HashSet();
- private static final Set LOGICAL = new HashSet();
- private static final Set QUANTIFIERS = new HashSet();
- private static final Set DML = new HashSet();
- private static final Set MISC = new HashSet();
- static {
-
- BEGIN_CLAUSES.add("left");
- BEGIN_CLAUSES.add("right");
- BEGIN_CLAUSES.add("inner");
- BEGIN_CLAUSES.add("outer");
- BEGIN_CLAUSES.add("group");
- BEGIN_CLAUSES.add("order");
-
- END_CLAUSES.add("where");
- END_CLAUSES.add("set");
- END_CLAUSES.add("having");
- END_CLAUSES.add("join");
- END_CLAUSES.add("from");
- END_CLAUSES.add("by");
- END_CLAUSES.add("join");
- END_CLAUSES.add("into");
- END_CLAUSES.add("union");
-
- LOGICAL.add("and");
- LOGICAL.add("or");
- LOGICAL.add("when");
- LOGICAL.add("else");
- LOGICAL.add("end");
-
- QUANTIFIERS.add("in");
- QUANTIFIERS.add("all");
- QUANTIFIERS.add("exists");
- QUANTIFIERS.add("some");
- QUANTIFIERS.add("any");
-
- DML.add("insert");
- DML.add("update");
- DML.add("delete");
-
- MISC.add("select");
- MISC.add("on");
- //MISC.add("values");
-
- }
-
- String indentString = " ";
- String initial = "\n ";
-
- boolean beginLine = true;
- boolean afterBeginBeforeEnd = false;
- boolean afterByOrSetOrFromOrSelect = false;
- boolean afterValues = false;
- boolean afterOn = false;
- boolean afterBetween = false;
- boolean afterInsert = false;
- int inFunction = 0;
- int parensSinceSelect = 0;
- private LinkedList parenCounts = new LinkedList();
- private LinkedList afterByOrFromOrSelects = new LinkedList();
-
- int indent = 1;
-
- StringBuffer result = new StringBuffer();
- StringTokenizer tokens;
- String lastToken;
- String token;
- String lcToken;
-
- public Formatter(String sql) {
- tokens = new StringTokenizer(
- sql,
- "()+*/-=<>'`\"[]," + StringHelper.WHITESPACE,
- true
- );
- }
-
- public Formatter setInitialString(String initial) {
- this.initial = initial;
- return this;
- }
-
- public Formatter setIndentString(String indent) {
- this.indentString = indent;
- return this;
- }
-
- public String format() {
-
- result.append(initial);
-
- while ( tokens.hasMoreTokens() ) {
- token = tokens.nextToken();
- lcToken = token.toLowerCase();
-
- if ( "'".equals(token) ) {
- String t;
- do {
- t = tokens.nextToken();
- token += t;
- }
- while ( !"'".equals(t) && tokens.hasMoreTokens() ); // cannot
handle single quotes
- }
- else if ( "\"".equals(token) ) {
- String t;
- do {
- t = tokens.nextToken();
- token += t;
- }
- while ( !"\"".equals(t) );
- }
-
- if ( afterByOrSetOrFromOrSelect && ",".equals(token) ) {
- commaAfterByOrFromOrSelect();
- }
- else if ( afterOn && ",".equals(token) ) {
- commaAfterOn();
- }
-
- else if ( "(".equals(token) ) {
- openParen();
- }
- else if ( ")".equals(token) ) {
- closeParen();
- }
-
- else if ( BEGIN_CLAUSES.contains(lcToken) ) {
- beginNewClause();
- }
-
- else if ( END_CLAUSES.contains(lcToken) ) {
- endNewClause();
- }
-
- else if ( "select".equals(lcToken) ) {
- select();
- }
-
- else if ( DML.contains(lcToken) ) {
- updateOrInsertOrDelete();
- }
-
- else if ( "values".equals(lcToken) ) {
- values();
- }
-
- else if ( "on".equals(lcToken) ) {
- on();
- }
-
- else if ( afterBetween && lcToken.equals("and") ) {
- misc();
- afterBetween = false;
- }
-
- else if ( LOGICAL.contains(lcToken) ) {
- logical();
- }
-
- else if ( isWhitespace(token) ) {
- white();
- }
-
- else {
- misc();
- }
-
- if ( !isWhitespace( token ) ) lastToken = lcToken;
-
- }
- return result.toString();
- }
-
- private void commaAfterOn() {
- out();
- indent--;
- newline();
- afterOn = false;
- afterByOrSetOrFromOrSelect = true;
- }
-
- private void commaAfterByOrFromOrSelect() {
- out();
- newline();
- }
-
- private void logical() {
- if ( "end".equals(lcToken) ) indent--;
- newline();
- out();
- beginLine = false;
- }
-
- private void on() {
- indent++;
- afterOn = true;
- newline();
- out();
- beginLine = false;
- }
-
- private void misc() {
- out();
- if ( "between".equals(lcToken) ) {
- afterBetween = true;
- }
- if (afterInsert) {
- newline();
- afterInsert = false;
- }
- else {
- beginLine = false;
- if ( "case".equals(lcToken) ) {
- indent++;
- }
- }
- }
-
- private void white() {
- if ( !beginLine ) {
- result.append(" ");
- }
- }
-
- private void updateOrInsertOrDelete() {
- out();
- indent++;
- beginLine = false;
- if ( "update".equals(lcToken) ) newline();
- if ( "insert".equals(lcToken) ) afterInsert = true;
- }
-
- private void select() {
- out();
- indent++;
- newline();
- parenCounts.addLast( new Integer(parensSinceSelect) );
- afterByOrFromOrSelects.addLast( new Boolean(afterByOrSetOrFromOrSelect) );
- parensSinceSelect = 0;
- afterByOrSetOrFromOrSelect = true;
- }
-
- private void out() {
- result.append(token);
- }
-
- private void endNewClause() {
- if (!afterBeginBeforeEnd) {
- indent--;
- if (afterOn) {
- indent--;
- afterOn=false;
- }
- newline();
- }
- out();
- if ( !"union".equals(lcToken) ) indent++;
- newline();
- afterBeginBeforeEnd = false;
- afterByOrSetOrFromOrSelect = "by".equals(lcToken)
- || "set".equals(lcToken)
- || "from".equals(lcToken);
- }
-
- private void beginNewClause() {
- if (!afterBeginBeforeEnd) {
- if (afterOn) {
- indent--;
- afterOn=false;
- }
- indent--;
- newline();
- }
- out();
- beginLine = false;
- afterBeginBeforeEnd = true;
- }
-
- private void values() {
- indent--;
- newline();
- out();
- indent++;
- newline();
- afterValues = true;
- }
-
- private void closeParen() {
- parensSinceSelect--;
- if (parensSinceSelect<0) {
- indent--;
- parensSinceSelect = ( (Integer) parenCounts.removeLast() ).intValue();
- afterByOrSetOrFromOrSelect = ( (Boolean) afterByOrFromOrSelects.removeLast()
).booleanValue();
- }
- if ( inFunction>0 ) {
- inFunction--;
- out();
- }
- else {
- if (!afterByOrSetOrFromOrSelect) {
- indent--;
- newline();
- }
- out();
- }
- beginLine = false;
- }
-
- private void openParen() {
- if ( isFunctionName( lastToken ) || inFunction>0 ) {
- inFunction++;
- }
- beginLine = false;
- if ( inFunction>0 ) {
- out();
- }
- else {
- out();
- if (!afterByOrSetOrFromOrSelect) {
- indent++;
- newline();
- beginLine = true;
- }
- }
- parensSinceSelect++;
- }
-
- private static boolean isFunctionName(String tok) {
- final char begin = tok.charAt(0);
- final boolean isIdentifier = Character.isJavaIdentifierStart( begin ) ||
'"'==begin;
- return isIdentifier &&
- !LOGICAL.contains(tok) &&
- !END_CLAUSES.contains(tok) &&
- !QUANTIFIERS.contains(tok) &&
- !DML.contains(tok) &&
- !MISC.contains(tok);
- }
-
- private static boolean isWhitespace(String token) {
- return StringHelper.WHITESPACE.indexOf(token)>=0;
- }
-
- private void newline() {
- result.append("\n");
- for ( int i=0; i<indent; i++ ) {
- result.append(indentString);
- }
- beginLine = true;
- }
-
- public static void main(String[] args) {
- if ( args.length>0 ) System.out.println(
- new Formatter( StringHelper.join(" ", args) ).format()
- );
- }
-
-}
Deleted:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/QLFormatHelper.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/QLFormatHelper.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/QLFormatHelper.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.hibernate.eclipse.console.utils;
-
-public class QLFormatHelper {
-
- static public String formatForScreen(String query) {
- return new Formatter(query).setInitialString("").setIndentString("
").format(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConfigurationsViewActionGroup.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -38,6 +38,7 @@
import org.hibernate.eclipse.console.actions.CriteriaEditorAction;
import org.hibernate.eclipse.console.actions.DeleteConfigurationAction;
import org.hibernate.eclipse.console.actions.EditConsoleConfiguration;
+import org.hibernate.eclipse.console.actions.ExternalProcessAction;
import org.hibernate.eclipse.console.actions.HQLScratchpadAction;
import org.hibernate.eclipse.console.actions.OpenMappingAction;
import org.hibernate.eclipse.console.actions.OpenSourceAction;
@@ -83,6 +84,7 @@
//private SelectionListenerAction connectAction;
private SelectionListenerAction reloadConfigurationAction;
private SelectionListenerAction schemaExportAction;
+ private SelectionListenerAction externalProcessAction;
private EditConsoleConfiguration editConfigurationAction;
private final StructuredViewer selectionProvider;
private SelectionListenerAction hqlEditorAction;
@@ -118,6 +120,9 @@
schemaExportAction = new SchemaExportAction(selectionProvider);
selectionProvider.addSelectionChangedListener(schemaExportAction);
+
+ externalProcessAction = new ExternalProcessAction(selectionProvider);
+ selectionProvider.addSelectionChangedListener(externalProcessAction);
editConfigurationAction = new EditConsoleConfiguration();
selectionProvider.addSelectionChangedListener(editConfigurationAction);
@@ -143,6 +148,7 @@
selectionProvider.removeSelectionChangedListener(refreshAction);
selectionProvider.removeSelectionChangedListener(reloadConfigurationAction);
selectionProvider.removeSelectionChangedListener(schemaExportAction);
+ selectionProvider.removeSelectionChangedListener(externalProcessAction);
selectionProvider.removeSelectionChangedListener(editConfigurationAction);
selectionProvider.removeSelectionChangedListener(hqlEditorAction);
selectionProvider.removeSelectionChangedListener(criteriaEditorAction);
@@ -174,6 +180,7 @@
menu.appendToGroup(GROUP_ADDITION, refreshAction);
if (first instanceof ConsoleConfiguration){
menu.appendToGroup(GROUP_ADDITION, schemaExportAction);
+ menu.appendToGroup(GROUP_ADDITION, externalProcessAction);
}
menu.add(new GroupMarker(GROUP_ADDITION_LAST));
menu.add(new Separator(GROUP_OTHER_EDITORS));
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -21,9 +21,6 @@
*/
package org.hibernate.eclipse.console.views;
-import java.util.Collections;
-import java.util.Iterator;
-
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
@@ -43,19 +40,12 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
-import org.hibernate.eclipse.console.utils.QLFormatHelper;
import org.hibernate.eclipse.hqleditor.HQLEditor;
import org.hibernate.eclipse.hqleditor.HQLEditorDocumentSetupParticipant;
import org.hibernate.eclipse.hqleditor.HQLSourceViewer;
import org.hibernate.eclipse.hqleditor.HQLSourceViewerConfiguration;
-import org.hibernate.engine.query.HQLQueryPlan;
-import org.hibernate.hql.QueryTranslator;
-import org.hibernate.impl.SessionFactoryImpl;
-import org.hibernate.type.Type;
import org.hibernate.util.StringHelper;
public class DynamicSQLPreviewView extends ViewPart {
@@ -133,99 +123,35 @@
}
private void updateText(HQLEditor editor) {
- if(textViewer!=null && textViewer.getDocument()!=null) {
- if(editor!=null) {
- ConsoleConfiguration consoleConfiguration = editor.getConsoleConfiguration();
- if(StringHelper.isEmpty( editor.getQueryString() )) {
- textViewer.getDocument().set(
HibernateConsoleMessages.DynamicSQLPreviewView_empty_hql_query );
- } else if(consoleConfiguration!=null) {
- if(consoleConfiguration.isSessionFactoryCreated()) {
- String generateSQL = generateSQL(consoleConfiguration.getExecutionContext(),
consoleConfiguration.getSessionFactory(), editor.getQueryString());
- if(StringHelper.isEmpty( generateSQL )) {
- textViewer.getDocument().set(
HibernateConsoleMessages.DynamicSQLPreviewView_no_sql_generated );
+ if (textViewer == null) {
+ return;
+ }
+ IDocument doc = textViewer.getDocument();
+ if (doc != null) {
+ if (editor != null) {
+ ConsoleConfiguration consoleConfig = editor.getConsoleConfiguration();
+ if (StringHelper.isEmpty(editor.getQueryString())) {
+ doc.set( HibernateConsoleMessages.DynamicSQLPreviewView_empty_hql_query );
+ } else if (consoleConfig != null) {
+ if (consoleConfig.isSessionFactoryCreated()) {
+ String generateSQL = consoleConfig.generateSQL(editor.getQueryString());
+ if (StringHelper.isEmpty(generateSQL)) {
+ doc.set( HibernateConsoleMessages.DynamicSQLPreviewView_no_sql_generated );
} else {
- textViewer.getDocument().set(generateSQL);
+ doc.set(generateSQL);
}
} else {
- textViewer.getDocument().set(HibernateConsoleMessages.DynamicSQLPreviewView_session_factory_not_created
+ consoleConfiguration.getName());
+ doc.set(HibernateConsoleMessages.DynamicSQLPreviewView_session_factory_not_created
+ consoleConfig.getName());
}
} else {
- textViewer.getDocument().set(HibernateConsoleMessages.DynamicSQLPreviewView_no_console_conf_associated);
+ doc.set(HibernateConsoleMessages.DynamicSQLPreviewView_no_console_conf_associated);
}
} else {
- textViewer.getDocument().set(HibernateConsoleMessages.DynamicSQLPreviewView_no_hql_query_editor);
+ doc.set(HibernateConsoleMessages.DynamicSQLPreviewView_no_hql_query_editor);
}
}
}
- public String generateSQL(ExecutionContext context, final SessionFactory sf, final
String query) {
-
- if(StringHelper.isEmpty(query)) return ""; //$NON-NLS-1$
-
- String result;
-
- result = (String) context.execute(new ExecutionContext.Command() {
- public Object execute() {
- try {
- SessionFactoryImpl sfimpl = (SessionFactoryImpl) sf; // hack - to get to the actual
queries..
- StringBuffer str = new StringBuffer(256);
- HQLQueryPlan plan = new HQLQueryPlan(query, false, Collections.EMPTY_MAP, sfimpl);
-
- QueryTranslator[] translators = plan.getTranslators();
- for (int i = 0; i < translators.length; i++) {
- QueryTranslator translator = translators[i];
- if(translator.isManipulationStatement()) {
- str.append(HibernateConsoleMessages.DynamicSQLPreviewView_manipulation_of + i +
":"); //$NON-NLS-1$
- Iterator<?> iterator = translator.getQuerySpaces().iterator();
- while ( iterator.hasNext() ) {
- Object qspace = iterator.next();
- str.append(qspace);
- if(iterator.hasNext()) { str.append(", "); } //$NON-NLS-1$
- }
-
- } else {
- Type[] returnTypes = translator.getReturnTypes();
- str.append(i +": "); //$NON-NLS-1$
- for (int j = 0; j < returnTypes.length; j++) {
- Type returnType = returnTypes[j];
- str.append(returnType.getName());
- if(j<returnTypes.length-1) { str.append(", "); }
//$NON-NLS-1$
- }
- }
- str.append("\n-----------------\n"); //$NON-NLS-1$
- Iterator<?> sqls = translator.collectSqlStrings().iterator();
- while ( sqls.hasNext() ) {
- String sql = (String) sqls.next();
- str.append(QLFormatHelper.formatForScreen(sql));
- str.append("\n\n"); //$NON-NLS-1$
- }
- }
- return str.toString();
- } catch(Throwable t) {
- //StringWriter sw = new StringWriter();
- StringBuffer msgs = new StringBuffer();
-
- Throwable cause = t;
- while(cause!=null) {
- msgs.append(t);
- if(cause.getCause()==cause) {
- cause=null;
- } else {
- cause = cause.getCause();
- if(cause!=null)
msgs.append(HibernateConsoleMessages.DynamicSQLPreviewView_caused_by);
- }
- }
- //t.printStackTrace(new PrintWriter(sw));
- //return sw.getBuffer().toString();
- return msgs.toString();
- }
-
- }
- });
-
- return result;
- }
-
public void createPartControl(Composite parent) {
textViewer = new HQLSourceViewer( parent, new VerticalRuler(1), null, false,
SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL );
//textViewer.setEditable(false);
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -40,7 +40,6 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.KnownConfigurationsListener;
@@ -105,7 +104,7 @@
}
}
- public void sessionFactoryBuilt(final ConsoleConfiguration ccfg, SessionFactory
builtFactory) {
+ public void sessionFactoryBuilt(final ConsoleConfiguration ccfg) {
/*(Display.getDefault().syncExec(new Runnable() { Disabled as it will generate double
entries in the child list
public void run() {
tv.refresh(ccfg);
@@ -113,7 +112,7 @@
}); */
}
- public void sessionFactoryClosing(final ConsoleConfiguration configuration,
SessionFactory closingFactory) {
+ public void sessionFactoryClosing(final ConsoleConfiguration configuration) {
refreshTree(configuration);
}
Deleted:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/CollectionPropertySource.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/CollectionPropertySource.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/CollectionPropertySource.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.hibernate.eclipse.console.views.properties;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-public class CollectionPropertySource implements IPropertySource {
-
- private Collection<?> collection;
-
- IPropertyDescriptor[] descriptors = null;
-
- Map<Object, Object> values = new WeakHashMap<Object, Object>();
-
- public CollectionPropertySource(Collection<?> propertyValue) {
- collection = propertyValue;
- }
-
- public Object getEditableValue() {
- return null;
- }
-
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if(descriptors==null) {
- PropertyDescriptor[] properties = new PropertyDescriptor[collection.size()];
- for (int i = 0; i < properties.length; i++) {
- properties[i] = new PropertyDescriptor(Integer.valueOf(i),"#" + i);
//$NON-NLS-1$
- }
- descriptors = properties;
- }
- return descriptors;
- }
-
- public Object getPropertyValue(Object id) {
- Object value = values.get(id);
- if(value==null) {
- Integer i = (Integer) id;
- Iterator<?> iterator = collection.iterator();
- int base = 0;
-
- while(iterator.hasNext()) {
-
- value = iterator.next();
-
- if(base==i.intValue()) {
- values.put(id, value);
- return value;
- } else {
- value=null;
- }
- base++;
- }
- }
-
- return value;
- }
-
- public boolean isPropertySet(Object id) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void resetPropertyValue(Object id) {
- // TODO Auto-generated method stub
-
- }
-
- public void setPropertyValue(Object id, Object value) {
-
-
- }
-
-}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -21,119 +21,34 @@
*/
package org.hibernate.eclipse.console.views.properties;
-import java.util.Collection;
-
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.hibernate.EntityMode;
-import org.hibernate.Session;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.execution.ExecutionContext;
-import org.hibernate.console.execution.ExecutionContext.Command;
-import org.hibernate.eclipse.console.HibernateConsoleMessages;
-import org.hibernate.metadata.ClassMetadata;
-import org.hibernate.metadata.CollectionMetadata;
-import org.hibernate.proxy.HibernateProxyHelper;
+import org.hibernate.console.stubs.SessionStub;
-
-
public class EntityPropertySource implements IPropertySource2
{
- private Object reflectedObject;
+ private Object reflectedObj;
private IPropertyDescriptor[] propertyDescriptors;
+ private final SessionStub sessionStub;
- private final String consoleConfigName;
- private final Session currentSession;
- private ClassMetadata classMetadata;
-
- public EntityPropertySource(final Object object, final Session currentSession, String
consoleConfigName)
- {
- this.currentSession = currentSession;
- this.consoleConfigName = consoleConfigName;
- reflectedObject = object;
- if(currentSession.isOpen()) {
- classMetadata = currentSession.getSessionFactory().getClassMetadata(
currentSession.getEntityName(reflectedObject) );
- } else {
- classMetadata = currentSession.getSessionFactory().getClassMetadata(
HibernateProxyHelper.getClassWithoutInitializingProxy(reflectedObject));
- }
-
+ public EntityPropertySource(final Object obj, final SessionStub sessionStub) {
+ this.sessionStub = sessionStub;
+ reflectedObj = obj;
}
-
public Object getEditableValue() {
return ""; //$NON-NLS-1$
}
public IPropertyDescriptor[] getPropertyDescriptors() {
if (propertyDescriptors == null) {
- ConsoleConfiguration consoleConfig =
KnownConfigurations.getInstance().find(consoleConfigName);
- if (consoleConfig != null) {
- ExecutionContext executionContext = consoleConfig.getExecutionContext();
- if (executionContext == null) {
- consoleConfig.build();
- executionContext = consoleConfig.getExecutionContext();
- }
- if (executionContext != null) {
- executionContext.execute(new Command() {
- public Object execute() {
- propertyDescriptors = initializePropertyDescriptors(classMetadata);
- return null;
- }
- });
- }
- }
+ propertyDescriptors = sessionStub.getPropertyDescriptors(reflectedObj);
}
return propertyDescriptors;
}
- static protected IPropertyDescriptor[] initializePropertyDescriptors(ClassMetadata
classMetadata) {
-
- String[] propertyNames = classMetadata.getPropertyNames();
- int length = propertyNames.length;
-
- PropertyDescriptor identifier = null;
-
- if(classMetadata.hasIdentifierProperty() ) {
- identifier = new PropertyDescriptor(classMetadata.getIdentifierPropertyName(),
classMetadata.getIdentifierPropertyName());
- identifier.setCategory(HibernateConsoleMessages.EntityPropertySource_identifier);
- length++;
- }
-
- PropertyDescriptor[] properties = new PropertyDescriptor[length];
-
- int idx = 0;
- if(identifier!=null) {
- properties[idx++] = identifier;
- }
-
- for (int i = 0; i < propertyNames.length; i++) {
- PropertyDescriptor prop = new PropertyDescriptor(propertyNames[i],propertyNames[i]);
- prop.setCategory(HibernateConsoleMessages.EntityPropertySource_properties);
- properties[i+idx] = prop;
- }
-
- return properties;
- }
-
-
public Object getPropertyValue(Object id) {
- Object propertyValue;
-
- if(id.equals(classMetadata.getIdentifierPropertyName())) {
- propertyValue = classMetadata.getIdentifier(reflectedObject, EntityMode.POJO);
- } else {
- propertyValue = classMetadata.getPropertyValue(reflectedObject, (String)id,
EntityMode.POJO);
- }
-
- if (propertyValue instanceof Collection<?>) {
- CollectionMetadata collectionMetadata =
currentSession.getSessionFactory().getCollectionMetadata(classMetadata.getEntityName() +
"." + id); //$NON-NLS-1$
- if(collectionMetadata!=null) {
- propertyValue = new CollectionPropertySource((Collection<?>) propertyValue);
- }
- }
- return propertyValue;
+ return sessionStub.getPropertyValue(reflectedObj, id);
}
public boolean isPropertySet(Object id) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -23,10 +23,9 @@
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.IPropertySourceProvider;
-import org.hibernate.Session;
import org.hibernate.console.QueryPage;
+import org.hibernate.console.stubs.SessionStub;
import org.hibernate.eclipse.console.views.QueryPageTabView;
-import org.hibernate.proxy.HibernateProxyHelper;
public class HibernatePropertySourceProvider implements IPropertySourceProvider
{
@@ -37,32 +36,23 @@
this.view = view;
}
- public IPropertySource getPropertySource(Object object) {
- if (object==null) {
- return null;
- }
- else if (object instanceof QueryPage)
- {
- return new QueryPagePropertySource( (QueryPage)object);
- }
- else if (object instanceof CollectionPropertySource) {
- return (IPropertySource) object;
- }
- else {
- // maybe we should be hooked up with the queryview to get this ?
- Session currentSession = view.getSelectedQueryPage().getSession();
- String consoleConfigName =
view.getSelectedQueryPage().getConsoleConfiguration().getName();
- if((currentSession.isOpen() && currentSession.contains(object)) ||
hasMetaData( object, currentSession) ) {
- return new EntityPropertySource(object, currentSession, consoleConfigName);
- } else {
- return null;
+ public IPropertySource getPropertySource(Object obj) {
+ IPropertySource res = null;
+ if (obj instanceof QueryPage) {
+ res = new QueryPagePropertySource((QueryPage)obj);
+ } else if (obj instanceof IPropertySource) {
+ res = (IPropertySource) obj;
+ } else {
+ // maybe we should be hooked up with the queryview to get this ?
+ QueryPage qp = view.getSelectedQueryPage();
+ if (qp != null) {
+ SessionStub sessionStub = qp.getSessionStub();
+ String consoleConfigName = qp.getConsoleConfigName();
+ if ((sessionStub.isOpen() && sessionStub.contains(obj)) ||
sessionStub.hasMetaData(obj)) {
+ res = new EntityPropertySource(obj, sessionStub);
+ }
}
-
}
-
+ return res;
}
-
- private boolean hasMetaData(Object object, Session currentSession) {
- return
currentSession.getSessionFactory().getClassMetadata(HibernateProxyHelper.getClassWithoutInitializingProxy(object))!=null;
- }
}
\ No newline at end of file
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/QueryPagePropertySource.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/QueryPagePropertySource.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/QueryPagePropertySource.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -101,7 +101,7 @@
public Object getPropertyValue(Object id) {
if(CONFIGURATION_TEXT.equals(id) ) {
- return page.getConsoleConfiguration().getName();
+ return page.getConsoleConfigName();
}
if(QUERY_TEXT.equals(id) ) {
return page.getQueryString();
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazySessionFactoryAdapter.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -38,7 +38,7 @@
LazySessionFactory lazySessionFactory = getLazySessionFactory(o);
String label = HibernateConsoleMessages.LazySessionFactoryAdapter_session_factory;
if(lazySessionFactory.getCfgNode()==null) {
- if(lazySessionFactory.getConsoleConfiguration().getSessionFactory()==null) {
+ if(lazySessionFactory.getConsoleConfiguration().getSessionStubFactory()==null) {
try {
lazySessionFactory.getConsoleConfiguration().buildSessionFactory();
} catch(Throwable t) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -58,13 +58,13 @@
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.hibernate.HibernateException;
-import org.hibernate.Session;
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.SessionStub;
import org.hibernate.eclipse.console.AbstractQueryEditor;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -149,10 +149,10 @@
cfg.execute(new Command() {
public Object execute() {
KnownConfigurations.getInstance().getQueryPageModel().remove(queryPage);
- Session session = cfg0.getSessionFactory().openSession();
+ SessionStub sessionStub = cfg0.getSessionStubFactory().openSession();
queryPage.setModel(getQueryInputModel().getCopyForQuery());
queryPage.setQueryString(getQueryString());
- queryPage.setSession(session);
+ queryPage.setSessionStub(sessionStub);
KnownConfigurations.getInstance().getQueryPageModel().add(queryPage);
return null;
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditor.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditor.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -53,11 +53,11 @@
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.hibernate.Session;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryPage;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.console.stubs.SessionStub;
import org.hibernate.eclipse.console.AbstractQueryEditor;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
@@ -426,10 +426,10 @@
cfg.execute(new Command() {
public Object execute() {
KnownConfigurations.getInstance().getQueryPageModel().remove(queryPage);
- Session session = cfg0.getSessionFactory().openSession();
+ SessionStub sessionStub = cfg0.getSessionStubFactory().openSession();
queryPage.setModel(getQueryInputModel().getCopyForQuery());
queryPage.setQueryString(getQueryString());
- queryPage.setSession(session);
+ queryPage.setSessionStub(sessionStub);
KnownConfigurations.getInstance().getQueryPageModel().add(queryPage);
return null;
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLFormattingStrategy.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLFormattingStrategy.java 2010-03-12
13:16:53 UTC (rev 20798)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLFormattingStrategy.java 2010-03-16
18:48:34 UTC (rev 20852)
@@ -22,7 +22,7 @@
package org.hibernate.eclipse.hqleditor;
import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.hibernate.eclipse.console.utils.QLFormatHelper;
+import org.hibernate.console.util.QLFormatHelper;
public class HQLFormattingStrategy implements IFormattingStrategy {