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

Fix possible NPE if ProductInfoDataProvider not provide logo #4703

Merged
merged 1 commit into from
Apr 4, 2017
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
Expand Up @@ -49,11 +49,13 @@
import org.eclipse.che.ide.util.dom.Elements;
import org.eclipse.che.ide.util.input.KeyMapUtil;
import org.vectomatic.dom.svg.ui.SVGImage;
import org.vectomatic.dom.svg.ui.SVGResource;

import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;

import static java.util.Objects.nonNull;
import static org.eclipse.che.ide.api.resources.Resource.PROJECT;

/**
Expand Down Expand Up @@ -98,7 +100,10 @@ public EmptyEditorsPanel(ActionManager actionManager,


eventBus.addHandler(ResourceChangedEvent.getType(), this);
logo.appendChild(new SVGImage(productInfoDataProvider.getLogo()).getSvgElement().getElement());
final SVGResource logo = productInfoDataProvider.getLogo();
if (nonNull(logo)) {
this.logo.appendChild(new SVGImage(logo).getSvgElement().getElement());
}
//Sometimes initialization of Create/Import Project actions are completed after the Empty editor page is rendered.
//In this case we need to wait when actions will be initialized.
Timer hoverToRenderTimer = new Timer() {
Expand Down
4 changes: 4 additions & 0 deletions plugins/plugin-help/che-plugin-help-ext-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<packaging>jar</packaging>
<name>Che Plugin :: Help :: Client</name>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.eclipse.che.ide.api.action.Action;
import org.eclipse.che.ide.api.action.ActionEvent;

import static com.google.common.base.Strings.isNullOrEmpty;

/**
* Redirect to support window
*
Expand All @@ -40,4 +42,9 @@ public RedirectToSupportAction(HelpExtensionLocalizationConstant locale,
public void actionPerformed(ActionEvent e) {
Window.open(productInfoDataProvider.getSupportLink(), "_blank", null);
}

@Override
public void update(ActionEvent event) {
event.getPresentation().setVisible(!isNullOrEmpty(productInfoDataProvider.getSupportLink()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.eclipse.che.ide.ext.help.client.HelpExtensionLocalizationConstant;
import org.eclipse.che.ide.ui.window.Window;
import org.vectomatic.dom.svg.ui.SVGImage;
import org.vectomatic.dom.svg.ui.SVGResource;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
Expand All @@ -26,6 +28,10 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;

import java.util.Objects;

import static java.util.Objects.nonNull;

/**
* UI for {@link AboutView}.
*
Expand Down Expand Up @@ -74,7 +80,10 @@ public void onClick(ClickEvent event) {
});
addButtonToFooter(btnOk);

logoPanel.add(new SVGImage(productInfoDataProvider.getLogo()));
final SVGResource logo = productInfoDataProvider.getLogo();
if (nonNull(logo)) {
logoPanel.add(new SVGImage(logo));
}
}

/** {@inheritDoc} */
Expand Down