Exemplo n.º 1
0
  Composite createControl(final Composite parent, final PreferencePage prefParent) {
    Composite composite = new Composite(parent, SWT.NONE);
    Font parentFont = parent.getFont();

    GridLayout glayout = new GridLayout(2, false);
    glayout.marginHeight = 0;
    glayout.marginWidth = 0;
    composite.setLayout(glayout);
    composite.setFont(parentFont);

    Label tableLabel = new Label(composite, SWT.NONE);
    tableLabel.setText(UITexts.cabalImplsBlock_installed);
    GridData gdata = new GridData(SWT.FILL, SWT.TOP, true, false);
    gdata.horizontalSpan = 2;
    tableLabel.setLayoutData(gdata);
    tableLabel.setFont(parentFont);

    Composite tableComposite = new Composite(composite, SWT.NONE);
    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    table = SWTUtil.createTable(tableComposite);
    createColumns(tableComposite);
    createViewer();

    // Deep copy the implementations, replace them later.
    CabalImplementationManager cMgr = CabalImplementationManager.getInstance();
    impls.clear();
    for (CabalImplementation impl : cMgr.getCabalImplementations()) {
      impls.add(new CabalImplementation(impl));
    }

    viewer.setInput(impls);

    // And set the current default (checked) implementation
    CabalImplementation defImpl = cMgr.getDefaultCabalImplementation();
    if (defImpl != null) {
      CabalImplementation impl = findImplementation(defImpl.getUserIdentifier());
      setCheckedCabalImplementation(impl);
    }

    Composite buttonsComp = new Composite(composite, SWT.NONE);

    glayout = new GridLayout(1, true);
    glayout.marginHeight = 0;
    glayout.marginWidth = 0;
    buttonsComp.setLayout(glayout);
    buttonsComp.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
    buttonsComp.setFont(parentFont);
    createButtons(buttonsComp);
    enableButtons();

    return composite;
  }
Exemplo n.º 2
0
  /** Put the Cabal implementation preferences into the preference store. */
  public boolean updateCabalImplementations() {
    CabalImplementationManager cMgr = CabalImplementationManager.getInstance();
    Object[] selected = viewer.getCheckedElements();
    CabalImplementation impl = (CabalImplementation) selected[0];
    String defaultImplIdent = new String();
    if (impl != null) {
      defaultImplIdent = impl.getUserIdentifier();
    }

    cMgr.setCabalImplementations(impls, defaultImplIdent);
    return true;
  }