private Composite createAvailableList(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData());

    Label label = new Label(container, SWT.NONE);
    label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList);

    Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 200;
    gd.widthHint = 225;
    table.setLayoutData(gd);

    fAvailableListViewer = new TableViewer(table);
    fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider());
    fAvailableListViewer.setContentProvider(new ContentProvider());
    fAvailableListViewer.setInput(PDECore.getDefault().getModelManager());
    fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);

    return container;
  }
 private void createImpTable(Composite container) {
   fElementViewer = new TableViewer(container, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_BOTH);
   gd.heightHint = 250;
   fElementViewer.getControl().setLayoutData(gd);
   fElementViewer.getControl().setFont(container.getFont());
   fElementViewer.setContentProvider(
       new DefaultTableProvider() {
         public Object[] getElements(Object inputElement) {
           ITargetDefinition target = getTargetDefinition();
           if (target != null) {
             NameVersionDescriptor[] bundles = target.getImplicitDependencies();
             if (bundles != null) {
               return bundles;
             }
           }
           return new NameVersionDescriptor[0];
         }
       });
   fElementViewer.setLabelProvider(new StyledBundleLabelProvider(false, false));
   fElementViewer.setInput(PDEPlugin.getDefault());
   fElementViewer.setComparator(
       new ViewerComparator() {
         public int compare(Viewer viewer, Object e1, Object e2) {
           NameVersionDescriptor bundle1 = (NameVersionDescriptor) e1;
           NameVersionDescriptor bundle2 = (NameVersionDescriptor) e2;
           return super.compare(viewer, bundle1.getId(), bundle2.getId());
         }
       });
   fElementViewer.addSelectionChangedListener(
       new ISelectionChangedListener() {
         public void selectionChanged(SelectionChangedEvent event) {
           updateImpButtons();
         }
       });
   fElementViewer
       .getTable()
       .addKeyListener(
           new KeyAdapter() {
             public void keyPressed(KeyEvent e) {
               if (e.character == SWT.DEL && e.stateMask == 0) {
                 handleRemove();
               }
             }
           });
 }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData sectionData = new GridData(GridData.FILL_BOTH);
    sectionData.verticalSpan = 2;
    section.setLayoutData(sectionData);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createOptionalDependenciesButton(container);

    TablePart tablePart = getTablePart();
    fPluginTable = tablePart.getTableViewer();
    fPluginTable.setContentProvider(new ContentProvider());
    fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPluginTable.setComparator(
        new ViewerComparator() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            IProductPlugin p1 = (IProductPlugin) e1;
            IProductPlugin p2 = (IProductPlugin) e2;
            return super.compare(viewer, p1.getId(), p2.getId());
          }
        });
    GridData data = (GridData) tablePart.getControl().getLayoutData();
    data.minimumWidth = 200;
    fPluginTable.setInput(getProduct());

    tablePart.setButtonEnabled(0, isEditable());
    tablePart.setButtonEnabled(1, isEditable());
    tablePart.setButtonEnabled(2, isEditable());

    // remove buttons will be updated on refresh

    tablePart.setButtonEnabled(5, isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);

    section.setText(PDEUIMessages.Product_PluginSection_title);
    section.setDescription(PDEUIMessages.Product_PluginSection_desc);
    getModel().addModelChangedListener(this);
    createSectionToolbar(section, toolkit);
  }
  @Override
  protected void createClient(Section section, FormToolkit toolkit) {
    section.setText(PDEUIMessages.ExportPackageSection_title);
    if (isFragment()) section.setDescription(PDEUIMessages.ExportPackageSection_descFragment);
    else section.setDescription(PDEUIMessages.ExportPackageSection_desc);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    TablePart tablePart = getTablePart();
    fPackageViewer = tablePart.getTableViewer();
    fPackageViewer.setContentProvider(new ExportPackageContentProvider());
    fPackageViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPackageViewer.setComparator(
        new ViewerComparator() {
          @Override
          public int compare(Viewer viewer, Object e1, Object e2) {
            String s1 = e1.toString();
            String s2 = e2.toString();
            if (s1.indexOf(" ") != -1) // $NON-NLS-1$
            s1 = s1.substring(0, s1.indexOf(" ")); // $NON-NLS-1$
            if (s2.indexOf(" ") != -1) // $NON-NLS-1$
            s2 = s2.substring(0, s2.indexOf(" ")); // $NON-NLS-1$
            return super.compare(viewer, s1, s2);
          }
        });
    toolkit.paintBordersFor(container);
    section.setClient(container);
    GridData gd = new GridData(GridData.FILL_BOTH);
    if (((ManifestEditor) getPage().getEditor()).isEquinox()) {
      gd.verticalSpan = 2;
      gd.minimumWidth = 300;
    }
    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    section.setLayoutData(gd);
    makeActions();

    IBundleModel model = getBundleModel();
    fPackageViewer.setInput(model);
    model.addModelChangedListener(this);
    updateButtons();
  }
Exemplo n.º 5
0
  protected void createViewer(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    fExportPart.createControl(composite);
    GridData gd = (GridData) fExportPart.getControl().getLayoutData();
    gd.heightHint = 125;
    gd.widthHint = 150;
    gd.horizontalSpan = 2;

    TableViewer viewer = fExportPart.getTableViewer();
    viewer.setContentProvider(new ExportListProvider());
    viewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    viewer.setComparator(ListUtil.PLUGIN_COMPARATOR);
    viewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            if (event.getSource() instanceof CheckboxTableViewer) {
              IStructuredSelection selection = (IStructuredSelection) event.getSelection();
              ((CheckboxTableViewer) event.getSource())
                  .setChecked(
                      selection.getFirstElement(),
                      !((CheckboxTableViewer) event.getSource())
                          .getChecked(selection.getFirstElement()));
              fExportPart.updateCounter(
                  ((CheckboxTableViewer) event.getSource()).getCheckedElements().length);
            }
          }
        });
    fExportPart.getTableViewer().setInput(getInput());
  }
Exemplo n.º 6
0
  @Override
  protected Control createDialogArea(Composite parent) {
    parent.setLayout(new GridLayout());

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    composite.setLayout(new GridLayout());

    viewer = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    Table table = viewer.getTable();
    table.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    table.setHeaderVisible(true);
    table.setLinesVisible(false);

    TableColumn tc;

    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(""); // $NON-NLS-1$
    tc.setWidth(40);

    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.ExterneDokumente_file_date);
    tc.setWidth(120);
    tc.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            // TODO sort by Datum
            // http://www.vogella.de/articles/EclipseJFaceTable/article.html#sortcolumns
          }
        });

    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.VerifierDialog_name);
    tc.setWidth(200);
    tc.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            // TODO sort by Nummer
          }
        });

    viewer.setContentProvider(new VerifierContentProvider());
    viewer.setLabelProvider(new VerifierLabelProvider());
    viewer.setComparator(new TimestampComparator());
    viewer.setInput(this);

    // edit file properties at if double clicked

    viewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            StructuredSelection selection = (StructuredSelection) viewer.getSelection();
            if (selection != null) {
              Object element = selection.getFirstElement();
              if (element instanceof File) {
                openFileEditorDialog((File) element);
              }
            }
          }
        });

    return composite;
  }
Exemplo n.º 7
0
  @Override
  public void createPartControl(Composite parent) {
    final IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager toolbar = actionBars.getToolBarManager();
    mSymbolEntryText = new TextContributionItem(""); // $NON-NLS-1$
    toolbar.add(mSymbolEntryText);
    toolbar.add(new AddSymbolAction(mSymbolEntryText, this));

    final Table table =
        new Table(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.BORDER);
    table.setHeaderVisible(true);
    mViewer = new TableViewer(table);
    GridDataFactory.defaultsFor(table).applyTo(table);

    final MarketDataItemComparator comparator = new MarketDataItemComparator();
    mViewer.setComparator(comparator);

    SelectionListener listener =
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // determine new sort column and direction
            TableColumn sortColumn = table.getSortColumn();
            TableColumn currentColumn = (TableColumn) e.widget;
            final int index = table.indexOf(currentColumn);
            int dir = table.getSortDirection();
            if (sortColumn == currentColumn) {
              dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
            } else {
              table.setSortColumn(currentColumn);
              dir = SWT.UP;
            }
            table.setSortDirection(dir);
            comparator.setSort(dir == SWT.UP ? 1 : -1);
            comparator.setIndex(index);
            mViewer.refresh();
          }
        };

    // create columns, using FIXFieldLocalizer to preserve backwards
    // compatibility
    TableViewerColumn symbolColumn =
        new TableViewerColumn(
            mViewer,
            createColumn(
                table,
                FIXFieldLocalizer.getLocalizedFIXFieldName(Symbol.class.getSimpleName()),
                SWT.LEFT,
                listener));
    symbolColumn.setEditingSupport(new SymbolEditingSupport());
    createColumn(
        table,
        FIXFieldLocalizer.getLocalizedFIXFieldName(LastPx.class.getSimpleName()),
        SWT.RIGHT,
        listener);
    createColumn(
        table,
        FIXFieldLocalizer.getLocalizedFIXFieldName(LastQty.class.getSimpleName()),
        SWT.RIGHT,
        listener);
    createColumn(
        table,
        FIXFieldLocalizer.getLocalizedFIXFieldName(BidSize.class.getSimpleName()),
        SWT.RIGHT,
        listener);
    createColumn(
        table,
        FIXFieldLocalizer.getLocalizedFIXFieldName(BidPx.class.getSimpleName()),
        SWT.RIGHT,
        listener);
    createColumn(
        table,
        FIXFieldLocalizer.getLocalizedFIXFieldName(OfferPx.class.getSimpleName()),
        SWT.RIGHT,
        listener);
    createColumn(
        table,
        FIXFieldLocalizer.getLocalizedFIXFieldName(OfferSize.class.getSimpleName()),
        SWT.RIGHT,
        listener);

    // restore table state if it exists
    if (mViewState != null) {
      ColumnState.restore(table, mViewState);
      for (TableColumn column : table.getColumns()) {
        if (column.getWidth() == 0) {
          column.setResizable(false);
        }
      }
    }

    registerContextMenu();
    getSite().setSelectionProvider(mViewer);

    ObservableListContentProvider content = new ObservableListContentProvider();
    mViewer.setContentProvider(content);
    IObservableSet domain = content.getKnownElements();
    IObservableMap[] maps =
        new IObservableMap[] {
          BeansObservables.observeMap(domain, MarketDataViewItem.class, "symbol"), // $NON-NLS-1$
          createCompositeMap(
              domain, "latestTick", MDPackage.Literals.MD_LATEST_TICK__PRICE), // $NON-NLS-1$
          createCompositeMap(
              domain, "latestTick", MDPackage.Literals.MD_LATEST_TICK__SIZE), // $NON-NLS-1$
          createCompositeMap(
              domain, "topOfBook", MDPackage.Literals.MD_TOP_OF_BOOK__BID_SIZE), // $NON-NLS-1$
          createCompositeMap(
              domain, "topOfBook", MDPackage.Literals.MD_TOP_OF_BOOK__BID_PRICE), // $NON-NLS-1$
          createCompositeMap(
              domain, "topOfBook", MDPackage.Literals.MD_TOP_OF_BOOK__ASK_PRICE), // $NON-NLS-1$
          createCompositeMap(
              domain, "topOfBook", MDPackage.Literals.MD_TOP_OF_BOOK__ASK_SIZE) // $NON-NLS-1$
        };
    mViewer.setLabelProvider(new ObservableMapLabelProvider(maps));
    mViewer.setUseHashlookup(true);
    mItems = WritableList.withElementType(MarketDataViewItem.class);
    mViewer.setInput(mItems);
  }