Search in sources :

Example 6 with DesignDocumentFunctionTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject 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)

Example 7 with DesignDocumentFunctionTreeObject

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

the class DeleteDesignDocumentFunctionAction 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 DesignDocumentFunctionTreeObject) {
        DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject) treeObject;
        // filter function
        if (treeObject instanceof DesignDocumentFilterTreeObject) {
            action.setEnabled(true);
        } else // update function
        if (treeObject instanceof DesignDocumentUpdateTreeObject) {
            action.setEnabled(true);
        } else // validate function
        if (treeObject instanceof DesignDocumentValidateTreeObject) {
            action.setEnabled(true);
        } else // view function
        {
            action.setEnabled(ddfto.getName().equals(CouchKey.reduce.key()));
        }
    }
}
Also used : DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)

Aggregations

DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)7 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)5 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)5 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)4 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)3 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)3 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)3 IDesignTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject)3 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)3 Shell (org.eclipse.swt.widgets.Shell)3 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)2 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)2 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)2 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)2 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)2 HandlersDeclarationTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject)2 PropertyTableColumnTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject)2 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)2 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)2 IVariableContainer (com.twinsoft.convertigo.beans.core.IVariableContainer)1