use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ViewExecuteSelectedAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof DesignDocumentViewTreeObject) {
action.setEnabled(((DesignDocumentViewTreeObject) treeObject).hasReduce());
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method run.
@Override
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) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
if ((treeObject != null) && (treeObject instanceof SequenceTreeObject)) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
openEditors(explorerView, sequenceTreeObject);
Sequence sequence = sequenceTreeObject.getObject();
ProjectTreeObject projectTreeObject = sequenceTreeObject.getProjectTreeObject();
SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
if (sequenceEditor != null) {
getActivePage().activate(sequenceEditor);
boolean fromStub = action.getId().contains("FromStub");
sequenceEditor.getSequenceEditorPart().getDocument(sequence.getName(), null, fromStub);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the selected sequence!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method loadProject.
private void loadProject(ProjectExplorerView explorerView, String projectName) {
if (!explorerView.isProjectLoaded(projectName)) {
TreeObject unloadedProjectTreeObject;
try {
unloadedProjectTreeObject = ((ViewContentProvider) explorerView.viewer.getContentProvider()).getProjectRootObject(projectName);
explorerView.loadProject((UnloadedProjectTreeObject) unloadedProjectTreeObject);
try {
while (!explorerView.isProjectLoaded(projectName)) Thread.sleep(10000);
} catch (InterruptedException e) {
}
} catch (EngineException e) {
e.printStackTrace();
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class DatabaseObjectFindDialog method findDatabaseObject.
protected void findDatabaseObject() {
Pattern pattern = null;
String substring = "";
try {
pattern = bRegExp ? (bMatchCase ? Pattern.compile(objectTextSubstring) : Pattern.compile(objectTextSubstring, Pattern.CASE_INSENSITIVE)) : null;
} catch (Exception pex) {
ConvertigoPlugin.errorMessageBox(pex.getClass().getName() + ":\n" + pex.getMessage());
return;
}
substring = bMatchCase ? objectTextSubstring : objectTextSubstring.toLowerCase();
while (true) {
Enumeration<DatabaseObjectTreeObject> enumDatabaseObjects = Collections.enumeration(vDatabaseObjects);
while (enumDatabaseObjects.hasMoreElements()) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) enumDatabaseObjects.nextElement();
DatabaseObject databaseObject = databaseObjectTreeObject.getObject();
boolean bContinue = false;
switch(objectType) {
case // *
0:
bContinue = true;
break;
case // Mobile Component
1:
bContinue = databaseObject.getDatabaseType().equals("MobileComponent");
break;
case // Screen class
2:
bContinue = databaseObject.getDatabaseType().equals("ScreenClass");
break;
case // Criteria
3:
bContinue = databaseObject.getDatabaseType().equals("Criteria");
break;
case // Extraction rule
4:
bContinue = databaseObject.getDatabaseType().equals("ExtractionRule");
break;
case // Sheet
5:
bContinue = databaseObject.getDatabaseType().equals("Sheet");
break;
case // Transaction
6:
bContinue = databaseObject.getDatabaseType().equals("Transaction");
break;
case // Statement
7:
bContinue = databaseObject.getDatabaseType().equals("Statement");
break;
case // Sequence
8:
bContinue = databaseObject.getDatabaseType().equals("Sequence");
break;
case // Step
9:
bContinue = databaseObject.getDatabaseType().equals("Step");
break;
}
if (bContinue) {
String text = databaseObjectTreeObject.toString();
try {
text = YamlConverter.toYaml(databaseObject.toXml(XMLUtils.createDom()));
} catch (Exception e) {
e.printStackTrace();
}
boolean bFound = false;
if (bRegExp) {
Matcher matcher = pattern.matcher(text);
bFound = matcher.find();
} else {
text = bMatchCase ? text : text.toLowerCase();
bFound = text.indexOf(substring) != -1;
}
if (bFound) {
// Object found !!!
// System.out.println(text);
ConvertigoPlugin.getDefault().getProjectExplorerView().objectSelected(new CompositeEvent(databaseObject));
vDatabaseObjects.remove(databaseObjectTreeObject);
return;
}
}
}
TreeObject treeSelected = firstSelected == null ? ConvertigoPlugin.projectManager.currentProjectTreeObject : firstSelected;
MessageBox messageBox = new MessageBox(getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = "End of the search for " + treeSelected.toString() + " object.\nDo you want to retry the search from the beginning?";
messageBox.setMessage(message);
int ret = messageBox.open();
if (ret == SWT.YES) {
ConvertigoPlugin.getDefault().getProjectExplorerView().setSelectedTreeObject(treeSelected);
vDatabaseObjects.clear();
getDatabaseObjects(null);
} else {
return;
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject 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