/* * (non-Javadoc) * * @see org.eclipse.gef.commands.Command#execute() */ @Override public void execute() { boolean modified = false; if (property.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) { if (param.isPromptNeeded() == (Boolean) newValue) { return; } oldValue = param.isPromptNeeded(); param.setPromptNeeded((Boolean) newValue); modified = true; } else if (property.equals(ContextTableConstants.COLUMN_PROMPT_PROPERTY)) { if (param.getPrompt() != null && param.getPrompt().equals(newValue)) { return; } oldValue = param.getPrompt(); param.setPrompt((String) newValue); modified = true; } else if (property.equals(ContextTableConstants.COLUMN_CONTEXT_VALUE)) { if (param.getValue() != null && param.getValue().equals(newValue)) { return; } oldValue = param.getValue(); // if (newValue != null) { param.setValue(newValue == null ? "" : (String) newValue); modified = true; // } } if (modified) { updateRelation(); } }
/* * (non-Javadoc) * * @see org.eclipse.gef.commands.Command#undo() */ @Override public void undo() { boolean modified = false; if (property.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) { param.setPromptNeeded((Boolean) oldValue); modified = true; } else if (property.equals(ContextTableConstants.COLUMN_PROMPT_PROPERTY)) { param.setPrompt((String) oldValue); modified = true; } else if (property.equals(ContextTableConstants.COLUMN_CONTEXT_VALUE)) { param.setValue((String) oldValue); modified = true; } if (modified) { updateRelation(); } }
/** * ggu Comment method "checkAndSetDefaultValue". * * <p>if value is null or empty. will return the undef value (bug 4420). */ public static void checkAndSetDefaultValue(final IContextParameter param) { if (param == null) { return; } final String value = param.getValue(); final String type = param.getType(); if (param.isBuiltIn() && (value == null || "".equals(value.trim()))) { // $NON-NLS-1$ final ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage(); switch (codeLanguage) { case JAVA: // break; case PERL: default: param.setValue("undef"); // $NON-NLS-1$ } } return; }