Commit 9fa4a6d2 authored by Andrey Lugovskiy's avatar Andrey Lugovskiy Committed by Matija Obreza
Browse files

- fixed jdbc url string

parent ae6c557f
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<excludes> <excludes>
<exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.3</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>
\ No newline at end of file
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<excludes> <excludes>
<exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:jar:4.3</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>
\ No newline at end of file
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<excludes> <excludes>
<exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.3</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>
\ No newline at end of file
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<excludes> <excludes>
<exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:jar:4.3</exclude>
<exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.3.2</exclude> <exclude>org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.3</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>
\ No newline at end of file
...@@ -31,6 +31,8 @@ import org.eclipse.jface.databinding.swt.WidgetProperties; ...@@ -31,6 +31,8 @@ import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
...@@ -93,10 +95,10 @@ public class DatabaseDialog extends Dialog { ...@@ -93,10 +95,10 @@ public class DatabaseDialog extends Dialog {
public DatabaseDialog(Shell parent, TreeViewer treeViewer, int style) { public DatabaseDialog(Shell parent, TreeViewer treeViewer, int style) {
super(parent, style); super(parent, style);
this.treeViewer = treeViewer; this.treeViewer = treeViewer;
this.databaseSettings=new DatabaseSettings(); this.databaseSettings = new DatabaseSettings();
setText("Add Database"); setText("Add Database");
} }
public void setDatabaseSettings(DatabaseSettings databaseSettings) { public void setDatabaseSettings(DatabaseSettings databaseSettings) {
this.databaseSettings = databaseSettings; this.databaseSettings = databaseSettings;
} }
...@@ -142,6 +144,7 @@ public class DatabaseDialog extends Dialog { ...@@ -142,6 +144,7 @@ public class DatabaseDialog extends Dialog {
/* Datasource type */ /* Datasource type */
Label lblType = new Label(grpDbConfiguration, SWT.NONE); Label lblType = new Label(grpDbConfiguration, SWT.NONE);
lblType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); lblType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblType.setAlignment(SWT.RIGHT);
lblType.setText("Database type"); lblType.setText("Database type");
comboType = new Combo(grpDbConfiguration, SWT.NONE); comboType = new Combo(grpDbConfiguration, SWT.NONE);
...@@ -166,6 +169,7 @@ public class DatabaseDialog extends Dialog { ...@@ -166,6 +169,7 @@ public class DatabaseDialog extends Dialog {
txtName = new Text(grpDbConfiguration, SWT.BORDER); txtName = new Text(grpDbConfiguration, SWT.BORDER);
txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); txtName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
/* Connection URL */ /* Connection URL */
Label lblDbUrl = new Label(grpDbConfiguration, SWT.NONE); Label lblDbUrl = new Label(grpDbConfiguration, SWT.NONE);
lblDbUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); lblDbUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
...@@ -174,6 +178,12 @@ public class DatabaseDialog extends Dialog { ...@@ -174,6 +178,12 @@ public class DatabaseDialog extends Dialog {
txtDbUrl = new Text(grpDbConfiguration, SWT.BORDER); txtDbUrl = new Text(grpDbConfiguration, SWT.BORDER);
txtDbUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDbUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtDbUrl.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
txtDbUrl.setSelection(txtDbUrl.getText().length());
}
});
/* User */ /* User */
Label lblDbUserName = new Label(grpDbConfiguration, SWT.NONE); Label lblDbUserName = new Label(grpDbConfiguration, SWT.NONE);
lblDbUserName.setAlignment(SWT.RIGHT); lblDbUserName.setAlignment(SWT.RIGHT);
...@@ -190,12 +200,12 @@ public class DatabaseDialog extends Dialog { ...@@ -190,12 +200,12 @@ public class DatabaseDialog extends Dialog {
txtDbPassword = new Text(grpDbConfiguration, SWT.BORDER | SWT.PASSWORD); txtDbPassword = new Text(grpDbConfiguration, SWT.BORDER | SWT.PASSWORD);
txtDbPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDbPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Label lblProperties = new Label(grpDbConfiguration, SWT.NONE); Label lblProperties = new Label(grpDbConfiguration, SWT.NONE);
lblProperties.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); lblProperties.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
lblProperties.setText("Additional JDBC properties"); lblProperties.setText("Additional JDBC properties");
lblProperties.setAlignment(SWT.RIGHT); lblProperties.setAlignment(SWT.RIGHT);
txtDbProperties = new Text(grpDbConfiguration, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI); txtDbProperties = new Text(grpDbConfiguration, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
GridData gd_txtDbProperties = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); GridData gd_txtDbProperties = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_txtDbProperties.heightHint = 60; gd_txtDbProperties.heightHint = 60;
...@@ -261,11 +271,11 @@ public class DatabaseDialog extends Dialog { ...@@ -261,11 +271,11 @@ public class DatabaseDialog extends Dialog {
Properties props = new Properties(); Properties props = new Properties();
props.put("user", this.txtDbUserName.getText()); props.put("user", this.txtDbUserName.getText());
props.put("password", this.txtDbPassword.getText()); props.put("password", this.txtDbPassword.getText());
props.put("charSet", "windows-1250"); props.put("charSet", "windows-1250");
try {
connection = ConnectionUtils.getConnection(databaseSettings.getDriverClassName(), this.txtDbUrl.getText(), props);
try {
connection = ConnectionUtils.getConnection(databaseSettings.getDriverClassName(), this.txtDbUrl.getText(), props);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
message = "Could not load JDBC driver " + e.getMessage(); message = "Could not load JDBC driver " + e.getMessage();
} catch (SQLException e) { } catch (SQLException e) {
...@@ -299,6 +309,7 @@ public class DatabaseDialog extends Dialog { ...@@ -299,6 +309,7 @@ public class DatabaseDialog extends Dialog {
this.shell.close(); this.shell.close();
ConnectionUtils.close(connection); ConnectionUtils.close(connection);
} }
protected DataBindingContext initDataBindings() { protected DataBindingContext initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext(); DataBindingContext bindingContext = new DataBindingContext();
// //
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment