Skip to content

Commit

Permalink
TEIIDDES-1806 Property names now allow a '-' character
Browse files Browse the repository at this point in the history
Also fixed couple minor I18n issues resulting from wrong UTIL class reference
  • Loading branch information
blafond committed Jul 29, 2013
1 parent 0ef2987 commit 4783994
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Expand Up @@ -7,7 +7,6 @@
*/
package org.teiid.designer.vdb.ui.editor.panels;

import static org.teiid.designer.vdb.VdbPlugin.UTIL;
import static org.teiid.designer.vdb.ui.VdbUiConstants.Util;

import java.util.HashSet;
Expand Down Expand Up @@ -233,28 +232,34 @@ private String validateValue() {
public static String validateName( String proposedName ) {
// must have a name
if (StringUtilities.isEmpty(proposedName)) {
return UTIL.getString(PREFIX + "emptyPropertyName"); //$NON-NLS-1$
return Util.getString(PREFIX + "emptyPropertyName"); //$NON-NLS-1$
}

// make sure only letters
for (char c : proposedName.toCharArray()) {
if (!Character.isLetter(c) && !Character.isDigit(c) ) {
return UTIL.getString(PREFIX + "invalidPropertyName"); //$NON-NLS-1$
if ( ! isValidChar(c)) {
return Util.getString(PREFIX + "invalidPropertyName"); //$NON-NLS-1$
}
}

// valid name
return null;
}

private static boolean isValidChar(char c) {
if((Character.isLetter(c) || Character.isDigit(c)) || c == '-') return true;

return false;
}

/**
* @param proposedValue the proposed value
* @return an error message or <code>null</code> if value is valid
*/
public static String validateValue( String proposedValue ) {
// must have a value
if (StringUtilities.isEmpty(proposedValue)) {
return UTIL.getString(PREFIX + "emptyPropertyValue"); //$NON-NLS-1$
return Util.getString(PREFIX + "emptyPropertyValue"); //$NON-NLS-1$
}

// valid
Expand Down
Expand Up @@ -234,7 +234,8 @@ AddGeneralPropertyDialog.lblValue.text = Value:
AddGeneralPropertyDialog.txtValue.toolTip = A non-empty value for this custom property
AddGeneralPropertyDialog.customPropertyAlreadyExists = Property "{0}" already exists.
AddGeneralPropertyDialog.emptyPropertyName=Name of property cannot be empty
AddGeneralPropertyDialog.invalidPropertyName=Name must contain only letters and numbers
AddGeneralPropertyDialog.invalidPropertyName=Name must contain only letters, numbers or a '-'
AddGeneralPropertyDialog.emptyPropertyValue=Value or property cannot be empty

AddPropertyDialog.customPropertyAlreadyExists = Property "{0}" already exists.
AddPropertyDialog.title = Add New Property
Expand Down

0 comments on commit 4783994

Please sign in to comment.