use of org.eclipse.swt.events.MouseEvent in project KaiZen-OpenAPI-Editor by RepreZen.
the class QuickOutline method createTreeViewer.
protected TreeViewer createTreeViewer(Composite parent) {
final Tree tree = new Tree(parent, SWT.SINGLE);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = tree.getItemHeight();
tree.setLayoutData(gd);
final TreeViewer treeViewer = new TreeViewer(tree);
treeViewer.setContentProvider(new OutlineContentProvider());
treeViewer.setLabelProvider(new OutlineStyledLabelProvider());
treeViewer.addFilter(new NamePatternFilter());
// Using ALL_LEVELS will cause editor to hang on large specs
treeViewer.setAutoExpandLevel(2);
treeViewer.setUseHashlookup(true);
tree.addKeyListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
if (isInvocationEvent(e)) {
e.doit = false;
handleMultiView();
} else if (e.keyCode == SWT.CR) {
handleSelection();
QuickOutline.this.close();
}
}
});
tree.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
super.mouseDown(e);
}
public void mouseUp(MouseEvent e) {
if (tree.getSelectionCount() < 1) {
return;
}
if (e.button != 1) {
return;
}
if (tree.equals(e.getSource())) {
Object o = tree.getItem(new Point(e.x, e.y));
TreeItem selection = tree.getSelection()[0];
if (selection.equals(o)) {
handleSelection();
}
}
}
});
tree.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
// do nothing
}
public void widgetDefaultSelected(SelectionEvent e) {
handleSelection();
}
});
return treeViewer;
}
use of org.eclipse.swt.events.MouseEvent in project tdi-studio-se by Talend.
the class TalendPaletteViewer method configListeners.
/**
* yzhang Comment method "configListeners".
*
* @param text
*/
private void configListeners(final Text text) {
text.addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) {
}
@Override
public void mouseDown(MouseEvent e) {
if (text.getText().equals(SEARCH_COMPONENT)) {
//$NON-NLS-1$
text.setText("");
}
}
@Override
public void mouseUp(MouseEvent e) {
}
});
text.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// text.setText(""); //$NON-NLS-1$
}
@Override
public void focusLost(FocusEvent e) {
if (text.getText() == "") {
//$NON-NLS-1$
text.setText(SEARCH_COMPONENT);
}
}
});
text.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
startFiltering(text);
}
});
}
use of org.eclipse.swt.events.MouseEvent 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) {
updateCellExpression();
// System.out.println("ExtendedModifyListener modify text");
}
});
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) {
highlightLineOfCursorPosition(styledText.getSelection());
}
public void mouseUp(MouseEvent e) {
}
});
}
use of org.eclipse.swt.events.MouseEvent in project tesb-studio-se by Talend.
the class SearchControl method initialize.
private void initialize(int style) {
text = new Text(this, style);
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
text.setMessage("search what you want");
text.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
text.selectAll();
}
});
text.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
text.selectAll();
}
});
clear = new ToolBar(this, SWT.FLAT);
ToolItem item = new ToolItem(clear, SWT.PUSH);
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
text.setText("");
}
});
Point computeSize = clear.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int height = computeSize.y + 2;
arcSize = height > arcSize ? height : arcSize;
GridLayout layout = new GridLayout(2, false);
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginBottom = 0;
layout.marginHeight = 0;
layout.marginLeft = marginHorizon;
layout.marginRight = marginHorizon;
layout.marginTop = 1;
layout.marginWidth = 0;
setLayout(layout);
setBackground(backgroundColor);
}
use of org.eclipse.swt.events.MouseEvent 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) {
}
});
}
Aggregations