From 55b4064a64ba423d0d5ffcbaeb888e45951b2ce3 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Mon, 14 Jul 2014 17:13:36 +0200 Subject: [PATCH] do not modify profile file to write default --- .../plugin/replace/ReplaceOptions.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java index b791d3e0602d..31642aa80e22 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/replace/ReplaceOptions.java @@ -20,7 +20,7 @@ public class ReplaceOptions implements JDOMExternalizable, Cloneable { private String replacement = ""; private boolean toShortenFQN; private boolean myToReformatAccordingToStyle; - private boolean myToUseStaticImport; + private boolean myToUseStaticImport = false; private MatchOptions matchOptions = new MatchOptions(); @NonNls private static final String REFORMAT_ATTR_NAME = "reformatAccordingToStyle"; @@ -85,12 +85,11 @@ public class ReplaceOptions implements JDOMExternalizable, Cloneable { } catch(DataConversionException ex) {} attribute = element.getAttribute(USE_STATIC_IMPORT_ATTR_NAME); - try { - myToUseStaticImport = attribute.getBooleanValue(); - } - catch (DataConversionException ignore) {} - catch (NullPointerException ignore) { - // old saved configurations without this attribute present + if (attribute != null) { // old saved configurations without this attribute present + try { + myToUseStaticImport = attribute.getBooleanValue(); + } + catch (DataConversionException ignore) {} } replacement = element.getAttributeValue(REPLACEMENT_ATTR_NAME); @@ -111,7 +110,9 @@ public class ReplaceOptions implements JDOMExternalizable, Cloneable { element.setAttribute(REFORMAT_ATTR_NAME,String.valueOf(myToReformatAccordingToStyle)); element.setAttribute(SHORTEN_FQN_ATTR_NAME,String.valueOf(toShortenFQN)); - element.setAttribute(USE_STATIC_IMPORT_ATTR_NAME, String.valueOf(isToUseStaticImport())); + if (isToUseStaticImport()) { + element.setAttribute(USE_STATIC_IMPORT_ATTR_NAME, String.valueOf(isToUseStaticImport())); + } element.setAttribute(REPLACEMENT_ATTR_NAME,replacement); if (variableDefs!=null) {