Skip to content

Commit b3d24e4

Browse files
tomlucushon
authored andcommitted
Update plugins for 2016.3.1.
2016.2.4 is still "intellij-latest". MOE_MIGRATED_REVID=142804141
1 parent 044961c commit b3d24e4

File tree

3 files changed

+194
-0
lines changed

3 files changed

+194
-0
lines changed

idea_plugin/google-java-format.iml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<exclude-output />
66
<content url="file://$MODULE_DIR$">
77
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/com/google/googlejavaformat/intellij/v2016_3" packagePrefix="com.google.googlejavaformat.intellij.v2016_3" isTestSource="false" />
9+
<excludeFolder url="file://$MODULE_DIR$/src/com/google/googlejavaformat/intellij/v2016_2" />
810
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
911
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
1012
</content>
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/*
2+
* Copyright 2015 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.googlejavaformat.intellij;
18+
19+
import com.intellij.lang.ASTNode;
20+
import com.intellij.openapi.editor.Document;
21+
import com.intellij.openapi.fileTypes.FileType;
22+
import com.intellij.openapi.project.Project;
23+
import com.intellij.openapi.util.Computable;
24+
import com.intellij.openapi.util.TextRange;
25+
import com.intellij.psi.PsiElement;
26+
import com.intellij.psi.PsiFile;
27+
import com.intellij.psi.codeStyle.ChangedRangesInfo;
28+
import com.intellij.psi.codeStyle.CodeStyleManager;
29+
import com.intellij.psi.codeStyle.Indent;
30+
import com.intellij.util.IncorrectOperationException;
31+
import com.intellij.util.ThrowableRunnable;
32+
import java.util.ArrayList;
33+
import java.util.Collection;
34+
import java.util.List;
35+
import org.jetbrains.annotations.NotNull;
36+
import org.jetbrains.annotations.Nullable;
37+
38+
/**
39+
* Decorates the {@link CodeStyleManager} abstract class by delegating to a concrete implementation
40+
* instance (likely IJ's default instance).
41+
*
42+
* @author [email protected] (Brian Chang)
43+
*/
44+
@SuppressWarnings("deprecation")
45+
class CodeStyleManagerDecorator extends CodeStyleManager {
46+
@NotNull private final CodeStyleManager delegate;
47+
48+
CodeStyleManagerDecorator(@NotNull CodeStyleManager delegate) {
49+
this.delegate = delegate;
50+
}
51+
52+
@NotNull
53+
CodeStyleManager getDelegate() {
54+
return delegate;
55+
}
56+
57+
@Override
58+
@NotNull
59+
public Project getProject() {
60+
return delegate.getProject();
61+
}
62+
63+
@Override
64+
@NotNull
65+
public PsiElement reformat(@NotNull PsiElement element) throws IncorrectOperationException {
66+
return delegate.reformat(element);
67+
}
68+
69+
@Override
70+
@NotNull
71+
public PsiElement reformat(@NotNull PsiElement element, boolean canChangeWhiteSpacesOnly)
72+
throws IncorrectOperationException {
73+
return delegate.reformat(element, canChangeWhiteSpacesOnly);
74+
}
75+
76+
@Override
77+
public PsiElement reformatRange(@NotNull PsiElement element, int startOffset, int endOffset)
78+
throws IncorrectOperationException {
79+
return delegate.reformatRange(element, startOffset, endOffset);
80+
}
81+
82+
@Override
83+
public PsiElement reformatRange(
84+
@NotNull PsiElement element, int startOffset, int endOffset, boolean canChangeWhiteSpacesOnly)
85+
throws IncorrectOperationException {
86+
return delegate.reformatRange(element, startOffset, endOffset, canChangeWhiteSpacesOnly);
87+
}
88+
89+
@Override
90+
public void reformatText(@NotNull PsiFile file, int startOffset, int endOffset)
91+
throws IncorrectOperationException {
92+
delegate.reformatText(file, startOffset, endOffset);
93+
}
94+
95+
@Override
96+
public void reformatText(@NotNull PsiFile file, @NotNull Collection<TextRange> ranges)
97+
throws IncorrectOperationException {
98+
delegate.reformatText(file, ranges);
99+
}
100+
101+
@Override
102+
public void reformatTextWithContext(@NotNull PsiFile file, @NotNull Collection<TextRange> ranges)
103+
throws IncorrectOperationException {
104+
delegate.reformatTextWithContext(file, ranges);
105+
}
106+
107+
@Override
108+
public void adjustLineIndent(@NotNull PsiFile file, TextRange rangeToAdjust)
109+
throws IncorrectOperationException {
110+
delegate.adjustLineIndent(file, rangeToAdjust);
111+
}
112+
113+
@Override
114+
public int adjustLineIndent(@NotNull PsiFile file, int offset)
115+
throws IncorrectOperationException {
116+
return delegate.adjustLineIndent(file, offset);
117+
}
118+
119+
@Override
120+
public int adjustLineIndent(@NotNull Document document, int offset) {
121+
return delegate.adjustLineIndent(document, offset);
122+
}
123+
124+
@Override
125+
public boolean isLineToBeIndented(@NotNull PsiFile file, int offset) {
126+
return delegate.isLineToBeIndented(file, offset);
127+
}
128+
129+
@Override
130+
@Nullable
131+
public String getLineIndent(@NotNull PsiFile file, int offset) {
132+
return delegate.getLineIndent(file, offset);
133+
}
134+
135+
@Override
136+
@Nullable
137+
public String getLineIndent(@NotNull Document document, int offset) {
138+
return delegate.getLineIndent(document, offset);
139+
}
140+
141+
@Override
142+
public Indent getIndent(String text, FileType fileType) {
143+
return delegate.getIndent(text, fileType);
144+
}
145+
146+
@Override
147+
public String fillIndent(Indent indent, FileType fileType) {
148+
return delegate.fillIndent(indent, fileType);
149+
}
150+
151+
@Override
152+
public Indent zeroIndent() {
153+
return delegate.zeroIndent();
154+
}
155+
156+
@Override
157+
public void reformatNewlyAddedElement(@NotNull ASTNode block, @NotNull ASTNode addedElement)
158+
throws IncorrectOperationException {
159+
delegate.reformatNewlyAddedElement(block, addedElement);
160+
}
161+
162+
@Override
163+
public boolean isSequentialProcessingAllowed() {
164+
return delegate.isSequentialProcessingAllowed();
165+
}
166+
167+
@Override
168+
public void performActionWithFormatterDisabled(Runnable r) {
169+
delegate.performActionWithFormatterDisabled(r);
170+
}
171+
172+
@Override
173+
public <T extends Throwable> void performActionWithFormatterDisabled(ThrowableRunnable<T> r)
174+
throws T {
175+
delegate.performActionWithFormatterDisabled(r);
176+
}
177+
178+
@Override
179+
public <T> T performActionWithFormatterDisabled(Computable<T> r) {
180+
return delegate.performActionWithFormatterDisabled(r);
181+
}
182+
183+
@Override
184+
public void reformatTextWithContext(
185+
@NotNull PsiFile psiFile, @NotNull ChangedRangesInfo changedRangesInfo)
186+
throws IncorrectOperationException {
187+
List<TextRange> ranges = new ArrayList<>();
188+
ranges.addAll(changedRangesInfo.insertedRanges);
189+
ranges.addAll(changedRangesInfo.allChangedRanges);
190+
this.reformatTextWithContext(psiFile, ranges);
191+
}
192+
}

0 commit comments

Comments
 (0)