WEB-11110 Wrong error message "Built-in HTTP Server on custom port disabled"

This commit is contained in:
Vladimir Krivosheev
2017-10-13 12:12:19 +02:00
parent b5918912db
commit 358e6b4c2e
3 changed files with 7 additions and 2 deletions
@@ -17,6 +17,11 @@ class BuiltInServerConfigurableUi implements ConfigurableUi<BuiltInServerOptions
public BuiltInServerConfigurableUi() {
portLabel.setLabelFor(builtInServerPort);
builtInServerPort.setMin(1024);
builtInServerPort.addChangeListener(e -> {
boolean isEnabled = builtInServerPort.getNumber() != BuiltInServerOptions.DEFAULT_PORT;
builtInServerAvailableExternallyCheckBox.setEnabled(isEnabled);
builtInServerAvailableExternallyCheckBox.setToolTipText(isEnabled ? null : "Can’t be enabled for default port. Please change it.");
});
}
@Override
@@ -29,7 +29,7 @@ import java.util.Collections;
storages = @Storage("other.xml")
)
public class BuiltInServerOptions implements PersistentStateComponent<BuiltInServerOptions>, Getter<BuiltInServerOptions> {
private static final int DEFAULT_PORT = 63342;
public static final int DEFAULT_PORT = 63342;
@Attribute
public int builtInServerPort = DEFAULT_PORT;
@@ -74,7 +74,7 @@ public class BuiltInServerManagerImpl extends BuiltInServerManager implements Ap
private static int getDefaultPort() {
if (System.getProperty(PROPERTY_RPC_PORT) == null) {
// Default port will be occupied by main idea instance - define the custom default to avoid searching of free port
return ApplicationManager.getApplication().isUnitTestMode() ? 64463 : 63342;
return ApplicationManager.getApplication().isUnitTestMode() ? 64463 : BuiltInServerOptions.DEFAULT_PORT;
}
else {
return Integer.parseInt(System.getProperty(PROPERTY_RPC_PORT));