Hook model state change to has main method live expression

This commit is contained in:
BoykoAlex
2021-06-17 17:28:37 -04:00
parent 42b7b89fbf
commit 8a8480539a
2 changed files with 12 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2020 Pivotal, Inc.
* Copyright (c) 2015, 2021 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -100,7 +100,7 @@ public class BootProjectDashElement extends AbstractLaunchConfigurationsDashElem
this.childFactory = childFactory;
hasMainMethod.refresh();
addElementState(hasMainMethod);
addModelState(hasMainMethod);
addDisposableChild(hasMainMethod);
// if (DEBUG) {
// onDispose((e) -> {

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2017 Pivotal, Inc.
* Copyright (c) 2015, 2021 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -251,6 +251,15 @@ public abstract class WrappingBootDashElement<T> extends AbstractDisposable impl
state.addListener(elementStateNotifier);
}
/**
* Ensure that model state notifications are fired when a given liveExp's value changes.
*/
protected void addModelState(LiveExpression<?> state) {
state.onChange((e,v) -> {
getBootDashModel().notifyModelStateChanged();
});
}
@Override
public String getUrl() {
return Utils.createUrl(getLiveHost(), getLivePort(), getDefaultRequestMappingPath());