Search in sources :

Example 1 with TreeDropAdapter

use of com.twinsoft.convertigo.eclipse.dnd.TreeDropAdapter in project convertigo by convertigo.

the class ProjectExplorerView method createPartControl.

/**
 * This is a callback that will allow us
 * to create the viewer and initialize it.
 */
@SuppressWarnings("deprecation")
public void createPartControl(Composite parent) {
    viewContentProvider = new ViewContentProvider(this);
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION) {

        @Override
        public void refresh(Object element) {
            if (Engine.objectsProvider != null) {
                viewer.getTree().getDisplay().asyncExec(() -> {
                    try {
                        super.refresh(element);
                    } catch (Throwable e) {
                        ConvertigoPlugin.logDebug3("Failed to refresh: " + e);
                    }
                });
                packColumns();
            }
        }

        @Override
        public void update(Object element, String[] properties) {
            super.update(element, properties);
            packColumns();
        }
    };
    viewer.setData(ProjectExplorerView.class.getCanonicalName(), this);
    viewer.setContentProvider(viewContentProvider);
    viewer.addSelectionChangedListener((event) -> {
        packColumns();
    });
    // DND support
    int ops = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] dragtfs = new Transfer[] { TextTransfer.getInstance() };
    Transfer[] droptfs = new Transfer[] { TextTransfer.getInstance(), StepSourceTransfer.getInstance(), PaletteSourceTransfer.getInstance(), MobileSourceTransfer.getInstance() };
    viewer.addDragSupport(ops, dragtfs, new TreeDragListener(viewer));
    viewer.addDropSupport(ops, droptfs, new TreeDropAdapter(viewer));
    viewer.addTreeListener(new ITreeViewerListener() {

        @Override
        public void treeExpanded(TreeExpansionEvent event) {
            packColumns();
        }

        @Override
        public void treeCollapsed(TreeExpansionEvent event) {
            packColumns();
        }
    });
    viewer.setSorter(new TreeObjectSorter());
    viewer.setInput(getViewSite());
    TreeViewerColumn treeViewerColumn = new TreeViewerColumn(viewer, SWT.LEFT);
    ILabelProvider lp = new ViewLabelProvider();
    ILabelDecorator ld = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
    treeViewerColumn.setLabelProvider(new DecoratingColumnLabelProvider(lp, ld));
    treeViewerColumn = new TreeViewerColumn(viewer, SWT.LEFT);
    treeViewerColumn.setLabelProvider(new CommentColumnLabelProvider());
    treeViewerColumn.setEditingSupport(new CommentEditingSupport(viewer));
    // drillDownAdapter = new DrillDownAdapter(viewer);
    makeActions();
    hookContextMenu();
    hookSelectionChangedEvent();
    hookDoubleClickAction();
    hookGlobalActions();
    hookKeyboardActions();
    contributeToActionBars();
    getSite().setSelectionProvider(viewer);
    ConvertigoPlugin.runAtStartup(() -> initialize());
}
Also used : ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) Point(org.eclipse.swt.graphics.Point) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) TreeDropAdapter(com.twinsoft.convertigo.eclipse.dnd.TreeDropAdapter) Transfer(org.eclipse.swt.dnd.Transfer) TextTransfer(org.eclipse.swt.dnd.TextTransfer) StepSourceTransfer(com.twinsoft.convertigo.eclipse.dnd.StepSourceTransfer) MobileSourceTransfer(com.twinsoft.convertigo.eclipse.dnd.MobileSourceTransfer) PaletteSourceTransfer(com.twinsoft.convertigo.eclipse.dnd.PaletteSourceTransfer) TreeDragListener(com.twinsoft.convertigo.eclipse.dnd.TreeDragListener) 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) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) 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) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent)

Aggregations

DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)1 MobileSourceTransfer (com.twinsoft.convertigo.eclipse.dnd.MobileSourceTransfer)1 PaletteSourceTransfer (com.twinsoft.convertigo.eclipse.dnd.PaletteSourceTransfer)1 StepSourceTransfer (com.twinsoft.convertigo.eclipse.dnd.StepSourceTransfer)1 TreeDragListener (com.twinsoft.convertigo.eclipse.dnd.TreeDragListener)1 TreeDropAdapter (com.twinsoft.convertigo.eclipse.dnd.TreeDropAdapter)1 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)1 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)1 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)1 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)1 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)1 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)1 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)1 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)1 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)1 DocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject)1 ExtractionRuleTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject)1 FullSyncListenerTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject)1 HandlersDeclarationTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject)1 IClosableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject)1