Search in sources :

Example 6 with TraceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject in project convertigo by convertigo.

the class TraceEditAction 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) {
            TraceTreeObject traceTreeObject = (TraceTreeObject) explorerView.getFirstSelectedTreeObject();
            traceTreeObject.launchEditor("TextEditor");
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to edit the trace!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 7 with TraceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject in project convertigo by convertigo.

the class ProjectExplorerView method findTreeObjectByPath.

// private void loadTrace(TreeParent parentTreeObject, File dir) {
// FolderTreeObject folderTreeObject = new FolderTreeObject(viewer, "Traces");
// parentTreeObject.addChild(folderTreeObject);
// 
// if (!dir.exists()) {
// if (!dir.mkdir())
// return;
// }
// File[] files = dir.listFiles(new FilenameFilter() {
// public boolean accept(File dir, String name) {
// if (new File(dir, name).isFile() && (name.endsWith(".etr"))) return true;
// return false;
// }
// });
// if (files == null) return;
// 
// File file;
// TraceTreeObject traceTreeObject;
// for (int i = 0; i < files.length; i++) {
// file = files[i];
// traceTreeObject = new TraceTreeObject(viewer, file);
// folderTreeObject.addChild(traceTreeObject);
// }
// }
public TreeObject findTreeObjectByPath(TreeParent treeParent, String path) {
    TreeObject foundObject = null;
    if (treeParent == null)
        return null;
    String treeParentPath = treeParent.getPath();
    if (treeParentPath.length() > path.length())
        return null;
    if (treeParent instanceof DatabaseObjectTreeObject) {
        if (((DatabaseObjectTreeObject) treeParent).isInherited)
            return null;
    }
    if (treeParent instanceof PropertyTableTreeObject) {
        if (((PropertyTableTreeObject) treeParent).isInherited())
            return null;
    }
    if (treeParentPath.equals(path))
        return treeParent;
    for (TreeObject treeObject : treeParent.getChildren()) {
        if (treeObject instanceof TreeParent) {
            foundObject = findTreeObjectByPath((TreeParent) treeObject, path);
            if (foundObject != null)
                break;
        } else if (treeObject.getPath().equals(path)) {
            foundObject = treeObject;
            break;
        }
    }
    return foundObject;
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IEditableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) VariableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)

Example 8 with TraceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject in project convertigo by convertigo.

the class ProjectLoadingJob method loadTrace.

public void loadTrace(TreeParent parentTreeObject, File dir) {
    FolderTreeObject folderTreeObject = new FolderTreeObject(viewer, "Traces");
    parentTreeObject.addChild(folderTreeObject);
    /**
     * Ticket #689 workaround, until better IRessource integration
     */
    try {
        String dirp = dir.getPath();
        dirp = dirp.replaceFirst(".*/(.*/.*)$", "$1");
        IFolder ifolder = parentTreeObject.getProjectTreeObject().getFolder(dirp);
        if (!ifolder.exists())
            ifolder.create(true, true, null);
    } catch (Exception e) {
        if (!dir.exists()) {
            if (!dir.mkdir())
                return;
        }
    }
    File[] files = dir.listFiles(new FilenameFilter() {

        public boolean accept(File dir, String name) {
            if (new File(dir, name).isFile() && (name.endsWith(".etr")))
                return true;
            return false;
        }
    });
    if (files == null)
        return;
    File file;
    TraceTreeObject traceTreeObject;
    for (int i = 0; i < files.length; i++) {
        file = files[i];
        traceTreeObject = new TraceTreeObject(viewer, file);
        folderTreeObject.addChild(traceTreeObject);
        if (file.getName().equals("demo.etr")) {
            if (demoTraceTreeObject == null)
                demoTraceTreeObject = traceTreeObject;
        }
    }
}
Also used : FilenameFilter(java.io.FilenameFilter) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) ResourceFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ResourceFolderTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) IFile(org.eclipse.core.resources.IFile) File(java.io.File) CoreException(org.eclipse.core.runtime.CoreException) ProjectInMigrationProcessException(com.twinsoft.convertigo.engine.ProjectInMigrationProcessException) IOException(java.io.IOException) EngineException(com.twinsoft.convertigo.engine.EngineException) IFolder(org.eclipse.core.resources.IFolder)

Example 9 with TraceTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject in project convertigo by convertigo.

the class ViewLabelProvider method getImage.

@Override
public Image getImage(Object obj) {
    try {
        String iconName = "/com/twinsoft/convertigo/beans/core/images/default_color_16x16.png";
        Image image = null;
        if (obj instanceof UnloadedProjectTreeObject) {
            String imageKey = org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED;
            image = PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
        } else if (obj instanceof ResourceTreeObject) {
            ILabelProvider workbenchLabelProvider = WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider();
            image = workbenchLabelProvider.getImage(obj);
        } else if (obj instanceof FolderTreeObject) {
            String imageKey = ISharedImages.IMG_OBJ_FOLDER;
            image = PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
            FolderTreeObject t_folder = (FolderTreeObject) obj;
            if (t_folder.getParent() instanceof DatabaseObjectTreeObject) {
                DatabaseObjectTreeObject parent = (DatabaseObjectTreeObject) t_folder.getParent();
                if (!parent.isEnabled())
                    image = ViewImageProvider.getImageFromCache(imageKey + "_disable", image, obj);
                else if (parent.hasAncestorDisabled())
                    image = ViewImageProvider.getImageFromCache(imageKey + "_unreachable", image, obj);
            }
        } else if (obj instanceof TemplateTreeObject) {
            String imageKey = ISharedImages.IMG_OBJ_FILE;
            image = PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
        } else if (obj instanceof HandlersDeclarationTreeObject) {
            String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
            image = PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
        } else if (obj instanceof TraceTreeObject) {
            String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
            image = PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
        } else if (obj instanceof VariableTreeObject2) {
            VariableTreeObject2 variableTreeObject = (VariableTreeObject2) obj;
            iconName = MySimpleBeanInfo.getIconName(variableTreeObject.databaseObjectBeanInfo, BeanInfo.ICON_COLOR_16x16);
            if (iconName == null) {
                iconName = "/com/twinsoft/convertigo/beans/core/images/variable_color_16x16.png";
            }
            image = ViewImageProvider.getImageFromCache(iconName, variableTreeObject);
        } else if (obj instanceof DatabaseObjectTreeObject) {
            DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) obj;
            iconName = MySimpleBeanInfo.getIconName(databaseObjectTreeObject.getObject(), BeanInfo.ICON_COLOR_16x16);
            image = ViewImageProvider.getImageFromCache(iconName, databaseObjectTreeObject);
        } else if (obj instanceof PropertyTableTreeObject) {
            iconName = "/com/twinsoft/convertigo/beans/core/images/bean_property_16x16.png";
            image = ViewImageProvider.getImageFromCache(iconName, (PropertyTableTreeObject) obj);
        } else if (obj instanceof PropertyTableRowTreeObject) {
            iconName = "/com/twinsoft/convertigo/beans/core/images/bean_property_16x16.png";
            image = ViewImageProvider.getImageFromCache(iconName, (PropertyTableRowTreeObject) obj);
        } else if (obj instanceof PropertyTableColumnTreeObject) {
            iconName = "/com/twinsoft/convertigo/beans/core/images/bean_property_16x16.png";
            image = ViewImageProvider.getImageFromCache(iconName, (PropertyTableColumnTreeObject) obj);
        } else if (obj instanceof DesignDocumentViewTreeObject) {
            iconName = "/com/twinsoft/convertigo/beans/couchdb/images/view_color_16x16.png";
            image = ViewImageProvider.getImageFromCache(iconName, (DesignDocumentViewTreeObject) obj);
        } else if (obj instanceof DesignDocumentFunctionTreeObject) {
            iconName = "/com/twinsoft/convertigo/beans/couchdb/images/function_color_16x16.png";
            image = ViewImageProvider.getImageFromCache(iconName, (DesignDocumentFunctionTreeObject) obj);
        } else {
            throw new IllegalArgumentException("Unexpected tree item object");
        }
        return image;
    } catch (Exception e) {
        String message = "Error while getting tree view item image for object [" + obj.getClass().getName() + "] " + obj.toString();
        ConvertigoPlugin.logException(e, message);
        String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
        if (obj instanceof TreeParent) {
            imageKey = ISharedImages.IMG_OBJ_FOLDER;
        }
        return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) Image(org.eclipse.swt.graphics.Image) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) ResourceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ResourceTreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) VariableTreeObject2(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject2) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)

Aggregations

TraceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject)9 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)5 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)5 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)4 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)4 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)4 HandlersDeclarationTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject)4 PropertyTableColumnTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject)4 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)4 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)4 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)4 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)3 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)3 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)3 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)3 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)3 DocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject)3 ExtractionRuleTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject)3 FullSyncListenerTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject)3 IClosableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject)3