Search in sources :

Example 1 with PaneConfig

use of org.rstudio.studio.client.workbench.ui.PaneConfig in project rstudio by rstudio.

the class PaneLayoutPreferencesPane method onApply.

@Override
public boolean onApply(RPrefs rPrefs) {
    boolean restartRequired = super.onApply(rPrefs);
    if (dirty_) {
        JsArrayString panes = JsArrayString.createArray().cast();
        panes.push(leftTop_.getValue(leftTop_.getSelectedIndex()));
        panes.push(leftBottom_.getValue(leftBottom_.getSelectedIndex()));
        panes.push(rightTop_.getValue(rightTop_.getSelectedIndex()));
        panes.push(rightBottom_.getValue(rightBottom_.getSelectedIndex()));
        JsArrayString tabSet1 = JsArrayString.createArray().cast();
        for (String tab : tabSet1ModuleList_.getValue()) tabSet1.push(tab);
        JsArrayString tabSet2 = JsArrayString.createArray().cast();
        for (String tab : tabSet2ModuleList_.getValue()) tabSet2.push(tab);
        // Determine implicit preference for console top/bottom location
        // This needs to be saved so that when the user executes the 
        // Console on Left/Right commands we know whether to position 
        // the Console on the Top or Bottom
        PaneConfig prevConfig = uiPrefs_.paneConfig().getGlobalValue();
        boolean consoleLeftOnTop = prevConfig.getConsoleLeftOnTop();
        boolean consoleRightOnTop = prevConfig.getConsoleRightOnTop();
        final String kConsole = "Console";
        if (panes.get(0).equals(kConsole))
            consoleLeftOnTop = true;
        else if (panes.get(1).equals(kConsole))
            consoleLeftOnTop = false;
        else if (panes.get(2).equals(kConsole))
            consoleRightOnTop = true;
        else if (panes.get(3).equals(kConsole))
            consoleRightOnTop = false;
        uiPrefs_.paneConfig().setGlobalValue(PaneConfig.create(panes, tabSet1, tabSet2, consoleLeftOnTop, consoleRightOnTop));
        dirty_ = false;
    }
    return restartRequired;
}
Also used : PaneConfig(org.rstudio.studio.client.workbench.ui.PaneConfig) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)1 PaneConfig (org.rstudio.studio.client.workbench.ui.PaneConfig)1