use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ComponentInfoWizardPage method fillTree.
public void fillTree(Class<? extends DatabaseObject> beanClass) {
treeItemName = null;
tree.removeAll();
if (parentObject instanceof Transaction) {
Connector connector = (Connector) ((Transaction) parentObject).getParent();
boolean isScreenClassAware = connector instanceof IScreenClassContainer<?>;
if (beanClass.equals(ScEntryHandlerStatement.class) || beanClass.equals(ScExitHandlerStatement.class)) {
if (isScreenClassAware) {
if (connector instanceof HtmlConnector) {
HtmlConnector htmlConnector = (HtmlConnector) connector;
ScreenClass defaultScreenClass = htmlConnector.getDefaultScreenClass();
TreeItem branch = new TreeItem(tree, SWT.NONE);
branch.setText(defaultScreenClass.getName());
List<ScreenClass> screenClasses = defaultScreenClass.getInheritedScreenClasses();
for (ScreenClass screenClass : screenClasses) {
getInHeritedScreenClass(screenClass, branch);
}
} else if (connector instanceof JavelinConnector) {
JavelinConnector javelinConnector = (JavelinConnector) connector;
ScreenClass defaultScreenClass = javelinConnector.getDefaultScreenClass();
TreeItem branch = new TreeItem(tree, SWT.NONE);
branch.setText(defaultScreenClass.getName());
List<ScreenClass> screenClasses = defaultScreenClass.getInheritedScreenClasses();
for (ScreenClass screenClass : screenClasses) {
getInHeritedScreenClass(screenClass, branch);
}
}
tree.setVisible(true);
}
} else if (beanClass.equals(HandlerStatement.class)) {
TreeItem branch;
branch = new TreeItem(tree, SWT.NONE);
branch.setText(HandlerStatement.EVENT_TRANSACTION_STARTED);
branch = new TreeItem(tree, SWT.NONE);
branch.setText(HandlerStatement.EVENT_XML_GENERATED);
tree.setVisible(true);
} else
tree.setVisible(false);
}
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ReferencesView method handleScreenClassSelection.
private void handleScreenClassSelection(Object firstElement) {
ScreenClassTreeObject screenClassTreeObject = (ScreenClassTreeObject) firstElement;
ScreenClass screenClass = screenClassTreeObject.getObject();
String screenClassName = screenClassTreeObject.getName();
// Get the referencing transactions
Connector connector = screenClass.getConnector();
List<Transaction> transactions = connector.getTransactionsList();
RootNode root = new RootNode();
ScreenClassNode screenClassFolder = new ScreenClassNode(root, screenClassName, screenClass);
root.addChild(screenClassFolder);
IsUsedByNode isUsedByNode = new IsUsedByNode(screenClassFolder, "Is used by");
EntryHandlerNode entryFolder = new EntryHandlerNode(isUsedByNode, "Transaction entry handlers", null);
ExitHandlerNode exitFolder = new ExitHandlerNode(isUsedByNode, "Transaction exit handlers", null);
if (connector instanceof HtmlConnector) {
for (Transaction transaction : transactions) {
HtmlTransaction htmlTransaction = (HtmlTransaction) transaction;
List<Statement> statements = htmlTransaction.getStatements();
for (Statement statement : statements) {
if (statement instanceof ScHandlerStatement) {
ScHandlerStatement scHandlerStatement = (ScHandlerStatement) statement;
if (scHandlerStatement.getNormalizedScreenClassName().equals(screenClassName)) {
if (scHandlerStatement.getName().endsWith("Entry")) {
entryFolder.addChild(new TransactionNode(entryFolder, transaction.getName(), scHandlerStatement));
} else {
exitFolder.addChild(new TransactionNode(exitFolder, transaction.getName(), scHandlerStatement));
}
}
}
}
}
} else if (connector instanceof JavelinConnector) {
for (Transaction transaction : transactions) {
JavelinTransaction javelinTransaction = (JavelinTransaction) transaction;
if (javelinTransaction.handlers.indexOf("function on" + screenClassName + "Entry()") != -1) {
entryFolder.addChild(new TransactionNode(entryFolder, transaction.getName(), transaction));
}
if (javelinTransaction.handlers.indexOf("function on" + screenClassName + "Exit()") != -1) {
exitFolder.addChild(new TransactionNode(exitFolder, transaction.getName(), transaction));
}
}
}
if (entryFolder.hasChildren()) {
isUsedByNode.addChild(entryFolder);
}
if (exitFolder.hasChildren()) {
isUsedByNode.addChild(exitFolder);
}
if (!isUsedByNode.hasChildren()) {
screenClassFolder.addChild(new InformationNode(screenClassFolder, "This screen class is not used in any transaction"));
} else {
screenClassFolder.addChild(isUsedByNode);
}
// Build the treeviewer model
treeViewer.setInput(null);
treeViewer.setInput(root);
treeViewer.expandAll();
}
use of com.twinsoft.convertigo.beans.core.ScreenClass 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);
}
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class LearnScreenClassWizardPage2 method screenClassAlreadyExists.
private boolean screenClassAlreadyExists(String screenClassName) {
if (detectedScreenClass instanceof ScreenClass) {
parentObject = detectedScreenClass;
if (isSisterClass)
parentObject = detectedScreenClass.getParent();
ScreenClass parentScreenClass = (ScreenClass) parentObject;
for (ScreenClass inheritedScreenClass : parentScreenClass.getInheritedScreenClasses()) {
if (screenClassName.equals(inheritedScreenClass.getName())) {
return true;
}
}
}
return false;
}
use of com.twinsoft.convertigo.beans.core.ScreenClass in project convertigo by convertigo.
the class ComponentInfoWizardPage method getInHeritedScreenClass.
public void getInHeritedScreenClass(ScreenClass screenClass, TreeItem branch) {
TreeItem leaf = new TreeItem(branch, SWT.NONE);
leaf.setText(screenClass.getName());
List<ScreenClass> screenClasses = screenClass.getInheritedScreenClasses();
for (ScreenClass sC : screenClasses) {
getInHeritedScreenClass(sC, leaf);
}
}
Aggregations