Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/META-INF/MANIFEST.MF =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/META-INF/MANIFEST.MF (revision 511515) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/META-INF/MANIFEST.MF (working copy) @@ -1,23 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Abator UI Plug-in -Bundle-SymbolicName: org.apache.ibatis.abator.ui; singleton:=true -Bundle-Version: 1.0.0 -Bundle-ClassPath: abatorui.jar -Bundle-Activator: org.apache.ibatis.abator.ui.plugin.AbatorUIPlugin -Bundle-Localization: plugin -Require-Bundle: org.apache.ibatis.abator.core, - org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.core.resources, - org.eclipse.jdt.core, - org.eclipse.text, - org.eclipse.jdt.launching, - org.eclipse.ui.editors, - org.eclipse.jface.text, - org.eclipse.ui.ide, - org.eclipse.ui.workbench.texteditor, - org.apache.ant, - org.eclipse.ant.core -Eclipse-AutoStart: true -Bundle-Vendor: ibatis.apache.org Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/NewConfigFileWizard.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/NewConfigFileWizard.java (revision 511515) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/NewConfigFileWizard.java (working copy) @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.ibatis.abator.ui.wizards; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; +import java.sql.Connection; +import java.util.Properties; import org.apache.ibatis.abator.ui.plugin.AbatorUIPlugin; import org.eclipse.core.resources.IContainer; @@ -35,7 +38,11 @@ import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizardContainer; +import org.eclipse.jface.wizard.IWizardContainer2; +import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; +import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; @@ -43,6 +50,11 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; +import org.eclipse.wst.rdb.connection.internal.ui.wizards.ConnectionWizardProperties; +import org.eclipse.wst.rdb.connection.internal.ui.wizards.shared.DatabaseAuthenticationWizardPage; +import org.eclipse.wst.rdb.internal.core.RDBCorePlugin; +import org.eclipse.wst.rdb.internal.core.connection.ConnectionInfo; +import org.eclipse.wst.rdb.internal.core.util.DatabaseProviderHelper; /** * This is a sample new wizard. Its role is to create a new file @@ -54,182 +66,478 @@ * as a template) is registered for the same extension, it will * be able to open it. */ +public class NewConfigFileWizard extends Wizard implements INewWizard +{ + private static final String P_PLUGINID_ROOT = "org.apache.ibatis.abator.ui.wizards."; + private static final String P_SELECT_CONFIG_PAGE = P_PLUGINID_ROOT + "SelectConfigPage"; + private static final String P_SELECT_CONNECTION_PAGE = P_PLUGINID_ROOT + "SelectConnectionWizardPage"; + private static final String P_AUTHENTICATION_PAGE = P_PLUGINID_ROOT + "DatabaseAuthenticationWizardPage"; + private static final String P_JDBC_CONFIGURATION_PAGE = P_PLUGINID_ROOT + "JDBCConfigurationWizardPage"; + private static final String P_ABATOR_CONFIGURATION_PAGE = P_PLUGINID_ROOT + "AbatorConfigurationWizardPage"; + private static final String P_SELECT_SCHEMA_PAGE = P_PLUGINID_ROOT + "SelectSchemaWizardPage"; + // private static final String P_SELECT_TABLE_PAGE = P_PLUGINID_ROOT + "SelectTableWizardPage"; -public class NewConfigFileWizard extends Wizard implements INewWizard { - private NewConfigFileWizardPage1 page; - private ISelection selection; + private NewConfigFileWizardPage1 _selectConfigPage; + private SelectConnectionWizardPage _selectConnectionPage; + private DatabaseAuthenticationWizardPage _authenticationPage; + private JDBCConfigurationWizardPage _jdbcConfigurationPage; + private AbatorConfigWizardPage _abatorConfigurationPage; + private SelectSchemaWizardPage _selectSchemaPage; - /** - * Constructor for NewConfigFileWizard. - */ - public NewConfigFileWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ + private boolean _controlsCreated = false; + private String _defaultConnection; + private boolean _noDefault = true; + private ConnectionWizardProperties _connectionProperties; - public void addPages() { - page = new NewConfigFileWizardPage1(selection); - addPage(page); - } + private ISelection _selection; - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - final String containerName = page.getLocation(); - final String fileName = page.getFileName(); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - try { - doFinish(containerName, fileName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the - * file if missing or just replace its contents, and open - * the editor on the newly created file. - */ + /** + * Constructor for NewConfigFileWizard. + * + * @param defaultConnection the default connection. + */ + public NewConfigFileWizard() + { + super(); + setNeedsProgressMonitor( true ); + setWindowTitle( "Abator Config Wizard Page" ); + } - private void doFinish( - String containerName, - String fileName, - IProgressMonitor monitor) - throws CoreException { - // create a sample file - monitor.beginTask("Creating " + fileName, 2); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName + "\" does not exist."); - } - IContainer container = (IContainer) resource; - final IFile file = container.getFile(new Path(fileName)); - try { - InputStream stream = openContentStream(); - if (file.exists()) { - file.setContents(stream, true, true, monitor); - } else { - file.create(stream, true, monitor); - } - stream.close(); - } catch (IOException e) { - } - monitor.worked(1); - monitor.setTaskName("Opening file for editing..."); - getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - IWorkbenchPage page = - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - try { - IDE.openEditor(page, file, true); - } catch (PartInitException e) { - } - } - }); - monitor.worked(1); - } - - /** - * We will initialize file contents with a sample text. - */ + /** + * We will accept the selection in the workbench to see if + * we can initialize from it. + * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) + */ + public void init( final IWorkbench workbench, final IStructuredSelection selection ) + { + _selection = selection; + } - private InputStream openContentStream() { - String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$ - if (lineSeparator == null) { - lineSeparator = "\n"; //$NON-NLS-1$ - } - - StringBuffer sb = new StringBuffer(); - sb.append(""); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(""); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(lineSeparator); - sb.append(""); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ + public void init( final IWorkbench workbench, final ISelection selection ) + { + _selection = selection; + // ISelection defaultConnection + if( selection != null ) + { + //TODO: type cast of defaultConnection ... + _defaultConnection = "sample"; + } + } - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); + /** + * @see Wizard#createPageControls(org.eclipse.swt.widgets.Composite) + */ + public void createPageControls( final Composite pageContainer ) + { + super.createPageControls( pageContainer ); + final IWizardContainer container = getContainer(); + if( container instanceof IWizardContainer2 ) + { + ( (IWizardContainer2) container ).updateSize(); + } + _controlsCreated = true; + } - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); + /** + * Adding the page to the wizard. + * @see Wizard#addPages() + */ + public void addPages() + { + super.addPages(); - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append(" "); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append("
"); //$NON-NLS-1$ - sb.append(lineSeparator); - - sb.append(lineSeparator); - sb.append("
"); //$NON-NLS-1$ - sb.append(lineSeparator); - sb.append("
"); //$NON-NLS-1$ - sb.append(lineSeparator); - - return new ByteArrayInputStream(sb.toString().getBytes()); - } + _selectConfigPage = new NewConfigFileWizardPage1( P_SELECT_CONFIG_PAGE, _selection ); + addPage( _selectConfigPage ); - private void throwCoreException(String message) throws CoreException { - IStatus status = - new Status(IStatus.ERROR, AbatorUIPlugin.getPluginId(), IStatus.OK, message, null); - throw new CoreException(status); - } + _selectConnectionPage = new SelectConnectionWizardPage( P_SELECT_CONNECTION_PAGE, _defaultConnection ); + addPage( _selectConnectionPage ); - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } + _authenticationPage = new DatabaseAuthenticationWizardPage( P_AUTHENTICATION_PAGE ); + addPage( _authenticationPage ); - public void init(IWorkbench workbench, ISelection selection) { - this.selection = selection; - } + _jdbcConfigurationPage = new JDBCConfigurationWizardPage( P_JDBC_CONFIGURATION_PAGE ); + addPage( _jdbcConfigurationPage ); + + _abatorConfigurationPage = new AbatorConfigWizardPage( P_ABATOR_CONFIGURATION_PAGE, _selection ); + addPage( _abatorConfigurationPage ); + + _selectSchemaPage = new SelectSchemaWizardPage( P_SELECT_SCHEMA_PAGE ); + addPage( _selectSchemaPage ); + } + + /* + * (non-Javadoc) + * @see Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage) + */ + public IWizardPage getNextPage( final IWizardPage wizardPage ) + { + _authenticationPage.setConnectionInfo( _selectConnectionPage.getSelectedConnection() ); + + // Sets the default connection properties, if one was defined. + if( _noDefault && _controlsCreated && _connectionProperties != null ) + { + _noDefault = false; + _jdbcConfigurationPage.setConnectionProperties( _connectionProperties ); + } + + final IWizardPage nextPage; + final String currentPage = wizardPage.getName(); + if( P_SELECT_CONFIG_PAGE.equals( currentPage ) ) + { + nextPage = _selectConnectionPage; + } + else if( P_SELECT_CONNECTION_PAGE.equals( currentPage ) ) + { + if( _selectConnectionPage.isNewConnectionSelected() ) + { + nextPage = _jdbcConfigurationPage; + } + else + { + // determine if prompt is needed + if( _selectConnectionPage.isSelectedConnectionClosed() ) + { + nextPage = _authenticationPage; + } + else + { + nextPage = _abatorConfigurationPage; // _selectSchemaPage + } + } + } + else if( P_JDBC_CONFIGURATION_PAGE.equals( currentPage ) ) + { + nextPage = _selectSchemaPage; + _selectConnectionPage._selectedConnection = _jdbcConfigurationPage.getConnectionName(); + } + else if( P_AUTHENTICATION_PAGE.equals( currentPage ) ) + { + nextPage = _abatorConfigurationPage; + } + else if( P_ABATOR_CONFIGURATION_PAGE.equals( currentPage ) ) + { + nextPage = _selectSchemaPage; + } + else if( P_SELECT_SCHEMA_PAGE.equals( currentPage ) ) + { + nextPage = null; + } + else + { + nextPage = super.getNextPage( wizardPage ); + } + return nextPage; + } + + /* + * (non-Javadoc) + * @see Wizard#canFinish() + */ + public boolean canFinish() + { + final boolean canFinish; + if( _selectSchemaPage.isPageComplete() && _selectConnectionPage.isExistingConnectionSelected() ) + { + canFinish = true; + } + else + { + canFinish = super.canFinish(); + } + return canFinish; + } + + /** + * This method is called when 'Finish' button is pressed in + * the wizard. We will create an operation and run it + * using wizard as execution context. + */ + public boolean performFinish() + { + final String containerName = _selectConfigPage.getLocation(); + final String fileName = _selectConfigPage.getFileName(); + final ConnectionInfo connection = _selectConnectionPage.getSelectedConnection(); + if( connection != null ) + { + final IRunnableWithProgress op = new IRunnableWithProgress() + { + public void run( final IProgressMonitor monitor ) throws InvocationTargetException + { + try + { + doFinish( containerName, fileName, connection, monitor ); + } + catch( CoreException e ) + { + throw new InvocationTargetException( e ); + } + finally + { + monitor.done(); + } + } + }; + try + { + getContainer().run( true, false, op ); + } + catch( final InterruptedException e ) + { + return false; + } + catch( final InvocationTargetException e ) + { + final Throwable realException = e.getTargetException(); + MessageDialog.openError( getShell(), "Error", realException.getMessage() ); + return false; + } + } + return true; + } + + /** + * The worker method. It will find the container, create the + * file if missing or just replace its contents, and open + * the editor on the newly created file. + */ + private void doFinish( final String containerName, final String fileName, final ConnectionInfo connection, + final IProgressMonitor monitor ) throws CoreException + { + // create a sample file + monitor.beginTask( "Creating " + fileName, 2 ); + final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + final IResource resource = root.findMember( new Path( containerName ) ); + if( !resource.exists() || !( resource instanceof IContainer ) ) + { + throwCoreException( "Container \"" + containerName + "\" does not exist." ); + } + final IContainer container = (IContainer) resource; + final IFile file = container.getFile( new Path( fileName ) ); + try + { + // the user and password are stored here. + final Properties p = connection.getProperties(); + + // JDBC_DRIVER and something else. + p.putAll( connection.getCustomProperties() ); + + // others ... + p.put( _PAR_classLocation, connection.getLoadingPath() ); + p.put( _PAR_connectionURL, connection.getURL() ); + p.put( _PAR_databaseName, connection.getDatabaseName() ); + p.put( _PAR_jdbcDriverClass, connection.getDriverClassName() ); + + final InputStream stream = openContentStream( p ); + if( file.exists() ) + { + file.setContents( stream, true, true, monitor ); + } + else + { + file.create( stream, true, monitor ); + } + stream.close(); + } + catch( IOException e ) + { + } + monitor.worked( 1 ); + monitor.setTaskName( "Opening file for editing..." ); + getShell().getDisplay().asyncExec( new Runnable() + { + public void run() + { + final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try + { + IDE.openEditor( page, file, true ); + } + catch( PartInitException e ) + { + } + } + } ); + monitor.worked( 1 ); + } + + /** + * We will initialize file contents with a sample text. + * + * TODO: move it out of this class ... + */ + private InputStream openContentStream( final Properties p ) + { + String lineSeparator = System.getProperty( "line.separator" ); //$NON-NLS-1$ + if( lineSeparator == null ) + { + lineSeparator = "\n"; //$NON-NLS-1$ + } + + final StringBuffer sb = new StringBuffer(); + + //TODO: combobox to get a different encoding ... + sb.append( "" ) //$NON-NLS-1$ + .append( lineSeparator ).append( "" ) //$NON-NLS-1$ + .append( lineSeparator ); + + sb.append( "" ) //$NON-NLS-1$ + .append( lineSeparator ).append( " " ) //$NON-NLS-1$ + .append( lineSeparator ); + + sb.append( lineSeparator ).append( " " ) //$NON-NLS-1$ + .append( lineSeparator ).append( " " ) //$NON-NLS-1$ + .append( lineSeparator ).append( " " ) //$NON-NLS-1$ + .append( lineSeparator ); + + //TODO: a new wizard page to configure the code below (coding stuff). + sb.append( lineSeparator ); + sb.append( " " ); //$NON-NLS-1$ + sb.append( lineSeparator ); + sb.append( " " ); //$NON-NLS-1$ + sb.append( lineSeparator ); + sb.append( " " ); //$NON-NLS-1$ + sb.append( lineSeparator ); + + //TODO: a new wizard page to configure the code below (schema, table, and columns). + sb.append( lineSeparator ); + sb.append( " " ); //$NON-NLS-1$ + sb.append( lineSeparator ); + sb.append( " " ); //$NON-NLS-1$ + sb.append( lineSeparator ); + sb.append( "
" ); //$NON-NLS-1$ + sb.append( lineSeparator ); + + sb.append( lineSeparator ).append( "
" ) //$NON-NLS-1$ + .append( lineSeparator ).append( "
" ) //$NON-NLS-1$ + .append( lineSeparator ); + + return new ByteArrayInputStream( sb.toString().getBytes() ); + } + + private void throwCoreException( final String message ) throws CoreException + { + IStatus status = new Status( IStatus.ERROR, AbatorUIPlugin.getPluginId(), IStatus.OK, message, null ); + throw new CoreException( status ); + } + + /** + * Sets the default connection properties. + * + * @param connectionProperties the default connection properties. + */ + public void setConnectionProperties( final ConnectionWizardProperties connectionProperties ) + { + _connectionProperties = connectionProperties; + } + + /** + * Returns the configured connection. + * + * @return the configured connection. + */ + public ConnectionInfo getConnection() + { + try + { + final ConnectionInfo connectionInfo; + if( _selectConnectionPage.isNewConnectionSelected() ) + { + _jdbcConfigurationPage.internalSaveWidgetValues(); + _jdbcConfigurationPage.performTestConnection( false ); + if( _jdbcConfigurationPage.isFinalConnection() ) + { + connectionInfo = _jdbcConfigurationPage.getConnection(); + saveConnection( connectionInfo ); + } + else + { + connectionInfo = null; + } + } + else + { + connectionInfo = _selectConnectionPage.getSelectedConnection(); + } + return connectionInfo; + } + catch( final Exception e ) + { + // If the connection is not valid, then this method should return null. + return null; + } + } + + /** + * Save the given connection at the default store. + * + * @param connectionInfo the connection to be saved. + * @return + */ + public ConnectionInfo saveConnection( final ConnectionInfo connectionInfo ) + { + Connection connection = null; + try + { + connection = connectionInfo.connect(); + connectionInfo.setSharedConnection( connection ); + connectionInfo.saveConnectionInfo(); + new DatabaseProviderHelper().setDatabase( connection, connectionInfo, connectionInfo.getDatabaseName() ); + } + catch( final Exception e ) + { + RDBCorePlugin.getDefault().getConnectionManager().removeConnectionInfo( connectionInfo.getName() ); + connection = null; + } + return connectionInfo; + } + + /** + * Simple class to display messages on eclipse. + */ + public class DisplayMessage implements Runnable + { + private String _title; + private String _message; + + /** + * Constructor. + * + * @param title the title message. + * @param message the message. + */ + public DisplayMessage( final String title, final String message ) + { + _title = title; + _message = message; + } + + /* + * (non-Javadoc) + * @see java.lang.Runnable#run() + */ + public void run() + { + MessageDialog.openInformation( getShell(), _title, _message ); + } + } + + /*/ internal constants /*/ + private static final String _PAR_databaseName = "Database"; + private static final String _PAR_jdbcDriverClass = "JDBC Driver Class"; + private static final String _PAR_classLocation = "Class Location"; + private static final String _PAR_connectionURL = "Connection URL"; + + private static final String _PAR_userId = "user"; + private static final String _PAR_userPassword = "password"; } \ No newline at end of file Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/JDBCConfigurationWizardPage.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/JDBCConfigurationWizardPage.java (revision 0) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/JDBCConfigurationWizardPage.java (revision 0) @@ -0,0 +1,70 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ibatis.abator.ui.wizards; + +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.wst.rdb.connection.internal.ui.wizards.shared.NewCWJDBCPage; + +/** + * The jdbc configuration page. + * + * @author Anaximandro de Godinho. + * @version $Revision: 1.0 $ + */ +public class JDBCConfigurationWizardPage extends NewCWJDBCPage +{ + /** + * Constructor. + * + * @param pageName the page name. + */ + public JDBCConfigurationWizardPage( final String pageName ) + { + super( pageName ); + } + + /* + * (non-Javadoc) + * @see org.eclipse.wst.rdb.connection.internal.ui.wizards.RDBWizardPage#getNextPage() + */ + public IWizardPage getNextPage() + { + performTestConnection( false ); + final IWizardPage nextPage; + if( isFinalConnection() ) + { + nextPage = super.getNextPage(); + } + else + { + nextPage = null; + } + return nextPage; + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage() + */ + public boolean canFlipToNextPage() + { + /* without this override the superclass will try to connect + * to the db on each key press event, so, don't remove it! + */ + return isPageComplete(); + } +} \ No newline at end of file Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/AbatorConfigWizardPage.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/AbatorConfigWizardPage.java (revision 0) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/AbatorConfigWizardPage.java (revision 0) @@ -0,0 +1,482 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ibatis.abator.ui.wizards; + +import org.eclipse.jface.dialogs.IDialogPage; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +/** + */ +public class AbatorConfigWizardPage extends WizardPage +{ + private ISelection _selection; + + private Composite _container = null; + private Group _grpGen = null; + private Composite _cmpGenM = null; + private Composite _cmpGenB = null; + private Combo _cboGenSet = null; + private Combo _cboGenModelType = null; + private Button _chkGenBigDecimals = null; + private Text _txtGenTypeResolver = null; + private Button _chkGenSuppressWarns = null; + + private Group _grpMod = null; + private Composite _cmpModM = null; + private Composite _cmpModB = null; + private Button _chkModEnableSub = null; + private Text _txtModTargetProject = null; + private Button _chkModTrimStrings = null; + private Text _txtModTargetPackage = null; + private Text _txtModRootClass = null; + + private Group _grpSql = null; + private Composite _cmpSqlM = null; + private Composite _cmpSqlB = null; + private Button _chkSqlEnableSub = null; + private Text _txtSqlTargetProject = null; + private Text _txtSqlTargetPackage = null; + private Text _txtSqlGeneratorClass = null; + + private Group _grpDao = null; + private Composite _cmpDaoM = null; + private Composite _cmpDaoB = null; + private Combo _cboDaoType = null; + private Button _chkDaoEnableSub = null; + private Combo _cboDaoByExample = null; + + private Text _txtDaoTargetProject = null; + private Text _txtDaoTargetPackage = null; + private Text _txtDaoSuperInterface = null; + private Combo _cboDaoNameCalculator = null; + + /** + * Constructor for SampleNewWizardPage. + * @param pageName the page name. + * @param selection - the current selection + */ + public AbatorConfigWizardPage( final String pageName, final ISelection selection ) + { + super( pageName ); + setTitle( "Abator Configuration File" ); + setDescription( "This wizard creates a new Abator for iBATIS configuration file." ); + _selection = selection; + } + + /** + * @see IDialogPage#createControl(Composite) + */ + public void createControl( final Composite parent ) + { + final GridData panelData = new GridData(); + panelData.horizontalAlignment = GridData.FILL; + panelData.grabExcessHorizontalSpace = true; + panelData.verticalAlignment = GridData.FILL; + panelData.grabExcessVerticalSpace = true; + + _container = new Composite( parent, SWT.NULL ); + _container.setLayoutData( panelData ); + _container.setLayout( new GridLayout() ); + + createGrpGeneral(); + createGrpModelGenerator(); + createGrpSqlGenerator(); + createGrpDaoGenerator(); + + setControl( _container ); + } + + private void createGrpGeneral() + { + _grpGen = new Group( _container, SWT.NONE ); + _grpGen.setLayout( groupLayout() ); + _grpGen.setLayoutData( groupData() ); + _grpGen.setText( "General Options" ); + createCmpGenM(); + createCmpGenB(); + } + + private void createCmpGenM() + { + _cmpGenM = new Composite( _grpGen, SWT.NONE ); + _cmpGenM.setLayout( compositeLayout() ); + _cmpGenM.setLayoutData( compositeData() ); + + final Label lblGenSet = new Label( _cmpGenM, SWT.NONE ); + lblGenSet.setText( "Generator Set:" ); + _cboGenSet = new ComboX( _cmpGenM, SWT.READ_ONLY, "Legacy;Java2;Java5", 1 ).getCombo(); + + final Label lblModelType = new Label( _cmpGenM, SWT.NONE ); + lblModelType.setText( "Model Type:" ); + _cboGenModelType = new ComboX( _cmpGenM, SWT.READ_ONLY, "conditional;flat;hierarchical", 1 ).getCombo(); + + final Label filler1 = new Label( _cmpGenM, SWT.NONE ); + + final Label lblBigDecimals = new Label( _cmpGenM, SWT.NONE ); + lblBigDecimals.setText( "BigDecimals ?" ); + _chkGenBigDecimals = new Button( _cmpGenM, SWT.CHECK ); + + final Label lblTypeResolver = new Label( _cmpGenM, SWT.NONE ); + lblTypeResolver.setText( "Type Resolver:" ); + _txtGenTypeResolver = new Text( _cmpGenM, SWT.BORDER ); + _txtGenTypeResolver.setLayoutData( textDataS() ); + + final Label lblSuppressWarn = new Label( _cmpGenM, SWT.NONE ); + lblSuppressWarn.setText( "Suppress Warns?" ); + _chkGenSuppressWarns = new Button( _cmpGenM, SWT.CHECK ); + } + + private void createCmpGenB() + { + _cmpGenB = new Composite( _grpGen, SWT.NONE ); + _cmpGenB.setLayout( buttonLayout() ); + _cmpGenB.setLayoutData( buttonData() ); + + final Label filler1 = new Label( _cmpGenB, SWT.NONE ); + filler1.setLayoutData( buttonDataS() ); + + final Button btnModTargetPackage = new Button( _cmpGenB, SWT.NONE ); + btnModTargetPackage.setLayoutData( buttonDataS() ); + btnModTargetPackage.setText( "..." ); + } + + private void createGrpModelGenerator() + { + _grpMod = new Group( _container, SWT.NONE ); + _grpMod.setLayoutData( groupData() ); + _grpMod.setLayout( groupLayout() ); + _grpMod.setText( "Model Generator" ); + createCmpModM(); + createCmpModB(); + } + + private void createCmpModM() + { + _cmpModM = new Composite( _grpMod, SWT.NONE ); + _cmpModM.setLayout( compositeLayout() ); + _cmpModM.setLayoutData( compositeData() ); + + final Label lblModEnableSub = new Label( _cmpModM, SWT.NONE ); + lblModEnableSub.setText( "Sub packages?" ); + _chkModEnableSub = new Button( _cmpModM, SWT.CHECK ); + + final Label lblModTargetProject = new Label( _cmpModM, SWT.NONE ); + lblModTargetProject.setText( "Target Project:" ); + _txtModTargetProject = new Text( _cmpModM, SWT.BORDER ); + _txtModTargetProject.setLayoutData( textDataS() ); + + final Label lblModTrimStrings = new Label( _cmpModM, SWT.NONE ); + lblModTrimStrings.setText( "Trim Strings?" ); + _chkModTrimStrings = new Button( _cmpModM, SWT.CHECK ); + + final Label lblModTargetPackage = new Label( _cmpModM, SWT.NONE ); + lblModTargetPackage.setText( "Target Package:" ); + _txtModTargetPackage = new Text( _cmpModM, SWT.BORDER ); + _txtModTargetPackage.setLayoutData( textDataS() ); + + final Label filler1 = new Label( _cmpModM, SWT.NONE ); + final Label filler2 = new Label( _cmpModM, SWT.NONE ); + final Label lblModRootClass = new Label( _cmpModM, SWT.NONE ); + lblModRootClass.setText( "Root Class:" ); + _txtModRootClass = new Text( _cmpModM, SWT.BORDER ); + _txtModRootClass.setLayoutData( textDataS() ); + } + + private void createCmpModB() + { + _cmpModB = new Composite( _grpMod, SWT.NONE ); + _cmpModB.setLayoutData( buttonData() ); + _cmpModB.setLayout( buttonLayout() ); + + final Button btnModTargetProject = new Button( _cmpModB, SWT.NONE ); + btnModTargetProject.setLayoutData( buttonDataS() ); + btnModTargetProject.setText( "..." ); + + final Button btnModTargetPackage = new Button( _cmpModB, SWT.NONE ); + btnModTargetPackage.setLayoutData( buttonDataS() ); + btnModTargetPackage.setText( "..." ); + + final Button btnModRootClass = new Button( _cmpModB, SWT.NONE ); + btnModRootClass.setLayoutData( buttonDataS() ); + btnModRootClass.setText( "..." ); + } + + private void createGrpSqlGenerator() + { + _grpSql = new Group( _container, SWT.NONE ); + _grpSql.setLayoutData( groupData() ); + _grpSql.setLayout( groupLayout() ); + _grpSql.setText( "SQL Map Generator" ); + createCmpSqlM(); + createCmpSqlB(); + } + + private void createCmpSqlM() + { + _cmpSqlM = new Composite( _grpSql, SWT.NONE ); + _cmpSqlM.setLayout( compositeLayout() ); + _cmpSqlM.setLayoutData( compositeData() ); + + final Label lblSqlEnableSub = new Label( _cmpSqlM, SWT.NONE ); + lblSqlEnableSub.setText( "Sub packages?" ); + _chkSqlEnableSub = new Button( _cmpSqlM, SWT.CHECK ); + + final Label lblSqlTargetProject = new Label( _cmpSqlM, SWT.NONE ); + lblSqlTargetProject.setText( "Target Project:" ); + _txtSqlTargetProject = new Text( _cmpSqlM, SWT.BORDER ); + _txtSqlTargetProject.setLayoutData( textDataS() ); + + final Label filler1 = new Label( _cmpSqlM, SWT.NONE ); + final Label filler2 = new Label( _cmpSqlM, SWT.NONE ); + final Label lblSqlTargetPackage = new Label( _cmpSqlM, SWT.NONE ); + lblSqlTargetPackage.setText( "Target Package:" ); + _txtSqlTargetPackage = new Text( _cmpSqlM, SWT.BORDER ); + _txtSqlTargetPackage.setLayoutData( textDataS() ); + + final Label filler3 = new Label( _cmpSqlM, SWT.NONE ); + final Label filler4 = new Label( _cmpSqlM, SWT.NONE ); + final Label lblSqlRootClass = new Label( _cmpSqlM, SWT.NONE ); + lblSqlRootClass.setText( "Generator Class:" ); + _txtSqlGeneratorClass = new Text( _cmpSqlM, SWT.BORDER ); + _txtSqlGeneratorClass.setLayoutData( textDataS() ); + } + + private void createCmpSqlB() + { + _cmpSqlB = new Composite( _grpSql, SWT.NONE ); + _cmpSqlB.setLayoutData( buttonData() ); + _cmpSqlB.setLayout( buttonLayout() ); + + final Button btnSqlTargetProject = new Button( _cmpSqlB, SWT.NONE ); + btnSqlTargetProject.setLayoutData( buttonDataS() ); + btnSqlTargetProject.setText( "..." ); + + final Button btnSqlTargetPackage = new Button( _cmpSqlB, SWT.NONE ); + btnSqlTargetPackage.setLayoutData( buttonDataS() ); + btnSqlTargetPackage.setText( "..." ); + + final Button btnSqlRootClass = new Button( _cmpSqlB, SWT.NONE ); + btnSqlRootClass.setLayoutData( buttonDataS() ); + btnSqlRootClass.setText( "..." ); + } + + private void createGrpDaoGenerator() + { + _grpDao = new Group( _container, SWT.NONE ); + _grpDao.setLayoutData( groupData() ); + _grpDao.setLayout( groupLayout() ); + _grpDao.setText( "DAO Generator" ); + createCmpDaoM(); + createCmpDaoB(); + } + + private void createCmpDaoM() + { + _cmpDaoM = new Composite( _grpDao, SWT.NONE ); + _cmpDaoM.setLayout( compositeLayout() ); + _cmpDaoM.setLayoutData( compositeData() ); + + final Label lblDaoType = new Label( _cmpDaoM, SWT.NONE ); + lblDaoType.setText( "Type:" ); + _cboDaoType = new ComboX( _cmpDaoM, SWT.READ_ONLY, "IBATIS;GENERIC-CI;GENERIC-SI;SPRING", 0 ).getCombo(); + + final Label lblDaoTargetProject = new Label( _cmpDaoM, SWT.NONE ); + lblDaoTargetProject.setText( "Target Project:" ); + _txtDaoTargetProject = new Text( _cmpDaoM, SWT.BORDER ); + _txtDaoTargetProject.setLayoutData( textDataS() ); + + final Label lblDaoEnableSub = new Label( _cmpDaoM, SWT.NONE ); + lblDaoEnableSub.setText( "Sub packages?" ); + _chkDaoEnableSub = new Button( _cmpDaoM, SWT.CHECK ); + + final Label lblDaoTargetPackage = new Label( _cmpDaoM, SWT.NONE ); + lblDaoTargetPackage.setText( "Target Package:" ); + _txtDaoTargetPackage = new Text( _cmpDaoM, SWT.BORDER ); + _txtDaoTargetPackage.setLayoutData( textDataS() ); + + final Label lblDaoExampleMethod = new Label( _cmpDaoM, SWT.NONE ); + lblDaoExampleMethod.setText( "By Example:" ); + _cboDaoByExample = new ComboX( _cmpDaoM, SWT.READ_ONLY, "public;private;protected;default", 0 ).getCombo(); + + final Label lblSuperInterface = new Label( _cmpDaoM, SWT.NONE ); + lblSuperInterface.setText( "Super Interface:" ); + _txtDaoSuperInterface = new Text( _cmpDaoM, SWT.BORDER ); + _txtDaoSuperInterface.setLayoutData( textDataS() ); + + final Label filler1 = new Label( _cmpDaoM, SWT.NONE ); + final Label filler2 = new Label( _cmpDaoM, SWT.NONE ); + + final Label lblDaoRootClass = new Label( _cmpDaoM, SWT.NONE ); + lblDaoRootClass.setText( "Calculator Class:" ); + _cboDaoNameCalculator = new ComboX( _cmpDaoM, SWT.NONE, "default;extended", 1 ).getCombo(); + _cboDaoNameCalculator.setLayoutData( textDataS() ); + } + + private void createCmpDaoB() + { + _cmpDaoB = new Composite( _grpDao, SWT.NONE ); + _cmpDaoB.setLayoutData( buttonData() ); + _cmpDaoB.setLayout( buttonLayout() ); + + final Button btnDaoTargetProject = new Button( _cmpDaoB, SWT.NONE ); + btnDaoTargetProject.setLayoutData( buttonDataS() ); + btnDaoTargetProject.setText( "..." ); + + final Button btnDaoTargetPackage = new Button( _cmpDaoB, SWT.NONE ); + btnDaoTargetPackage.setLayoutData( buttonDataS() ); + btnDaoTargetPackage.setText( "..." ); + + final Button btnDaoRootClass = new Button( _cmpDaoB, SWT.NONE ); + btnDaoRootClass.setLayoutData( buttonDataS() ); + btnDaoRootClass.setText( "..." ); + + final Button btnDaoRootInterface = new Button( _cmpDaoB, SWT.NONE ); + btnDaoRootInterface.setLayoutData( buttonDataS() ); + btnDaoRootInterface.setText( "..." ); + } + + /*/ defaults /*/ + + /*/ layout methods /*/ + private GridLayout groupLayout() + { + final GridLayout layout = new GridLayout(); + layout.makeColumnsEqualWidth = false; + layout.numColumns = 2; + return layout; + } + + private GridLayout compositeLayout() + { + final GridLayout layout = new GridLayout(); + layout.numColumns = 5; + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.makeColumnsEqualWidth = true; + return layout; + } + + private GridLayout buttonLayout() + { + final GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.horizontalSpacing = 0; + layout.verticalSpacing = 2; + layout.marginHeight = 2; + layout.marginWidth = 0; + layout.makeColumnsEqualWidth = true; + return layout; + } + + private GridData groupData() + { + final GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + data.verticalAlignment = GridData.FILL; + data.grabExcessVerticalSpace = true; + return data; + } + + private GridData compositeData() + { + final GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + data.verticalAlignment = GridData.CENTER; + data.grabExcessVerticalSpace = true; + return data; + } + + private GridData buttonData() + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = false; + data.verticalAlignment = GridData.CENTER; + data.grabExcessVerticalSpace = false; + data.widthHint = 19; + return data; + } + + private GridData buttonDataS() + { + final GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + data.verticalAlignment = GridData.CENTER; + data.widthHint = 15; + data.heightHint = 16; + return data; + } + + private GridData textDataS() + { + final GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + data.verticalAlignment = GridData.CENTER; + data.horizontalSpan = 2; + return data; + } + + /** + * TODO: move this class to one package in org.eclipse.swt.widgets. to be able to extend Combo!!! + * (this is a SWT restriction) + */ + private class ComboX + { + private final Combo _combo; + + public ComboX( final Composite container, final int style, final String delimitedItens, final int selectedItem ) + { + _combo = new Combo( container, style ); + addDelimitedItens( delimitedItens, selectedItem ); + } + + public void addDelimitedItens( final String delimitedItens, final int selectedItem ) + { + final String itens[] = delimitedItens.split( ";" ); + final int l = itens.length; + for( int i = 0; i < l; i++ ) + { + _combo.add( itens[i] ); + } + if( selectedItem > -1 ) + { + _combo.select( selectedItem ); + } + } + + public Combo getCombo() + { + return _combo; + } + } +} \ No newline at end of file Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/SelectConnectionWizardPage.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/SelectConnectionWizardPage.java (revision 0) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/SelectConnectionWizardPage.java (revision 0) @@ -0,0 +1,182 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ibatis.abator.ui.wizards; + +import java.sql.SQLException; +import java.util.List; +import java.util.Vector; + +import org.eclipse.wst.rdb.connection.internal.ui.wizards.shared.ExistingConnectionsWizardPage; +import org.eclipse.wst.rdb.internal.core.RDBCorePlugin; +import org.eclipse.wst.rdb.internal.core.connection.ConnectionInfo; + +/** + * The select existing connection wizard page. + * + * @author Anaximandro de Godinho. + * @version $Revision: 1.0 $ + */ +public class SelectConnectionWizardPage extends ExistingConnectionsWizardPage +{ + // the filter list. + protected final List _filter; + + // the default connection. + protected String _selectedConnection; + + /** + * Constructor. + * + * @param pageName the page name. + */ + public SelectConnectionWizardPage( final String pageName, final String defaultConnection ) + { + super( pageName ); + _filter = new Vector(); + _selectedConnection = defaultConnection; + } + + /* + * (non-Javadoc) + * @see org.eclipse.wst.rdb.connection.internal.ui.wizards.shared.ExistingConnectionsWizardPage#setVisible(boolean) + */ + public void setVisible( boolean visible ) + { + super.setVisible( visible ); + if( visible && _selectedConnection != null ) + { + setDefaultConnection( _selectedConnection ); + _selectedConnection = null; + } + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage() + */ + public boolean canFlipToNextPage() + { + final boolean can = super.canFlipToNextPage(); + if( can ) + { + final boolean isNewConnection = isNewConnectionSelected(); + if( isNewConnection ) + { + setDefaultConnection( "" ); + _selectedConnection = null; + } + else + { + final ConnectionInfo info = getSelectedConnection(); + if( info != null ) + { + _selectedConnection = info.getName(); + } + } + } + return can; + } + + /** + * This method overrides the base class implementation and returns + * all connections for the specified filter, if one was specified. + * + * @see org.eclipse.wst.rdb.connection.internal.ui.wizards.shared.ExistingConnectionsWizardPage#getConnectionsToDisplay() + */ + protected ConnectionInfo[] getConnectionsToDisplay() + { + final ConnectionInfo[] infos; + final ConnectionInfo[] allInfos = RDBCorePlugin.getDefault().getConnectionManager().getAllNamedConnectionInfo(); + if( _filter.isEmpty() ) + { + infos = allInfos; + } + else + { + final int infoLength = allInfos.length; + infos = new ConnectionInfo[infoLength]; + if( infoLength > 0 ) + { + final List filteredInfosCollection = new Vector(); + for( int i = 0; i < infoLength; i++ ) + { + final String entry = getFilterEntry( allInfos[i].getDatabaseDefinition().getProduct(), allInfos[i] + .getDatabaseDefinition().getVersion() ); + if( _filter.contains( entry ) ) + { + filteredInfosCollection.add( allInfos[i] ); + } + } + filteredInfosCollection.toArray( infos ); + } + } + return infos; + } + + /** + * Returns the status of the selected connection. + * + * @return true if the selected connection is still open otherwise false. + */ + public boolean isSelectedConnectionClosed() + { + boolean isClosed = true; + final ConnectionInfo connectionInfo = getSelectedConnection(); + if( ( connectionInfo != null ) && ( connectionInfo.getSharedConnection() != null ) ) + { + try + { + if( !connectionInfo.getSharedConnection().isClosed() ) + { + isClosed = false; + } + } + catch( final SQLException e ) + { + // just ignore. + } + } + return isClosed; + } + + /** + * Adds one filter to the filter list, this filter will be used on the connection wizard page. + * + * @param vendor the vendor string to filter all connections at the connection wizard page. + * @param version the version string to filter all connections at the connection wizard page. + */ + protected void addFilter( final String vendor, final String version ) + { + _filter.add( getFilterEntry( vendor, version ) ); + } + + /** + * Builds the vendor + version filter string. + * + * @param vendor the vendor string. + * @param version the version string. + */ + protected String getFilterEntry( final String vendor, final String version ) + { + final String vendor2 = vendor == null? _empty: vendor.trim().toUpperCase(); + final String version2 = version == null? _empty: version.trim().toUpperCase(); + return vendor2 + ";" + version2; + } + + /*/ private constants /*/ + private static final String _empty = ""; +} \ No newline at end of file Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/NewConfigFileWizardPage1.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/NewConfigFileWizardPage1.java (revision 511515) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/NewConfigFileWizardPage1.java (working copy) @@ -54,10 +54,11 @@ /** * Constructor for SampleNewWizardPage. + * @param pageName the page name. * @param selection - the current selection */ - public NewConfigFileWizardPage1(ISelection selection) { - super("wizardPage"); + public NewConfigFileWizardPage1(String pageName, ISelection selection) { + super(pageName); setTitle("Abator Configuration File"); setDescription("This wizard creates a new Abator for iBATIS configuration file."); this.selection = selection; Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/SelectSchemaWizardPage.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/SelectSchemaWizardPage.java (revision 0) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/wizards/SelectSchemaWizardPage.java (revision 0) @@ -0,0 +1,52 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ibatis.abator.ui.wizards; + +import org.eclipse.wst.rdb.connection.internal.ui.filter.SchemaFilterWizardPage; + +/** + * The select schema wizard page. + * + * @author Anaximandro de Godinho. + * @version $Revision: 1.0 $ + */ +public class SelectSchemaWizardPage extends SchemaFilterWizardPage +{ + /** + * Constructor. + * + * @param pageName the page name. + */ + public SelectSchemaWizardPage( final String pageName ) + { + super( pageName ); + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean) + */ + public void setVisible( final boolean visible ) + { + super.setVisible( visible ); + if( visible ) + { + setConnectionInfo( ( (NewConfigFileWizard) getWizard() ).getConnection() ); + setPageComplete( true ); + } + } +} \ No newline at end of file Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/content/AbatorConfigVerifyer.java =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/content/AbatorConfigVerifyer.java (revision 511515) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/src/org/apache/ibatis/abator/ui/content/AbatorConfigVerifyer.java (working copy) @@ -16,7 +16,6 @@ package org.apache.ibatis.abator.ui.content; -import java.io.IOException; import java.io.InputStream; import java.io.StringReader; @@ -82,7 +81,7 @@ } } - public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { + public InputSource resolveEntity(String publicId, String systemId) throws SAXException { if (!XmlConstants.ABATOR_CONFIG_PUBLIC_ID.equals(publicId)) { throw new SAXException("Not an Abator configuration file"); } Index: D:/work/abator/eclipse/org.apache.ibatis.abator.ui/plugin.xml =================================================================== --- D:/work/abator/eclipse/org.apache.ibatis.abator.ui/plugin.xml (revision 511515) +++ D:/work/abator/eclipse/org.apache.ibatis.abator.ui/plugin.xml (working copy) @@ -1,7 +1,41 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +