Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upJBIDE-18188 HTML5 Palette: provide a way to filter palette groups, #413
Conversation
|
|
||
| /** | ||
| * Returns true if the library with the given version is used in this context. | ||
| * If version==null then the version does not meter. Any version of the library is recognized as used. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| setProperty(HTML5_RECOGNIZED_GROUPS_ONLY, ""+value); | ||
| } | ||
| } | ||
|
|
This comment has been minimized.
This comment has been minimized.
scabanovich
Dec 5, 2014
Contributor
I think it is better to move added static fields and methods to new class with singleton instance PaletteSettings (see below).
Remove 'test' parameter and field. Why cannot test remember in setUp() current value PaletteSettings.getInstance().isRecognizedGroupsOnly(), then set property in testing methods as needed and finally restore it to the saved value in tearDown()?
public class PaletteSettings {
public static final QualifiedName HTML5_RECOGNIZED_GROUPS_ONLY = new QualifiedName(WebUiPlugin.PLUGIN_ID, "HTML5_RECOGNIZED_GROUPS_ONLY");
public static final QualifiedName HTML5_FILTER_TEXT = new QualifiedName(WebUiPlugin.PLUGIN_ID, "HTML5_FILTER_TEXT");
static PaletteSettings instance = new PaletteSettings();
public static PaletteSettings getInstance() {
return instance;
}
private boolean recognizedCategoriesOnly;
private String filterString;
private PaletteSettings() {
recognizedCategoriesOnly = new Boolean(getProperty(HTML5_RECOGNIZED_GROUPS_ONLY));
filterString = getProperty(HTML5_FILTER_TEXT);
if(filterString == null) {
filterString = "";
}
}
public boolean isRecognizedGroupsOnly(){
return recognizedCategoriesOnly;
}
public void setRecognizedGroupsOnly(boolean value) {
recognizedCategoriesOnly = true;
setProperty(HTML5_RECOGNIZED_GROUPS_ONLY, ""+value);
}
public String getFilterString() {
return filterString;
}
public void setFilterString(String value) {
filterString = value;
setProperty(HTML5_FILTER_TEXT, value);
}
private synchronized String getProperty(QualifiedName propertyName){
// implementation as in PR
}
private synchronized void setProperty(QualifiedName propertyName, String value){
// implementation as in PR
}
}
This comment has been minimized.
This comment has been minimized.
78cd50e
to
432e60e
Add option to show only palette groups which libraries defined on the current html page
dazarov commentedDec 5, 2014
Add option to show only palette groups which libraries defined on the current html page