use of org.eclipse.swt.events.PaintListener in project liferay-ide by liferay.
the class LayoutTplPreviewEditor method _refreshViewer.
private void _refreshViewer(GraphicalViewer viewer) {
Control control = viewer.getControl();
control.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
EditPart editPage = getGraphicalViewer().getContents();
editPage.refresh();
control.removePaintListener(this);
}
});
}
use of org.eclipse.swt.events.PaintListener in project core by jcryptool.
the class AlgorithmView method createSearchArea.
/**
* Creates the search field. On Mac the text does contain a clear (reset) icon which resets
* the view filter. Since Windows does not support this an additional clear (reset) icon
* is shown next to the text.
*
* @param parent The parent composite
*/
private void createSearchArea(Composite parent) {
// search field
final Text search = new Text(parent, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
if ((search.getStyle() & SWT.CANCEL) == 0) {
// reset search button for systems that do not support the cancel icon
Canvas canvas = new Canvas(parent, SWT.NONE);
GridData gridData = new GridData();
gridData.heightHint = 18;
gridData.widthHint = 18;
canvas.setLayoutData(gridData);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
// $NON-NLS-1$
e.gc.drawImage(ViewsPlugin.getImageDescriptor("icons/clear.gif").createImage(), 1, 1);
}
});
canvas.addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent e) {
search.setText(Messages.AlgorithmView_search_message);
search.setForeground(COLOR_FILTER_INITIAL);
initialSearchState = true;
// $NON-NLS-1$
treeView.setFilter("");
// $NON-NLS-1$
paletteView.setFilter("");
}
});
}
search.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
search.setText(Messages.AlgorithmView_search_message);
search.setForeground(COLOR_FILTER_INITIAL);
search.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
if (initialSearchState) {
// $NON-NLS-1$
search.setText("");
search.setForeground(COLOR_FILTER_USER);
initialSearchState = false;
}
}
});
search.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
treeView.setFilter(search.getText());
paletteView.setFilter(search.getText());
}
});
search.addSelectionListener(new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
if (e.detail == SWT.CANCEL) {
search.setText(Messages.AlgorithmView_search_message);
search.setForeground(COLOR_FILTER_INITIAL);
initialSearchState = true;
// $NON-NLS-1$
treeView.setFilter("");
// $NON-NLS-1$
paletteView.setFilter("");
}
}
});
}
use of org.eclipse.swt.events.PaintListener in project jbosstools-openshift by jbosstools.
the class AbstractProjectPage method onPageActivated.
@Override
protected void onPageActivated(final DataBindingContext dbc) {
loadResources(getPreviousPage() == null);
// fix GTK3 combo boxes too small
// https://issues.jboss.org/browse/JBIDE-16877,
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=431425
getControl().addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
if (getControl().isVisible()) {
((Composite) getControl()).layout(true, true);
((Composite) getControl()).update();
getControl().removePaintListener(this);
}
}
});
}
use of org.eclipse.swt.events.PaintListener in project whole by wholeplatform.
the class LanguageWorkbenchSplashHandler method init.
public void init(Shell splash) {
super.init(splash);
IProduct product = Platform.getProduct();
if (product == null) {
getContent();
return;
}
String progressPosition = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
setProgressRect(StringConverter.asRectangle(progressPosition, new Rectangle(0, 0, 300, 15)));
String messagePosition = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
setMessageRect(StringConverter.asRectangle(messagePosition, new Rectangle(0, 35, 300, 15)));
String foreground = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
int foregroundColor;
try {
foregroundColor = Integer.parseInt(foreground, 16);
} catch (NumberFormatException e) {
// off white
foregroundColor = 0xD2D7FF;
}
setForeground(new RGB((foregroundColor & 0xFF0000) >> 16, (foregroundColor & 0xFF00) >> 8, foregroundColor & 0xFF));
getContent().addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setForeground(getForeground());
e.gc.drawText(Platform.getBundle("org.whole.product.lw").getVersion().toString(), 250, 52, true);
}
});
}
use of org.eclipse.swt.events.PaintListener in project watchdog by TestRoots.
the class EditorListener method listenToEditorScrolling.
private void listenToEditorScrolling() {
styledText = (StyledText) editor.getAdapter(Control.class);
if (styledText == null) {
return;
}
// creates a listener for when the user moves the caret (cursor)
caretListener = new CaretListener() {
@Override
public void caretMoved(CaretEvent event) {
WatchDogEventType.CARET_MOVED.process(editor);
// cursor place changed
}
};
styledText.addCaretListener(caretListener);
// creates a listener for redraws of the view, e.g. when scrolled
paintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
WatchDogEventType.PAINT.process(editor);
}
};
styledText.addPaintListener(paintListener);
focusListener = new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
}
@Override
public void focusGained(FocusEvent e) {
WatchDogEventType.ACTIVE_FOCUS.process(editor);
}
};
styledText.addFocusListener(focusListener);
}
Aggregations