/*
* Copyright 2013-2014 Grzegorz Ligas <ligasgr@gmail.com> and other contributors
* (see the CONTRIBUTORS file).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.intellij.xquery.formatter.settings;
import com.intellij.application.options.CodeStyleAbstractConfigurable;
import com.intellij.application.options.CodeStyleAbstractPanel;
import com.intellij.application.options.TabbedLanguageCodeStylePanel;
import com.intellij.openapi.options.Configurable;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
import org.intellij.xquery.XQueryLanguage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* User: ligasgr
* Date: 01/09/13
* Time: 19:08
*/
public class XQueryCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
return new XQueryCodeStyleSettings(settings);
}
@Nullable
@Override
public String getConfigurableDisplayName() {
return "XQuery";
}
@NotNull
@Override
public Configurable createSettingsPage(CodeStyleSettings settings, CodeStyleSettings originalSettings) {
return new CodeStyleAbstractConfigurable(settings, originalSettings, "XQuery") {
@Override
protected CodeStyleAbstractPanel createPanel(CodeStyleSettings settings) {
return new XQueryCodeStyleMainPanel(getCurrentSettings(), settings);
}
@Nullable
@Override
public String getHelpTopic() {
return null;
}
};
}
private static class XQueryCodeStyleMainPanel extends TabbedLanguageCodeStylePanel {
public XQueryCodeStyleMainPanel(CodeStyleSettings currentSettings, CodeStyleSettings settings) {
super(XQueryLanguage.INSTANCE, currentSettings, settings);
}
}
}