use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ProjectExplorerView method getFirstSelectedDatabaseObject.
public Object getFirstSelectedDatabaseObject() {
Object object = null;
TreeObject treeObject = getFirstSelectedTreeObject();
if (treeObject != null)
object = treeObject.getObject();
return object;
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ProjectExplorerView method findTreeObjectByUserObject.
public TreeObject findTreeObjectByUserObject(DatabaseObject databaseObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = findTreeObjectByUserObjectFromCache(databaseObject);
if (databaseObjectTreeObject != null) {
return databaseObjectTreeObject;
}
boolean isProject = false;
if (databaseObject != null) {
Project databaseProject = null;
if (databaseObject instanceof Project) {
isProject = true;
databaseProject = (Project) databaseObject;
} else {
databaseProject = databaseObject.getProject();
}
if (databaseProject == null) {
return null;
}
ViewContentProvider provider = (ViewContentProvider) viewer.getContentProvider();
if (provider != null) {
Object[] objects = provider.getChildren(provider.getTreeRoot());
for (int i = 0; i < objects.length; i++) {
TreeObject treeObject = (TreeObject) objects[i];
if (treeObject instanceof ProjectTreeObject) {
ProjectTreeObject projectTreeObject = (ProjectTreeObject) treeObject;
Project project = projectTreeObject.getObject();
if (project.getName().equals(databaseProject.getName())) {
return isProject ? projectTreeObject : findTreeObjectByUserObject(databaseObject, projectTreeObject);
}
} else if (treeObject instanceof UnloadedProjectTreeObject) {
UnloadedProjectTreeObject unloadedProjectTreeObject = (UnloadedProjectTreeObject) treeObject;
if (unloadedProjectTreeObject.getName().equals(databaseProject.getName())) {
TreeParent parent = unloadedProjectTreeObject.getParent();
String path = unloadedProjectTreeObject.getPath();
return findTreeObjectByPath(parent, path);
}
}
}
}
}
return null;
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ProjectExplorerView method getViewerComparator.
public Comparator<TreeObject> getViewerComparator() {
Comparator<TreeObject> comparator = null;
ViewerComparator sorter = viewer != null ? viewer.getComparator() : new ViewerComparator();
comparator = new Comparator<TreeObject>() {
@Override
public int compare(TreeObject o1, TreeObject o2) {
return sorter.compare(viewer, o1, o2);
}
};
return comparator;
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ClipboardManager method copy.
public String copy(TreePath[] treePaths) throws EngineException {
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
clipboardDocument = XMLUtils.getDefaultDocumentBuilder().newDocument();
ProcessingInstruction pi = clipboardDocument.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"ISO-8859-1\"");
clipboardDocument.appendChild(pi);
clipboardRootElement = clipboardDocument.createElement("convertigo-clipboard");
clipboardDocument.appendChild(clipboardRootElement);
TreePath[] selectedPaths = ((treePaths == null) ? projectExplorerView.getSelectionPaths() : treePaths);
treeObjectsList = new ArrayList<TreeObject>();
treeParentsList = new ArrayList<TreeObject>();
for (int i = 0; i < selectedPaths.length; i++) {
TreeObject treeObject = (TreeObject) selectedPaths[i].getLastPathComponent();
if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) treeObject;
DatabaseObjectTreeObject parentDatabaseObjectTreeObject = databaseObjectTreeObject.getParentDatabaseObjectTreeObject();
treeObjectsList.add(databaseObjectTreeObject);
treeParentsList.add(parentDatabaseObjectTreeObject);
copyDatabaseObject((DatabaseObject) databaseObjectTreeObject.getObject());
} else if (treeObject instanceof IPropertyTreeObject) {
IPropertyTreeObject propertyTreeObject = (IPropertyTreeObject) treeObject;
treeObjectsList.add(treeObject);
treeParentsList.add(((IPropertyTreeObject) treeObject).getTreeObjectOwner());
copyPropertyObject(propertyTreeObject);
} else if (treeObject instanceof IDesignTreeObject) {
IDesignTreeObject designTreeObject = (IDesignTreeObject) treeObject;
treeObjectsList.add(treeObject);
treeParentsList.add(((IDesignTreeObject) treeObject).getTreeObjectOwner());
copyDesignObject(designTreeObject);
} else {
throw new EngineException("Tree item not supported :" + treeObject.getClass().getName());
}
}
objects = treeObjectsList.toArray(new Object[selectedPaths.length]);
parentTreeNodeOfCutObjects = treeParentsList.toArray(new TreeObject[selectedPaths.length]);
String strObject = XMLUtils.prettyPrintDOM(clipboardDocument);
return strObject;
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ViewContentProvider method getOpenedProjects.
public Collection<ProjectTreeObject> getOpenedProjects() {
List<? extends TreeObject> children = invisibleRoot.getChildren();
Collection<ProjectTreeObject> opened = new ArrayList<ProjectTreeObject>(children.size());
for (TreeObject treeObject : children) {
if (treeObject instanceof ProjectTreeObject) {
opened.add((ProjectTreeObject) treeObject);
}
}
return opened;
}
Aggregations