1 |
4db49a38
|
Alexander Oppermann
|
package eu.etaxonomy.taxeditor.editor.view.checklist.listener;
|
2 |
|
|
|
3 |
|
|
import org.eclipse.swt.events.FocusEvent;
|
4 |
|
|
import org.eclipse.swt.events.FocusListener;
|
5 |
|
|
import org.eclipse.swt.events.ModifyListener;
|
6 |
|
|
import org.eclipse.swt.widgets.Text;
|
7 |
|
|
|
8 |
|
|
import eu.etaxonomy.taxeditor.editor.EditorUtil;
|
9 |
1ba96658
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4;
|
10 |
4db49a38
|
Alexander Oppermann
|
import eu.etaxonomy.taxeditor.preference.Resources;
|
11 |
|
|
|
12 |
|
|
public class ChecklistFocusListener implements FocusListener{
|
13 |
|
|
|
14 |
61c51c84
|
Patrick Plitzner
|
private final Text searchText;
|
15 |
|
|
private final ModifyListener modifyListener;
|
16 |
4db49a38
|
Alexander Oppermann
|
|
17 |
|
|
public ChecklistFocusListener(Text searchText, ModifyListener modifyListener) {
|
18 |
|
|
this.searchText = searchText;
|
19 |
|
|
this.modifyListener = modifyListener;
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
@Override
|
24 |
|
|
public void focusGained(FocusEvent e) {
|
25 |
1ba96658
|
Patrick Plitzner
|
if (ChecklistEditorE4.TYPE_FILTER_TEXT.equals(searchText.getText())) {
|
26 |
4db49a38
|
Alexander Oppermann
|
searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOCUS));
|
27 |
61c51c84
|
Patrick Plitzner
|
searchText.setText(""); //$NON-NLS-1$
|
28 |
4db49a38
|
Alexander Oppermann
|
}
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
@Override
|
32 |
|
|
public void focusLost(FocusEvent e) {
|
33 |
61c51c84
|
Patrick Plitzner
|
if ("".equals(searchText.getText())) { //$NON-NLS-1$
|
34 |
4db49a38
|
Alexander Oppermann
|
//TODO: set demo string
|
35 |
|
|
searchText.removeModifyListener(modifyListener);
|
36 |
|
|
|
37 |
|
|
searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
|
38 |
1ba96658
|
Patrick Plitzner
|
searchText.setText(ChecklistEditorE4.TYPE_FILTER_TEXT);
|
39 |
4db49a38
|
Alexander Oppermann
|
|
40 |
|
|
searchText.addModifyListener(modifyListener);
|
41 |
|
|
}
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
e3240965
|
Andreas Kohlbecker
|
}
|