use of org.eclipse.swt.events.FocusListener in project tdi-studio-se by Talend.
the class StyledTextHandler method addListeners.
/**
* DOC amaumont Comment method "addListeners".
*/
private void addListeners() {
styledText.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
refreshProposalSize();
}
public void focusLost(FocusEvent e) {
}
});
styledText.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
}
public void controlResized(ControlEvent e) {
refreshProposalSize();
}
});
styledText.addExtendedModifyListener(new ExtendedModifyListener() {
public void modifyText(ExtendedModifyEvent event) {
// System.out.println("ExtendedModifyListener modify text");
updateCellExpression();
}
});
styledText.getContent().addTextChangeListener(new TextChangeListener() {
public void textChanged(TextChangedEvent event) {
highlightLineOfCursorPosition(styledText.getSelection());
}
public void textChanging(TextChangingEvent event) {
// System.out.println("textChanging");
}
public void textSet(TextChangedEvent event) {
// System.out.println("textSet");
}
});
styledText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
highlightLineOfCursorPosition(styledText.getSelection());
}
});
styledText.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
highlightLineOfCursorPosition(styledText.getSelection());
}
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
});
styledText.addVerifyKeyListener(new VerifyKeyListener() {
public void verifyKey(VerifyEvent verifyEvent) {
if (verifyEvent.character == '\r' && contentProposalAdapter != null && contentProposalAdapter.isProposalOpened()) {
verifyEvent.doit = false;
} else {
verifyEvent.doit = true;
}
}
});
styledText.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
highlightLineOfCursorPosition(styledText.getSelection());
}
public void mouseDown(MouseEvent e) {
mapperManager.fireCurrentDirectEditApply();
highlightLineOfCursorPosition(styledText.getSelection());
}
public void mouseUp(MouseEvent e) {
}
});
}
use of org.eclipse.swt.events.FocusListener in project tdi-studio-se by Talend.
the class RowGeneratorUI method init.
/**
* yzhang Comment method "init".
*
* @param fromDialog
*/
public void init(boolean fromDialog) {
uiManager = generatorManager.getUiManager();
final ExternalRowGeneratorUiProperties uiProperties = uiManager.getUiProperties();
addParentListeners(uiManager, uiProperties);
final Display display = rowGenUIParent.getDisplay();
GridLayout parentLayout = new GridLayout(1, true);
rowGenUIParent.setLayout(parentLayout);
addKeyListener(uiManager, display);
mainSashForm = new SashForm(rowGenUIParent, SWT.SMOOTH | SWT.VERTICAL);
GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
mainSashForm.setLayoutData(mainSashFormGridData);
datasFlowViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
datasFlowViewSashForm.setLayoutData(mainSashFormGridData);
datasFlowViewSashForm.setBackgroundMode(SWT.INHERIT_FORCE);
initBackgroundComponents();
// if (WindowSystem.isGTK()) {
// datasFlowViewSashForm.setBackground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
// }
/* Create Schema Table Editor */
createSchemaComposite();
/* Create the tabs */
tabFolderEditors = new TabFolderEditors(mainSashForm, SWT.BORDER, externalNode, dataTableView);
tabFolderEditors.setRowGeneratorUI(this);
tabFolderEditors.getProcessPreview().refreshTablePreview(outputMetaTable.getListColumns(), null, true);
if (!fromDialog) {
new FooterComposite(this.rowGenUIParent, SWT.NONE, generatorManager);
}
dataTableView.getTable().addSelectionListener(new SelectionAdapter() {
/*
* (non-Java)
*
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@SuppressWarnings("unchecked")
@Override
public void widgetSelected(SelectionEvent e) {
updateFunParameter((Table) e.getSource());
}
});
dataTableView.getTable().addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
dataTableView.getTableViewerCreator().refresh();
}
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
}
});
}
use of org.eclipse.swt.events.FocusListener in project tdi-studio-se by Talend.
the class FunParaTableView2 method updateData.
private void updateData(List<Parameter> params) {
final Table table = this.getTable();
final TableViewer viewer = this.getTableViewerCreator().getTableViewer();
final TableEditor editor = new TableEditor(table);
// The editor must have the same size as the cell and must
// editing the Third column
final int eDITABLECOLUMN = 2;
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// Clean up any previous editor control
Control oldEditor = editor.getEditor();
if (oldEditor != null) {
oldEditor.dispose();
}
// Identify the selected row
TableItem item = (TableItem) e.item;
if (item == null) {
return;
}
Parameter param = (Parameter) item.getData();
if (param instanceof ListParameter) {
createCombo((ListParameter) param, item);
}
}
private void createCombo(final ListParameter list, TableItem item) {
final CCombo combo = new CCombo(table, SWT.NONE);
combo.setItems(list.getValues());
combo.setFocus();
editor.setEditor(combo, item, eDITABLECOLUMN);
combo.setText(list.getValue());
Point size = combo.computeSize(SWT.DEFAULT, table.getItemHeight());
// Set attributes of the editor
editor.horizontalAlignment = SWT.LEFT;
editor.minimumHeight = size.y;
editor.minimumWidth = size.x;
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
list.setValue(combo.getText());
viewer.refresh(list);
ext.setChanged(true);
rowGenTableEditor2.getTableViewerCreator().getTableViewer().refresh();
}
});
combo.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
}
/**
* Sent when a control loses focus.
*
* @param e an event containing information about the focus change
*/
public void focusLost(FocusEvent e) {
combo.dispose();
}
});
}
});
getTableViewerCreator().setInputList(params);
}
use of org.eclipse.swt.events.FocusListener in project tdi-studio-se by Talend.
the class HeapHistogramPage method createContextMenu.
/**
* Creates the context menu.
*
* @param actionBars The action bars
*/
private void createContextMenu(IActionBars actionBars) {
final OpenDeclarationAction openAction = OpenDeclarationAction.createOpenDeclarationAction(actionBars);
final CopyAction copyAction = CopyAction.createCopyAction(actionBars);
configureColumnsAction = new ConfigureColumnsAction(this);
heapViewer.addSelectionChangedListener(openAction);
heapViewer.getControl().addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
heapViewer.removeSelectionChangedListener(copyAction);
}
@Override
public void focusGained(FocusEvent e) {
heapViewer.addSelectionChangedListener(copyAction);
}
});
heapViewer.addOpenListener(new IOpenListener() {
@Override
public void open(OpenEvent event) {
openAction.run();
}
});
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.add(openAction);
manager.add(copyAction);
manager.add(new Separator());
manager.add(configureColumnsAction);
}
});
Menu menu = menuMgr.createContextMenu(heapViewer.getControl());
heapViewer.getControl().setMenu(menu);
}
use of org.eclipse.swt.events.FocusListener in project tdi-studio-se by Talend.
the class MapperUI method addParentListeners.
private void addParentListeners(final UIManager uiManager, final ExternalMapperUiProperties uiProperties) {
mapperUIParent.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
release();
}
});
mapperUIParent.addListener(SWT.Close, new Listener() {
public void handleEvent(Event event) {
if (uiManager.getMapperResponse() == SWT.NONE) {
uiManager.setMapperResponse(SWT.CANCEL);
}
}
});
mapperUIParent.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
updateBackground(false, true);
}
public void focusLost(FocusEvent e) {
}
});
// store size if not maximized
if (mapperUIParent instanceof Shell) {
((Shell) mapperUIParent).addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
}
public void controlResized(ControlEvent e) {
if (!((Shell) e.getSource()).getMaximized()) {
uiProperties.setBoundsMapper(((Shell) e.getSource()).getBounds());
}
}
});
}
}
Aggregations