Skip to content

Commit 6ab6533

Browse files
committed
Adding missing @OverRide annotations. Adding RRA/RWA/RUI annotations. Some localization and refactoring
1 parent 40e8077 commit 6ab6533

50 files changed

Lines changed: 758 additions & 614 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎python-debugger/src/main/java/com/jetbrains/python/debugger/pydev/ChangeVariableCommand.java‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
package com.jetbrains.python.debugger.pydev;
22

3-
43
import com.jetbrains.python.debugger.IPyDebugProcess;
54
import com.jetbrains.python.debugger.PyDebugValue;
65
import com.jetbrains.python.debugger.PyDebuggerException;
76

87
public class ChangeVariableCommand extends AbstractFrameCommand {
9-
108
private final String myVariableName;
119
private final String myValue;
1210
private PyDebugValue myNewValue = null;
1311
private final IPyDebugProcess myDebugProcess;
1412

15-
public ChangeVariableCommand(RemoteDebugger debugger, String threadId, String frameId, String variableName,
16-
String value) {
13+
public ChangeVariableCommand(RemoteDebugger debugger, String threadId, String frameId, String variableName, String value) {
1714
super(debugger, CHANGE_VARIABLE, threadId, frameId);
1815
myVariableName = variableName;
1916
myValue = value;
2017
myDebugProcess = debugger.getDebugProcess();
2118
}
2219

23-
2420
@Override
2521
protected void buildPayload(Payload payload) {
2622
super.buildPayload(payload);
@@ -32,6 +28,7 @@ public boolean isResponseExpected() {
3228
return true;
3329
}
3430

31+
@Override
3532
protected void processResponse(ProtocolFrame response) throws PyDebuggerException {
3633
super.processResponse(response);
3734
myNewValue = ProtocolParser.parseValue(response.getPayload(), myDebugProcess).setName(myVariableName);

‎python-debugger/src/main/java/com/jetbrains/python/debugger/pydev/ClientModeMultiProcessDebugger.java‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.jetbrains.python.debugger.pydev;
22

3-
import com.google.common.base.Function;
43
import com.google.common.collect.Collections2;
54
import com.google.common.collect.Lists;
65
import com.google.common.collect.Maps;
@@ -10,8 +9,8 @@
109
import consulo.execution.debug.breakpoint.SuspendPolicy;
1110
import consulo.execution.debug.frame.XValueChildrenList;
1211
import consulo.logging.Logger;
13-
1412
import org.jspecify.annotations.Nullable;
13+
1514
import java.util.*;
1615

1716
/**
@@ -163,7 +162,8 @@ public XValueChildrenList loadVariable(String threadId, String frameId, PyDebugV
163162
return debugger(threadId).loadVariable(threadId, frameId, var);
164163
}
165164

166-
public ArrayChunk loadArrayItems(String threadId, String frameId, PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) throws PyDebuggerException
165+
@Override
166+
public ArrayChunk loadArrayItems(String threadId, String frameId, PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) throws PyDebuggerException
167167
{
168168
return debugger(threadId).loadArrayItems(threadId, frameId, var, rowOffset, colOffset, rows, cols, format);
169169
}
@@ -250,17 +250,12 @@ public Collection<PyThreadInfo> getThreads()
250250
if(!isOtherDebuggersEmpty())
251251
{
252252
//here we add process id to thread name in case there are more then one process
253-
return Collections.unmodifiableCollection(Collections2.transform(threads, new Function<PyThreadInfo, PyThreadInfo>()
254-
{
255-
@Override
256-
public PyThreadInfo apply(PyThreadInfo t)
257-
{
258-
String threadName = ThreadRegistry.threadName(t.getName(), t.getId());
259-
PyThreadInfo newThread = new PyThreadInfo(t.getId(), threadName, t.getFrames(), t.getStopReason(), t.getMessage());
260-
newThread.updateState(t.getState(), t.getFrames());
261-
return newThread;
262-
}
263-
}));
253+
return Collections.unmodifiableCollection(Collections2.transform(threads, t -> {
254+
String threadName = ThreadRegistry.threadName(t.getName(), t.getId());
255+
PyThreadInfo newThread = new PyThreadInfo(t.getId(), threadName, t.getFrames(), t.getStopReason(), t.getMessage());
256+
newThread.updateState(t.getState(), t.getFrames());
257+
return newThread;
258+
}));
264259
}
265260
else
266261
{
@@ -439,7 +434,8 @@ private void addDebugger(RemoteDebugger debugger)
439434
}
440435
}
441436

442-
public void addCloseListener(RemoteDebuggerCloseListener listener)
437+
@Override
438+
public void addCloseListener(RemoteDebuggerCloseListener listener)
443439
{
444440
myMainDebugger.addCloseListener(listener);
445441
}

‎python-debugger/src/main/java/com/jetbrains/python/debugger/pydev/transport/BaseDebuggerReader.java‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.jetbrains.python.debugger.pydev.transport;
22

3+
import com.jetbrains.python.debugger.pydev.RemoteDebugger;
4+
import consulo.application.Application;
5+
import consulo.logging.Logger;
6+
import consulo.process.io.BaseOutputReader;
7+
import consulo.util.lang.TimeoutUtil;
8+
39
import java.io.IOException;
410
import java.io.InputStream;
511
import java.nio.charset.Charset;
612
import java.util.Arrays;
713
import java.util.concurrent.Future;
814

9-
10-
import consulo.application.ApplicationManager;
11-
import consulo.logging.Logger;
12-
import consulo.util.lang.TimeoutUtil;
13-
import consulo.process.io.BaseOutputReader;
14-
import com.jetbrains.python.debugger.pydev.RemoteDebugger;
15-
1615
/**
1716
* @author Alexander Koshevoy
1817
*/
@@ -34,7 +33,8 @@ protected RemoteDebugger getDebugger()
3433
return myDebugger;
3534
}
3635

37-
protected void doRun()
36+
@Override
37+
protected void doRun()
3838
{
3939
try
4040
{
@@ -73,7 +73,7 @@ protected void doRun()
7373
@Override
7474
protected Future<?> executeOnPooledThread(Runnable runnable)
7575
{
76-
return ApplicationManager.getApplication().executeOnPooledThread(runnable);
76+
return Application.get().executeOnPooledThread(runnable);
7777
}
7878

7979
@Override

‎python-debugger/src/main/java/com/jetbrains/python/debugger/pydev/transport/ClientModeDebuggerTransport.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ public DebuggerReader(RemoteDebugger debugger, InputStream stream) throws IOExce
303303
start(getClass().getName());
304304
}
305305

306-
protected void onCommunicationError()
306+
@Override
307+
protected void onCommunicationError()
307308
{
308309
if(myState == State.APPROVED)
309310
{

‎python-impl/src/main/java/com/jetbrains/python/impl/PyBundle.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl;
1817

18+
import consulo.annotation.DeprecationInfo;
19+
import consulo.annotation.internal.MigratedExtensionsTo;
1920
import consulo.component.util.localize.AbstractBundle;
21+
import consulo.python.impl.localize.PyLocalize;
2022
import org.jetbrains.annotations.PropertyKey;
2123

24+
@Deprecated
25+
@DeprecationInfo("Use PyLocalize")
26+
@MigratedExtensionsTo(PyLocalize.class)
2227
public class PyBundle extends AbstractBundle {
2328
private static final String BUNDLE = "com.jetbrains.python.impl.PyBundle";
2429
private static final PyBundle ourInstance = new PyBundle();

‎python-impl/src/main/java/com/jetbrains/python/impl/buildout/config/BuildoutCfgColorsPage.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl.buildout.config;
1817

1918
import consulo.annotation.component.ExtensionImpl;
@@ -41,30 +40,35 @@ public class BuildoutCfgColorsPage implements ColorSettingsPage {
4140
new AttributesDescriptor("Comment", BuildoutCfgSyntaxHighlighter.BUILDOUT_COMMENT)
4241
};
4342

44-
private static final HashMap<String, TextAttributesKey> ourTagToDescriptorMap = new HashMap<String, TextAttributesKey>();
43+
private static final HashMap<String, TextAttributesKey> ourTagToDescriptorMap = new HashMap<>();
4544

4645
static {
4746
//ourTagToDescriptorMap.put("comment", DjangoTemplateHighlighterColors.DJANGO_COMMENT);
4847
}
4948

49+
@Override
5050
public LocalizeValue getDisplayName() {
5151
return LocalizeValue.localizeTODO("Buildout config");
5252
}
5353

54+
@Override
5455
public AttributesDescriptor[] getAttributeDescriptors() {
5556
return ATTRS;
5657
}
5758

59+
@Override
5860
public ColorDescriptor[] getColorDescriptors() {
5961
return ColorDescriptor.EMPTY_ARRAY;
6062
}
6163

64+
@Override
6265
public SyntaxHighlighter getHighlighter() {
6366
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(BuildoutCfgFileType.INSTANCE, null, null);
6467
assert highlighter != null;
6568
return highlighter;
6669
}
6770

71+
@Override
6872
public String getDemoText() {
6973
return
7074
"; Buildout config\n" +
@@ -79,6 +83,7 @@ public String getDemoText() {
7983
"eggs = ${buildout:eggs}";
8084
}
8185

86+
@Override
8287
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
8388
return ourTagToDescriptorMap;
8489
}

‎python-impl/src/main/java/com/jetbrains/python/impl/buildout/config/BuildoutCfgFileType.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl.buildout.config;
1817

1918
import consulo.language.file.LanguageFileType;
2019
import consulo.localize.LocalizeValue;
20+
import consulo.python.impl.icon.PythonImplIconGroup;
2121
import consulo.ui.image.Image;
22-
import com.jetbrains.python.impl.PythonIcons;
2322

2423
import org.jspecify.annotations.Nullable;
2524

@@ -34,21 +33,25 @@ private BuildoutCfgFileType() {
3433
super(BuildoutCfgLanguage.INSTANCE);
3534
}
3635

36+
@Override
3737
public String getId() {
3838
return "BuildoutCfg";
3939
}
4040

41+
@Override
4142
public LocalizeValue getDescription() {
4243
return LocalizeValue.localizeTODO("Buildout config files");
4344
}
4445

46+
@Override
4547
public String getDefaultExtension() {
4648
return DEFAULT_EXTENSION;
4749
}
4850

4951
@Nullable
52+
@Override
5053
public Image getIcon() {
51-
return PythonIcons.Python.Buildout.Buildout;
54+
return PythonImplIconGroup.pythonBuildoutBuildout();
5255
}
5356
}
5457

‎python-impl/src/main/java/com/jetbrains/python/impl/buildout/config/BuildoutCfgParserDefinition.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl.buildout.config;
1817

1918
import com.jetbrains.python.impl.buildout.config.lexer.BuildoutCfgFlexLexer;
@@ -46,35 +45,43 @@ public Language getLanguage() {
4645
return BuildoutCfgLanguage.INSTANCE;
4746
}
4847

48+
@Override
4949
public Lexer createLexer(LanguageVersion languageVersion) {
5050
return new BuildoutCfgFlexLexer();
5151
}
5252

5353
@Nullable
54+
@Override
5455
public PsiParser createParser(LanguageVersion languageVersion) {
5556
return new BuildoutCfgParser();
5657
}
5758

59+
@Override
5860
public IFileElementType getFileNodeType() {
5961
return FILE;
6062
}
6163

64+
@Override
6265
public TokenSet getWhitespaceTokens(LanguageVersion languageVersion) {
6366
return TokenSet.create(WHITESPACE);
6467
}
6568

69+
@Override
6670
public TokenSet getCommentTokens(LanguageVersion languageVersion) {
6771
return TokenSet.create(COMMENT);
6872
}
6973

74+
@Override
7075
public TokenSet getStringLiteralElements(LanguageVersion languageVersion) {
7176
return TokenSet.create(TEXT);
7277
}
7378

79+
@Override
7480
public PsiElement createElement(ASTNode node) {
7581
return astFactory.create(node);
7682
}
7783

84+
@Override
7885
public PsiFile createFile(FileViewProvider viewProvider) {
7986
return new BuildoutCfgFile(viewProvider);
8087
}

‎python-impl/src/main/java/com/jetbrains/python/impl/buildout/config/BuildoutCfgSyntaxHighlighter.java‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.jetbrains.python.impl.buildout.config;
1817

1918
import com.google.common.collect.Maps;
@@ -27,14 +26,13 @@
2726
import java.util.Map;
2827

2928
/**
30-
* @author: traff
29+
* @author traff
3130
*/
3231
public class BuildoutCfgSyntaxHighlighter extends SyntaxHighlighterBase implements BuildoutCfgTokenTypes {
3332
static final String COMMENT_ID = "BUILDOUT_COMMENT";
3433
static final String TEXT_ID = "BUILDOUT_TEXT";
3534
static final String BRACKETS_ID = "BUILDOUT_BRACKETS";
3635

37-
3836
public static final TextAttributesKey BUILDOUT_SECTION_NAME = TextAttributesKey.createTextAttributesKey(
3937
"BUILDOUT.SECTION_NAME",
4038
DefaultLanguageHighlighterColors.NUMBER
@@ -79,11 +77,12 @@ public class BuildoutCfgSyntaxHighlighter extends SyntaxHighlighterBase implemen
7977
ATTRIBUTES.put(VALUE_CHARACTERS, BUILDOUT_VALUE);
8078
}
8179

82-
80+
@Override
8381
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
8482
return SyntaxHighlighterBase.pack(ATTRIBUTES.get(tokenType));
8583
}
8684

85+
@Override
8786
public Lexer getHighlightingLexer() {
8887
return new BuildoutCfgFlexLexer();
8988
}

0 commit comments

Comments
 (0)