public static String getValue(final IElement node, final String text) { String newText = new String(""); // $NON-NLS-1$ if (text == null) { return newText; } IElementParameter param = null; boolean end = false; List<IElementParameter> params = (List<IElementParameter>) node.getElementParametersWithChildrens(); if (params != null && !params.isEmpty()) { for (int i = 0; i < params.size() && !end; i++) { param = params.get(i); if (text.indexOf(param.getVariableName()) != -1) { newText = getDisplayValue(param); end = true; } } } // see feature 3725 replace tMsgBox MESSAGE parameter if (node instanceof INode) { INode valueNode = (INode) node; /* * Apply to all components in Perl mode */ if (isPerlProject()) { return PerlVarParserUtils.findAndReplacesAll(newText, valueNode); } } return newText; }
/** * Only work with one element. * * @param element * @param text * @return */ public static Object getObjectValue(final IElement element, final String text) { if (text == null) { return null; } IElementParameter param; List<IElementParameter> params = (List<IElementParameter>) element.getElementParametersWithChildrens(); if (params != null && !params.isEmpty()) { for (int i = 0; i < params.size(); i++) { param = params.get(i); if (text.indexOf(param.getVariableName()) != -1 || (param.getVariableName() != null && param.getVariableName().contains(text))) { if (param.getFieldType() == EParameterFieldType.TABLE) { return createTableValues((List<Map<String, Object>>) param.getValue(), param); } return param.getValue(); } } } return null; }