/**
  * Sets the visibility of the ascii text.
  *
  * @param visible the visibility of the ascii text
  * @see #getAsciiVisible()
  */
 public void setAsciiVisible(boolean visible) {
   ((GridData) asciiText.getLayoutData()).exclude = !visible;
   asciiText.setVisible(visible);
   ((GridLayout) composite.getLayout()).makeColumnsEqualWidth =
       visible && brailleText.getVisible();
   composite.layout();
 }
 public void open() {
   commandLineText.setVisible(true);
   commandLineText.getParent().redraw();
   // The expected size of the command line is only known when the parent is drawn, paint async
   Display.getCurrent()
       .asyncExec(
           new Runnable() {
             @Override
             public void run() {
               updateUISize();
               commandLineText.setFocus();
             }
           });
 }
  @Override
  public void close() {
    commandLineText.setVisible(false);
    commandLineText.setEditable(true);
    registerModeSelection = null;
    prompt = "";
    contentsOffset = 0;
    resetContents("");
    commandLineText.setWordWrap(true);

    readOnly = false;

    copyItem.setEnabled(false);
    cutItem.setEnabled(false);
    pasteItem.setEnabled(true);
  }
示例#4
0
  public CommandLineUIFactory(StyledText parentText) {
    parent = parentText;

    StyledText widget = new StyledText(parent, SWT.ON_TOP);
    widget.setFont(parent.getFont());
    widget.setMargins(COMMAND_CHAR_INDENT, 3, 3, 3);
    widget.setSize(5, 5);
    widget.setBackground(parent.getBackground());
    widget.setForeground(parent.getForeground());
    widget.setWordWrap(true);
    widget.setEnabled(true);
    //        widget.setCaretOffset(2);
    widget.moveAbove(parent);
    widget.setVisible(false);
    widget.addPaintListener(new BorderPaintListener());
    commandLineText = widget;

    parent.addPaintListener(new TextEditorPaintListener());
    parent.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            if (commandLineUI != null && commandLineUI.isOpen()) {
              commandLineText.forceFocus();
            }
          }
        });
    parent.addDisposeListener(
        new DisposeListener() {
          @Override
          public void widgetDisposed(DisposeEvent e) {
            commandLineText.dispose();
            if (commandLineUI != null) {
              commandLineUI.dispose();
            }
          }
        });
  }