Search in sources :

Example 91 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class HL7MultiSchemaUI method updateCurrentMetadataTable.

private void updateCurrentMetadataTable() {
    IStructuredSelection selection = (IStructuredSelection) metaTableViewer.getSelection();
    Object selectedObj = selection.getFirstElement();
    if (selectedObj != null) {
        String key = ((IModel) selectedObj).getDisplayName();
        Map m = hl7Manager.getSchemaRelationMap();
        List<MetadataColumn> beans = (List<MetadataColumn>) m.get(key);
        MetadataTable currentTable = getCurrentTable(key, beans);
        if (currentTable != null) {
            metadataEditor.setMetadataTable(currentTable);
            hl7SchemaEditorView.setExtendedTableModel(metadataEditor);
        } else {
            currentTable = ConnectionFactory.eINSTANCE.createMetadataTable();
            metadataEditor.setMetadataTable(currentTable);
        }
    }
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) IModel(org.talend.designer.hl7.model.IModel) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) ArrayList(java.util.ArrayList) List(java.util.List) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Map(java.util.Map)

Example 92 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class HotSpotsTabPage method createHotSpotsViewer.

/**
     * Creates the hot spots viewer.
     * 
     * @param composite The parent composite
     * @param propertySheet The property sheet
     */
private void createHotSpotsViewer(Composite composite, PropertySheet propertySheet) {
    filteredTree = new HotSpotsFilteredTree(composite, propertySheet.getViewSite().getActionBars()) {

        @Override
        protected void addMenus(IMenuManager manager) {
            manager.add(new Separator());
            manager.add(new ConfigureCpuProfilerAction(cpuSection));
        }
    };
    TreeViewer hotSpotsViewer = filteredTree.getViewer();
    hotSpotsViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getHotSpotRoots();
            }
            return new Object[0];
        }
    });
    hotSpotsViewer.setLabelProvider(new HotSpotsLabelProvider(filteredTree));
    hotSpotsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            filteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    filteredTree.sortColumn(hotSpotsViewer.getTree().getColumn(1));
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 93 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class CallerCalleeTabPage method createCalleeViewer.

/**
     * Creates the callee viewer.
     * 
     * @param parent The parent composite
     * @param propertySheet The property sheet
     */
private void createCalleeViewer(Composite parent, PropertySheet propertySheet) {
    calleeFilteredTree = new HotSpotsFilteredTree(parent, propertySheet.getViewSite().getActionBars()) {

        @Override
        protected void addMenus(IMenuManager manager) {
            manager.add(new Separator());
            manager.add(new ConfigureCpuProfilerAction(cpuSection));
        }

        @Override
        public ViewerType getViewerType() {
            return ViewerType.Callee;
        }

        @Override
        protected String getMethodColumnName() {
            return Messages.calleeColumnLabel;
        }

        @Override
        protected String getMethodColumnToolTip() {
            return Messages.calleeColumnToolTip;
        }
    };
    TreeViewer calleeViewer = calleeFilteredTree.getViewer();
    calleeViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getCallees();
            }
            return new Object[0];
        }
    });
    calleeViewer.setLabelProvider(new HotSpotsLabelProvider(calleeFilteredTree));
    calleeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            calleeFilteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    calleeFilteredTree.sortColumn(calleeViewer.getTree().getColumn(1));
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 94 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class MapperManager method selectionChanged.

@Override
public void selectionChanged(SelectionChangedEvent event) {
    if (!event.getSelection().isEmpty() && event.getSelection() instanceof IStructuredSelection) {
        Iterator iterator = ((IStructuredSelection) event.getSelection()).iterator();
        while (iterator.hasNext()) {
            Object firstElement = iterator.next();
            if (firstElement instanceof TableEntityPart) {
                AbstractNode model = (AbstractNode) ((TableEntityPart) firstElement).getModel();
                boolean isInputMain = false;
                if (model instanceof OutputTreeNode) {
                    OutputTreeNode outputTreeNodeRoot = (OutputTreeNode) XmlMapUtil.getTreeNodeRoot((OutputTreeNode) model);
                    if (outputTreeNodeRoot != null && outputTreeNodeRoot.eContainer() instanceof OutputXmlTree) {
                        selectOutputXmlTree((OutputXmlTree) outputTreeNodeRoot.eContainer());
                        onEntitySelection((IStructuredSelection) event.getSelection(), selectedOutputTree);
                    }
                } else if (model instanceof TreeNode) {
                    TreeNode inputTreeNodeRoot = XmlMapUtil.getTreeNodeRoot((TreeNode) model);
                    if (inputTreeNodeRoot != null && inputTreeNodeRoot.eContainer() instanceof InputXmlTree) {
                        selectInputXmlTree((InputXmlTree) inputTreeNodeRoot.eContainer());
                        isInputMain = !((InputXmlTree) inputTreeNodeRoot.eContainer()).isLookup();
                        onEntitySelection((IStructuredSelection) event.getSelection(), selectedInputTree);
                    }
                }
                if (!isInputMain) {
                    refreshStyledTextEditor((TableEntityPart) firstElement);
                } else {
                    refreshStyledTextEditor(null);
                }
                selectedFigure = ((TableEntityPart) firstElement).getFigure();
            } else if (firstElement instanceof InputXmlTreeEditPart) {
                selectInputXmlTree((InputXmlTree) ((InputXmlTreeEditPart) firstElement).getModel());
                refreshStyledTextEditor(null);
            } else if (firstElement instanceof OutputXmlTreeEditPart) {
                selectOutputXmlTree((OutputXmlTree) ((OutputXmlTreeEditPart) firstElement).getModel());
                refreshStyledTextEditor(null);
            }
        }
    }
// else {
// ExtendedTableModel<TreeSchemaTableEntry> oldModel = mapperUI.getTabFolderEditors().getInputTreeSchemaEditor()
// .getExtendedTableModel();
// if (oldModel != null && oldModel.getBeanCount() != 0) {
// List<TreeSchemaTableEntry> treeSchemaEntrys = new ArrayList<TreeSchemaTableEntry>();
// mapperUI.getTabFolderEditors().getInputTreeSchemaEditor()
// .setExtendedControlModel(new ExtendedTableModel<TreeSchemaTableEntry>("Tree Schema", treeSchemaEntrys));
// mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().getTableViewerCreator().refresh();
// }
// refreshStyledTextEditor(null);
// }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) AbstractNode(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode) InputXmlTreeEditPart(org.talend.designer.xmlmap.parts.InputXmlTreeEditPart) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputXmlTreeEditPart(org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart)

Example 95 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class StatsAndLogsTabPropertySection method setInput.

public void setInput(final IWorkbenchPart workbenchPart, final ISelection selection) {
    Object input = ((IStructuredSelection) selection).getFirstElement();
    if (input instanceof RepositoryNode) {
        // This is the only RepositoryNode that displays the Job.
        Process process = StatsAndLogsSectionFilter.getProcessPartByRepositoryNode((RepositoryNode) input);
        if (process == null) {
            return;
        }
        // make a mock processPart here for super.setInput();
        ProcessPart part = new ProcessPart();
        part.setModel(process);
        StructuredSelection sel = new StructuredSelection(part);
        super.setInput(workbenchPart, sel);
    } else {
        super.setInput(workbenchPart, selection);
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Process(org.talend.designer.core.ui.editor.process.Process) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) RepositoryNode(org.talend.repository.model.RepositoryNode)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)600 ISelection (org.eclipse.jface.viewers.ISelection)177 GridData (org.eclipse.swt.layout.GridData)97 ArrayList (java.util.ArrayList)88 Composite (org.eclipse.swt.widgets.Composite)80 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)78 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)77 SelectionEvent (org.eclipse.swt.events.SelectionEvent)74 GridLayout (org.eclipse.swt.layout.GridLayout)73 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)67 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)60 List (java.util.List)56 TableViewer (org.eclipse.jface.viewers.TableViewer)51 Button (org.eclipse.swt.widgets.Button)51 Iterator (java.util.Iterator)46 IResource (org.eclipse.core.resources.IResource)42 RepositoryNode (org.talend.repository.model.RepositoryNode)41 IFile (org.eclipse.core.resources.IFile)40 TreeViewer (org.eclipse.jface.viewers.TreeViewer)39 Label (org.eclipse.swt.widgets.Label)38