use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method openEditors.
private void openEditors(/*ProjectExplorerView explorerView, */
List<Step> steps, Set<SequenceStep> alreadyOpened) {
for (Step step : steps) {
if (step.isEnabled()) {
if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String projectName = sequenceStep.getProjectName();
// load project if necessary
if (!step.getSequence().getProject().getName().equals(projectName)) {
// loadProject(explorerView, projectName);
}
if (alreadyOpened.contains(sequenceStep)) {
// avoid sequence recursion
return;
}
alreadyOpened.add(sequenceStep);
try {
// ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
Project p = step.getProject();
Sequence subSequence = p.getSequenceByName(sequenceStep.getSequenceName());
SequenceView subSequenceTreeObject = (SequenceView) Studio.getViewFromDbo(subSequence, studio);
// recurse on sequence
openEditors(/*explorerView, */
subSequenceTreeObject, alreadyOpened);
} catch (EngineException e) {
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String projectName = transactionStep.getProjectName();
if (!step.getSequence().getProject().getName().equals(projectName)) {
// loadProject(explorerView, projectName); // load project if necessary
}
try {
// ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
Project project = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
ProjectView projectTreeObject = new ProjectView(project, studio);
Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
ConnectorView connectorTreeObject = new ConnectorView(connector, studio);
// open connector editor
connectorTreeObject.openConnectorEditor();
} catch (EngineException e) {
}
} else if (step instanceof StepWithExpressions) {
openEditors(/*explorerView, */
((StepWithExpressions) step).getSteps(), alreadyOpened);
}
}
}
}
use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method run2.
@Override
protected void run2() throws Exception {
try {
WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
if (treeObject != null && treeObject.instanceOf(Sequence.class)) {
SequenceView sequenceTreeObject = (SequenceView) treeObject;
openEditors(/*explorerView, */
sequenceTreeObject);
Sequence sequence = sequenceTreeObject.getObject();
ProjectView projectTreeObject = sequenceTreeObject.getProjectView();
SequenceEditorWrap sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
if (sequenceEditor != null) {
// getActivePage().activate(sequenceEditor);
sequenceEditor.getDocument(sequence.getName(), null, isStubRequested());
}
}
} catch (Exception e) {
throw e;
}
}
use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.
the class TestCaseExecuteSelectedAction method run2.
@Override
protected void run2() throws Exception {
try {
WrapDatabaseObject treeObject = (WrapDatabaseObject) studio.getFirstSelectedTreeObject();
if ((treeObject != null) && (treeObject.instanceOf(TestCase.class))) {
TestCase testCase = (TestCase) treeObject.getObject();
ProjectView projectTreeObject = treeObject.getProjectViewObject();
RequestableObject requestable = (RequestableObject) testCase.getParent();
if (requestable instanceof Transaction) {
TransactionView transactionTreeObject = (TransactionView) treeObject.getParent();
transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
Transaction transaction = (Transaction) testCase.getParent();
Connector connector = (Connector) transaction.getParent();
ConnectorEditorWrap connectorEditor = projectTreeObject.getConnectorEditor(connector);
if (connectorEditor != null) {
// getActivePage().activate(connectorEditor);
connectorEditor.getDocument(transaction.getName(), testCase.getName(), false);
}
} else if (requestable instanceof Sequence) {
SequenceView sequenceTreeObject = (SequenceView) treeObject.getParent();
new SequenceExecuteSelectedAction(studio).openEditors(sequenceTreeObject);
Sequence sequence = (Sequence) testCase.getParent();
SequenceEditorWrap sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
if (sequenceEditor != null) {
// getActivePage().activate(sequenceEditor);
sequenceEditor.getDocument(sequence.getName(), testCase.getName(), false);
}
}
}
} catch (Exception e) {
throw e;
}
}
use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.
the class DatabaseObjectDeleteAction method run2.
@Override
protected void run2() throws Exception {
String qname = null;
try {
treeNodesToUpdate = new ArrayList<WrapDatabaseObject>();
WrapDatabaseObject treeObject = null;
WrapObject[] treeObjects = studio.getSelectedObjects().toArray(new WrapObject[0]);
dboDoDelete = new HashMap<>(treeObjects.length);
if (treeObjects != null) {
MultipleDeletionDialog dialog = new MultipleDeletionDialog(studio, "Object Deletion", treeObjects.length > 1);
for (int i = 0; i < treeObjects.length; ++i) {
treeObject = (WrapDatabaseObject) treeObjects[i];
String message = treeObject.instanceOf(Project.class) ? java.text.MessageFormat.format("Do you really want to delete the project \"{0}\" and all its sub-objects?", new Object[] { treeObject.getName() }) : java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { treeObject.getName() });
qname = ((DatabaseObject) treeObject.getObject()).getQName();
if (!dialog.shouldBeDeleted(message)) {
dboDoDelete.put(qname, false);
continue;
}
dboDoDelete.put(qname, true);
if (treeObject.instanceOf(Project.class)) {
((ProjectView) treeObject).closeAllEditors();
} else if (treeObject.instanceOf(Sequence.class)) {
((ProjectView) ((SequenceView) treeObject).getParent()).closeSequenceEditors((Sequence) treeObject.getObject());
} else if (treeObject.instanceOf(Connector.class)) {
((ProjectView) ((ConnectorView) treeObject).getParent()).closeConnectorEditors((Connector) treeObject.getObject());
} else if (treeObject.instanceOf(Step.class)) {
// // We close the editor linked with the SimpleStep (=SequenceJsStep)
// if (treeObject.getObject() instanceof SimpleStep) {
// boolean find = false;
// SimpleStep simpleStep = (SimpleStep) treeObject.getObject();
// IWorkbenchPage page = this.getActivePage();
// IEditorReference[] editors = page.getEditorReferences();
// int _i = 0;
// while (find != true && _i < editors.length) {
// IEditorReference editor = editors[_i];
// IEditorPart editorPart = page.findEditor(editor.getEditorInput());
// if (editorPart != null && editorPart instanceof JscriptStepEditor) {
// JscriptStepEditor jscriptEditor = (JscriptStepEditor) editorPart;
// if (jscriptEditor.getSimpleStepLinked().equals(simpleStep)) {
// find = true;
// page.activate(editorPart);
// page.closeEditor(editorPart, false);
// }
// }
// ++_i;
// }
}
delete(treeObject);
if (treeObject.instanceOf(Project.class)) {
// explorerView.removeProjectTreeObject(treeObject);
} else {
// // prevents treeObject and its childs to receive further TreeObjectEvents
// if (treeObject instanceof TreeObjectListener)
// explorerView.removeTreeObjectListener(treeObject);
// treeObject.removeAllChildren();
}
//
// explorerView.fireTreeObjectRemoved(new TreeObjectEvent(treeObject));
}
}
// Updating the tree and the properties panel
Enumeration<WrapDatabaseObject> enumeration = Collections.enumeration(treeNodesToUpdate);
WrapDatabaseObject parentTreeObject;
while (enumeration.hasMoreElements()) {
parentTreeObject = enumeration.nextElement();
if (parentTreeObject != null) {
// explorerView.reloadTreeObject(parentTreeObject);
// explorerView.setSelectedTreeObject(parentTreeObject);
}
}
//
// Refresh tree to show potential 'broken' steps
// explorerView.refreshTree();
} catch (Exception e) {
throw e;
}
}
use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.
the class ReferencesView method handleTransactionSelection.
private void handleTransactionSelection(Object firstElement) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) firstElement;
Transaction transaction = transactionTreeObject.getObject();
String transactionName = transactionTreeObject.getName();
// Get the referencing sequence steps
String transactionProjectName = transaction.getProject().getName();
String transactionConnectorName = transaction.getParent().getName();
try {
Project project = null;
List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
treeViewer.setInput(null);
RootNode root = new RootNode();
TransactionNode transactionFolder = new TransactionNode(root, transactionName, transaction);
root.addChild(transactionFolder);
IsUsedByNode isUsedByNode = new IsUsedByNode(transactionFolder, "Is used by");
RequiresNode requiresNode = new RequiresNode(transactionFolder, "Requires");
ProjectNode projectFolder = null;
// Searching all objects are required transaction selected
Connector connector = transaction.getConnector();
if (connector instanceof HtmlConnector) {
Project proj = ((HtmlConnector) connector).getProject();
ProjectNode projectNode = new ProjectNode(requiresNode, transactionProjectName, proj);
HtmlTransaction htmlTransaction = (HtmlTransaction) transaction;
List<Statement> statements = htmlTransaction.getStatements();
List<ScreenClass> screenClassList = new ArrayList<ScreenClass>();
List<String> siteClipperConnectorNames = new ArrayList<String>();
for (Statement statement : statements) {
if (statement instanceof ScHandlerStatement) {
ScHandlerStatement scHandlerStatement = (ScHandlerStatement) statement;
String screenClassName = scHandlerStatement.getNormalizedScreenClassName();
ScreenClass screenClass = ((HtmlConnector) connector).getScreenClassByName(screenClassName);
if (screenClass != null) {
if (!screenClassList.contains(screenClass)) {
screenClassList.add(screenClass);
requiresNode.addChild(new ScreenClassNode(requiresNode, screenClassName, screenClass));
}
}
}
List<Statement> statementList = ((FunctionStatement) statement).getStatements();
for (Statement st : statementList) {
if (st instanceof ContinueWithSiteClipperStatement) {
ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
String siteClipperconnectorName = continueWithSiteClipperStatement.getSiteClipperConnectorName();
if (!siteClipperConnectorNames.contains(siteClipperconnectorName)) {
siteClipperConnectorNames.add(siteClipperconnectorName);
Connector siteClipperConnector = proj.getConnectorByName(siteClipperconnectorName);
ConnectorNode connectorSiteClipperNode = new SiteClipperConnectorNode(projectNode, siteClipperconnectorName, siteClipperConnector);
projectNode.addChild(connectorSiteClipperNode);
}
}
}
}
if (projectNode.hasChildren()) {
requiresNode.addChild(projectNode);
}
} else if (connector instanceof JavelinConnector) {
JavelinTransaction javelinTransaction = (JavelinTransaction) transaction;
String handlers = javelinTransaction.handlers;
List<JavelinScreenClass> screenClasses = ((JavelinConnector) connector).getAllScreenClasses();
List<JavelinScreenClass> screenClassList = new ArrayList<JavelinScreenClass>();
for (JavelinScreenClass screenClass : screenClasses) {
if (handlers.indexOf("function on" + screenClass.getName()) != -1) {
if (!screenClassList.contains(screenClass)) {
screenClassList.add(screenClass);
requiresNode.addChild(new ScreenClassNode(requiresNode, screenClass.getName(), screenClass));
}
}
}
}
// Searching all objects are used transaction selected
for (String projectName : projectNames) {
project = getProject(projectName, projectExplorerView);
if (project != null) {
projectFolder = new ProjectNode(isUsedByNode, project.getName(), project);
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(transactionProjectName + "." + transactionConnectorName + "." + transactionName)) {
MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
pathNode.addChild(operationNode);
}
}
if (pathNode.hasChildren()) {
mapperNode.addChild(pathNode);
}
}
if (mapperNode.hasChildren()) {
projectFolder.addChild(mapperNode);
}
}
List<Sequence> sequences = project.getSequencesList();
for (Sequence sequence : sequences) {
List<Step> stepList = sequence.getAllSteps();
SequenceNode sequenceNode = new SequenceNode(projectFolder, sequence.getName(), sequence);
for (Step step : stepList) {
getTransactionReferencing(step, projectExplorerView, sequenceNode, transactionProjectName, transactionConnectorName, transactionName);
}
if (sequenceNode.hasChildren()) {
projectFolder.addChild(sequenceNode);
}
}
if (projectFolder.hasChildren()) {
isUsedByNode.addChild(projectFolder);
}
}
}
if (requiresNode.hasChildren()) {
transactionFolder.addChild(requiresNode);
}
if (isUsedByNode.hasChildren()) {
transactionFolder.addChild(isUsedByNode);
}
if (!transactionFolder.hasChildren()) {
transactionFolder.addChild(new InformationNode(projectFolder, "This transaction is not used in any sequence"));
}
treeViewer.setInput(root);
treeViewer.expandAll();
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
}
}
Aggregations