Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JBIDE-15967] app wiz: trigger envvar button visibility on domain change #299

Merged
merged 1 commit into from Nov 14, 2013
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -598,13 +598,18 @@ private void createAdvancedGroup(Composite parent, DataBindingContext dbc) {
.align(SWT.FILL, SWT.CENTER).grab(true, true).span(2, 1).applyTo(sourceCodeExplanationText);

// environment variables
if (pageModel.isEnvironmentVariablesSupported()) {
Button environmentVariablesButton = new Button(advancedComposite, SWT.NONE);
environmentVariablesButton.setText("Environment Variables... ");
GridDataFactory.fillDefaults()
.align(SWT.BEGINNING, SWT.CENTER).applyTo(environmentVariablesButton);
environmentVariablesButton.addSelectionListener(onBrowseEnvironmentVariables(dbc));
}
Button environmentVariablesButton = new Button(advancedComposite, SWT.NONE);
environmentVariablesButton.setText("Environment Variables... ");
GridDataFactory.fillDefaults()
.align(SWT.BEGINNING, SWT.CENTER).applyTo(environmentVariablesButton);
environmentVariablesButton.addSelectionListener(onBrowseEnvironmentVariables(dbc));
ValueBindingBuilder
.bind(WidgetProperties.visible().observe(environmentVariablesButton))
.notUpdatingParticipant()
.to(BeanProperties.value(
ApplicationConfigurationWizardPageModel.PROPERTY_ENVIRONMENT_VARIABLES_SUPPORTED)
.observe(pageModel))
.in(dbc);
}

protected SelectionListener onManageDomains() {
Expand Down
Expand Up @@ -57,7 +57,8 @@ public class ApplicationConfigurationWizardPageModel extends ObservableUIPojo im
public static final String PROPERTY_GEAR_PROFILES = "gearProfiles";
public static final String PROPERTY_DEFAULT_SOURCECODE = "defaultSourcecode";
public static final String PROPERTY_INITIAL_GITURL = "initialGitUrl";
public static final String PROPERTY_ENVIRONMENT_VARIABLES = "EnvironmentVariables";
public static final String PROPERTY_ENVIRONMENT_VARIABLES = "environmentVariables";
public static final String PROPERTY_ENVIRONMENT_VARIABLES_SUPPORTED = "environmentVariablesSupported";

private final OpenShiftApplicationWizardModel wizardModel;

Expand Down Expand Up @@ -493,6 +494,7 @@ public IDomain getDomain() throws OpenShiftException {

public void setDomain(IDomain domain) throws OpenShiftException {
firePropertyChange(PROPERTY_DOMAIN, wizardModel.getDomain(), wizardModel.setDomain(domain));
setEnvironmentVariablesSupported(isEnvironmentVariablesSupported());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wont this mean a remote call is done everytime this method is called which happens during typing/updating ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

public List<IDomain> getDomains() throws OpenShiftException {
Expand Down Expand Up @@ -550,8 +552,12 @@ public void setEnvironmentVariables(Map<String, String> environmentVariables) {

}

public void setEnvironmentVariablesSupported(boolean supported) {
firePropertyChange(PROPERTY_ENVIRONMENT_VARIABLES_SUPPORTED, null, isEnvironmentVariablesSupported());
}

public boolean isEnvironmentVariablesSupported() {
return wizardModel.getDomain() != null
&& wizardModel.getDomain().canCreateApplicationWithEnvironmentVariables();
return getDomain() != null
&& getDomain().canCreateApplicationWithEnvironmentVariables();
}
}