01: /**
02: *
03: */package net.refractions.udig.catalog.internal.db2.ui;
04:
05: import java.net.URL;
06:
07: import net.refractions.udig.catalog.db2.internal.Messages;
08: import net.refractions.udig.catalog.internal.db2.DB2ServiceExtension;
09: import net.refractions.udig.catalog.ui.preferences.AbstractProprietaryJarPreferencePage;
10:
11: import org.eclipse.core.runtime.Platform;
12: import org.eclipse.jface.resource.ImageDescriptor;
13: import org.eclipse.ui.IWorkbenchPreferencePage;
14:
15: /**
16: * @author jones
17: */
18: public class DB2Preferences extends
19: AbstractProprietaryJarPreferencePage implements
20: IWorkbenchPreferencePage {
21: private static final String JDBC_DRIVER = "db2jcc.jar"; //$NON-NLS-1$
22: private static final String LICENSE = "db2jcc_license_cu.jar"; //$NON-NLS-1$
23:
24: /**
25: * @param title
26: * @param image
27: */
28: public DB2Preferences() {
29: super (Messages.DB2Preferences_title);
30: }
31:
32: public DB2Preferences(String file) {
33: super (file);
34: }
35:
36: public DB2Preferences(String file, ImageDescriptor desc) {
37: super (file, desc);
38: }
39:
40: public static boolean isInstalled() {
41: return DB2ServiceExtension.getFactory().isAvailable();
42: }
43:
44: @Override
45: protected String getDefaultJarName(int jarIndex) {
46: if (jarIndex == 0) {
47: return JDBC_DRIVER;
48: } else
49: return LICENSE;
50: }
51:
52: @Override
53: protected String getDriverLabel(int jarIndex) {
54: if (jarIndex == 0) {
55: return Messages.DB2Preferences_driverLabel;
56: } else
57: return Messages.DB2Preferences_licenceLabel;
58: }
59:
60: @Override
61: protected int getRequiredJarsCount() {
62: return 2;
63: }
64:
65: @Override
66: protected boolean installed() {
67: return isInstalled();
68: }
69:
70: @Override
71: protected URL getLibsURL() {
72: return Platform
73: .getBundle("net.refractions.udig.libs.db2").getEntry("/libs"); //$NON-NLS-1$ //$NON-NLS-2$
74: }
75:
76: }
|