Author: vyemialyanchyk
Date: 2009-12-22 11:36:37 -0500 (Tue, 22 Dec 2009)
New Revision: 19539
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.console/src/org/hibernate/eclipse/console/views/QueryPageViewer.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/QueryPagePropertySource.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4450 - fix
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2009-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -43,6 +43,7 @@
protected long queryTime = -1; //shows how long query runs
protected boolean sticky = true;
private List<Throwable> exceptions = new ArrayList<Throwable>();
+ protected String tabName;
/**
* @param i
@@ -143,4 +144,13 @@
public long getQueryTime(){
return queryTime;
}
+
+ public String getTabName() {
+ return tabName;
+ }
+ public void setTabName(String tabName) {
+ String oldValue = this.tabName;
+ this.tabName = tabName;
+ pcs.firePropertyChange("tabName", oldValue, tabName); //$NON-NLS-1$
+ }
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java 2009-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -97,6 +97,7 @@
public HQLQueryPage(ConsoleConfiguration cfg, String string, QueryInputModel model) {
super(cfg);
queryString = string;
+ setTabName(getQueryString().replace('\n', ' ').replace('\r',
' '));
this.model = model;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java 2009-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -57,6 +57,7 @@
public JavaPage(ConsoleConfiguration cfg, String criteriaCode, QueryInputModel model)
{
super(cfg);
this.criteriaCode = criteriaCode;
+ setTabName(getQueryString().replace('\n', ' ').replace('\r',
' '));
this.model = model;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java 2009-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -60,6 +60,11 @@
* @return
*/
public abstract String getQueryString();
+ /**
+ * @return
+ */
+ public abstract String getTabName();
+ public abstract void setTabName(String tabName);
/**
* @param b
*/
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-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -161,6 +161,7 @@
public static String QueryPagePropertySource_query_string;
public static String QueryPagePropertySource_sec;
public static String QueryPagePropertySource_unknown;
+ public static String QueryPagePropertySource_tab_name;
//
public static String ConsoleConfigurationWizardPage_config_name_already_exist;
public static String ConsoleConfigurationWizardPage_config_page;
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-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-12-22
16:36:37 UTC (rev 19539)
@@ -154,6 +154,7 @@
QueryPagePropertySource_query_run_time=Query run time
QueryPagePropertySource_query_size=Query size
QueryPagePropertySource_query_string=Query string
+QueryPagePropertySource_tab_name=Tab name
# {0}=count in seconds
QueryPagePropertySource_sec={0} sec
QueryPagePropertySource_unknown=(unknown)
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageViewer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageViewer.java 2009-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageViewer.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -22,6 +22,7 @@
package org.hibernate.eclipse.console.views;
import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.List;
import org.eclipse.jface.action.IMenuListener;
@@ -180,7 +181,7 @@
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH) );
- this.tabItem.setText(this.queryPage.getQueryString().replace('\n', '
').replace('\r', ' ') );
+ this.tabItem.setText(this.queryPage.getTabName());
this.tabItem.setToolTipText(this.queryPage.getQueryString());
/* different icon dependent on java/hql etc.
if (this.queryPage.getEntity() == null) {
@@ -204,6 +205,7 @@
initializePopUpMenu();
this.qrView.tabs.setSelection(index-1);
+ this.queryPage.addPropertyChangeListener(queryPagePropChangeListener);
}
@@ -270,6 +272,14 @@
return columnCount;
}
+ protected PropertyChangeListener queryPagePropChangeListener = new
PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if ("tabName".equals(event.getPropertyName() )) { //$NON-NLS-1$
+ tabItem.setText(queryPage.getTabName());
+ }
+ }
+ };
+
public void propertyChange(PropertyChangeEvent event) {
if ("rows".equals(event.getPropertyName() ) ) { //$NON-NLS-1$
this.tableViewer.refresh();
@@ -289,6 +299,7 @@
public void dispose() {
//this.queryPage.removePropertyChangeListener(this);
+ this.queryPage.removePropertyChangeListener(queryPagePropChangeListener);
this.tabItem.dispose();
}
Modified:
trunk/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 2009-12-22
16:30:28 UTC (rev 19538)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/QueryPagePropertySource.java 2009-12-22
16:36:37 UTC (rev 19539)
@@ -43,8 +43,10 @@
private static final String QUERY_TIME = "QueryPage.time"; //$NON-NLS-1$
+ private static final String TAB_NAME = "QueryPage.tabName"; //$NON-NLS-1$
+
static {
- descriptors = new IPropertyDescriptor[4];
+ descriptors = new IPropertyDescriptor[5];
PropertyDescriptor descriptor;
// query string
@@ -68,11 +70,17 @@
//descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
descriptors[2] = descriptor;
- // time of query running
+ // time of query running
descriptor = new TextPropertyDescriptor(QUERY_TIME,
HibernateConsoleMessages.QueryPagePropertySource_query_run_time);
descriptor.setAlwaysIncompatible(false);
descriptors[3] = descriptor;
+
+ // time of query running
+ descriptor = new TextPropertyDescriptor(TAB_NAME,
+ HibernateConsoleMessages.QueryPagePropertySource_tab_name);
+ descriptor.setAlwaysIncompatible(false);
+ descriptors[4] = descriptor;
}
public QueryPagePropertySource (QueryPage page) {
@@ -112,7 +120,9 @@
}
return NLS.bind(HibernateConsoleMessages.QueryPagePropertySource_millisec,
resultTime);
}
-
+ if(TAB_NAME.equals(id) ) {
+ return page.getTabName();
+ }
return null;
}
@@ -121,11 +131,14 @@
}
public void resetPropertyValue(Object id) {
-
+ if (TAB_NAME.equals(id)) {
+ page.setTabName(page.getQueryString().replace('\n', '
').replace('\r', ' '));
+ }
}
public void setPropertyValue(Object id, Object value) {
-
-
+ if (TAB_NAME.equals(id)) {
+ page.setTabName(value == null ? "<null>" : value.toString());
//$NON-NLS-1$
+ }
}
}
\ No newline at end of file