Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBIDE-18188 HTML5 Palette: provide a way to filter palette groups, #413

Merged
merged 1 commit into from Dec 6, 2014

Conversation

@dazarov
Copy link
Member

dazarov commented Dec 5, 2014

Add option to show only palette groups which libraries defined on the current html page


/**
* 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.

Copy link
@scabanovich

scabanovich Dec 5, 2014

Contributor

does not matter

This comment has been minimized.

Copy link
@dazarov

dazarov Dec 5, 2014

Author Member

Done

setProperty(HTML5_RECOGNIZED_GROUPS_ONLY, ""+value);
}
}

This comment has been minimized.

Copy link
@scabanovich

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.

Copy link
@dazarov

dazarov Dec 5, 2014

Author Member

Done

@dazarov dazarov force-pushed the dazarov:JBIDE-18188-2 branch 5 times, most recently from 78cd50e to 432e60e Dec 5, 2014
Add option to show only palette groups which libraries defined on the current html page
@dazarov dazarov force-pushed the dazarov:JBIDE-18188-2 branch from 432e60e to 13ec348 Dec 6, 2014
@alexeykazakov alexeykazakov merged commit 13ec348 into jbosstools:master Dec 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.