use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.
the class ShowRoutineItemsDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
routineViewer = new TreeViewer(composite);
labelProvider = new ShowRoutineItemsLabelProvider(allRoutineItems, existedRoutinesRecord);
routineViewer.setContentProvider(labelProvider);
routineViewer.setLabelProvider(labelProvider);
routineViewer.setInput(allRoutineItems);
routineViewer.setFilters(new ViewerFilter[] { new ShowRoutineItemsViewerFilter(allRoutineItems, system) });
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.heightHint = 150;
layoutData.widthHint = 200;
routineViewer.getTree().setLayoutData(layoutData);
routineViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
updateButtons();
}
});
return composite;
}
use of org.eclipse.jface.viewers.SelectionChangedEvent 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.SelectionChangedEvent 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.SelectionChangedEvent in project tdi-studio-se by Talend.
the class DataMapTableView method addTablesListeners.
/**
* DOC amaumont Comment method "addTableForColumnsListeners".
*/
private void addTablesListeners() {
tableViewerCreatorForColumns.addCellValueModifiedListener(new ITableCellValueModifiedListener() {
@Override
public void cellValueModified(TableCellValueModifiedEvent e) {
unselectAllEntriesIfErrorDetected(e);
}
});
abstractDataMapTable.getTableColumnsEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {
@Override
public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
mapperManager.getUiManager().refreshSqlExpression();
}
});
final TableViewer tableViewerForEntries = tableViewerCreatorForColumns.getTableViewer();
tableViewerForEntries.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
int[] selectionIndices = tableViewerForEntries.getTable().getSelectionIndices();
if (selectionIndices.length > 0) {
selectThisDataMapTableView();
onSelectedEntries(event.getSelection(), selectionIndices);
// bug 18414
MetadataTableEditorView metadataTableEditorView = null;
if (getZone() == Zone.INPUTS) {
metadataTableEditorView = mapperManager.getUiManager().getInputMetaEditorView();
} else if (getZone() == Zone.OUTPUTS) {
metadataTableEditorView = mapperManager.getUiManager().getOutputMetaEditorView();
}
if (metadataTableEditorView != null) {
metadataTableEditorView.getTableViewerCreator().refresh();
}
}
}
});
tableForEntries.addListener(SWT.DragDetect, new Listener() {
@Override
public void handleEvent(Event event) {
onSelectedEntries(tableViewerForEntries.getSelection(), tableViewerForEntries.getTable().getSelectionIndices());
}
});
tableViewerCreatorForColumns.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {
@Override
public void handle(LineSelectionEvent e) {
if (forceExecuteSelectionEvent) {
forceExecuteSelectionEvent = false;
onSelectedEntries(tableViewerForEntries.getSelection(), tableViewerForEntries.getTable().getSelectionIndices());
}
}
});
tableForEntries.addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event event) {
processEnterKeyDown(tableViewerCreatorForColumns, event);
}
});
abstractDataMapTable.getTableColumnsEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<IColumnEntry>() {
@Override
public void handleEvent(ModifiedBeanEvent<IColumnEntry> event) {
TableViewerCreator tableViewerCreator = tableViewerCreatorForColumns;
ITableEntry tableEntry = event.bean;
parseExpressionIfNeeded(event, tableViewerCreator, tableEntry);
mapperManager.getUiManager().refreshSqlExpression();
}
});
if (abstractDataMapTable instanceof OutputTable) {
OutputTable outputTable = (OutputTable) abstractDataMapTable;
outputTable.getWhereTableFiltersEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {
@Override
public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
resizeAtExpandedSize();
mapperManager.getUiManager().refreshSqlExpression();
}
});
outputTable.getWhereTableFiltersEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<FilterTableEntry>() {
@Override
public void handleEvent(ModifiedBeanEvent<FilterTableEntry> event) {
onOutputTableFiltersModified(event, extendedTableViewerForFilters);
mapperManager.getUiManager().refreshSqlExpression();
}
});
outputTable.getOtherTableFiltersEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {
@Override
public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
resizeAtExpandedSize();
mapperManager.getUiManager().refreshSqlExpression();
}
});
outputTable.getOtherTableFiltersEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<FilterTableEntry>() {
@Override
public void handleEvent(ModifiedBeanEvent<FilterTableEntry> event) {
onOutputTableFiltersModified(event, entendedTableViewerForOtherClauses);
mapperManager.getUiManager().refreshSqlExpression();
}
});
}
}
use of org.eclipse.jface.viewers.SelectionChangedEvent in project tdi-studio-se by Talend.
the class JSONFileOutputStep2Form method addJSONFileViewer.
private void addJSONFileViewer(final Composite mainComposite, final int width, final int height) {
final Group group = Form.createGroup(mainComposite, 1, "Linker Target", height);
GridData data = new GridData(GridData.FILL_BOTH);
Composite composite = new Composite(group, SWT.BORDER);
composite.setLayout(new GridLayout());
composite.setLayoutData(data);
JSONViewer = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
data = new GridData(GridData.FILL_BOTH);
JSONViewer.getControl().setLayoutData(data);
JSONViewer.setUseHashlookup(true);
Tree tree = JSONViewer.getTree();
if (isReadOnly()) {
tree.setEnabled(false);
}
tree.setLinesVisible(true);
tree.setBackground(tree.getDisplay().getSystemColor(SWT.COLOR_WHITE));
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setText("JSON Tree");
column1.setWidth(120);
TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
column2.setText("Related Column");
column2.setWidth(100);
TreeColumn column3 = new TreeColumn(tree, SWT.CENTER);
column3.setText("Node Status");
column3.setWidth(100);
TreeColumn column4 = new TreeColumn(tree, SWT.CENTER);
column4.setText("Default Value");
column4.setWidth(100);
tree.setHeaderVisible(true);
JSONFileTreeViewerProvider provider = new JSONFileTreeViewerProvider();
JSONViewer.setLabelProvider(provider);
JSONViewer.setCellModifier(new ICellModifier() {
public void modify(Object element, String property, Object value) {
TreeItem treeItem = (TreeItem) element;
FOXTreeNode node = (FOXTreeNode) treeItem.getData();
if (property.equals("C1")) {
node.setLabel((String) value);
}
if (property.equals("C4")) {
node.setDefaultValue((String) value);
}
JSONViewer.refresh(node);
}
public Object getValue(Object element, String property) {
FOXTreeNode node = (FOXTreeNode) element;
if (property.equals("C1")) {
//$NON-NLS-1$
return node.getLabel();
}
if (property.equals("C4")) {
//$NON-NLS-1$
return node.getDefaultValue();
}
return null;
}
public boolean canModify(Object element, String property) {
FOXTreeNode node = (FOXTreeNode) element;
if (property.equals("C1")) {
if (node.getLabel() != null && node.getLabel().length() > 0) {
return true;
}
}
if (property.equals("C4")) {
if (node.getDefaultValue() != null && node.getDefaultValue().length() > 0) {
return true;
}
}
return false;
}
});
JSONViewer.setColumnProperties(new String[] { "C1", "C2", "C3", "C4" });
CellEditor editor = new TextCellEditor(JSONViewer.getTree());
editor.addListener(new DialogErrorJSONLabelCellEditor(editor, "C1"));
CellEditor editorDefault = new TextCellEditor(JSONViewer.getTree());
editorDefault.addListener(new DialogErrorJSONLabelCellEditor(editorDefault, "C4"));
JSONViewer.setCellEditors(new CellEditor[] { editor, null, null, editorDefault });
JSONViewer.setContentProvider(provider);
// JSONViewer.setInput(treeData);
JSONViewer.expandAll();
createAction();
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(JSONViewer.getControl());
JSONViewer.getControl().setMenu(menu);
JSONViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
}
});
initToolBar(composite);
}
Aggregations