Author: dgeraskov
Date: 2010-01-12 04:59:02 -0500 (Tue, 12 Jan 2010)
New Revision: 19706
Modified:
trunk/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/JavaCompletionProcessor.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4613
Modified:
trunk/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-01-12
03:01:44 UTC (rev 19705)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/CriteriaEditor.java 2010-01-12
09:59:02 UTC (rev 19706)
@@ -56,6 +56,7 @@
import org.eclipse.ui.texteditor.IDocumentProvider;
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;
@@ -174,15 +175,19 @@
final ConsoleConfiguration consoleConfiguration = getConsoleConfiguration();
if(consoleConfiguration.getConfiguration()==null) {
- consoleConfiguration.build();
- consoleConfiguration.execute( new ExecutionContext.Command() {
- public Object execute() {
- if(consoleConfiguration.hasConfiguration()) {
- consoleConfiguration.getConfiguration().buildMappings();
- }
- return consoleConfiguration;
- }
- });
+ try {
+ consoleConfiguration.build();
+ consoleConfiguration.execute( new ExecutionContext.Command() {
+ public Object execute() {
+ if(consoleConfiguration.hasConfiguration()) {
+ consoleConfiguration.getConfiguration().buildMappings();
+ }
+ return consoleConfiguration;
+ }
+ });
+ } catch (HibernateException e) {
+
+ }
}
Set<String> imports = new HashSet<String>();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java 2010-01-12
03:01:44 UTC (rev 19705)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java 2010-01-12
09:59:02 UTC (rev 19706)
@@ -38,7 +38,6 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.hqleditor.CompletionHelper;
-import org.hibernate.eclipse.hqleditor.LoadConsoleCFGCompletionProposal;
import org.hibernate.util.StringHelper;
public class JavaCompletionProcessor implements IContentAssistProcessor {
@@ -114,12 +113,12 @@
CompletionHelper.transpose( null, -prefix.length(), results );
- if (editor.getConsoleConfiguration().getConfiguration() == null){
+ /*if (editor.getConsoleConfiguration().getConfiguration() == null){
ICompletionProposal[] results2 = new ICompletionProposal[results.length + 1];
System.arraycopy(results, 0, results2, 1, results.length);
results2[0] = new
LoadConsoleCFGCompletionProposal(editor.getConsoleConfiguration());
return results2;
- }
+ }*/
return results;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2010-01-12
03:01:44 UTC (rev 19705)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor.java 2010-01-12
09:59:02 UTC (rev 19706)
@@ -34,8 +34,10 @@
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.QueryEditor;
@@ -90,7 +92,7 @@
return result;
}
- ICompletionProposal[] computeProposals(IDocument doc, int lineStart, final int
currentOffset, ConsoleConfiguration consoleConfiguration) {
+ ICompletionProposal[] computeProposals(IDocument doc, int lineStart, final int
currentOffset, final ConsoleConfiguration consoleConfiguration) {
ICompletionProposal[] result = null;
errorMessage = null;
if (doc != null && currentOffset >= 0) {
@@ -112,6 +114,21 @@
return result;
}
+ if(consoleConfiguration != null &&
consoleConfiguration.getConfiguration()==null) {
+ try{
+ consoleConfiguration.build();
+ consoleConfiguration.execute( new ExecutionContext.Command() {
+ public Object execute() {
+ if(consoleConfiguration.hasConfiguration()) {
+ consoleConfiguration.getConfiguration().buildMappings();
+ }
+ return consoleConfiguration;
+ }
+ });
+ } catch (HibernateException e){
+ }
+ }
+
Configuration configuration =
consoleConfiguration!=null?consoleConfiguration.getConfiguration():null;
IHQLCodeAssist hqlEval = new HQLCodeAssist(configuration);
EclipseHQLCompletionRequestor eclipseHQLCompletionCollector = new
EclipseHQLCompletionRequestor();
@@ -119,9 +136,9 @@
proposalList.addAll(eclipseHQLCompletionCollector.getCompletionProposals());
errorMessage = eclipseHQLCompletionCollector.getLastErrorMessage();
- if(configuration == null && consoleConfiguration!=null) {
+ /*if(configuration == null && consoleConfiguration!=null) {
proposalList.add(new LoadConsoleCFGCompletionProposal(consoleConfiguration));
- }
+ }*/
//findMatchingWords( currentOffset, proposalList, startWord,
HQLCodeScanner.getHQLKeywords(), "keyword" );
//findMatchingWords( currentOffset, proposalList, startWord,
HQLCodeScanner.getHQLFunctionNames(), "function");