1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / wizards / BookmarkWizard.java
index 2b4a902..e5fe89e 100644 (file)
@@ -1,5 +1,6 @@
 package net.sourceforge.phpdt.sql.wizards;
 
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -14,6 +15,8 @@ import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+import net.sourceforge.phpdt.sql.Messages;
+import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
 import net.sourceforge.phpdt.sql.adapters.AdapterFactory;
 import net.sourceforge.phpdt.sql.adapters.DriverInfo;
 import net.sourceforge.phpdt.sql.view.BookmarkView;
@@ -25,34 +28,34 @@ public class BookmarkWizard extends Wizard {
        private BookmarkNode current;
 
        public void init(BookmarkNode selection) {
-               System.out.println("Initing workbench");
+               System.out.println("Initing workbench"); //$NON-NLS-1$
                this.current = selection;
-               setWindowTitle("New Bookmark");
+               setWindowTitle(Messages.getString("BookmarkWizard.NewBookmark")); //$NON-NLS-1$
        }
        public void init() {
-               System.out.println("Initing workbench");
+               System.out.println("Initing workbench"); //$NON-NLS-1$
                current = null;
-               setWindowTitle("New Bookmark");
+               setWindowTitle(Messages.getString("BookmarkWizard.NewBookmark")); //$NON-NLS-1$
        }
        public boolean performFinish() {
-               System.out.println("perform finish workbench");
+               System.out.println("perform finish workbench"); //$NON-NLS-1$
                mainPage.performFinish();
                return true;
        }
        public void addPages() {
-               System.out.println("adding pages");
+               System.out.println("adding pages"); //$NON-NLS-1$
                if (current != null) {
-                       mainPage = new BookmarkPage("Testing...", current);
+                       mainPage = new BookmarkPage(Messages.getString("BookmarkWizard.Testing"), current); //$NON-NLS-1$
                } else {
-                       mainPage = new BookmarkPage("Testing...");
+                       mainPage = new BookmarkPage(Messages.getString("BookmarkWizard.Testing")); //$NON-NLS-1$
                }
                addPage(mainPage);
-               System.out.println("adding pages");
+               System.out.println("adding pages"); //$NON-NLS-1$
        }
 }
 
 class BookmarkPage extends WizardPage {
-       public static final String ADD = "ADD";
+       public static final String ADD = "ADD"; //$NON-NLS-1$
        String action = ADD;
        Text name;
        Text username;
@@ -63,6 +66,7 @@ class BookmarkPage extends WizardPage {
        //List driverList;
        Combo type;
        Text driverFile;
+       private IPreferenceStore fStore =       PHPEclipseSQLPlugin.getDefault().getPreferenceStore();
 
        BookmarkNode initialData = null;
 
@@ -87,10 +91,10 @@ class BookmarkPage extends WizardPage {
        }
 
        public void createControl(Composite parent) {
-               System.out.println("page create control");
+               System.out.println("page create control"); //$NON-NLS-1$
                dialog = new FileDialog(getContainer().getShell(), SWT.OPEN);
-               dialog.setFilterExtensions(new String[]{"*.jar", "*.zip","*.*"});
-               dialog.setFilterNames(new String[]{"Jar Files (*.jar)","Zip Files (*.zip)", "All Files (*.*)"});
+               dialog.setFilterExtensions(new String[]{"*.jar", "*.zip","*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+               dialog.setFilterNames(new String[]{Messages.getString("BookmarkWizard.JarFiles"),Messages.getString("BookmarkWizard.ZipFiles"), Messages.getString("BookmarkWizard.AllFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                Composite container = new Composite(parent, SWT.NULL);
                GridLayout layout = new GridLayout();
                container.setLayout(layout);
@@ -99,21 +103,21 @@ class BookmarkPage extends WizardPage {
 
 
                Label label = new Label(container, SWT.NULL);
-               label.setText("*Bookmark Name");
+               label.setText(Messages.getString("BookmarkWizard.BookmarkNameAst")); //$NON-NLS-1$
                name = new Text(container, SWT.BORDER | SWT.SINGLE);
                GridData fullHorizontal = new GridData();
                fullHorizontal.horizontalAlignment = GridData.FILL;
                name.setLayoutData(fullHorizontal);
 
                label = new Label(container, SWT.NULL);
-               label.setText("*Username");
+               label.setText(Messages.getString("BookmarkWizard.UsernameAst")); //$NON-NLS-1$
                username = new Text(container, SWT.BORDER | SWT.SINGLE);
                fullHorizontal = new GridData();
                fullHorizontal.horizontalAlignment = GridData.FILL;
                username.setLayoutData(fullHorizontal);
 
                label = new Label(container, SWT.NULL);
-               label.setText("*Password");
+               label.setText(Messages.getString("BookmarkWizard.PasswordAst")); //$NON-NLS-1$
                password = new Text(container, SWT.BORDER | SWT.SINGLE);
                password.setEchoChar('*');
                fullHorizontal = new GridData();
@@ -121,21 +125,21 @@ class BookmarkPage extends WizardPage {
                password.setLayoutData(fullHorizontal);
  
                label = new Label(container, SWT.NULL);
-               label.setText("Schema (optional)");
+               label.setText(Messages.getString("BookmarkWizard.Schema")); //$NON-NLS-1$
                schema = new Text(container, SWT.BORDER | SWT.SINGLE);
                fullHorizontal = new GridData();
                fullHorizontal.horizontalAlignment = GridData.FILL;
                schema.setLayoutData(fullHorizontal);
 
                label = new Label(container, SWT.NULL);
-               label.setText("*Connect");
+               label.setText(Messages.getString("BookmarkWizard.ConnectAst")); //$NON-NLS-1$
                connect = new Text(container, SWT.BORDER | SWT.SINGLE);
                fullHorizontal = new GridData();
                fullHorizontal.horizontalAlignment = GridData.FILL;
                connect.setLayoutData(fullHorizontal);
 
                label = new Label(container, SWT.NULL);
-               label.setText("*Driver");
+               label.setText(Messages.getString("BookmarkWizard.DriverAst")); //$NON-NLS-1$
                driver = new Text(container, SWT.BORDER | SWT.SINGLE);
                fullHorizontal = new GridData();
                fullHorizontal.horizontalAlignment = GridData.FILL;
@@ -165,7 +169,7 @@ class BookmarkPage extends WizardPage {
                });*/
 
                label = new Label(container, SWT.NULL);
-               label.setText("*Type");
+               label.setText(Messages.getString("BookmarkWizard.TypeAst")); //$NON-NLS-1$
                type = new Combo(container, SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY);
                String driverNames[] = new String[drivers.length];
                for (int i = 0; i < drivers.length; i++) {
@@ -178,14 +182,14 @@ class BookmarkPage extends WizardPage {
                type.setLayoutData(fullHorizontal);
 
                label = new Label(container, SWT.NULL);
-               label.setText("*Driver Filename");
+               label.setText(Messages.getString("BookmarkWizard.DriverFilenameAst")); //$NON-NLS-1$
                driverFile = new Text(container, SWT.BORDER | SWT.SINGLE);
                fullHorizontal = new GridData();
                fullHorizontal.horizontalAlignment = GridData.FILL;
                driverFile.setLayoutData(fullHorizontal);
 
                Button button = new Button(container, SWT.PUSH);
-               button.setText("Browse...");
+               button.setText(Messages.getString("BookmarkWizard.Browse")); //$NON-NLS-1$
                
                button.addSelectionListener(new SelectionListener() {
                        public void widgetDefaultSelected(SelectionEvent e) {
@@ -214,7 +218,21 @@ class BookmarkPage extends WizardPage {
                        type.select(selectedIndex);
                        driverFile.setText(initialData.getDriverFile());
                        updateDriverList();
+               }else {
+
+               username.setText(fStore.getString("phpeclipse.sql.username.connect"));
+               connect.setText(fStore.getString("phpeclipse.sql.connect.connect"));
+               driver.setText(fStore.getString("phpeclipse.sql.driver.connect"));
+               String typeData = fStore.getString("phpeclipse.sql.type.connect");
+               int selectedIndex = 0;
+               for (int i = 0; i < drivers.length; i++) {
+                       if (typeData.equals(drivers[i].getDisplayName())) {
+                               selectedIndex = i;
+                       }
                }
+               type.select(selectedIndex);
+               driverFile.setText(fStore.getString("phpeclipse.sql.filename.connect"));
+       }
                setControl(container);
 
                setPageComplete(true);
@@ -239,6 +257,7 @@ class BookmarkPage extends WizardPage {
                if (initialData == null) {
                        initialData = new BookmarkNode();
                }
+               
                initialData.setName(name.getText());
                initialData.setUsername(username.getText());
                initialData.setPassword(password.getText());
@@ -251,5 +270,11 @@ class BookmarkPage extends WizardPage {
                }
                initialData.setDriverFile(driverFile.getText());
                BookmarkView.getInstance().addNewBookmark(initialData);
+               
+               //PHP Specific section
+               fStore.putValue("phpeclipse.sql.username.connect", username.getText());
+               fStore.putValue("phpeclipse.sql.connect.connect", connect.getText());
+               fStore.putValue("phpeclipse.sql.driver.connect", driver.getText());
+               fStore.putValue("phpeclipse.sql.filename.connect",driverFile.getText());
        }
 }
\ No newline at end of file