/** * 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(); }
/** * Accept all of the binding type modifications. This will go thru the Binding modifications and * make them permanent. */ public void applyBindingTypeModifications() { // If any of the newSymbols is non-null, there are type modifications for (int i = 0; i < bindingList.size(); i++) { Binding originalBinding = originalBindingList.get(i); Binding binding = bindingList.get(i); // Change the Attribute Types if required if (binding.hasAttrTypeModification()) { originalBinding.setNewAttrDatatype(binding.getCurrentAttrDatatype()); } // Set the SqlSymbol on the original Binding if required if (binding.sqlSymbolWasConverted()) { originalBinding.setNewSymbol(binding.getCurrentSymbol()); } } }
/** 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; }