Skip to content

Commit

Permalink
TEIIDDES-2320 fixed enablement issue when either masking or condition…
Browse files Browse the repository at this point in the history
… exist.
  • Loading branch information
blafond committed Aug 28, 2014
1 parent aff445b commit c3e2791
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public class SecurityDefinitionDialog extends AbstractAddOrEditTitleDialog {
* @param okEnabled
*/
public SecurityDefinitionDialog( Shell parentShell, String title, String message, Permission permission, boolean allowsFilter,
boolean allowsMasking ) {
super(parentShell, title, message, true);
boolean allowsMasking, boolean existingSecurity) {
super(parentShell, title, message, existingSecurity);

this.targetName = permission.getTargetName();
isEdit = true;
Expand Down Expand Up @@ -277,11 +277,6 @@ protected void validate() {
this.maskString = maskTextEditor.getText();
this.constraint = constraintButton.getSelection();
boolean conditionEmpty = (this.conditionString == null || this.conditionString.trim().isEmpty());

if( conditionEmpty && allowsFilter) {
enable = false;
setErrorMessage(Messages.conditionIsUndefined);
}

if( this.allowsMasking ) {
boolean maskEmpty = (maskString == null || maskString.trim().isEmpty());
Expand All @@ -302,6 +297,9 @@ protected void validate() {
setErrorMessage(Messages.orderMustNotBeNull);
return;
}
} else if( conditionEmpty && allowsFilter) {
enable = false;
setErrorMessage(Messages.conditionIsUndefined);
}

getButton(IDialogConstants.OK_ID).setEnabled(enable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ private void handleSelection(int column, Object rowData) {
private void handleDoubleClick(int column, Object target) {
if (column == 1 && getTreeProvider().allowsSecurity(target) ) {
Permission perm = getTreeProvider().getPermission(target);
boolean existingPerm = perm != null;
if( perm == null ) {
perm = getTreeProvider().createPermission(target);
}
Expand All @@ -182,7 +183,7 @@ private void handleDoubleClick(int column, Object target) {
SecurityDefinitionDialog dialog =
new SecurityDefinitionDialog(getShell(),
Messages.setSecurityValuesTitle, message, perm,
allowsCondition, allowsMask);
allowsCondition, allowsMask, existingPerm);

if( dialog.open() == Window.OK) {
if( allowsCondition) {
Expand Down

0 comments on commit c3e2791

Please sign in to comment.