コード例 #1
0
  /**
   * Update the Symbol Conversion Panel with the provided binding info
   *
   * @param binding the selected Binding
   */
  private void updateSymbolConversionPanel(Binding binding) {
    if (binding != null) {
      // Update the runtimeType label text and image
      Object symbol = binding.getCurrentSymbol();
      if (symbol != null) {
        symbolRuntimeTypeLabel.setText(getTypeText(symbol));
        sqlSymbolLabel.setImage(getLabelImage(symbol));
        sqlSymbolLabel.setText(symbol.toString());
      }
      // Update the available conversion label
      String convertedSymbol = binding.getSqlConversionText();
      int lossOfPrecIndex = convertedSymbol.indexOf('\n');
      String warningText = CoreStringUtil.Constants.EMPTY_STRING;
      if (lossOfPrecIndex > -1) {
        warningText = convertedSymbol.substring(lossOfPrecIndex + 1, convertedSymbol.length());
        convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex);
      }
      symbolConversionLabel.setText(convertedSymbol);
      symbolWarningLabel.setText(warningText);
    }

    updateSymbolConversionPanelButtons(binding);

    sqlGroup.layout();
  }
コード例 #2
0
    public String getConvertedSymbol(Binding binding) {
      String convertedSymbol = binding.getSqlConversionText();
      int lossOfPrecIndex = convertedSymbol.indexOf('\n');
      if (lossOfPrecIndex > -1) {
        convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex);
      }

      return convertedSymbol;
    }
コード例 #3
0
    public String getWarningText(Binding binding) {
      String convertedSymbol = binding.getSqlConversionText();
      int lossOfPrecIndex = convertedSymbol.indexOf('\n');
      String warningText = CoreStringUtil.Constants.EMPTY_STRING;
      if (lossOfPrecIndex > -1) {
        warningText = convertedSymbol.substring(lossOfPrecIndex + 1, convertedSymbol.length());
      }

      return warningText;
    }
コード例 #4
0
 public boolean canConvert(Binding binding) {
   String convertedSymbol = binding.getSqlConversionText();
   int lossOfPrecIndex = convertedSymbol.indexOf('\n');
   if (lossOfPrecIndex > -1) {
     convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex);
   }
   if (convertedSymbol.toUpperCase().startsWith("CONVERT SQL SYMBOL")) { // $NON-NLS-1$
     return false;
   }
   return true;
 }
コード例 #5
0
  /** Create the Panel for resolving sql symbols */
  private void createResolveSqlPanel(Composite parent) {
    Group newGroup = WidgetFactory.createGroup(parent, RESOLVE_SQL_GROUP_NAME);
    GridLayout gridLayout = new GridLayout();
    newGroup.setLayout(gridLayout);
    gridLayout.numColumns = 3;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.marginLeft = 5;
    gridLayout.marginBottom = 5;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    newGroup.setLayoutData(gridData);
    newGroup.setText(SQL_SYMBOL_TXT);
    // SQL Symbol Label
    // --------------------------------------
    sqlSymbolLabel =
        WidgetFactory.createLabel(newGroup, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // $NON-NLS-1$
    GridData gdSSL =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 3, 1);
    sqlSymbolLabel.setLayoutData(gdSSL);
    sqlSymbolLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));

    // Symbol RuntimeType Label
    // --------------------------------------
    Label rtTypeLabel = WidgetFactory.createLabel(newGroup, RUNTIME_TYPE_TXT);
    GridData gdRT =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 2, 1);
    rtTypeLabel.setLayoutData(gdRT);
    // WidgetFactory.createLabel(newGroup, "");

    Binding binding = bindingList.get(0);
    Object symbol = binding.getCurrentSymbol();
    String text = getLabelText(symbol);
    symbolRuntimeTypeLabel =
        WidgetFactory.createLabel(
            newGroup, text, GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);

    // Available Conversion Title Label
    // --------------------------------------
    Label cvLabel =
        WidgetFactory.createLabel(
            newGroup, GridData.HORIZONTAL_ALIGN_BEGINNING, CONVERTED_SYMBOL_TXT);
    GridData gdCV =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 2, 1);
    cvLabel.setLayoutData(gdCV);

    // Available Sql Conversion Text
    // --------------------------------------

    String convertedSymbol = binding.getSqlConversionText();
    int lossOfPrecIndex = convertedSymbol.indexOf('\n');
    String warningText = CoreStringUtil.Constants.EMPTY_STRING;
    if (lossOfPrecIndex > -1) {
      warningText = convertedSymbol.substring(lossOfPrecIndex + 1, convertedSymbol.length());
      convertedSymbol = convertedSymbol.substring(0, lossOfPrecIndex);
    }

    symbolConversionLabel =
        WidgetFactory.createLabel(newGroup, convertedSymbol, GridData.FILL_BOTH);

    symbolWarningLabel = WidgetFactory.createLabel(newGroup, warningText, GridData.FILL_BOTH);
    GridData gdWarning =
        new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_FILL, false, false, 3, 1);
    symbolWarningLabel.setLayoutData(gdWarning);

    // Conversion Buttons Panel
    // --------------------------------------

    // Create the changeSelectedSql Button
    this.convertSelectedSqlButton =
        WidgetFactory.createButton(
            newGroup, CONVERT_SELECTED_SQL_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING);
    this.convertSelectedSqlButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            convertSelectedSqlPressed();
          }
        });

    // Create the changeAllSql Button
    this.convertAllSqlButton =
        WidgetFactory.createButton(
            newGroup, CONVERT_ALL_SQL_BUTTON, GridData.HORIZONTAL_ALIGN_BEGINNING);
    this.convertAllSqlButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent event) {
            convertAllSqlPressed();
          }
        });
    sqlGroup = newGroup;
  }