CR-IC-1923#CFR-48484

This commit is contained in:
Vladimir Krivosheev
2013-08-14 09:46:22 +02:00
parent df29bc0f21
commit 3d3000f909
3 changed files with 9 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.PortField; import com.intellij.ui.PortField;
import com.intellij.xdebugger.impl.settings.DebuggerConfigurable; import com.intellij.xdebugger.impl.settings.DebuggerConfigurable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -153,9 +154,8 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor<
} }
private void checkPort() throws ConfigurationException { private void checkPort() throws ConfigurationException {
final int port = myPortField.getNumber(); if (isSocket() && !myPortField.isSpecified()) {
if (isSocket() && port > 0 && (port < 0 || port > 0xffff)) { throw new ConfigurationException(DebuggerBundle.message("error.text.invalid.port"));
throw new ConfigurationException(DebuggerBundle.message("error.text.invalid.port.0", port));
} }
} }
@@ -172,7 +172,7 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor<
private void setPort(String port) { private void setPort(String port) {
if (isSocket()) { if (isSocket()) {
myPortField.setNumber(StringUtil.parseInt(port, 0)); myPortField.setNumber(StringUtilRt.parseInt(port, 0));
} }
else { else {
myAddressField.setText(port); myAddressField.setText(port);

View File

@@ -38,4 +38,8 @@ public class PortField extends JSpinner {
public int getNumber() { public int getNumber() {
return ((SpinnerNumberModel)getModel()).getNumber().intValue(); return ((SpinnerNumberModel)getModel()).getNumber().intValue();
} }
public boolean isSpecified() {
return getNumber() != 0;
}
} }

View File

@@ -424,7 +424,7 @@ label.breakpoint.properties.panel.group.actions=Actions
label.breakpoint.properties.panel.group.suspend.policy=Suspend policy label.breakpoint.properties.panel.group.suspend.policy=Suspend policy
active.tooltip.title=Evaluation of {0} active.tooltip.title=Evaluation of {0}
active.tooltip.suggestion=Click here to view object tree active.tooltip.suggestion=Click here to view object tree
error.text.invalid.port.0=Invalid port: ''{0,number,#}'' error.text.invalid.port=Port is not specified
error.cannot.invoke.method.in.collected.thread=Cannot invoke method: the invocation thread has been collected error.cannot.invoke.method.in.collected.thread=Cannot invoke method: the invocation thread has been collected
title.smart.step.popup=Method to Step Into title.smart.step.popup=Method to Step Into
action.show.watches.description=Shows or hides 'watches' pane action.show.watches.description=Shows or hides 'watches' pane