Ejemplo n.º 1
0
 /**
  * @return <code>true</code> if data source should be auto-created based on the current preference
  *     value
  */
 static boolean shouldAutoCreateDataSource() {
   return DqpPlugin.getInstance()
       .getPreferences()
       .getBoolean(
           PreferenceConstants.AUTO_CREATE_DATA_SOURCE,
           PreferenceConstants.AUTO_CREATE_DATA_SOURCE_DEFAULT);
 }
  /** @return the server manager (never <code>null</code>) */
  private ServerManager getServerManager() {
    if (this.serverMgr == null) {
      this.serverMgr = DqpPlugin.getInstance().getServerManager();
    }

    return this.serverMgr;
  }
  /**
   * @see
   *     org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   * @since 5.5.3
   */
  @SuppressWarnings("unused")
  @Override
  protected Control createDialogArea(Composite parent) {

    Composite pnlOuter = (Composite) super.createDialogArea(parent);
    Composite panel = new Composite(pnlOuter, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    panel.setLayout(gridLayout);
    panel.setLayoutData(new GridData(GridData.FILL_BOTH));

    // set title
    setTitle(UTIL.getString(PREFIX + "title")); // $NON-NLS-1$
    setMessage(UTIL.getString(PREFIX + "initialMessage")); // $NON-NLS-1$

    //		Group serversGroup = WidgetFactory.createGroup(panel, UTIL.getString(PREFIX +
    // "teiidServers"), GridData.FILL_BOTH, 2, 2); //$NON-NLS-1$
    //		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    //		gd.horizontalSpan = 2;
    //		serversGroup.setLayoutData(gd);

    ACTION_COMBO:
    {
      serversCombo = new Combo(panel, SWT.NONE | SWT.READ_ONLY);
      GridData gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalSpan = 2;
      serversCombo.setLayoutData(gd);

      serversCombo.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent ev) {
              selectedServer = null;
              String serverName = serversCombo.getItem(serversCombo.getSelectionIndex());

              Collection<ITeiidServer> teiidServers =
                  DqpPlugin.getInstance().getServerManager().getServers();
              for (ITeiidServer teiidServer : teiidServers) {
                if (teiidServer.getCustomLabel().equalsIgnoreCase(serverName)) {
                  selectedServer = teiidServer;
                  break;
                }
              }

              updateState();
            }
          });
      Collection<ITeiidServer> teiidServers =
          DqpPlugin.getInstance().getServerManager().getServers();
      List<String> nameList = new ArrayList<String>();
      for (ITeiidServer teiidServer : teiidServers) {
        nameList.add(teiidServer.getCustomLabel());
      }
      WidgetUtil.setComboItems(serversCombo, nameList, null, true);
    }

    return panel;
  }
Ejemplo n.º 4
0
  /**
   * If the preview preference is disabled or a Teiid server does not exist, a dialog is shown
   * asking the user if they want to enable preview and create a server.
   *
   * @param shell the shell used to display dialog if necessary
   * @return <code>true</code> if preview is enabled, a Teiid server exists, and a connection to the
   *     server has been made
   */
  public static boolean ensurePreviewEnabled(Shell shell) {
    boolean previewEnabled = isPreviewEnabled();
    boolean previewServerExists = previewServerExists();

    // dialog message (null if preview preference enabled and server exists)
    String msg = null;

    if (!previewEnabled && !previewServerExists) {
      msg = UTIL.getString(PREFIX + "previewDisabledNoTeiidInstanceMsg"); // $NON-NLS-1$
    } else if (!previewEnabled) {
      msg = UTIL.getString(PREFIX + "previewDisabledMsg"); // $NON-NLS-1$
    } else if (!previewServerExists) {
      msg = UTIL.getString(PREFIX + "noTeiidInstanceMsg"); // $NON-NLS-1$
    }

    // if necessary open question dialog
    if ((msg != null)
        && MessageDialog.openQuestion(
            shell, UTIL.getString(PREFIX + "confirmEnablePreviewTitle"), msg)) { // $NON-NLS-1$
      // if necessary change preference
      if (!previewEnabled) {
        IEclipsePreferences prefs = DqpPlugin.getInstance().getPreferences();
        prefs.putBoolean(PreferenceConstants.PREVIEW_ENABLED, true);

        // save
        try {
          prefs.flush();
        } catch (BackingStoreException e) {
          UTIL.log(e);
        }
      }

      // if necessary create new server
      if (!previewServerExists) {
        runNewServerAction(shell);
      }
    }

    // if dialog was shown get values again
    if (msg != null) {
      previewEnabled = isPreviewEnabled();
      previewServerExists = previewServerExists();

      // if preview is not enabled or server does not exist then user canceled the dialog or the new
      // server wizard
      if (!previewEnabled || !previewServerExists) {
        return false;
      }
    }

    // abort preview if server is not connected
    return serverConnectionExists(shell);
  }
Ejemplo n.º 5
0
  private void populateJBossServerCombo() {
    serverMap.clear();

    IServer[] servers = DqpPlugin.getInstance().getServersProvider().getServers();
    for (IServer server : servers) {
      if (TeiidServerAdapterUtil.isJBossServer(server)) {
        serverMap.add(server);
      }
    }

    String[] items = serverMap.keySet().toArray(new String[0]);
    jbossServerCombo.setItems(items);

    if (items.length == 0) {
      newServerOrOpenServerViewHyperlink.setText(NEW_SERVER_LABEL);
    } else {
      newServerOrOpenServerViewHyperlink.setText(EDIT_SERVER_LABEL);
      jbossServerCombo.setText(items[0]);
    }

    // even if nothing in combo, still want the viewer to refresh
    handleServerComboSelection();
  }
Ejemplo n.º 6
0
 private static ITeiidServerManager getServerManager() {
   return DqpPlugin.getInstance().getServerManager();
 }
  public static void executeAction(String id, Properties properties, boolean synchronous) {

    // IMPORT OPTIONS
    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_DDL)) {
      launchWizard(ImportMetadataAction.DDL_TO_RELATIONAL, properties, synchronous);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_FLAT_FILE)) {
      launchWizard(ImportMetadataAction.TEIID_FLAT_FILE, properties, synchronous);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_JDBC)) {
      launchWizard(ImportMetadataAction.JDBC, properties, synchronous);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_SALESFORCE)) {
      launchWizard(ImportMetadataAction.SALESFORCE_TO_RELATIONAL, properties, synchronous);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_XML_FILE)) {
      properties.put(IPropertiesContext.KEY_IMPORT_XML_TYPE, IPropertiesContext.IMPORT_XML_LOCAL);
      launchWizard(ImportMetadataAction.TEIID_XML_FILE, properties, synchronous);
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_XML_FILE_URL)) {
      properties.put(IPropertiesContext.KEY_IMPORT_XML_TYPE, IPropertiesContext.IMPORT_XML_REMOTE);
      launchWizard(ImportMetadataAction.TEIID_XML_FILE, properties, synchronous);
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_WSDL_TO_SOURCE)) {
      launchWizard(ImportMetadataAction.WSDL_TO_RELATIONAL, properties, synchronous);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.IMPORT_WSDL_TO_WS)) {
      launchWizard(ImportMetadataAction.WSDL_TO_WEB_SERVICE, properties, synchronous);
      return;
    }

    // NEW MODEL OPTIONS
    if (id.equalsIgnoreCase(COMMAND_IDS.NEW_MODEL_RELATIONAL_SOURCE)) {
      createNewModel(ModelType.PHYSICAL_LITERAL, MODEL_CLASSES.RELATIONAL, properties);
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.NEW_MODEL_RELATIONAL_VIEW)) {
      createNewModel(ModelType.VIRTUAL_LITERAL, MODEL_CLASSES.RELATIONAL, properties);
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.NEW_MODEL_WS)) {
      createNewModel(ModelType.VIRTUAL_LITERAL, MODEL_CLASSES.WEB_SERVICE, properties);
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.NEW_MODEL_XML_DOC)) {
      createNewModel(ModelType.VIRTUAL_LITERAL, MODEL_CLASSES.XML, properties);
      return;
    }

    // NEW OBJECT OPTIONS
    if (id.equalsIgnoreCase(COMMAND_IDS.DEFINE_VIEW_TABLE)) {
      DefineViewTableAction action = new DefineViewTableAction(properties);
      action.run();
      return;
    }

    // CONNECTIONPROFILE OPTIONS
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_JDBC)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_JDBC, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_FLAT_FILE)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_ODA_FLAT_FILE_ID, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_LDAP)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_LDAP_CONNECTION, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_MODESHAPE)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_MODESHAPE, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_SALESFORCE)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_SALESFORCE_CONNECTION, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_WEB_SERVICE)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_WS_CONNECTION, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_WEB_SERVICE_ODA)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_ODA_WS_ID, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_XML_FILE_LOCAL)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_XML_FILE_LOCAL, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_CONNECTION_XML_FILE_URL)) {
      createConnection(CONNECTION_PROFILE_IDS.CATEGORY_XML_FILE_URL, properties);
      return;
    }
    if (id.equalsIgnoreCase(COMMAND_IDS.GENERATE_WS_MODELS_FROM_WSDL)) {
      launchWizard(ImportMetadataAction.WSDL_TO_RELATIONAL, properties, synchronous);
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_VDB)) {
      ModelerUiViewUtils.launchWizard(
          "newVdbWizard", new StructuredSelection(), properties, synchronous); // $NON-NLS-1$
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.DEFINE_VDB)) {
      DefineVdbAction action = new DefineVdbAction(properties);
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.EDIT_VDB)) {
      EditVdbAction action = new EditVdbAction();
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.EXECUTE_VDB)) {
      ExecuteVdbAction action = new ExecuteVdbAction(properties);
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.DEPLOY_VDB)) {
      DeployVdbAction action = new DeployVdbAction(properties);
      action.queryUserAndRun();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.NEW_TEIID_MODEL_PROJECT)) {
      ModelerUiViewUtils.launchWizard(
          "newModelProject", new StructuredSelection(), properties, synchronous); // $NON-NLS-1$
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.DEFINE_TEIID_MODEL_PROJECT)) {
      DefineProjectAction action = new DefineProjectAction(properties);
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.OPEN_DATA_SOURCE_EXPLORER_VIEW)) {
      try {
        UiUtil.getWorkbenchPage()
            .showView(
                "org.eclipse.datatools.connectivity.DataSourceExplorerNavigator"); //$NON-NLS-1$
      } catch (final PartInitException err) {
        AdvisorUiConstants.UTIL.log(err);
        WidgetUtil.showError(err.getLocalizedMessage());
      }
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.PREVIEW_DATA)) {
      PreviewDataAction action = new PreviewDataAction(properties);
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.NEW_TEIID_SERVER)) {
      RuntimeAssistant.runNewServerAction(
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.EDIT_TEIID_SERVER)) {
      RuntimeAssistant.runEditServerAction(
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.CREATE_DATA_SOURCE)) {
      // make sure there is a Teiid connection
      if (RuntimeAssistant.ensureServerConnection(
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
          Messages.CreateDataSource_NoServerMessage)) {
        try {
          TeiidServer teiidServer = DqpPlugin.getInstance().getServerManager().getDefaultServer();

          CreateDataSourceAction action = new CreateDataSourceAction();
          action.setAdmin(teiidServer.getAdmin());

          action.setSelection(new StructuredSelection());

          action.setEnabled(true);
          action.run();
        } catch (Exception ex) {
          AdvisorUiConstants.UTIL.log(ex);
        }
      }

      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.DEFINE_SOURCE)) {
      DefineSourceAction action = new DefineSourceAction(properties);
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(COMMAND_IDS.GENERATE_REST_WAR)) {
      GenerateRESTWarAction action = new GenerateRESTWarAction(properties);
      action.run();
      return;
    }

    //		if( id.equalsIgnoreCase(COMMAND_IDS.GENERATE_SOAP_WAR)) {
    //			// TODO
    //	        return;
    //		}

    if (id.equalsIgnoreCase(COMMAND_IDS.DEPLOY_WAR)) {
      LaunchInstructionsAction action = new LaunchInstructionsAction(INSTRUCTIONS.DEPLOY_WAR_FILE);
      action.run();
      return;
    }

    if (id.equalsIgnoreCase(CHEAT_SHEET_IDS.CONSUME_SOAP_SERVICE)
        || id.equalsIgnoreCase(CHEAT_SHEET_IDS.CREATE_AND_TEST_VDB)
        || id.equalsIgnoreCase(CHEAT_SHEET_IDS.MODEL_FLAT_FILE_SOURCE)
        || id.equalsIgnoreCase(CHEAT_SHEET_IDS.MODEL_FROM_JDBC_SOURCE)
        || id.equalsIgnoreCase(CHEAT_SHEET_IDS.MODEL_XML_LOCAL_SOURCE)
        || id.equalsIgnoreCase(CHEAT_SHEET_IDS.MODEL_XML_REMOTE_SOURCE)
        || id.equalsIgnoreCase(CHEAT_SHEET_IDS.MULTI_SOURCE_VDB)) {
      executeCheatSheet(id);
      return;
    }

    MessageDialog.openWarning(
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
        "Unimplemented Action", //$NON-NLS-1$
        "Action for ID [" + id + "] is not yet implemented"); // $NON-NLS-1$ //$NON-NLS-2$
  }
Ejemplo n.º 8
0
  /** This is a callback that will allow us to create the viewer and initialize it. */
  @Override
  public void createPartControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());

    Composite frame = toolkit.createComposite(parent, SWT.BORDER);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(frame);

    Composite comboDescFrame = toolkit.createComposite(frame, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(comboDescFrame);
    GridLayoutFactory.fillDefaults()
        .margins(5, 20)
        .spacing(SWT.DEFAULT, 25)
        .applyTo(comboDescFrame);

    Composite comboFrame = toolkit.createComposite(comboDescFrame, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(comboFrame);
    GridLayoutFactory.fillDefaults().applyTo(comboFrame);

    Composite labelFrame = toolkit.createComposite(comboFrame, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(labelFrame);
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(labelFrame);

    Label jbLabel =
        WidgetFactory.createLabel(
            labelFrame, UTIL.getString("TeiidServerOverviewSection.jbLabel")); // $NON-NLS-1$
    jbLabel.setForeground(labelFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));
    GridDataFactory.swtDefaults().grab(false, false).applyTo(jbLabel);

    newServerOrOpenServerViewHyperlink =
        toolkit.createHyperlink(labelFrame, EDIT_SERVER_LABEL, SWT.NONE);
    GridDataFactory.swtDefaults().applyTo(newServerOrOpenServerViewHyperlink);
    newServerOrOpenServerViewHyperlink.addHyperlinkListener(
        new HyperlinkAdapter() {

          @Override
          public void linkActivated(HyperlinkEvent e) {
            if (serverMap.isEmpty()) {
              // There are no servers so open the server wizard
              NewServerAction action =
                  new NewServerAction(getViewSite().getShell(), getServerManager());
              action.run();
            } else {
              // open the servers view
              IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
              try {
                window
                    .getActivePage()
                    .showView("org.eclipse.wst.server.ui.ServersView"); // $NON-NLS-1$
              } catch (PartInitException ex) {
                UTIL.log(ex);
              }
            }
          }
        });

    jbossServerCombo = new Combo(comboFrame, SWT.READ_ONLY | SWT.DROP_DOWN);
    toolkit.adapt(jbossServerCombo);
    GridDataFactory.swtDefaults().minSize(250, 30).grab(true, false).applyTo(jbossServerCombo);
    jbossServerCombo.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            handleServerComboSelection();
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            handleServerComboSelection();
          }
        });

    Text descriptionText =
        toolkit.createText(
            comboDescFrame,
            UTIL.getString("TeiidServerOverviewSection.description"), // $NON-NLS-1$
            SWT.MULTI | SWT.WRAP);
    descriptionText.setForeground(comboDescFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));
    GridDataFactory.fillDefaults()
        .grab(false, true)
        .hint(100, SWT.DEFAULT)
        .applyTo(descriptionText);

    super.createPartControl(frame);

    viewer = getCommonViewer();
    GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl());

    viewer.setSorter(new NameSorter());

    DqpPlugin.getInstance().getServersProvider().addServerLifecycleListener(serversListener);

    // Populate the jboss server combo box which
    // should also populate the viewer as well
    populateJBossServerCombo();

    viewer.expandToLevel(3);
  }
  /**
   * @see org.eclipse.jface.action.IAction#run()
   * @since 5.0
   */
  @Override
  public void run() {
    final IWorkbenchWindow iww = VdbUiPlugin.singleton.getCurrentWorkbenchWindow();
    // A) get the selected model and extract a "ConnectionProfileInfo" from it using the
    // ConnectionProfileInfoHandler

    // B) Use ConnectionProfileHandler.getConnectionProfile(connectionProfileInfo) to query the user
    // to
    // select a ConnectionProfile (or create new one)

    // C) Get the resulting ConnectionProfileInfo from the dialog and re-set the model's connection
    // info
    // via the ConnectionProfileInfoHandler
    ModelResource modelResource = null;
    if (!getSelection().isEmpty()) {
      IFile modelFile = (IFile) SelectionUtilities.getSelectedObjects(getSelection()).get(0);
      modelResource = ModelUtilities.getModelResource(modelFile);
    }
    try {

      ITeiidServer teiidServer = cachedServer;
      if (teiidServer == null) {
        if (DqpPlugin.getInstance().getServerManager().getDefaultServer() == null) {
          MessageDialog.openConfirm(
              iww.getShell(),
              getString("noServer.title"), // $NON-NLS-1$
              getString("noServer.message")); // $NON-NLS-1$
          return;
        } else if (DqpPlugin.getInstance().getServerManager().getDefaultServer().isConnected()) {
          teiidServer = DqpPlugin.getInstance().getServerManager().getDefaultServer();
        } else {
          MessageDialog.openConfirm(
              iww.getShell(),
              getString("noServerConnection.title"), // $NON-NLS-1$
              getString("noServerConnection.message")); // $NON-NLS-1$
          return;
        }

        teiidServer.connect();
      }

      Collection<ModelResource> relationalModels = getRelationalModelsWithConnections();
      final CreateDataSourceWizard wizard =
          new CreateDataSourceWizard(teiidServer, relationalModels, modelResource);

      wizard.init(iww.getWorkbench(), new StructuredSelection());
      final WizardDialog dialog = new WizardDialog(wizard.getShell(), wizard);
      final int rc = dialog.open();
      if (rc == Window.OK) {
        // Need to check if the connection needs a password

        TeiidDataSourceInfo info = wizard.getTeiidDataSourceInfo();
        Properties props = info.getProperties();
        IConnectionInfoProvider provider = info.getConnectionInfoProvider();
        boolean cancelledPassword = false;
        if (null != provider.getDataSourcePasswordPropertyKey()
            && props.get(provider.getDataSourcePasswordPropertyKey()) == null) {

          int result =
              new AbstractPasswordDialog(
                  iww.getShell(), getString("passwordTitle"), null) { // $NON-NLS-1$
                @SuppressWarnings("synthetic-access")
                @Override
                protected boolean isPasswordValid(final String password) {
                  pwd = password;
                  return true;
                }
              }.open();
          if (result == Window.OK) {
            props.put(provider.getDataSourcePasswordPropertyKey(), this.pwd);
          } else {
            cancelledPassword = true;
          }
        }

        if (!cancelledPassword) {
          teiidServer.getOrCreateDataSource(
              info.getDisplayName(), info.getJndiName(), provider.getDataSourceType(), props);
        }
      }
      // createDataSource(modelFile);
    } catch (Exception e) {
      if (modelResource != null) {
        MessageDialog.openError(
            getShell(),
            getString("errorCreatingDataSourceForModel", modelResource.getItemName()),
            e.getMessage()); // $NON-NLS-1$
        DqpUiConstants.UTIL.log(
            IStatus.ERROR,
            e,
            getString(
                "errorCreatingDataSourceForModel", modelResource.getItemName())); // $NON-NLS-1$
      } else {
        MessageDialog.openError(
            getShell(), getString("errorCreatingDataSource"), e.getMessage()); // $NON-NLS-1$
        DqpUiConstants.UTIL.log(
            IStatus.ERROR, e, getString("errorCreatingDataSource")); // $NON-NLS-1$
      }
    }
  }
 /**
  * Obtains the <code>IEclipsePreferences</code> where this preference is being persisted.
  *
  * @return the preferences
  */
 private IEclipsePreferences getPreferences() {
   return DqpPlugin.getInstance().getPreferences();
 }