diff options
author | Lucas Bullen | 2017-12-01 16:05:29 +0000 |
---|---|---|
committer | Lucas Bullen | 2017-12-01 16:52:09 +0000 |
commit | 45c76cacad2d0e3839304f2a16330b02d965c3b1 (patch) | |
tree | 0f3be5461656fe1f9910a2199d002e76d4fa4dd3 | |
parent | 1ee194e213ba0ebcad498da3abbd8f4677bd8f47 (diff) | |
download | eclipse.platform.text-45c76cacad2d0e3839304f2a16330b02d965c3b1.tar.gz eclipse.platform.text-45c76cacad2d0e3839304f2a16330b02d965c3b1.tar.xz eclipse.platform.text-45c76cacad2d0e3839304f2a16330b02d965c3b1.zip |
Bug 527071 - [generic editor] Hover in .project editor does not workI20171204-0530I20171203-2000I20171203-0800I20171202-1500I20171202-0800I20171201-2000
Nature Label Hover was returning an empty string instead of null
Change-Id: Ic64575e8e0230a2b617f1fb8178627251063cd30
Signed-off-by: Lucas Bullen <lbullen@redhat.com>
2 files changed, 11 insertions, 6 deletions
diff --git a/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NatureLabelHoverProvider.java b/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NatureLabelHoverProvider.java index e6fd01b94d2..f8af6da84da 100644 --- a/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NatureLabelHoverProvider.java +++ b/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NatureLabelHoverProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Red Hat Inc. and others + * Copyright (c) 2016, 2017 Red Hat Inc. and others * 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 @@ -7,6 +7,7 @@ * * Contributors: * Mickael Istria, Sopot Cela (Red Hat Inc.) + * Lucas Bullen (Red Hat Inc.) - [Bug 527071] Hover breaks with missing nature *******************************************************************************/ package org.eclipse.ui.genericeditor.examples.dotproject; @@ -39,7 +40,7 @@ public class NatureLabelHoverProvider implements ITextHover { if (natureDescriptors[i].getNatureId().equals(selection)) return natureDescriptors[i].getLabel(); } - return ""; + return null; } @Override diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/CompositeInformationControl.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/CompositeInformationControl.java index a63088f2fb4..86d0f62a248 100644 --- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/CompositeInformationControl.java +++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/hover/CompositeInformationControl.java @@ -7,6 +7,7 @@ * * Contributors: * - Mickael Istria (Red Hat Inc.) + * - Lucas Bullen (Red Hat Inc.) - [Bug 527071] Empty string as content breaks hover *******************************************************************************/ package org.eclipse.ui.internal.genericeditor.hover; @@ -70,8 +71,11 @@ public class CompositeInformationControl extends AbstractInformationControl impl if (informationControl != null) { if (informationControl instanceof IInformationControlExtension2) { ((IInformationControlExtension2)informationControl).setInput(entry.getValue()); - } else { - informationControl.setInformation(entry.getValue().toString()); + continue; + } + String information = entry.getValue().toString(); + if(!information.isEmpty()){ + informationControl.setInformation(information); } } } @@ -107,14 +111,14 @@ public class CompositeInformationControl extends AbstractInformationControl impl } } } - + @Override public void dispose() { controls.values().forEach(IInformationControl::dispose); controls.clear(); super.dispose(); } - + @Override public IInformationControlCreator getInformationPresenterControlCreator() { if (controls.isEmpty()) { |