TDQ-5981 Additional tMatchGroup options for multiple matching rules

git-svn-id: http://talendforge.org/svn/tos/trunk@98314 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
zshen
2013-02-20 07:27:55 +00:00
parent ce89924ae9
commit de8f86cc3c
3 changed files with 57 additions and 5 deletions

View File

@@ -89,7 +89,7 @@ Require-Bundle: org.eclipse.gef,
org.talend.commons.runtime;visibility:=reexport,
org.talend.commons.ui,
org.talend.model,
org.talend.utils,
org.talend.utils;visibility:=reexport,
org.talend.libraries.dom4j-jaxen,
org.eclipse.jface.text,
org.eclipse.ui.editors,

View File

@@ -195,6 +195,42 @@ public final class ElementParameterParser {
return null;
}
/**
* this method working with tMatchgroup component which has several tables of mathcing rule.
*
* @param element
* @param text
* @return
*/
@SuppressWarnings("unchecked")
public static Object getMultiObjectValue(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()) {
List<List<Map<String, String>>> multiObjectValues = new ArrayList<List<Map<String, String>>>();
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))) {
List<?> paramValues = (List<?>) param.getValue();
if (param.getFieldType() == EParameterFieldType.TABLE) {
if (paramValues != null && paramValues.size() > 0) {
multiObjectValues.add(createTableValues((List<Map<String, Object>>) paramValues, param));
}
return multiObjectValues;
}
return paramValues;
}
}
}
return null;
}
private static List<Map<String, String>> createTableValues(final List<Map<String, Object>> paramValues,
final IElementParameter param) {
List<Map<String, String>> tableValues = new ArrayList<Map<String, String>>();
@@ -414,8 +450,8 @@ public final class ElementParameterParser {
return (String) value;
}
// hywang add for 6484
if ("SELECTED_FILE".equals(param.getRepositoryValue())) { //$NON-NLS-N$ //$NON-NLS-1$
IElementParameter propertyParam = param.getElement().getElementParameter("PROPERTY:REPOSITORY_PROPERTY_TYPE"); //$NON-NLS-N$ //$NON-NLS-1$
if ("SELECTED_FILE".equals(param.getRepositoryValue())) { //$NON-NLS-1$
IElementParameter propertyParam = param.getElement().getElementParameter("PROPERTY:REPOSITORY_PROPERTY_TYPE"); //$NON-NLS-1$
if (propertyParam != null && propertyParam.getValue() != null && !propertyParam.getValue().equals("")) { //$NON-NLS-1$
try {
IRepositoryViewObject object = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory()

View File

@@ -101,26 +101,32 @@ public abstract class AContextualAction extends Action implements ITreeContextua
private IRepositoryNode node;
@Override
public boolean isEditAction() {
return editAction;
}
@Override
public void setEditAction(boolean editAction) {
this.editAction = editAction;
}
@Override
public boolean isReadAction() {
return readAction;
}
@Override
public void setReadAction(boolean readAction) {
this.readAction = readAction;
}
@Override
public boolean isPropertiesAction() {
return propertiesAction;
}
@Override
public void setPropertiesAction(boolean propertiesAction) {
this.propertiesAction = propertiesAction;
}
@@ -130,6 +136,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
*
* @return the level
*/
@Override
public int getLevel() {
return this.level;
}
@@ -139,6 +146,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
*
* @param level the level to set
*/
@Override
public void setLevel(int level) {
this.level = level;
}
@@ -148,6 +156,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
*
* @see org.talend.commons.ui.swt.actions.ITreeContextualAction#isVisible()
*/
@Override
public boolean isVisible() {
return isEnabled();
}
@@ -157,6 +166,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
*
* @return <code>true</code> if action is accessible by double-click, <code>true</code> otherwise
*/
@Override
public final boolean isDoubleClickAction() {
return getClassForDoubleClick() != null;
}
@@ -166,6 +176,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
*
* @return the class on wich this action may be call by double-click
*/
@Override
public Class getClassForDoubleClick() {
return null;
}
@@ -229,6 +240,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
*
* @param workbenchPart the workbenchPart to set
*/
@Override
public void setWorkbenchPart(IWorkbenchPart workbenchPart) {
this.workbenchPart = workbenchPart;
}
@@ -509,8 +521,8 @@ public abstract class AContextualAction extends Action implements ITreeContextua
String label = selectedNode.getObject().getProperty().getLabel();
for (int i = 0; i < references.length; i++) {
IEditorPart part = references[i].getEditor(false);
for (IEditorReference reference : references) {
IEditorPart part = reference.getEditor(false);
// find unsaved dialog
if (part == null || part.isDirty() == false) {
continue;
@@ -551,6 +563,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
return dialog.open();
}
@Override
public void setSpecialSelection(ISelectionProvider selectionProvider) {
this.specialSelectionProvider = selectionProvider;
}
@@ -590,6 +603,7 @@ public abstract class AContextualAction extends Action implements ITreeContextua
// only avoid NPE if item has been deleted in svn
if (property != null) {
exist = true;
doRun();
}
} else {
@@ -667,10 +681,12 @@ public abstract class AContextualAction extends Action implements ITreeContextua
return false;
}
@Override
public String getGroupId() {
return this.groupId;
}
@Override
public void setGroupId(String groupId) {
this.groupId = groupId;
}