use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class ReferencesView method handleCallStepselection.
private void handleCallStepselection(Object firstElement) {
try {
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
StepTreeObject stepTreeObject = (StepTreeObject) firstElement;
Step step = stepTreeObject.getObject();
RootNode root = new RootNode();
if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String transactionStepName = transactionStep.getName();
TransactionStepNode transactionStepNode = new TransactionStepNode(root, transactionStepName, transactionStep);
RequiresNode requiresNode = new RequiresNode(transactionStepNode, "Requires");
String transactionName = transactionStep.getTransactionName();
String connectorName = transactionStep.getConnectorName();
String projectName = transactionStep.getProjectName();
Project project = getProject(projectName, projectExplorerView);
ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
Connector connector = null;
Transaction transaction = null;
try {
if (project != null) {
connector = project.getConnectorByName(connectorName);
if (connector != null) {
transaction = connector.getTransactionByName(transactionName);
}
}
} catch (EngineException e) {
connector = null;
transaction = null;
}
ConnectorNode connectorNode = getConnectorNode(projectNode, connector);
if (connectorNode == null)
connectorNode = new ConnectorNode(projectNode, connectorName, connector);
projectNode.addChild(connectorNode);
TransactionNode transactionNode = new TransactionNode(projectNode, transactionName, transaction);
connectorNode.addChild(transactionNode);
requiresNode.addChild(projectNode);
transactionStepNode.addChild(requiresNode);
root.addChild(transactionStepNode);
} else if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String sequenceStepName = sequenceStep.getName();
SequenceStepNode sequenceStepNode = new SequenceStepNode(root, sequenceStepName, sequenceStep);
RequiresNode requiresNode = new RequiresNode(sequenceStepNode, "Requires");
String sequenceName = sequenceStep.getSequenceName();
String projectName = sequenceStep.getProjectName();
Project project = getProject(projectName, projectExplorerView);
ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
Sequence sequence = null;
try {
if (project != null)
sequence = project.getSequenceByName(sequenceName);
} catch (EngineException e) {
sequence = null;
}
projectNode.addChild(new SequenceNode(projectNode, sequenceName, sequence));
requiresNode.addChild(projectNode);
sequenceStepNode.addChild(requiresNode);
root.addChild(sequenceStepNode);
} else {
root.addChild(new InformationNode(root, "References are not handled for this object"));
treeViewer.setInput(root);
}
treeViewer.setInput(root);
treeViewer.expandAll();
} catch (Exception e) {
ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
}
}
use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class ReferencesView method getUsedRequestables.
private void getUsedRequestables(Step step, Project projectSelected, AbstractParentNode parentNode) {
try {
if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String sourceProjectName = sequenceStep.getProjectName();
if (sourceProjectName.equals(projectSelected.getName())) {
Sequence sourceSequence = null;
String sourceSequenceName = sequenceStep.getSequenceName();
try {
if (projectSelected != null)
sourceSequence = projectSelected.getSequenceByName(sourceSequenceName);
} catch (EngineException e) {
sourceSequence = null;
}
SequenceStepNode sequenceStepNode = new SequenceStepNode(parentNode, step.getName() + " -> " + sequenceStep.getSourceSequence(), sourceSequence);
parentNode.addChild(sequenceStepNode);
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String sourceProjectName = transactionStep.getProjectName();
if (sourceProjectName.equals(projectSelected.getName())) {
Transaction sourceTransaction = null;
Connector connectorSelected = projectSelected.getConnectorByName(transactionStep.getConnectorName());
try {
if (connectorSelected != null)
sourceTransaction = connectorSelected.getTransactionByName(transactionStep.getTransactionName());
} catch (Exception e) {
sourceTransaction = null;
}
TransactionStepNode transactionStepNode = new TransactionStepNode(parentNode, step.getName() + " -> " + ((TransactionStep) step).getSourceTransaction(), sourceTransaction);
parentNode.addChild(transactionStepNode);
}
} else if (isStepContainer(step)) {
List<Step> steps = getStepList(step);
if (steps != null) {
for (Step s : steps) {
getUsedRequestables(s, projectSelected, parentNode);
}
}
}
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Unable to load the project", true);
}
}
use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class ReferencesView method handleSequenceSelection.
private void handleSequenceSelection(Object firstElement) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) firstElement;
Sequence sequenceSelected = sequenceTreeObject.getObject();
String sequenceSelectedName = sequenceSelected.getName();
// String sequenceProjectName = sequenceSelected.getProject().getName();
List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
treeViewer.setInput(null);
// Get the referencing sequence steps
List<String> referencingSequence = new ArrayList<String>();
RootNode root = new RootNode();
SequenceNode sequenceFolder = new SequenceNode(root, sequenceSelectedName, sequenceSelected);
root.addChild(sequenceFolder);
IsUsedByNode isUsedByNode = new IsUsedByNode(sequenceFolder, "Is used by");
// Searching all objects that reference the selected sequence
for (String projectName : projectNames) {
Project project = getProject(projectName, projectExplorerView);
if (project != null) {
ProjectNode projectFolder = null;
projectFolder = new ProjectNode(isUsedByNode, project.getName(), project);
List<Sequence> sequences = project.getSequencesList();
referencingSequence.clear();
UrlMapper urlMapper = project.getUrlMapper();
if (urlMapper != null) {
MapperNode mapperNode = new MapperNode(projectFolder, urlMapper.getName(), urlMapper);
List<UrlMapping> mappings = urlMapper.getMappingList();
for (UrlMapping mapping : mappings) {
MappingPathNode pathNode = new MappingPathNode(mapperNode, mapping.getPath(), mapping);
List<UrlMappingOperation> operations = mapping.getOperationList();
for (UrlMappingOperation operation : operations) {
String targetRequestable = operation.getTargetRequestable();
if (targetRequestable.equals(projectName + "." + sequenceSelectedName)) {
MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
pathNode.addChild(operationNode);
}
}
if (pathNode.hasChildren()) {
mapperNode.addChild(pathNode);
}
}
if (mapperNode.hasChildren()) {
projectFolder.addChild(mapperNode);
}
}
for (Sequence sequence : sequences) {
List<Step> steps = sequence.getSteps();
for (Step step : steps) {
SequenceNode sequenceNode = new SequenceNode(projectFolder, sequence.getName(), sequence);
getSequenceReferencingIsUsedBy(step, sequenceSelected, sequenceNode);
if (sequenceNode.hasChildren()) {
projectFolder.addChild(sequenceNode);
}
}
}
if (projectFolder.hasChildren()) {
isUsedByNode.addChild(projectFolder);
}
}
}
List<Step> steps = sequenceSelected.getSteps();
RequiresNode requiresNode = new RequiresNode(root, "Requires");
// Searching all objects that are referenced by the selected sequence
List<String> transactionList = new ArrayList<String>();
List<String> sequenceList = new ArrayList<String>();
for (Step step : steps) {
getSequenceReferencingRequires(step, sequenceSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
}
if (requiresNode.hasChildren()) {
sequenceFolder.addChild(requiresNode);
}
if (isUsedByNode.hasChildren()) {
sequenceFolder.addChild(isUsedByNode);
}
if (!sequenceFolder.hasChildren()) {
sequenceFolder.addChild(new InformationNode(sequenceFolder, "This sequence is not used in any sequence"));
}
treeViewer.setInput(root);
treeViewer.expandAll();
}
use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class EnableStepAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
DatabaseObjectTreeObject treeObject = null;
Step step = null;
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
for (int i = treeObjects.length - 1; i >= 0; i--) {
treeObject = (DatabaseObjectTreeObject) treeObjects[i];
if (treeObject instanceof StepTreeObject) {
StepTreeObject stepTreeObject = (StepTreeObject) treeObject;
step = (Step) stepTreeObject.getObject();
step.setEnabled(true);
stepTreeObject.setEnabled(true);
stepTreeObject.hasBeenModified(true);
TreeObjectEvent treeObjectEvent = new TreeObjectEvent(stepTreeObject, "isEnable", false, true);
explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
explorerView.refreshSelectedTreeObjects();
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to enable step!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.beans.core.Step in project convertigo by convertigo.
the class StepSourceEditorComposite method createSequenceTree.
private void createSequenceTree() {
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.verticalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
tree = new Tree(treesSashForm, SWT.BORDER);
tree.setLayoutData(gd);
tree.setEnabled(sourcePicker.getStepSourceDefinition().size() > 0);
tree.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
TreeItem tItem = (TreeItem) e.item;
if (tItem.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_RED))) {
if (lastSelectedItem != null)
tree.setSelection(lastSelectedItem);
return;
}
if ((lastSelectedItem == null) || ((lastSelectedItem != null) && !lastSelectedItem.equals(tItem))) {
DatabaseObject databaseObject = (DatabaseObject) tItem.getData();
if (databaseObject instanceof Step) {
setSourcePriority(databaseObject.priority);
sourcePicker.displayTargetWsdlDom(databaseObject);
}
}
lastSelectedItem = tItem;
}
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
});
addStepsInTree(tree, step.getParentSequence());
disableStepsInTree();
if (lastSelectableItem != null) {
tree.showItem(lastSelectableItem);
}
}
Aggregations