SPM - 2006-11-28

I have started developing a MSSQL extension.

I have opened the text of a stored procedure in the SQL editor using the following code:

SQLEditorInput input = new SQLEditorInput(_selectedNodes[i].getSchemaOrCatalogName() + ".dbo." + _selectedNodes[i].getName() + ".sql");
                        input.setSessionNode(_selectedNodes[0].getSession());
                        IWorkbenchPage page = SQLExplorerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();

                        SQLEditor editorPart = (SQLEditor) page.openEditor((IEditorInput) input,
                                "net.sourceforge.sqlexplorer.plugin.editors.SQLEditor");
                        editorPart.setText(finalResult);

so the SQL editor opens with the text and tab text of database.dbo.storedprocedure.sql.

1. First problem is that sql coloring does not seem to be done automatically.
2. Second problem is when you save it give you the default "sql_editor.txt" instead of the name it is initialised to.

/**
     * Save editor content to file.
     *
     * @see org.eclipse.ui.ISaveablePart#doSaveAs()
     */
    public void doSaveAs() {

        FileDialog dialog = new FileDialog(getSite().getShell(), SWT.SAVE);
        dialog.setText(Messages.getString("SQLEditor.SaveAsDialog.Title"));
        dialog.setFilterExtensions(SUPPORTED_FILETYPES);
        dialog.setFilterNames(SUPPORTED_FILETYPES);
        dialog.setFileName("sql_editor.txt");

Maybe I am doing it wrong but I think the code should automatically when initialised in the SQL Editor it should highlight the code if it is initialised with an sql extension, and it should try and save automatically to that filename. I do not have the code set up in Eclipse currently so I can't do much investigation.

Anyone have any comments?