Skip to content

Commit

Permalink
Fix possible NPE if ProductInfoDataProvider not provide logo (eclipse…
Browse files Browse the repository at this point in the history
…-che#4703)

Signed-off-by: Vitalii Parfonov <[email protected]>
  • Loading branch information
Vitalii Parfonov authored Apr 4, 2017
1 parent 5d3c618 commit 3aaa9f5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
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

0 comments on commit 3aaa9f5

Please sign in to comment.