Revision 20e64571
Added by Katja Luther over 1 year ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java | ||
---|---|---|
74 | 74 |
|
75 | 75 |
text_cache = formFactory.createText(container, initialText, SWT.WRAP | SWT.MULTI); |
76 | 76 |
addControl(text_cache); |
77 |
text_cache.addModifyListener(this); |
|
77 |
if (initialState){ |
|
78 |
text_cache.addModifyListener(this); |
|
79 |
} |
|
78 | 80 |
text_cache.setLayoutData(LayoutConstants.FILL()); |
79 | 81 |
|
80 | 82 |
// Don't accept carriage returns as input |
... | ... | |
135 | 137 |
|
136 | 138 |
public void setCacheEnabled(boolean enabled) { |
137 | 139 |
text_cache.setEditable(enabled); |
140 |
if (enabled){ |
|
141 |
text_cache.removeModifyListener(this); |
|
142 |
text_cache.addModifyListener(this); |
|
143 |
}else{ |
|
144 |
text_cache.removeModifyListener(this); |
|
145 |
} |
|
138 | 146 |
btnToggleProtectTitleCache.setGrayed(enabled); |
139 | 147 |
btnToggleProtectTitleCache.setSelection(enabled); |
140 | 148 |
Color color = enabled ? null : AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED); |
... | ... | |
145 | 153 |
@Override |
146 | 154 |
public void setEnabled(boolean isEnabled){ |
147 | 155 |
this.isEnabled = isEnabled; |
148 |
text_cache.setEditable(isEnabled); |
|
156 |
if (state){ |
|
157 |
text_cache.setEditable(isEnabled); |
|
158 |
} |
|
149 | 159 |
btnToggleProtectTitleCache.setEnabled(isEnabled); |
150 | 160 |
} |
151 | 161 |
|
Also available in: Unified diff
fix #9688: Fix disabled toggleable text field