Ejemplo n.º 1
0
    @Override
    protected Control createDialogArea(Composite dialogArea) {
      dialogArea = (Composite) super.createDialogArea(dialogArea);

      LayoutUtil.addGDDummy(dialogArea);
      final Composite inputComposite = new Composite(dialogArea, SWT.NONE);
      inputComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
      inputComposite.setLayout(LayoutUtil.applyCompositeDefaults(new GridLayout(), 2));

      fLocationGroup =
          new ResourceInputComposite(
              inputComposite,
              ResourceInputComposite.STYLE_COMBO,
              fMode,
              Messages.Util_SelectFile_File_label);
      fLocationGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
      fLocationGroup.setHistory(getDialogSettings().getArray(fHistoryId));

      LayoutUtil.addSmallFiller(dialogArea, true);

      final ToolInfoGroup info = new ToolInfoGroup(dialogArea, fTool);
      info.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

      final DatabindingSupport databinding = new DatabindingSupport(dialogArea);
      addBindings(databinding);
      databinding.installStatusListener(new TitleAreaStatusUpdater(this));

      return dialogArea;
    }
Ejemplo n.º 2
0
  protected void showReload() {
    if (this.reloadControl == null) {
      this.reloadControl = new Composite(this, SWT.NONE);
      this.reloadControl.setLayout(LayoutUtil.createCompositeGrid(4));

      final Label label = new Label(this.reloadControl, SWT.WRAP);
      label.setText("The structure of the R element is changed (columns / data type).");
      label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 4, 1));

      {
        final Button button = new Button(this.reloadControl, SWT.PUSH);
        button.setLayoutData(
            LayoutUtil.hintWidth(new GridData(SWT.FILL, SWT.CENTER, false, false), button));
        button.setText("Refresh");
        button.setToolTipText("Refresh table with old structure");
        button.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(final SelectionEvent e) {
                refresh();
              }
            });
      }
      {
        final Button button = new Button(this.reloadControl, SWT.PUSH);
        button.setLayoutData(
            LayoutUtil.hintWidth(new GridData(SWT.FILL, SWT.CENTER, false, false), button));
        button.setText("Reopen");
        button.setToolTipText("Reopen table with new structure");
        button.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(final SelectionEvent e) {
                setInput(RDataTableComposite.this.input);
              }
            });
      }
      if (this.callbacks.isCloseSupported()) {
        final Button button = new Button(this.reloadControl, SWT.PUSH);
        button.setLayoutData(
            LayoutUtil.hintWidth(new GridData(SWT.FILL, SWT.CENTER, false, false), button));
        button.setText("Close");
        button.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(final SelectionEvent e) {
                RDataTableComposite.this.callbacks.close();
              }
            });
      }
      //
      LayoutUtil.addSmallFiller(this.reloadControl, true);
    }
    this.layout.topControl = this.reloadControl;
    layout(true);
  }
Ejemplo n.º 3
0
    @Override
    public void createControl(final Composite parent) {
      final Composite composite = new Composite(parent, SWT.NONE);
      composite.setLayout(LayoutUtil.applyDialogDefaults(new GridLayout(), 2));
      setControl(composite);

      final int count = getRefactoring().getAllOccurrencesCount();

      {
        final Label label = new Label(composite, SWT.NONE);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
        label.setText(Messages.ExtractTemp_Wizard_header);
        label.setFont(JFaceResources.getBannerFont());
      }

      LayoutUtil.addSmallFiller(composite, false);

      {
        final Label label = new Label(composite, SWT.NONE);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
        label.setText(Messages.ExtractTemp_Wizard_VariableName_label);

        fVariableNameControl = new Text(composite, SWT.BORDER);
        fVariableNameControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
        fVariableNameControl.setFont(JFaceResources.getTextFont());
      }

      LayoutUtil.addSmallFiller(composite, false);

      {
        if (count > 0) {
          final Label label = new Label(composite, SWT.WRAP);
          label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
          if (count == 1) {
            label.setText("No other occurrences of the selected expression found.");
          } else {
            label.setText(
                NLS.bind("{0} other occurrences of the selected expression found.", count - 1));
          }
        }

        fReplaceAllControl = new Button(composite, SWT.CHECK);
        fReplaceAllControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
        fReplaceAllControl.setText(Messages.ExtractTemp_Wizard_ReplaceAll_label);
        if (count <= 1) {
          fReplaceAllControl.setEnabled(false);
        }
      }

      LayoutUtil.addSmallFiller(composite, false);
      Dialog.applyDialogFont(composite);

      initBindings();
      //			PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),);
    }
Ejemplo n.º 4
0
  @Override
  public Point computeSizeConstraints(final int widthInChars, final int heightInChars) {
    final int titleWidth =
        LayoutUtil.hintWidth(this.titleText, JFaceResources.DIALOG_FONT, widthInChars);
    final int titleHeight = this.titleText.getLineHeight();
    final int infoWidth = LayoutUtil.hintWidth(this.infoText, PREF_DETAIL_PANE_FONT, widthInChars);
    final int infoHeight = this.infoText.getLineHeight() * (heightInChars);

    return new Point(
        Math.max(titleWidth, infoWidth), titleHeight + LayoutUtil.defaultVSpacing() + infoHeight);
  }
Ejemplo n.º 5
0
  @Override
  public Point computeSizeHint() {
    updateInput();
    final Point sizeConstraints = getSizeConstraints();
    final Rectangle trim = computeTrim();

    //		int charWidth= 20;
    //		if (fInput.detailInfo != null) {
    //			final int count= Math.min(6, fInfoText.getLineCount());
    //			for (int i= 0; i < count; i++) {
    //				charWidth= Math.max(charWidth, fInfoText.getLine(i).length());
    //			}
    //		}
    int widthHint =
        this.infoText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x + LayoutUtil.defaultHSpacing();
    final int widthMax2 = LayoutUtil.hintWidth(this.infoText, PREF_DETAIL_PANE_FONT, 80);
    final int widthMax =
        ((sizeConstraints != null && sizeConstraints.x != SWT.DEFAULT)
                ? sizeConstraints.x
                : widthMax2)
            - trim.width;
    this.layoutHint = true;
    final int titleHint =
        LayoutUtil.defaultHMargin()
            + this.titleImage.getSize().x
            + LayoutUtil.defaultHSpacing()
            + this.titleText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    this.layoutHint = false;
    if (titleHint > widthHint && widthMax2 > widthHint) {
      widthHint = Math.min(widthMax2, titleHint);
    }
    if (widthMax < widthHint) {
      widthHint = widthMax;
    }
    // avoid change of wrapping caused by scrollbar
    if (widthHint < titleHint
        && widthHint + this.infoText.computeTrim(0, 0, 0, 0).width >= titleHint) {
      widthHint = titleHint;
    }

    final int heightMax =
        ((sizeConstraints != null && sizeConstraints.y != SWT.DEFAULT)
                ? sizeConstraints.y
                : this.infoText.getLineHeight() * 12)
            - trim.height;

    final Point size = this.contentComposite.computeSize(widthHint, SWT.DEFAULT, true);
    size.y += LayoutUtil.defaultVSpacing();
    size.x = Math.max(Math.min(size.x, widthMax), 200) + trim.width;
    size.y = Math.max(Math.min(size.y, heightMax), 100) + trim.height;
    return size;
  }
Ejemplo n.º 6
0
  private Composite createAppearance(final Composite pageComposite) {
    final Group group = new Group(pageComposite, SWT.NONE);
    group.setText("Output" + ':');
    group.setLayout(LayoutUtil.applyGroupDefaults(new GridLayout(), 2));

    {
      final Label label = new Label(group, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      label.setText("Size (characters):");
      final Text text = new Text(group, SWT.BORDER | SWT.RIGHT);
      final GridData gd = new GridData(SWT.LEFT, SWT.CENTER, true, false);
      gd.widthHint = LayoutUtil.hintWidth(text, 12);
      text.setLayoutData(gd);
      text.setTextLimit(20);
      fCharLimitControl = text;
    }
    {
      final Label label = new Label(group, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      label.setText("Prompt/Info:");
      final ColorSelector selector = new ColorSelector(group);
      selector.getButton().setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
      fColorInfoControl = selector;
    }
    {
      final Label label = new Label(group, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      label.setText("Input:");
      final ColorSelector selector = new ColorSelector(group);
      selector.getButton().setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
      fColorInputControl = selector;
    }
    {
      final Label label = new Label(group, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      label.setText("Output:");
      final ColorSelector selector = new ColorSelector(group);
      selector.getButton().setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
      fColorOutputControl = selector;
    }
    {
      final Label label = new Label(group, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      label.setText("Error:");
      final ColorSelector selector = new ColorSelector(group);
      selector.getButton().setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
      fColorErrorControl = selector;
    }

    return group;
  }
Ejemplo n.º 7
0
  @Override
  public Point computeSizeConstraints(final int widthInChars, final int heightInChars) {
    final GC gc = new GC(fContentComposite);
    gc.setFont(JFaceResources.getDialogFont());
    final int titleWidth = gc.getFontMetrics().getAverageCharWidth() * widthInChars;
    final int titleHeight = fTitleText.getLineHeight();
    gc.dispose();

    final int infoWidth = LayoutUtil.hintWidth(fInfoText, PREF_DETAIL_PANE_FONT, widthInChars);
    final int infoHeight = fInfoText.getLineHeight() * (heightInChars);

    return new Point(
        Math.max(titleWidth, infoWidth), titleHeight + LayoutUtil.defaultVSpacing() + infoHeight);
  }
Ejemplo n.º 8
0
  @Override
  protected void createBlockArea(final Composite pageComposite) {
    final Map<Preference<?>, String> prefs = new HashMap<>();

    prefs.put(TaskTagsPreferences.PREF_TAGS, TaskTagsPreferences.GROUP_ID);
    prefs.put(TaskTagsPreferences.PREF_PRIORITIES, TaskTagsPreferences.GROUP_ID);

    setupPreferenceManager(prefs);

    createImages();

    { // Table area
      final Composite composite = new Composite(pageComposite, SWT.NONE);
      composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
      composite.setLayout(LayoutUtil.createCompositeGrid(2));

      final Composite table = createTable(composite);
      table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

      this.listButtons =
          new ButtonGroup<TaskTag>(composite) {
            @Override
            protected TaskTag edit1(
                final TaskTag item, final boolean newItem, final Object parent) {
              final TaskTagsInputDialog dialog =
                  new TaskTagsInputDialog(
                      getShell(), item, newItem, TaskTagsConfigurationBlock.this.list);
              if (dialog.open() == Dialog.OK) {
                return dialog.getResult();
              }
              return null;
            }

            @Override
            public void updateState() {
              super.updateState();
              saveTaskTags();
            }
          };
      this.listButtons.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true));
      this.listButtons.addAddButton(null);
      this.listButtons.addCopyButton(null);
      this.listButtons.addEditButton(null);
      this.listButtons.addDeleteButton(null);
      this.listButtons.addSeparator();
      this.listButtons.addDefaultButton(null);

      this.listButtons.connectTo(this.listViewer, this.list, this.defaultValue);
      this.listViewer.setInput(this.list);
    }

    updateControls();
  }
Ejemplo n.º 9
0
  @Override
  protected Control createDialogArea(final Composite parent) {
    final Composite area = new Composite(parent, SWT.NONE);
    area.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
    area.setLayout(LayoutUtil.applyDialogDefaults(new GridLayout(), 1));

    final Composite checkboxComposite = createCheckboxComposite(area, "&R projects:");
    checkboxComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    applyDialogFont(area);

    return area;
  }
Ejemplo n.º 10
0
    @Override
    public void createControl(final Composite parent) {
      initializeDialogUnits(parent);

      final Composite composite = new Composite(parent, SWT.NONE);
      composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
      composite.setLayout(LayoutUtil.createContentGrid(1));

      final IRLibPaths rLibPaths = fRPkgManager.getRLibPaths();
      {
        final Group group = new Group(composite, SWT.NONE);
        group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        group.setText("Target Library:");
        group.setLayout(LayoutUtil.createGroupGrid(1));

        fSelectTargetControl = new RLibrarySelectionComposite(group);
        fSelectTargetControl.setLayoutData(fSelectTargetControl.createGD());
        fSelectTargetControl.getValidator().setRequired(IRLibPaths.WRITABLE);
        fSelectTargetControl.setInput(rLibPaths);

        if (fMode == MODE_UPDATE) {
          fSameTargetControl = new Button(group, SWT.CHECK);
          fSameTargetControl.setText(
              "Install updates to the library of the installed package, if possible.");
          fSameTargetControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        }
      }

      Dialog.applyDialogFont(composite);
      setControl(composite);

      final DataBindingSupport databinding = new DataBindingSupport(composite);
      addBindings(databinding);

      fTargetLibraryValue.setValue(RPkgUtil.getDefaultInstallLocation(rLibPaths));
      WizardPageSupport.create(this, databinding.getContext());
    }
Ejemplo n.º 11
0
  private Composite createInputOptions(final Composite pageComposite) {
    final Group group = new Group(pageComposite, SWT.NONE);
    group.setText("Input" + ':');
    group.setLayout(LayoutUtil.applyGroupDefaults(new GridLayout(), 1));

    {
      final Label label = new Label(group, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
      label.setText("Include in history navigation (up/down):");

      fSubmitTypeControl = new SubmitTypeSelectionComposite(group);
      fSubmitTypeControl.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true));
    }

    return group;
  }
Ejemplo n.º 12
0
  @Override
  protected void createContent(final Composite parent) {
    fContentComposite =
        new Composite(parent, SWT.NONE) {
          @Override
          public Point computeSize(final int width, final int height, final boolean changed) {
            return super.computeSize(width, height, changed || width != getSize().x);
          }
        };
    fContentComposite.setBackgroundMode(SWT.INHERIT_FORCE);

    final GridLayout gridLayout = LayoutUtil.applyCompositeDefaults(new GridLayout(), 2);
    gridLayout.horizontalSpacing = (int) ((gridLayout.horizontalSpacing) / 1.5);
    fContentComposite.setLayout(gridLayout);

    final int vIndent = Math.max(1, LayoutUtil.defaultVSpacing() / 4);
    final int hIndent = Math.max(2, LayoutUtil.defaultHSpacing() / 3);

    { // Title image
      fTitleImage = new Label(fContentComposite, SWT.NULL);
      final Image image = SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID);
      fTitleImage.setImage(image);

      final GridData textGd = new GridData(SWT.FILL, SWT.TOP, false, false);
      fTitleText =
          new StyledText(fContentComposite, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP) {
            @Override
            public Point computeSize(int width, final int height, final boolean changed) {
              if (!fLayoutHint && width <= 0 && fContentComposite.getSize().x > 0) {
                width =
                    fContentComposite.getSize().x
                        - LayoutUtil.defaultHMargin()
                        - fTitleImage.getSize().x
                        - LayoutUtil.defaultHSpacing()
                        - 10;
              }

              final Point size = super.computeSize(width, -1, true);
              //					if (width >= 0) {
              //						size.x = Math.min(size.x, width);
              //					}
              return size;
            }
          };

      fTitleText.setFont(JFaceResources.getDialogFont());
      final GC gc = new GC(fTitleText);
      final FontMetrics fontMetrics = gc.getFontMetrics();
      final GridData imageGd = new GridData(SWT.FILL, SWT.TOP, false, false);
      imageGd.horizontalIndent = hIndent;
      final int textHeight = fontMetrics.getAscent() + fontMetrics.getLeading();
      final int imageHeight = image.getBounds().height;
      final int shift = Math.max(3, (int) ((fontMetrics.getDescent()) / 1.5));
      if (textHeight + shift < imageHeight) {
        imageGd.verticalIndent = vIndent + shift;
        textGd.verticalIndent = vIndent + (imageHeight - textHeight);
      } else {
        imageGd.verticalIndent = vIndent + (textHeight - imageHeight) + shift;
        textGd.verticalIndent = vIndent;
      }
      fTitleImage.setLayoutData(imageGd);
      fTitleText.setLayoutData(textGd);
      fLayoutWorkaround = true;

      gc.dispose();
    }

    fInfoText =
        new StyledText(
            fContentComposite,
            fMode == MODE_FOCUS
                ? (SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL)
                : (SWT.MULTI | SWT.READ_ONLY));
    fInfoText.setIndent(hIndent);
    fInfoText.setFont(JFaceResources.getFont(PREF_DETAIL_PANE_FONT));

    final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    //		gd.widthHint = LayoutUtil.hintWidth(fInfoText, INFO_FONT, 50);
    fInfoText.setLayoutData(gd);

    setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));

    updateInput();
  }
Ejemplo n.º 13
0
  @Override
  protected Control createDialogArea(final Composite parent) {
    final Composite area = new Composite(parent, SWT.NONE);
    final Layouter layouter =
        new Layouter(area, LayoutUtil.applyDialogDefaults(new GridLayout(), 2));
    area.setLayoutData(new GridData(GridData.FILL_BOTH));

    this.keywordControl = layouter.addLabeledTextControl(Messages.TaskTags_InputDialog_Name_label);
    ((GridData) this.keywordControl.getLayoutData()).widthHint =
        new PixelConverter(this.keywordControl).convertWidthInCharsToPixels(45);
    this.keywordControl.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(final ModifyEvent e) {
            TaskTagsInputDialog.this.keyword = TaskTagsInputDialog.this.keywordControl.getText();
            doValidation();
          };
        });

    final String[] items =
        new String[] {
          StatetMessages.TaskPriority_High,
          StatetMessages.TaskPriority_Normal,
          StatetMessages.TaskPriority_Low,
        };
    this.priorityControl =
        layouter.addLabeledComboControl(Messages.TaskTags_InputDialog_Priority_label, items);
    this.priorityControl.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(final ModifyEvent e) {
            switch (TaskTagsInputDialog.this.priorityControl.getSelectionIndex()) {
              case 0:
                TaskTagsInputDialog.this.priority = TaskPriority.HIGH;
                break;
              case 2:
                TaskTagsInputDialog.this.priority = TaskPriority.LOW;
                break;
              default:
                TaskTagsInputDialog.this.priority = TaskPriority.NORMAL;
                break;
            }
          };
        });

    // Init Fields
    if (this.keyword != null) {
      this.keywordControl.setText(this.keyword);
      switch (this.priority) {
        case HIGH:
          this.priorityControl.select(0);
          break;
        case LOW:
          this.priorityControl.select(2);
          break;
        default: // NORMAL
          this.priorityControl.select(1);
          break;
      }
    } else {
      this.priorityControl.select(1);
    }
    final Display display = parent.getDisplay();
    if (display != null) {
      display.asyncExec(
          new Runnable() {
            @Override
            public void run() {
              TaskTagsInputDialog.this.keywordControl.setFocus();
            }
          });
    }

    LayoutUtil.addSmallFiller(area, true);

    applyDialogFont(area);

    return area;
  }
  @Override
  protected Control createDialogArea(final Composite parent) {
    // page group
    final Composite area = (Composite) super.createDialogArea(parent);

    createMessageArea(area);
    final IDialogSettings dialogSettings = getDialogSettings();

    {
      final Composite composite = new Composite(area, SWT.NONE);
      composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
      composite.setLayout(LayoutUtil.applyCompositeDefaults(new GridLayout(), 3));

      final Label label = new Label(composite, SWT.NONE);
      label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
      label.setText(Messages.RRemoteConsoleSelectionDialog_Hostname_label);

      fHostAddressControl = new Combo(composite, SWT.DROP_DOWN);
      final GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
      gd.widthHint = LayoutUtil.hintWidth(fHostAddressControl, 50);
      fHostAddressControl.setLayoutData(gd);
      final String[] history = dialogSettings.getArray(SETTINGS_HOST_HISTORY_KEY);
      if (history != null) {
        fHistoryAddress.addAll(Arrays.asList(history));
      }
      fHostAddressControl.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetDefaultSelected(final SelectionEvent e) {
              update();
            }
          });

      final Button goButton = new Button(composite, SWT.PUSH);
      goButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
      goButton.setText(Messages.RRemoteConsoleSelectionDialog_Update_label);
      goButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
              update();
            }
          });
    }

    {
      final TreeComposite composite =
          new TreeComposite(area, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
      final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
      gd.heightHint = LayoutUtil.hintHeight(composite.tree, 10);
      composite.setLayoutData(gd);
      fRServerViewer = composite.viewer;
      composite.tree.setHeaderVisible(true);
      ColumnViewerToolTipSupport.enableFor(composite.viewer);

      {
        final TreeViewerColumn column = new TreeViewerColumn(fRServerViewer, SWT.NONE);
        column.getColumn().setText(Messages.RRemoteConsoleSelectionDialog_Table_UserOrEngine_label);
        composite.layout.setColumnData(column.getColumn(), new ColumnWeightData(1));
        column.setLabelProvider(
            new RemoteRLabelProvider() {
              @Override
              public void update(final ViewerCell cell) {
                final Object element = cell.getElement();
                String text = null;
                Image image = null;
                if (element instanceof String) {
                  text = (String) element;
                  image = SharedUIResources.getImages().get(SharedUIResources.OBJ_USER_IMAGE_ID);
                } else if (element instanceof RemoteR) {
                  text = getText((RemoteR) element);
                }
                cell.setText(text);
                cell.setImage(image);
              }

              @Override
              public String getText(final RemoteR r) {
                return r.info.getName();
              }
            });
      }
      {
        final TreeViewerColumn column = new TreeViewerColumn(fRServerViewer, SWT.NONE);
        column.getColumn().setText(Messages.RRemoteConsoleSelectionDialog_Table_Host_label);
        composite.layout.setColumnData(column.getColumn(), new ColumnWeightData(1));
        column.setLabelProvider(
            new RemoteRLabelProvider() {
              @Override
              public String getText(final RemoteR r) {
                return r.hostName;
              }
            });
      }

      fRServerViewer.setContentProvider(new RemoteRContentProvider());

      fRServerViewer
          .getTree()
          .addSelectionListener(
              new SelectionListener() {
                @Override
                public void widgetSelected(final SelectionEvent e) {
                  updateState();
                }

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                  updateState();
                  if (getOkButton().isEnabled()) {
                    buttonPressed(IDialogConstants.OK_ID);
                  }
                }
              });
    }

    Dialog.applyDialogFont(area);

    updateInput();
    if (fRServerList != null) {
      updateStatus(
          new Status(
              IStatus.OK,
              RConsoleUIPlugin.PLUGIN_ID,
              Messages.RRemoteConsoleSelectionDialog_info_ListRestored_message));
    }
    return area;
  }