use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.
the class TreeObjectSorter method compare.
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if ((e1 instanceof DatabaseObjectTreeObject) && (e2 instanceof DatabaseObjectTreeObject)) {
DatabaseObject d1 = ((DatabaseObjectTreeObject) e1).getObject();
DatabaseObject d2 = ((DatabaseObjectTreeObject) e2).getObject();
DatabaseObjectTreeObject p1 = ((DatabaseObjectTreeObject) e1).getOwnerDatabaseObjectTreeObject();
DatabaseObjectTreeObject p2 = ((DatabaseObjectTreeObject) e2).getOwnerDatabaseObjectTreeObject();
if (p1.equals(p2)) {
DatabaseObject p = (DatabaseObject) p1.getObject();
try {
Object o1 = p.getOrder(d1);
Object o2 = p.getOrder(d2);
if ((o1 instanceof Long) && (o2 instanceof Long)) {
long l1 = ((Long) o1).longValue();
long l2 = ((Long) o2).longValue();
int dp = (int) (l1 - l2);
if (dp != 0)
return dp;
}
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Error while sorting objects \"" + d1.getQName() + "\" and \"" + d2.getQName() + "\" in Tree.");
}
}
} else if ((e1 instanceof PropertyTableRowTreeObject) && (e2 instanceof PropertyTableRowTreeObject)) {
PropertyTableRowTreeObject r1 = (PropertyTableRowTreeObject) e1;
PropertyTableRowTreeObject r2 = (PropertyTableRowTreeObject) e2;
int i1 = r1.getParent().indexOf(r1);
int i2 = r2.getParent().indexOf(r2);
return i1 - i2;
} else if ((e1 instanceof PropertyTableColumnTreeObject) && (e2 instanceof PropertyTableColumnTreeObject)) {
PropertyTableColumnTreeObject c1 = (PropertyTableColumnTreeObject) e1;
PropertyTableColumnTreeObject c2 = (PropertyTableColumnTreeObject) e2;
int i1 = c1.getParent().indexOf(c1);
int i2 = c2.getParent().indexOf(c2);
return i1 - i2;
} else if ((e1 instanceof ObjectsFolderTreeObject) && !(e2 instanceof ObjectsFolderTreeObject)) {
return -1;
} else if (!(e1 instanceof ObjectsFolderTreeObject) && (e2 instanceof ObjectsFolderTreeObject)) {
return 1;
}
return super.compare(viewer, e1, e2);
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.
the class CreateDocumentAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
try {
boolean enable = true;
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof ObjectsFolderTreeObject)
enable = ((ObjectsFolderTreeObject) treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_DOCUMENTS;
else if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
enable = actionModel.isEnabled;
}
action.setEnabled(enable);
} catch (Exception e) {
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.
the class CreateIndexAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
try {
boolean enable = true;
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof ObjectsFolderTreeObject)
enable = ((ObjectsFolderTreeObject) treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_INDEXES;
else if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
enable = actionModel.isEnabled;
}
action.setEnabled(enable);
} catch (Exception e) {
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.
the class CreateListenerAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
try {
boolean enable = true;
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof ObjectsFolderTreeObject)
enable = ((ObjectsFolderTreeObject) treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_LISTENERS;
else if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
enable = actionModel.isEnabled;
}
action.setEnabled(enable);
} catch (Exception e) {
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.
the class CreateMobileRouteActionComponentAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
try {
boolean enable = true;
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof ObjectsFolderTreeObject) {
ObjectsFolderTreeObject ofto = (ObjectsFolderTreeObject) treeObject;
enable = ofto.folderType == ObjectsFolderTreeObject.FOLDER_TYPE_ACTIONS;
treeObject = ofto.getParent();
}
if (enable && treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
enable = actionModel.isEnabled;
}
action.setEnabled(enable);
} catch (Exception e) {
}
}
Aggregations