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);
}
}
}
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));
}
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));
}
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);
// }
}
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);
}
}
Aggregations