Commit fc09781a authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Changed Ttcn3HoverInfoControl's toolbar to use text button instead of small icons


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 251dc847
......@@ -17,14 +17,13 @@ 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.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI;
/**
......@@ -82,32 +81,30 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
viewer.setEditable(false);
viewer.setBackground(fShell.getBackground());
if (isRich) {
IAction infoAction = new Action("", IAction.AS_PUSH_BUTTON) {
IAction switchAction = new Action("", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
actualType = HoverContentType.INFO;
switch (actualType) {
case INFO:
actualType = HoverContentType.SOURCE;
break;
case SOURCE:
actualType = HoverContentType.INFO;
break;
}
setText(getButtonText());
HoverContentType.storeAsProperty(actualType);
setHoverContentToActual();
setSize(computeSizeHint());
toolbar.update(true);
}
};
IAction sourceAction = new Action("", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
actualType = HoverContentType.SOURCE;
HoverContentType.storeAsProperty(actualType);
setHoverContentToActual();
setSize(computeSizeHint());
}
};
infoAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
infoAction.setToolTipText("Switch to info view");
sourceAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
sourceAction.setToolTipText("Switch to source view");
ToolBar tb = toolbar.createControl(parent);
tb.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND));
toolbar.add(infoAction);
toolbar.add(sourceAction);
//setBackgroundColor(display.getSystemColor(SWT.COLOR_YELLOW));
tb.setForeground(fShell.getDisplay().getSystemColor(SWT.COLOR_LINK_FOREGROUND));
switchAction.setText(getButtonText());
toolbar.add(switchAction);
toolbar.update(true);
} else {
setStatusText("Hover to focus");
......@@ -170,4 +167,8 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
public void setSize(Point size) {
setSize(size.x, size.y);
}
private String getButtonText() {
return "Click to switch to " + (actualType == HoverContentType.INFO ? "source" : "info") + " view";
}
}
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