Skip to content

Commit

Permalink
#5695 avoid leaking of double click handler (#6168)
Browse files Browse the repository at this point in the history
Signed-off-by: Yevhen Vydolob <evidolob@codenvy.com>
  • Loading branch information
evidolob authored Sep 7, 2017
1 parent 9160081 commit 3cdf3b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
Expand Down Expand Up @@ -54,6 +55,15 @@ public class NavigateToFileViewImpl extends PopupPanel implements NavigateToFile

interface NavigateToFileViewImplUiBinder extends UiBinder<Widget, NavigateToFileViewImpl> {}

interface Styles extends CssResource {

String labelMargin();

String suggestionsPanel();

String noborder();
}

@UiField TextBox fileName;

@UiField(provided = true)
Expand All @@ -69,7 +79,9 @@ interface NavigateToFileViewImplUiBinder extends UiBinder<Widget, NavigateToFile

@UiField FlowPanel suggestionsPanel;

@UiField HTML suggestionsContainer;
private HTML suggestionsContainer;

@UiField Styles style;

private HandlerRegistration resizeHandler;

Expand Down Expand Up @@ -167,7 +179,7 @@ public Element createElement() {

@Override
public void hidePopup() {
suggestionsContainer.getElement().setInnerHTML("");
suggestionsContainer.removeFromParent();
suggestionsPanel.setVisible(false);

suggestionsPanel.getElement().getStyle().setWidth(400, Style.Unit.PX);
Expand All @@ -186,6 +198,7 @@ public void showItems(List<SearchResultDto> items) {
// Hide popup if it is nothing to show
if (items.isEmpty()) {
suggestionsContainer.getElement().setInnerHTML("");
suggestionsContainer.removeFromParent();
suggestionsPanel.setVisible(false);

suggestionsPanel.getElement().getStyle().setWidth(400, Style.Unit.PX);
Expand All @@ -196,7 +209,9 @@ public void showItems(List<SearchResultDto> items) {

// Show popup
suggestionsPanel.setVisible(true);
suggestionsContainer.getElement().setInnerHTML("");
suggestionsContainer = new HTML();
suggestionsContainer.addStyleName(style.noborder());
suggestionsPanel.add(suggestionsContainer);

// Create and show list of items
final TableElement itemHolder = Elements.createTableElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ui:with field='res' type='org.eclipse.che.ide.Resources'/>
<ui:with field='locale' type='org.eclipse.che.ide.CoreLocalizationConstant'/>

<ui:style>
<ui:style type='org.eclipse.che.ide.navigation.NavigateToFileViewImpl.Styles'>
.labelMargin {
margin: 5px 0;
}
Expand Down Expand Up @@ -71,9 +71,7 @@
<g:TextBox ui:field="fileName" width="387px" height="18px" />
<g:Label width="100%" addStyleNames="{style.labelMargin} {res.coreCss.greyFontColor}" text="{locale.navigateToFileViewFileFieldPrompt}"/>

<g:FlowPanel ui:field="suggestionsPanel" styleName="{style.suggestionsPanel}" visible="false">
<g:HTML ui:field="suggestionsContainer" styleName="{style.noborder}"></g:HTML>
</g:FlowPanel>
<g:FlowPanel ui:field="suggestionsPanel" styleName="{style.suggestionsPanel}" visible="false" />
</g:FlowPanel>
</g:center>
</g:DockLayoutPanel>
Expand Down

0 comments on commit 3cdf3b6

Please sign in to comment.