Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
package com.jetbrains.python.debugger.pydev;


import com.jetbrains.python.debugger.IPyDebugProcess;
import com.jetbrains.python.debugger.PyDebugValue;
import com.jetbrains.python.debugger.PyDebuggerException;

public class ChangeVariableCommand extends AbstractFrameCommand {

private final String myVariableName;
private final String myValue;
private PyDebugValue myNewValue = null;
private final IPyDebugProcess myDebugProcess;

public ChangeVariableCommand(RemoteDebugger debugger, String threadId, String frameId, String variableName,
String value) {
public ChangeVariableCommand(RemoteDebugger debugger, String threadId, String frameId, String variableName, String value) {
super(debugger, CHANGE_VARIABLE, threadId, frameId);
myVariableName = variableName;
myValue = value;
myDebugProcess = debugger.getDebugProcess();
}


@Override
protected void buildPayload(Payload payload) {
super.buildPayload(payload);
Expand All @@ -32,6 +28,7 @@ public boolean isResponseExpected() {
return true;
}

@Override
protected void processResponse(ProtocolFrame response) throws PyDebuggerException {
super.processResponse(response);
myNewValue = ProtocolParser.parseValue(response.getPayload(), myDebugProcess).setName(myVariableName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.jetbrains.python.debugger.pydev;

import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand All @@ -10,8 +9,8 @@
import consulo.execution.debug.breakpoint.SuspendPolicy;
import consulo.execution.debug.frame.XValueChildrenList;
import consulo.logging.Logger;

import org.jspecify.annotations.Nullable;

import java.util.*;

/**
Expand Down Expand Up @@ -163,7 +162,8 @@ public XValueChildrenList loadVariable(String threadId, String frameId, PyDebugV
return debugger(threadId).loadVariable(threadId, frameId, var);
}

public ArrayChunk loadArrayItems(String threadId, String frameId, PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) throws PyDebuggerException
@Override
public ArrayChunk loadArrayItems(String threadId, String frameId, PyDebugValue var, int rowOffset, int colOffset, int rows, int cols, String format) throws PyDebuggerException
{
return debugger(threadId).loadArrayItems(threadId, frameId, var, rowOffset, colOffset, rows, cols, format);
}
Expand Down Expand Up @@ -250,17 +250,12 @@ public Collection<PyThreadInfo> getThreads()
if(!isOtherDebuggersEmpty())
{
//here we add process id to thread name in case there are more then one process
return Collections.unmodifiableCollection(Collections2.transform(threads, new Function<PyThreadInfo, PyThreadInfo>()
{
@Override
public PyThreadInfo apply(PyThreadInfo t)
{
String threadName = ThreadRegistry.threadName(t.getName(), t.getId());
PyThreadInfo newThread = new PyThreadInfo(t.getId(), threadName, t.getFrames(), t.getStopReason(), t.getMessage());
newThread.updateState(t.getState(), t.getFrames());
return newThread;
}
}));
return Collections.unmodifiableCollection(Collections2.transform(threads, t -> {
String threadName = ThreadRegistry.threadName(t.getName(), t.getId());
PyThreadInfo newThread = new PyThreadInfo(t.getId(), threadName, t.getFrames(), t.getStopReason(), t.getMessage());
newThread.updateState(t.getState(), t.getFrames());
return newThread;
}));
}
else
{
Expand Down Expand Up @@ -439,7 +434,8 @@ private void addDebugger(RemoteDebugger debugger)
}
}

public void addCloseListener(RemoteDebuggerCloseListener listener)
@Override
public void addCloseListener(RemoteDebuggerCloseListener listener)
{
myMainDebugger.addCloseListener(listener);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.jetbrains.python.debugger.pydev.transport;

import com.jetbrains.python.debugger.pydev.RemoteDebugger;
import consulo.application.Application;
import consulo.logging.Logger;
import consulo.process.io.BaseOutputReader;
import consulo.util.lang.TimeoutUtil;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.concurrent.Future;


import consulo.application.ApplicationManager;
import consulo.logging.Logger;
import consulo.util.lang.TimeoutUtil;
import consulo.process.io.BaseOutputReader;
import com.jetbrains.python.debugger.pydev.RemoteDebugger;

/**
* @author Alexander Koshevoy
*/
Expand All @@ -34,7 +33,8 @@ protected RemoteDebugger getDebugger()
return myDebugger;
}

protected void doRun()
@Override
protected void doRun()
{
try
{
Expand Down Expand Up @@ -73,7 +73,7 @@ protected void doRun()
@Override
protected Future<?> executeOnPooledThread(Runnable runnable)
{
return ApplicationManager.getApplication().executeOnPooledThread(runnable);
return Application.get().executeOnPooledThread(runnable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ public DebuggerReader(RemoteDebugger debugger, InputStream stream) throws IOExce
start(getClass().getName());
}

protected void onCommunicationError()
@Override
protected void onCommunicationError()
{
if(myState == State.APPROVED)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.jetbrains.python.impl;

import consulo.annotation.DeprecationInfo;
import consulo.annotation.internal.MigratedExtensionsTo;
import consulo.component.util.localize.AbstractBundle;
import consulo.python.impl.localize.PyLocalize;
import org.jetbrains.annotations.PropertyKey;

@Deprecated
@DeprecationInfo("Use PyLocalize")
@MigratedExtensionsTo(PyLocalize.class)
public class PyBundle extends AbstractBundle {
private static final String BUNDLE = "com.jetbrains.python.impl.PyBundle";
private static final PyBundle ourInstance = new PyBundle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.jetbrains.python.impl.buildout.config;

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

private static final HashMap<String, TextAttributesKey> ourTagToDescriptorMap = new HashMap<String, TextAttributesKey>();
private static final HashMap<String, TextAttributesKey> ourTagToDescriptorMap = new HashMap<>();

static {
//ourTagToDescriptorMap.put("comment", DjangoTemplateHighlighterColors.DJANGO_COMMENT);
}

@Override
public LocalizeValue getDisplayName() {
return LocalizeValue.localizeTODO("Buildout config");
}

@Override
public AttributesDescriptor[] getAttributeDescriptors() {
return ATTRS;
}

@Override
public ColorDescriptor[] getColorDescriptors() {
return ColorDescriptor.EMPTY_ARRAY;
}

@Override
public SyntaxHighlighter getHighlighter() {
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(BuildoutCfgFileType.INSTANCE, null, null);
assert highlighter != null;
return highlighter;
}

@Override
public String getDemoText() {
return
"; Buildout config\n" +
Expand All @@ -79,6 +83,7 @@ public String getDemoText() {
"eggs = ${buildout:eggs}";
}

@Override
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
return ourTagToDescriptorMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.jetbrains.python.impl.buildout.config;

import consulo.language.file.LanguageFileType;
import consulo.localize.LocalizeValue;
import consulo.python.impl.icon.PythonImplIconGroup;
import consulo.ui.image.Image;
import com.jetbrains.python.impl.PythonIcons;

import org.jspecify.annotations.Nullable;

Expand All @@ -34,21 +33,25 @@ private BuildoutCfgFileType() {
super(BuildoutCfgLanguage.INSTANCE);
}

@Override
public String getId() {
return "BuildoutCfg";
}

@Override
public LocalizeValue getDescription() {
return LocalizeValue.localizeTODO("Buildout config files");
}

@Override
public String getDefaultExtension() {
return DEFAULT_EXTENSION;
}

@Nullable
@Override
public Image getIcon() {
return PythonIcons.Python.Buildout.Buildout;
return PythonImplIconGroup.pythonBuildoutBuildout();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.jetbrains.python.impl.buildout.config;

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

@Override
public Lexer createLexer(LanguageVersion languageVersion) {
return new BuildoutCfgFlexLexer();
}

@Nullable
@Override
public PsiParser createParser(LanguageVersion languageVersion) {
return new BuildoutCfgParser();
}

@Override
public IFileElementType getFileNodeType() {
return FILE;
}

@Override
public TokenSet getWhitespaceTokens(LanguageVersion languageVersion) {
return TokenSet.create(WHITESPACE);
}

@Override
public TokenSet getCommentTokens(LanguageVersion languageVersion) {
return TokenSet.create(COMMENT);
}

@Override
public TokenSet getStringLiteralElements(LanguageVersion languageVersion) {
return TokenSet.create(TEXT);
}

@Override
public PsiElement createElement(ASTNode node) {
return astFactory.create(node);
}

@Override
public PsiFile createFile(FileViewProvider viewProvider) {
return new BuildoutCfgFile(viewProvider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.jetbrains.python.impl.buildout.config;

import com.google.common.collect.Maps;
Expand All @@ -27,14 +26,13 @@
import java.util.Map;

/**
* @author: traff
* @author traff
*/
public class BuildoutCfgSyntaxHighlighter extends SyntaxHighlighterBase implements BuildoutCfgTokenTypes {
static final String COMMENT_ID = "BUILDOUT_COMMENT";
static final String TEXT_ID = "BUILDOUT_TEXT";
static final String BRACKETS_ID = "BUILDOUT_BRACKETS";


public static final TextAttributesKey BUILDOUT_SECTION_NAME = TextAttributesKey.createTextAttributesKey(
"BUILDOUT.SECTION_NAME",
DefaultLanguageHighlighterColors.NUMBER
Expand Down Expand Up @@ -79,11 +77,12 @@ public class BuildoutCfgSyntaxHighlighter extends SyntaxHighlighterBase implemen
ATTRIBUTES.put(VALUE_CHARACTERS, BUILDOUT_VALUE);
}


@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
return SyntaxHighlighterBase.pack(ATTRIBUTES.get(tokenType));
}

@Override
public Lexer getHighlightingLexer() {
return new BuildoutCfgFlexLexer();
}
Expand Down
Loading
Loading