Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #172 from nwnpallewela/master
Browse files Browse the repository at this point in the history
Adding drop down list for data mapper element edit dialog for interre…
  • Loading branch information
nwnpallewela authored Aug 5, 2016
2 parents cd9e087 + f0acf25 commit 4b10d18
Show file tree
Hide file tree
Showing 13 changed files with 193 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public AddNewArrayAction(IWorkbenchPart workbenchPart) {
protected void doRun(IProgressMonitor progressMonitor) {
selectedEP = getSelectedEditPart();
AddNewObjectDialog objectDialog = new AddNewObjectDialog(Display.getCurrent().getActiveShell(),
new Class[] { IRegistryFile.class });
new Class[] { IRegistryFile.class }, selectedEP);
//Check if the edit part is an output edit part
isOutputEditPart = checkContainer(selectedEP);
objectDialog.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected void doRun(IProgressMonitor progressMonitor) {
selectedEP = getSelectedEditPart();

AddNewObjectDialog objectDialog = new AddNewObjectDialog(Display.getCurrent().getActiveShell(),
new Class[] { IRegistryFile.class });
new Class[] { IRegistryFile.class }, selectedEP);
objectDialog.create();
objectDialog.setTitle(DIALOG_TITLE);
objectDialog.setVisibility(DIALOG_TITLE,false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public AddNewFieldAction(IWorkbenchPart workbenchPart) {
protected void doRun(IProgressMonitor progressMonitor) {
selectedEP = getSelectedEditPart();
AddNewObjectDialog objectDialog = new AddNewObjectDialog(Display.getCurrent().getActiveShell(),
new Class[] { IRegistryFile.class });
new Class[] { IRegistryFile.class }, selectedEP);
objectDialog.create();
objectDialog.setTitle(DIALOG_TITLE);
objectDialog.setVisibility(DIALOG_TITLE,false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected void doRun(IProgressMonitor progressMonitor) {
selectedEP = getSelectedEditPart();

AddNewObjectDialog objectDialog = new AddNewObjectDialog(Display.getCurrent().getActiveShell(),
new Class[] { IRegistryFile.class });
new Class[] { IRegistryFile.class }, selectedEP);
objectDialog.create();
objectDialog.setTitle(DIALOG_TITLE);
objectDialog.setVisibility(DIALOG_TITLE,false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected void doRun(IProgressMonitor progressMonitor) {
} else {

AddNewObjectDialog rootElementDialog = new AddNewObjectDialog(Display.getCurrent().getActiveShell(),
new Class[] { IRegistryFile.class });
new Class[] { IRegistryFile.class }, selectedEP);
rootElementDialog.create();
rootElementDialog.setTitle(DIALOG_TITLE);
rootElementDialog.setVisibility(DIALOG_TITLE,false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ private void openEditRecordDialog(TreeNode selectedNode, String title, String sc
String required, String schemaValue, String namespaces, String value, String identifierType,
String identifierValue, String identifierURL, boolean isNullable, String interrelatedElement, boolean isOutputEditPart, boolean isRootElement, String rootInterrelatedElement) {
Shell shell = Display.getDefault().getActiveShell();
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class });
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class }, selectedEP);

editTypeDialog.create();
editTypeDialog.setTypeWhenEditing(schemaType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private void openEditFieldDialog(TreeNode selectedNode, String title, String sch
String schemaValue, String namespaces, boolean isNullable) {

Shell shell = Display.getDefault().getActiveShell();
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class });
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class }, selectedEP);

editTypeDialog.create();
editTypeDialog.setTypeWhenEditing(schemaType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private void executeCommand(TreeNode selectedNode, EStructuralFeature feature, S
private void openEditRecordDialog(TreeNode selectedNode, String title, String schemaType, String id,
String required, String schemaValue, String namespaces, boolean isNullable) {
Shell shell = Display.getDefault().getActiveShell();
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class });
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class }, selectedEP);

editTypeDialog.create();
editTypeDialog.setTypeWhenEditing(schemaType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ private void openEditRecordDialog(TreeNode selectedNode, String title, String sc
String required, String schemaValue, String namespaces, String value, String identifierType,
String identifierValue, String identifierURL, boolean isNullable,String interrelatedElement, boolean isOutputEditPart, boolean isRootElement, String rootInterrelatedElement) {
Shell shell = Display.getDefault().getActiveShell();
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class });
AddNewObjectDialog editTypeDialog = new AddNewObjectDialog(shell, new Class[] { IRegistryFile.class }, selectedEP);

editTypeDialog.create();
editTypeDialog.setTypeWhenEditing(schemaType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void populateOutputArrayRootVariableMap(DataMapperDiagramModel model) {
if (outputVariable.getMappedInputVariableRootArrayElement() != null) {
if (forLoopBeanMap.containsKey(ScriptGenerationUtil
.removeInvalidCharaters(outputVariable.getMappedInputVariableRootArrayElement()))) {
int rootArrayVariableForLoopIndex = outputArrayVariableForLoopMap
int rootArrayVariableForLoopIndex = forLoopBeanMap
.get(outputVariable.getMappedInputVariableRootArrayElement());
outputArrayRootVariableForLoop.put(outputVariable.getName(), rootArrayVariableForLoopIndex);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package org.wso2.developerstudio.datamapper.diagram.custom.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -954,7 +956,18 @@ private String getMappedRootArrayInputElement(TreeNodeImpl currentTreeNode) {

private String getMappedInputArrayFromMap(Map<String, String> outputInputElementMapping, String variableName) {
Set<String> outputArrayVariables = outputInputElementMapping.keySet();
for (String arrayName : outputArrayVariables) {
List<String> outputArrayVariablesList = new ArrayList<>();
for (String string : outputArrayVariables) {
outputArrayVariablesList.add(string);
}
Collections.sort(outputArrayVariablesList, new Comparator<String>() {

@Override
public int compare(String str1, String str2) {
return -str1.length() + str2.length();
}
});
for (String arrayName : outputArrayVariablesList) {
if(variableName.startsWith(arrayName)){
return outputInputElementMapping.get(arrayName);
}
Expand Down
Loading

0 comments on commit 4b10d18

Please sign in to comment.