mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't create empty groovyc.xml
This commit is contained in:
+4
-11
@@ -21,8 +21,6 @@ import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CodeFormatterFacade {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade");
|
||||
|
||||
@@ -123,15 +121,10 @@ public class CodeFormatterFacade {
|
||||
}
|
||||
|
||||
private void printToConsole(final Block rootBlock, final FormattingModel model) {
|
||||
try {
|
||||
String tree = JDOMUtil.writeElement(new FormatInfoPrinter(rootBlock, model.getDocumentModel()).blocksAsTree(), "\n");
|
||||
System.out.println("---TREE---");
|
||||
System.out.println(tree);
|
||||
System.out.println("---/TREE---");
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String tree = JDOMUtil.writeElement(new FormatInfoPrinter(rootBlock, model.getDocumentModel()).blocksAsTree(), "\n");
|
||||
System.out.println("---TREE---");
|
||||
System.out.println(tree);
|
||||
System.out.println("---/TREE---");
|
||||
}
|
||||
|
||||
public void processTextWithoutHeadWhitespace(final PsiFile file, final int startOffset, final int endOffset) {
|
||||
|
||||
+2
-8
@@ -15,7 +15,6 @@ import org.jdom.Element;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@SuppressWarnings({"deprecation"})
|
||||
@@ -80,13 +79,8 @@ class DefaultStateSerializer {
|
||||
}
|
||||
else if (JDOMExternalizable.class.isAssignableFrom(stateClass)) {
|
||||
if (mergeInto != null) {
|
||||
try {
|
||||
String elementText = JDOMUtil.writeElement(stateElement, "\n");
|
||||
LOG.error("State is " + stateClass.getName() + ", merge into is " + mergeInto.toString() + ", state element text is " + elementText);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
String elementText = JDOMUtil.writeElement(stateElement, "\n");
|
||||
LOG.error("State is " + stateClass.getName() + ", merge into is " + mergeInto.toString() + ", state element text is " + elementText);
|
||||
}
|
||||
try {
|
||||
final T t = stateClass.newInstance();
|
||||
|
||||
+1
-6
@@ -151,12 +151,7 @@ public class StorageUtil {
|
||||
}
|
||||
|
||||
static String printElement(Element element) throws StateStorage.StateStorageException {
|
||||
try {
|
||||
return JDOMUtil.writeElement(element, SystemProperties.getLineSeparator());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new StateStorage.StateStorageException(e);
|
||||
}
|
||||
return JDOMUtil.writeElement(element, SystemProperties.getLineSeparator());
|
||||
}
|
||||
|
||||
static void save(IFile file, Element element) throws StateStorage.StateStorageException {
|
||||
|
||||
@@ -403,10 +403,15 @@ public class JDOMUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String writeElement(Element element, String lineSeparator) throws IOException {
|
||||
final StringWriter writer = new StringWriter();
|
||||
writeElement(element, writer, lineSeparator);
|
||||
return writer.toString();
|
||||
public static String writeElement(Element element, String lineSeparator) {
|
||||
try {
|
||||
final StringWriter writer = new StringWriter();
|
||||
writeElement(element, writer, lineSeparator);
|
||||
return writer.toString();
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
throw new RuntimeException(ignored);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeDocument(Document document, Writer writer, String lineSeparator) throws IOException {
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.intellij.util.xmlb;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import org.jdom.Element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -27,7 +29,13 @@ public class SkipDefaultValuesSerializationFilters implements SerializationFilte
|
||||
public boolean accepts(final Accessor accessor, final Object bean) {
|
||||
Object defaultBean = getDefaultBean(bean);
|
||||
|
||||
return !Comparing.equal(accessor.read(bean), accessor.read(defaultBean));
|
||||
final Object defValue = accessor.read(defaultBean);
|
||||
final Object beanValue = accessor.read(bean);
|
||||
if (defValue instanceof Element && beanValue instanceof Element) {
|
||||
return !JDOMUtil.writeElement((Element)defValue, "\n").equals(JDOMUtil.writeElement((Element)beanValue, "\n"));
|
||||
}
|
||||
|
||||
return !Comparing.equal(beanValue, defValue);
|
||||
}
|
||||
|
||||
private Object getDefaultBean(final Object bean) {
|
||||
|
||||
Reference in New Issue
Block a user