do a check for no environment values
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / editors / SQLEditor.java
index 1ceab17..a27f6ec 100644 (file)
@@ -12,17 +12,20 @@ import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
 
 public class SQLEditor extends TextEditor {
-       SQLConfiguration config;
+       private SQLSourceViewerConfiguration config;
        private ColorManager colorManager;
+       private SQLContentOutlinePage outlinePage;
        /**
         * An editor capable of editing SQL scripts
         */
        public SQLEditor() {
                super();
+//System.out.println("SQL Editor");
                colorManager = new ColorManager();
-               config = new SQLConfiguration(colorManager);
+               config = new SQLSourceViewerConfiguration(colorManager);
                config.loadPrefs();
                
                setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
@@ -56,4 +59,18 @@ public class SQLEditor extends TextEditor {
                Color background = colorManager.getColor(SQLColorConstants.BACKGROUND);
                widget.setBackground(background);
        }
+       
+       public Object getAdapter(Class required) {
+               if (IContentOutlinePage.class.equals(required)) {
+                       if (this.outlinePage == null) {
+                               this.outlinePage= new SQLContentOutlinePage(
+                                               (SQLDocumentProvider) getDocumentProvider(), this);
+                               if (getEditorInput() != null)
+                                       this.outlinePage.setInput(getEditorInput());
+                       }
+                       return this.outlinePage;
+               }
+               return super.getAdapter(required);
+       }
+
 }