Update plugins for 2016.3.1.
2016.2.4 is still "intellij-latest".
MOE_MIGRATED_REVID=142804141
diff --git a/idea_plugin/google-java-format.iml b/idea_plugin/google-java-format.iml
index a5cd516..dfcd8e0 100644
--- a/idea_plugin/google-java-format.iml
+++ b/idea_plugin/google-java-format.iml
@@ -5,6 +5,8 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/com/google/googlejavaformat/intellij/v2016_3" packagePrefix="com.google.googlejavaformat.intellij.v2016_3" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/src/com/google/googlejavaformat/intellij/v2016_2" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java b/idea_plugin/src/com/google/googlejavaformat/intellij/v2016_2/CodeStyleManagerDecorator.java
similarity index 100%
rename from idea_plugin/src/com/google/googlejavaformat/intellij/CodeStyleManagerDecorator.java
rename to idea_plugin/src/com/google/googlejavaformat/intellij/v2016_2/CodeStyleManagerDecorator.java
diff --git a/idea_plugin/src/com/google/googlejavaformat/intellij/v2016_3/CodeStyleManagerDecorator.java b/idea_plugin/src/com/google/googlejavaformat/intellij/v2016_3/CodeStyleManagerDecorator.java
new file mode 100644
index 0000000..8a74668
--- /dev/null
+++ b/idea_plugin/src/com/google/googlejavaformat/intellij/v2016_3/CodeStyleManagerDecorator.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ *
+ * 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 com.google.googlejavaformat.intellij;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.codeStyle.ChangedRangesInfo;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.codeStyle.Indent;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.ThrowableRunnable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Decorates the {@link CodeStyleManager} abstract class by delegating to a concrete implementation
+ * instance (likely IJ's default instance).
+ *
+ * @author bcsf@google.com (Brian Chang)
+ */
+@SuppressWarnings("deprecation")
+class CodeStyleManagerDecorator extends CodeStyleManager {
+ @NotNull private final CodeStyleManager delegate;
+
+ CodeStyleManagerDecorator(@NotNull CodeStyleManager delegate) {
+ this.delegate = delegate;
+ }
+
+ @NotNull
+ CodeStyleManager getDelegate() {
+ return delegate;
+ }
+
+ @Override
+ @NotNull
+ public Project getProject() {
+ return delegate.getProject();
+ }
+
+ @Override
+ @NotNull
+ public PsiElement reformat(@NotNull PsiElement element) throws IncorrectOperationException {
+ return delegate.reformat(element);
+ }
+
+ @Override
+ @NotNull
+ public PsiElement reformat(@NotNull PsiElement element, boolean canChangeWhiteSpacesOnly)
+ throws IncorrectOperationException {
+ return delegate.reformat(element, canChangeWhiteSpacesOnly);
+ }
+
+ @Override
+ public PsiElement reformatRange(@NotNull PsiElement element, int startOffset, int endOffset)
+ throws IncorrectOperationException {
+ return delegate.reformatRange(element, startOffset, endOffset);
+ }
+
+ @Override
+ public PsiElement reformatRange(
+ @NotNull PsiElement element, int startOffset, int endOffset, boolean canChangeWhiteSpacesOnly)
+ throws IncorrectOperationException {
+ return delegate.reformatRange(element, startOffset, endOffset, canChangeWhiteSpacesOnly);
+ }
+
+ @Override
+ public void reformatText(@NotNull PsiFile file, int startOffset, int endOffset)
+ throws IncorrectOperationException {
+ delegate.reformatText(file, startOffset, endOffset);
+ }
+
+ @Override
+ public void reformatText(@NotNull PsiFile file, @NotNull Collection<TextRange> ranges)
+ throws IncorrectOperationException {
+ delegate.reformatText(file, ranges);
+ }
+
+ @Override
+ public void reformatTextWithContext(@NotNull PsiFile file, @NotNull Collection<TextRange> ranges)
+ throws IncorrectOperationException {
+ delegate.reformatTextWithContext(file, ranges);
+ }
+
+ @Override
+ public void adjustLineIndent(@NotNull PsiFile file, TextRange rangeToAdjust)
+ throws IncorrectOperationException {
+ delegate.adjustLineIndent(file, rangeToAdjust);
+ }
+
+ @Override
+ public int adjustLineIndent(@NotNull PsiFile file, int offset)
+ throws IncorrectOperationException {
+ return delegate.adjustLineIndent(file, offset);
+ }
+
+ @Override
+ public int adjustLineIndent(@NotNull Document document, int offset) {
+ return delegate.adjustLineIndent(document, offset);
+ }
+
+ @Override
+ public boolean isLineToBeIndented(@NotNull PsiFile file, int offset) {
+ return delegate.isLineToBeIndented(file, offset);
+ }
+
+ @Override
+ @Nullable
+ public String getLineIndent(@NotNull PsiFile file, int offset) {
+ return delegate.getLineIndent(file, offset);
+ }
+
+ @Override
+ @Nullable
+ public String getLineIndent(@NotNull Document document, int offset) {
+ return delegate.getLineIndent(document, offset);
+ }
+
+ @Override
+ public Indent getIndent(String text, FileType fileType) {
+ return delegate.getIndent(text, fileType);
+ }
+
+ @Override
+ public String fillIndent(Indent indent, FileType fileType) {
+ return delegate.fillIndent(indent, fileType);
+ }
+
+ @Override
+ public Indent zeroIndent() {
+ return delegate.zeroIndent();
+ }
+
+ @Override
+ public void reformatNewlyAddedElement(@NotNull ASTNode block, @NotNull ASTNode addedElement)
+ throws IncorrectOperationException {
+ delegate.reformatNewlyAddedElement(block, addedElement);
+ }
+
+ @Override
+ public boolean isSequentialProcessingAllowed() {
+ return delegate.isSequentialProcessingAllowed();
+ }
+
+ @Override
+ public void performActionWithFormatterDisabled(Runnable r) {
+ delegate.performActionWithFormatterDisabled(r);
+ }
+
+ @Override
+ public <T extends Throwable> void performActionWithFormatterDisabled(ThrowableRunnable<T> r)
+ throws T {
+ delegate.performActionWithFormatterDisabled(r);
+ }
+
+ @Override
+ public <T> T performActionWithFormatterDisabled(Computable<T> r) {
+ return delegate.performActionWithFormatterDisabled(r);
+ }
+
+ @Override
+ public void reformatTextWithContext(
+ @NotNull PsiFile psiFile, @NotNull ChangedRangesInfo changedRangesInfo)
+ throws IncorrectOperationException {
+ List<TextRange> ranges = new ArrayList<>();
+ ranges.addAll(changedRangesInfo.insertedRanges);
+ ranges.addAll(changedRangesInfo.allChangedRanges);
+ this.reformatTextWithContext(psiFile, ranges);
+ }
+}