Package org.eclipse.datatools.connectivity.drivers

Examples of org.eclipse.datatools.connectivity.drivers.DriverInstance


    }

    // Otherwise create one, and if necessary also create a new driver
    // definition
    if (profile == null) {
      DriverInstance driverInstance = null;

      // See if there is already a driver instance that can be used;
      driverInstance = DriverManager.getInstance().getDriverInstanceByName(descriptor.getDriverName());

      // Prompt for new driver instance
      if (driverInstance == null) {

        TemplateDescriptor[] templates = TemplateDescriptor.getDriverTemplateDescriptors();
        TemplateDescriptor driverTemplate = null;

        if (templates != null) {
          for (TemplateDescriptor temp : templates) {
            String templateID = temp.getId();
            if (templateID.contains(descriptor.getDriverTemplateIdentifier())) {
              driverTemplate = temp;
              break;
            }
          }
        }

        if (driverTemplate != null) {
          IPropertySet properties = new PropertySetImpl(descriptor.getDriverName(), driverTemplate.getName());
          Properties props = new Properties();
          props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, Messages.DataToolsTunnelAction_PROP_REPLACE);

          props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, driverTemplate.getId());

          // Must set the properties as the driver dialogue
          // throws exceptions if all properties are not set with
          // values
          // Properties get set again later regardless if a driver
          // instance
          // was created or not
          setProperties(props, tunnelDescriptor);

          properties.setBaseProperties(props);

          Shell shell = PlatformUI.getWorkbench().getModalDialogShellProvider().getShell();
          if (shell != null) {
            DriverDialog jdbcDriverDialog = new DriverDialog(shell, driverTemplate.getParentCategory());

            jdbcDriverDialog.setPropertySet(properties);
            jdbcDriverDialog.setEditMode(true);
            jdbcDriverDialog.setIsEditable(true);

            if (jdbcDriverDialog.open() == Window.OK) {
              properties = jdbcDriverDialog.getPropertySet();
              if (properties != null) {

                DriverManager.getInstance().addDriverInstance(properties);
                driverInstance = DriverManager.getInstance().getDriverInstanceByName(
                    descriptor.getDriverName());

              }
            }
          }
        }
      }

      if (driverInstance != null) {
        Properties props = driverInstance.getPropertySet().getBaseProperties();
        props.setProperty(DATA_TOOLS_DRIVER_DEFINITION_ID, driverInstance.getId());
        try {
          String providerID = descriptor.getDriverProviderID();
          profile = ProfileManager.getInstance().createProfile(descriptor.getProfileName(),
              CLOUD_FOUNDRY_JDBC_PROFILE_DESCRIPTION, providerID, props);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.datatools.connectivity.drivers.DriverInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.