Commit 0fb5f39c authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Added rich information control mode for Ttcn3HoverInfoControl


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent d5330a36
......@@ -8,11 +8,15 @@
package org.eclipse.titan.designer.editors.controls;
import org.eclipse.jface.text.AbstractInformationControl;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IInformationControlExtension2;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.editors.text.EditorsUI;
/**
* Control for handling ttcn3 source editor hovers
......@@ -24,9 +28,15 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
private StyledText viewer;
private Ttcn3HoverContent content;
private Shell fShell;
private boolean isRich;
public Ttcn3HoverInfoControl(Shell parentShell, String string) {
this(parentShell, string, false);
}
public Ttcn3HoverInfoControl(Shell parentShell, String string, boolean isRich) {
super(parentShell, string);
this.isRich = isRich;
createContent(parentShell);
create();
}
......@@ -52,10 +62,24 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
@Override
protected void createContent(Composite parent) {
fShell = parent.getShell();
viewer = new StyledText(parent, 0);
viewer = new StyledText(parent, isRich ? (SWT.H_SCROLL | SWT.V_SCROLL) : 0);
viewer.setEditable(false);
viewer.setBackground(fShell.getBackground());
setStatusText("Hover or press F2 to focus");
if (isRich) {
setStatusText("Press Ctrl+F2 for code view mode");
} else {
setStatusText("Hover to focus");
}
}
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
return new IInformationControlCreator() {
@Override
public IInformationControl createInformationControl(Shell parent) {
return new Ttcn3HoverInfoControl(parent, EditorsUI.getTooltipAffordanceString(), true);
}
};
}
@Override
......
......@@ -151,7 +151,7 @@ public final class TextHover extends BaseTextHover implements ITextHoverExtensio
}
/**
* Legacy inteface method implemented for completeness
* Legacy interface method implemented for completeness
*
* getHoverInfo2 is used instead
*/
......@@ -359,7 +359,7 @@ public final class TextHover extends BaseTextHover implements ITextHoverExtensio
}
sb.append(memberTypeName + " ");
addStyledText(sb, styles, def.getIdentifier().getDisplayName(), boldItalicRange());
sb.append(memberText != null ? memberText : "");
sb.append(" " + memberText != null ? memberText : "");
sb.append("\n");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment