Skip to content

Commit

Permalink
TEIIDDES-1802 fixed enablement issues with Add button and added toolt…
Browse files Browse the repository at this point in the history
…ip to Include check-box
  • Loading branch information
blafond committed Jul 29, 2013
1 parent 7f31e28 commit cc36fed
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
Expand Up @@ -127,6 +127,7 @@ public class Messages extends NLS {
public static String newIndexMessage;
public static String createIndexTitle;
public static String editIndexTitle;
public static String includeResultSetTooltip;

static {
NLS.initializeMessages("org.teiid.designer.relational.ui.messages", Messages.class); //$NON-NLS-1$
Expand Down
Expand Up @@ -180,6 +180,7 @@ protected void synchronizeExtendedUI() {
if( this.getRelationalReference().getResultSet() == null ) {
if( WidgetUtil.widgetValueChanged(includeResultSetCB, false)) {
this.includeResultSetCB.setSelection(false);
this.addColumnButton.setEnabled(false);
}

this.resultSetNameText.setEnabled(false);
Expand Down Expand Up @@ -226,6 +227,7 @@ private Composite createResultSetPanel(Composite parent) {
this.includeResultSetCB = new Button(thePanel, SWT.CHECK | SWT.RIGHT);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(this.includeResultSetCB);
this.includeResultSetCB.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.INCLUDE));
this.includeResultSetCB.setToolTipText(Messages.includeResultSetTooltip);
this.includeResultSetCB.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
Expand Down Expand Up @@ -291,6 +293,7 @@ public void widgetSelected(SelectionEvent e) {
}

});
this.addColumnButton.setEnabled(false);

deleteColumnButton = new Button(buttonPanel, SWT.PUSH);
deleteColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DELETE));
Expand Down Expand Up @@ -995,6 +998,16 @@ private void setUiState() {
if (this.useDistinctRowsCB != null)
this.useDistinctRowsCB.setEnabled(aggregateState);
}
} else {
if( this.addColumnButton != null && this.includeResultSetCB != null ) {
boolean enable = this.includeResultSetCB.getSelection();
this.addColumnButton.setEnabled(enable);
if( !enable ) {
this.deleteColumnButton.setEnabled(false);
this.downColumnButton.setEnabled(false);
this.upColumnButton.setEnabled(false);
}
}
}
}

Expand Down
Expand Up @@ -127,3 +127,4 @@ newIndexMessage=Enter valid name, select column references and press OK
selectColumnReferencesForIndex=Select Column References for Index
createIndexTitle=Create Index
editIndexTitle=Create Index
includeResultSetTooltip=Click to include a result set in your procedure and to enable column editing below.
Expand Up @@ -142,6 +142,7 @@ public class Messages extends NLS {
public static String newIndexMessage;
public static String createIndexTitle;
public static String editIndexTitle;
public static String includeResultSetTooltip;

public static String sqlTemplateDialogTitle;
public static String sqlTemplateDialogTitleMessage;
Expand Down
Expand Up @@ -190,6 +190,7 @@ protected void synchronizeExtendedUI() {
if( this.getRelationalReference().getResultSet() == null ) {
if( WidgetUtil.widgetValueChanged(includeResultSetCB, false)) {
this.includeResultSetCB.setSelection(false);
this.addColumnButton.setEnabled(false);
}

this.resultSetNameText.setEnabled(false);
Expand Down Expand Up @@ -235,6 +236,7 @@ private Composite createResultSetPanel(Composite parent) {
this.includeResultSetCB = new Button(thePanel, SWT.CHECK | SWT.RIGHT);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(this.includeResultSetCB);
this.includeResultSetCB.setText(Messages.includeLabel);
this.includeResultSetCB.setToolTipText(Messages.includeResultSetTooltip);
this.includeResultSetCB.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
Expand Down Expand Up @@ -300,6 +302,7 @@ public void widgetSelected(SelectionEvent e) {
}

});
this.addColumnButton.setEnabled(false);

deleteColumnButton = new Button(buttonPanel, SWT.PUSH);
deleteColumnButton.setText(Messages.deleteLabel);
Expand Down Expand Up @@ -1000,8 +1003,19 @@ public void modifyText(ModifyEvent e) {
}

private void setUiState() {
if( ! this.getRelationalReference().isFunction() )
return;
if( ! this.getRelationalReference().isFunction() ) {
if( this.addColumnButton != null && this.includeResultSetCB != null ) {
boolean enable = this.includeResultSetCB.getSelection();
this.addColumnButton.setEnabled(enable);
if( !enable ) {
this.deleteColumnButton.setEnabled(false);
this.downColumnButton.setEnabled(false);
this.upColumnButton.setEnabled(false);
}
}

return;
}

boolean functionState = true;
this.deterministicCB.setEnabled(functionState);
Expand All @@ -1018,6 +1032,7 @@ private void setUiState() {
this.analyticCB.setEnabled(aggregateState);
this.decomposableCB.setEnabled(aggregateState);
this.useDistinctRowsCB.setEnabled(aggregateState);

}

@Override
Expand Down
Expand Up @@ -141,6 +141,7 @@ newIndexMessage=Enter valid name, select column references and press OK
selectColumnReferencesForIndex=Select Column References for Index
createIndexTitle=Create Index
editIndexTitle=Create Index
includeResultSetTooltip=Click to include a result set in your procedure and to enable column editing below.

sqlTemplateDialogTitle=Choose a SQL Template
sqlTemplateDialogTitleMessage=Choose a SQL Template from the available options.
Expand Down

0 comments on commit cc36fed

Please sign in to comment.