Author: max.andersen(a)jboss.com
Date: 2007-11-04 04:22:29 -0500 (Sun, 04 Nov 2007)
New Revision: 4688
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/AbstractQueryEditor.java
Log:
HBX-774 ClassCastException by create/open/execute a *.hql file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/AbstractQueryEditor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/AbstractQueryEditor.java 2007-11-03
18:57:08 UTC (rev 4687)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/AbstractQueryEditor.java 2007-11-04
09:22:29 UTC (rev 4688)
@@ -36,6 +36,9 @@
private ToolBarManager tbm;
final private QueryInputModel queryInputModel;
+ // to enable execution of queries from files - hack for HBX-744
+ private String consoleConfigurationName;
+
public AbstractQueryEditor() {
queryInputModel = new QueryInputModel();
}
@@ -53,16 +56,24 @@
}
final public String getConsoleConfigurationName() {
- QueryEditorInput hei = (QueryEditorInput) getEditorInput();
- return hei.getConsoleConfigurationName();
+ //TODO: these should be stored as resource info
+ if(getEditorInput() instanceof QueryEditorInput) {
+ QueryEditorInput hei = (QueryEditorInput) getEditorInput();
+ return hei.getConsoleConfigurationName();
+ } else {
+ return consoleConfigurationName;
+ }
}
final public void setConsoleConfigurationName(String name) {
- QueryEditorInput hei = (QueryEditorInput) getEditorInput();
- hei.setConsoleConfigurationName( name );
- hei.setQuery( getQueryString() );
- hei.resetName();
- showEditorInput( hei );
+ if(getEditorInput() instanceof QueryEditorInput) {
+ QueryEditorInput hei = (QueryEditorInput) getEditorInput();
+ hei.setConsoleConfigurationName( name );
+ hei.setQuery( getQueryString() );
+ hei.resetName();
+ }
+ this.consoleConfigurationName = name;
+ showEditorInput( getEditorInput() );
}
public void showEditorInput(IEditorInput editorInput) {
@@ -78,10 +89,16 @@
final public void doSave(IProgressMonitor progressMonitor) {
// super.doSave(progressMonitor);
- QueryEditorInput hei = (QueryEditorInput) getEditorInput();
- hei.setQuery( getQueryString() );
+ if(getEditorInput() instanceof QueryEditorInput) {
+ QueryEditorInput hei = (QueryEditorInput) getEditorInput();
+ hei.setQuery( getQueryString() );
+ }
performSave( false, progressMonitor );
}
+
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ super.doSetInput(input);
+ }
final public String getQueryString() {
IEditorInput editorInput = getEditorInput();
Show replies by date