use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-plugins by JetBrains.
the class ActionScriptFormatterTest method testCdataDamaged.
public void testCdataDamaged() throws Exception {
final CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(getProject());
final XmlCodeStyleSettings xmlSettings = styleSettings.getCustomSettings(XmlCodeStyleSettings.class);
int before = styleSettings.getTabSize(StdFileTypes.XML);
int aroundCDataBefore = xmlSettings.XML_WHITE_SPACE_AROUND_CDATA;
try {
styleSettings.getIndentOptions(StdFileTypes.XML).TAB_SIZE = 4;
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = XmlCodeStyleSettings.WS_AROUND_CDATA_NEW_LINES;
myUseReformatText = true;
doTestFromFile("mxml");
} finally {
styleSettings.getIndentOptions(StdFileTypes.XML).TAB_SIZE = before;
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = aroundCDataBefore;
myUseReformatText = false;
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-plugins by JetBrains.
the class ActionScriptFormatterTest method testActionScriptRestParameter.
public void testActionScriptRestParameter() throws Exception {
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings();
final JSCodeStyleSettings jsSettings = settings.getCustomSettings(ECMA4CodeStyleSettings.class);
jsSettings.SPACE_AFTER_DOTS_IN_REST_PARAMETER = false;
doTest("class Bar {\n" + " public function foo(... rest):void {\n" + " }\n" + "}", "class Bar {\n" + " public function foo(...rest):void {\n" + " }\n" + "}", ".as");
jsSettings.SPACE_AFTER_DOTS_IN_REST_PARAMETER = true;
doTest("class Bar {\n" + " public function foo(... rest):void {\n" + " }\n" + "}", "class Bar {\n" + " public function foo(... rest):void {\n" + " }\n" + "}", ".as");
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project android by JetBrains.
the class AndroidCodeStyleNotificationProvider method createNotificationPanel.
@Nullable
@Override
public MyPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (file.getFileType() != XmlFileType.INSTANCE || !(fileEditor instanceof TextEditor)) {
return null;
}
final Module module = ModuleUtilCore.findModuleForFile(file, myProject);
if (module == null) {
return null;
}
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
return null;
}
final VirtualFile parent = file.getParent();
final VirtualFile resDir = parent != null ? parent.getParent() : null;
if (resDir == null || !facet.getLocalResourceManager().isResourceDir(resDir)) {
return null;
}
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(myProject);
final AndroidXmlCodeStyleSettings androidSettings = AndroidXmlCodeStyleSettings.getInstance(settings);
if (androidSettings.USE_CUSTOM_SETTINGS) {
return null;
}
if (NotificationsConfigurationImpl.getSettings(ANDROID_XML_CODE_STYLE_NOTIFICATION_GROUP).getDisplayType() == NotificationDisplayType.NONE) {
return null;
}
NotificationsConfiguration.getNotificationsConfiguration().register(ANDROID_XML_CODE_STYLE_NOTIFICATION_GROUP, NotificationDisplayType.BALLOON, false);
return new MyPanel();
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project android-butterknife-zelezny by avast.
the class Utils method getPrefix.
/**
* Load field name prefix from code style
*
* @return
*/
public static String getPrefix() {
if (PropertiesComponent.getInstance().isValueSet(Settings.PREFIX)) {
return PropertiesComponent.getInstance().getValue(Settings.PREFIX);
} else {
CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance();
CodeStyleSettings settings = manager.getCurrentSettings();
return settings.FIELD_NAME_PREFIX;
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-plugins by JetBrains.
the class RubyMotionOverriddenMethodGenerator method generateObjCOverride.
private static PsiElement generateObjCOverride(Project project, Function function, @NotNull final LanguageLevel languageLevel) {
final StringBuilder text = new StringBuilder();
text.append("def ");
text.append(MotionSymbolUtil.getSelectorNames(function).get(0));
final List<Pair<String, String>> arguments = function.getArguments();
if (arguments.size() > 0) {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
final boolean generateParenthesesAroundArguments = settings.PARENTHESES_AROUND_METHOD_ARGUMENTS;
text.append(generateParenthesesAroundArguments ? "(" : " ");
text.append(arguments.get(0).first);
final String[] namedArguments = function.getName().split(":");
for (int i = 1; i < namedArguments.length; i++) {
String argument = namedArguments[i];
text.append(", ").append(argument).append(":").append(arguments.get(i).first);
}
text.append(generateParenthesesAroundArguments ? ")" : "");
}
text.append("\n").append(" super\nend\n");
return RubyElementFactory.createElementFromText(project, text.toString(), languageLevel);
}
Aggregations