use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject in project convertigo by convertigo.
the class CreateConnectorAction method postCreate.
public void postCreate(TreeObject parentTreeObject, DatabaseObject createdDatabaseObject) throws Exception {
super.postCreate(parentTreeObject, createdDatabaseObject);
ProjectTreeObject projectTreeObject = (ProjectTreeObject) parentTreeObject;
projectTreeObject.openConnectorEditor((Connector) createdDatabaseObject);
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject in project convertigo by convertigo.
the class CreateStubFromXMLAction method getXML.
public Document getXML(TreeObject treeObject) throws Exception {
Document dom = XMLUtils.createDom("java");
ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
Object requestable = treeObject.getObject();
if (requestable instanceof Transaction) {
Transaction transaction = (Transaction) requestable;
ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor((Connector) transaction.getParent());
dom = connectorEditor.getLastGeneratedDocument();
} else if (requestable instanceof Sequence) {
SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor((Sequence) requestable);
dom = sequenceEditor.getLastGeneratedDocument();
}
if (dom == null) {
throw new NoSuchElementException();
}
return dom;
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject in project convertigo by convertigo.
the class CustomStatisticsAction 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) {
ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getFirstSelectedTreeObject();
if (projectTreeObject != null) {
StatisticsDialog stats = new StatisticsDialog(shell, projectTreeObject.getName(), projectTreeObject.getObject().getComment(), projectTreeObject.getObject().getVersion());
stats.open();
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to compute statistics!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject in project convertigo by convertigo.
the class ReferencesView method handleProjectSelection.
private void handleProjectSelection(Object firstElement) {
List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
Project projectSelected = null;
ProjectTreeObject projectTreeObjectSelected = null;
UnloadedProjectTreeObject unloadedProjectTreeObjectSelected = null;
if (firstElement instanceof ProjectTreeObject) {
projectTreeObjectSelected = (ProjectTreeObject) firstElement;
projectSelected = projectTreeObjectSelected.getObject();
} else if (firstElement instanceof UnloadedProjectTreeObject) {
unloadedProjectTreeObjectSelected = (UnloadedProjectTreeObject) firstElement;
String projectNameSelected = unloadedProjectTreeObjectSelected.getName();
projectSelected = getProject(projectNameSelected, projectExplorerView);
}
if (projectSelected == null) {
return;
}
String projectNameSelected = projectSelected.getName();
treeViewer.setInput(null);
// Get the referencing sequences and transactions
List<Sequence> sequences = projectSelected.getSequencesList();
RootNode root = new RootNode();
ProjectNode projectNode = new ProjectNode(root, projectNameSelected, projectSelected);
root.addChild(projectNode);
// Get all the projects needed to successfully execute the selected project
// i.e. get all CallTransaction and CallSequence steps from the selected project
// that refer to other projects
RequiresNode requiresNode = new RequiresNode(root, "Requires");
// Search for external sequence or transaction referenced by CallSequence or CallTransaction
// from the selected project
List<String> transactionList = new ArrayList<String>();
List<String> sequenceList = new ArrayList<String>();
for (Sequence sequence : sequences) {
List<Step> steps = sequence.getSteps();
for (Step step : steps) {
getRequiredRequestables(step, projectSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
}
}
UrlMapper urlMapper = projectSelected.getUrlMapper();
if (urlMapper != null) {
List<UrlMapping> mappings = urlMapper.getMappingList();
for (UrlMapping mapping : mappings) {
List<UrlMappingOperation> operations = mapping.getOperationList();
for (UrlMappingOperation operation : operations) {
try {
String targetRequestableName = operation.getTargetRequestable();
if (!targetRequestableName.isEmpty() && !targetRequestableName.startsWith(projectNameSelected)) {
handleTargetRequestable(targetRequestableName, projectExplorerView, requiresNode);
}
} catch (Exception e) {
ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
}
}
}
}
if (requiresNode.hasChildren()) {
projectNode.addChild(requiresNode);
} else {
projectNode.addChild(new InformationNode(projectNode, "This project does not require any other project"));
}
// Get all the projects using the selected project
// i.e. get all CallTransaction and CallSequence steps that refer to transactions
// or sequences from the selected project
IsUsedByNode isUsedByNode = new IsUsedByNode(root, "Is used by");
for (String projectName : projectNames) {
if (!(projectName.equals(projectNameSelected))) {
Project project = getProject(projectName, projectExplorerView);
if (project == null) {
// Unable to load the project, just ignore it
ConvertigoPlugin.logWarning("[References View] Unable to load the project \"" + projectName + "\"", false);
continue;
}
ProjectNode projectFolderExports = new ProjectNode(root, projectName, project);
urlMapper = project.getUrlMapper();
if (urlMapper != null) {
MapperNode mapperNode = new MapperNode(projectFolderExports, 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.startsWith(projectNameSelected + ".")) {
MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
pathNode.addChild(operationNode);
}
}
if (pathNode.hasChildren()) {
mapperNode.addChild(pathNode);
}
}
if (mapperNode.hasChildren()) {
projectFolderExports.addChild(mapperNode);
}
}
List<Sequence> sequencesList = project.getSequencesList();
for (Sequence sequence : sequencesList) {
// Search for CallTransaction and CallSequence
// referencing a transaction or sequence
// from the selected project
List<Step> stepList = sequence.getSteps();
SequenceNode sequenceNode = new SequenceNode(root, sequence.getName(), sequence);
for (Step step : stepList) {
getUsedRequestables(step, projectSelected, sequenceNode);
}
if (sequenceNode.hasChildren()) {
projectFolderExports.addChild(sequenceNode);
}
}
if (projectFolderExports.hasChildren()) {
isUsedByNode.addChild(projectFolderExports);
}
}
}
if (isUsedByNode.hasChildren()) {
projectNode.addChild(isUsedByNode);
} else {
projectNode.addChild(new InformationNode(projectNode, "This project is not used by any other project"));
}
treeViewer.setInput(null);
treeViewer.setInput(root);
treeViewer.expandAll();
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject in project convertigo by convertigo.
the class DatabaseObjectFindDialog method getDatabaseObjects.
private void getDatabaseObjects(TreeParent treeObject) {
ProjectTreeObject projectTreeObject = ConvertigoPlugin.projectManager.currentProjectTreeObject;
TreeParent treeParent = treeObject;
if (treeObject == null) {
treeParent = projectTreeObject;
TreeObject treeSelected = ConvertigoPlugin.getDefault().getProjectExplorerView().getFirstSelectedTreeObject();
while (treeSelected != null && !(treeSelected instanceof TreeParent)) {
treeSelected = treeSelected.getParent();
}
if (treeSelected != null) {
treeParent = (TreeParent) treeSelected;
}
if (firstSelected == null) {
firstSelected = treeSelected;
}
}
List<? extends TreeObject> children = treeParent.getChildren();
children.sort(ConvertigoPlugin.getDefault().getProjectExplorerView().getViewerComparator());
for (TreeObject child : children) {
if (child instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) child;
if (!databaseObjectTreeObject.isInherited) {
vDatabaseObjects.add(databaseObjectTreeObject);
getDatabaseObjects(databaseObjectTreeObject);
}
} else if (child instanceof TreeParent) {
getDatabaseObjects((TreeParent) child);
}
}
}
Aggregations