Author: mdryakhlenkov
Date: 2007-10-25 10:34:33 -0400 (Thu, 25 Oct 2007)
New Revision: 4512
Modified:
trunk/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/hqleditor/HQLEditorDocumentSetupParticipant.java
Log:
JBIDE-1172: HIbernate Dynamic SQL Preview is UGLY!
Modified:
trunk/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 2007-10-25
13:01:50 UTC (rev 4511)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java 2007-10-25
14:34:33 UTC (rev 4512)
@@ -50,6 +50,7 @@
import org.hibernate.eclipse.console.QueryEditor;
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;
@@ -103,7 +104,8 @@
private SourceViewer textViewer;
private HQLEditor currentEditor;
private MonoReconciler reconciler;
-
+ private HQLEditorDocumentSetupParticipant docSetupParticipant = new
HQLEditorDocumentSetupParticipant();
+
private void hookIntoEditor(IWorkbenchPartReference partRef) {
if(partRef==null) {
setCurrentEditor(null);
@@ -230,7 +232,11 @@
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);
- textViewer.setDocument( new Document() );
+ IDocument doc = new Document();
+ textViewer.setDocument( doc );
+
+ docSetupParticipant.setup( doc );
+
textViewer.getDocument().set("No HQL Query editor selected");
textViewer.configure(new HQLSourceViewerConfiguration(null));
@@ -276,6 +282,7 @@
.getActiveWorkbenchWindow();
IPartService service = window.getPartService();
service.removePartListener(partListener);
+ docSetupParticipant.unsetup();
super.dispose();
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditorDocumentSetupParticipant.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditorDocumentSetupParticipant.java 2007-10-25
13:01:50 UTC (rev 4511)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLEditorDocumentSetupParticipant.java 2007-10-25
14:34:33 UTC (rev 4512)
@@ -32,6 +32,7 @@
* order to setup document partitioning for HQL documents.
*/
public class HQLEditorDocumentSetupParticipant implements IDocumentSetupParticipant {
+ private IDocumentPartitioner partitioner;
/**
* Sets up the document to be ready for use by a text file buffer.
@@ -41,9 +42,13 @@
public void setup( IDocument document ) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
- IDocumentPartitioner partitioner = new DefaultPartitioner( new HQLPartitionScanner(),
HQLPartitionScanner.HQL_PARTITION_TYPES );
+ partitioner = new DefaultPartitioner( new HQLPartitionScanner(),
HQLPartitionScanner.HQL_PARTITION_TYPES );
partitioner.connect( document );
extension3.setDocumentPartitioner( HQLSourceViewerConfiguration.HQL_PARTITIONING,
partitioner );
}
}
+
+ public void unsetup() {
+ partitioner.disconnect();
+ }
}
Show replies by date