Java Code Examples for org.eclipse.swt.widgets.Table

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/rcputils/de/ralfebert/rcputils/tables/sort/.

Source file: ColumnSortSelectionListener.java

  23 
vote

@Override public void widgetSelected(SelectionEvent e){
  TableColumn column=(TableColumn)e.getSource();
  Table table=column.getParent();
  boolean alreadyActiveSortColumn=column == table.getSortColumn();
  if (alreadyActiveSortColumn) {
    table.setSortDirection(table.getSortDirection() == SWT.DOWN ? SWT.UP : SWT.DOWN);
  }
 else {
    table.setSortColumn(column);
    table.setSortDirection(SWT.UP);
  }
  viewer.refresh();
}
 

Example 2

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/wizards/.

Source file: NewSpectrumDetailWizardPage.java

  22 
vote

private Table createTable(Composite container,String[] columnNames){
  int style=SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL| SWT.FULL_SELECTION| SWT.HIDE_SELECTION| SWT.LEFT;
  Table table=new Table(container,style);
  RowData rowData=new RowData();
  rowData.height=100;
  table.setLayoutData(rowData);
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  TableColumn[] column=new TableColumn[columnNames.length];
  for (int i=0; i < columnNames.length; i++) {
    column[i]=new TableColumn(table,SWT.CENTER,i);
    column[i].setText(columnNames[i]);
    column[i].setWidth(100);
  }
  return table;
}
 

Example 3

From project bndtools, under directory /bndtools.core/src/bndtools/editor/common/.

Source file: MapEntryCellModifier.java

  22 
vote

public void addColumnsToTable(){
  Table table=viewer.getTable();
  for (  String label : LABELS) {
    TableColumn col=new TableColumn(table,SWT.NONE);
    col.setText(label);
    col.setWidth(120);
  }
}
 

Example 4

From project bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/wizards/fields/.

Source file: TableLayoutComposite.java

  22 
vote

/** 
 * Creates a new <code>TableLayoutComposite</code>.
 */
public TableLayoutComposite(Composite parent,int style){
  super(parent,style);
  addControlListener(new ControlAdapter(){
    @Override public void controlResized(    ControlEvent e){
      Rectangle area=getClientArea();
      Table table=(Table)getChildren()[0];
      Point preferredSize=computeTableSize(table);
      int width=area.width - 2 * table.getBorderWidth();
      if (preferredSize.y > area.height) {
        Point vBarSize=table.getVerticalBar().getSize();
        width-=vBarSize.x;
      }
      layoutTable(table,width,area,table.getSize().x < area.width);
    }
  }
);
}
 

Example 5

From project bundlemaker, under directory /main/org.bundlemaker.core.ui.view.problemview/src/org/bundlemaker/core/ui/view/problemview/.

Source file: ProblemView.java

  22 
vote

@Override public void createPartControl(Composite parent){
  FillLayout fillLayout=new FillLayout();
  fillLayout.type=SWT.VERTICAL;
  parent.setLayout(fillLayout);
  Composite tableComposite=new Composite(parent,SWT.NONE);
  tableComposite.setLayout(new TableColumnLayout());
  _viewer=new TableViewer(tableComposite,SWT.VIRTUAL | SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL| SWT.FULL_SELECTION);
  final Table table=_viewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  _viewer.setContentProvider(ArrayContentProvider.getInstance());
  createColumns(tableComposite,_viewer);
}
 

Example 6

From project cilia-workbench, under directory /cilia-workbench-monitoring/src/fr/liglab/adele/cilia/workbench/monitoring/changesview/.

Source file: ChangesTableViewer.java

  22 
vote

/** 
 * Creates the viewer.
 * @param parent the parent
 */
private static void createViewer(Composite parent){
  viewer=new TableViewer(parent,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.FULL_SELECTION| SWT.BORDER);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setComparator(tableSorter);
  createColumnsAndLabelProvider(viewer);
  final Table table=viewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  viewer.getControl().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
}
 

Example 7

From project CIShell, under directory /templates/org.cishell.templates.wizards/src/org/cishell/templates/guibuilder/.

Source file: ListBuilder.java

  22 
vote

private Table createTable(Composite parent){
  final Table table=new Table(parent,SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  String[] titles=delegate.getColumns();
  for (int i=0; i < titles.length; i++) {
    TableColumn column=new TableColumn(table,SWT.NONE);
    column.setText(titles[i]);
    column.pack();
    column.setWidth(100);
  }
  return table;
}
 

Example 8

From project eclipse-integration-gradle, under directory /org.springsource.ide.eclipse.gradle.ui/src/org/springsource/ide/eclipse/gradle/ui/launch/.

Source file: GradleTaskOrderDialog.java

  22 
vote

/** 
 * Creates a list viewer for the targets
 * @param comp
 */
private void createTargetList(Composite comp){
  fViewer=new TableViewer(comp,SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
  fViewer.setLabelProvider(new ToStringLabelProvider());
  fViewer.setContentProvider(new ArrayContentProvider());
  fViewer.setInput(fTargets);
  fViewer.addSelectionChangedListener(this);
  Table table=fViewer.getTable();
  GridData gd=new GridData(GridData.FILL_BOTH);
  gd.heightHint=200;
  gd.widthHint=250;
  table.setLayoutData(gd);
  table.setFont(comp.getFont());
}
 

Example 9

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/.

Source file: MigrateBrickPage1.java

  22 
vote

private void setFromDisk(TableViewer tableViewer,Brick brickToSelect){
  Table table=tableViewer.getTable();
  for (int i=0; i < table.getItemCount(); i++) {
    TableItem item=table.getItem(i);
    if (item.getData() == brickToSelect) {
      table.select(i);
      return;
    }
  }
}
 

Example 10

From project mousefeed, under directory /com.mousefeed/src/com/mousefeed/eclipse/preferences/.

Source file: ActionInvocationModeControl.java

  22 
vote

/** 
 * Creates the table control to initialize  {@link #table}.
 * @param aboveControl the control above this one.Can be <code>null</code> if this is the topmost control in the container.
 * @return the table control.
 */
private Table createTable(final Control aboveControl){
  final Table t=new Table(this,SWT.V_SCROLL | SWT.BORDER | SWT.MULTI| SWT.FULL_SELECTION);
  t.setLinesVisible(true);
  t.setHeaderVisible(true);
{
    final TableColumn column=new TableColumn(t,SWT.NONE,0);
    column.setText(MESSAGES.get("actionTable.column.action"));
  }
{
    final TableColumn column=new TableColumn(t,SWT.NONE,1);
    column.setText(MESSAGES.get("actionTable.column.onWrongInvocationMode"));
  }
  return t;
}
 

Example 11

From project netifera, under directory /platform/com.netifera.platform.ui/com.netifera.platform.ui/src/com/netifera/platform/ui/util/.

Source file: HookingViewerComparator.java

  22 
vote

protected void hookViewer(){
  if (viewer instanceof TableViewer) {
    Table table=((TableViewer)viewer).getTable();
    TableColumn[] columns=table.getColumns();
    for (int i=0; i < columns.length; i++) {
      TableColumn column=columns[i];
      addColumnSelectionListener(column);
    }
  }
}
 

Example 12

From project phing-eclipse, under directory /org.ganoro.phing.ui/src/org/ganoro/phing/ui/internal/preferences/.

Source file: AntPage.java

  22 
vote

/** 
 * Persist table settings into the give dialog store, prefixed with the given key.
 * @param settings dialog store
 * @since 3.5
 */
public void saveColumnSettings(IDialogSettings settings){
  Table table=this.tableViewer.getTable();
  int columnCount=table.getColumnCount();
  for (int i=0; i < columnCount; i++) {
    settings.put(getHelpContextId() + ".columnWidth" + i,table.getColumn(i).getWidth());
  }
  TableColumn column=table.getSortColumn();
  if (column != null) {
    settings.put(getHelpContextId() + ".sortColumn",table.indexOf(column));
    settings.put(getHelpContextId() + ".sortDirection",table.getSortDirection());
  }
}
 

Example 13

From project rascal-eclipse, under directory /src/org/rascalmpl/eclipse/ambidexter/.

Source file: AbstractAmbidexterAction.java

  22 
vote

@Override public void widgetSelected(SelectionEvent event){
  Object selection=event.getSource();
  if (selection != null && selection instanceof Table) {
    Table table=(Table)selection;
    for (    TableItem item : table.getSelection()) {
      this.sentence=(String)item.getData("sentence");
      this.nonterminal=(IConstructor)item.getData("nonterminal");
      this.project=(String)item.getData("project");
      this.module=(String)item.getData("module");
      this.tree=(IConstructor)item.getData("tree");
    }
  }
}
 

Example 14

From project rcputils, under directory /de.ralfebert.rcputils/src/de/ralfebert/rcputils/tables/sort/.

Source file: ColumnSortSelectionListener.java

  22 
vote

@Override public void widgetSelected(SelectionEvent e){
  TableColumn column=(TableColumn)e.getSource();
  Table table=column.getParent();
  boolean alreadyActiveSortColumn=(column == table.getSortColumn());
  if (alreadyActiveSortColumn) {
    table.setSortDirection(table.getSortDirection() == SWT.DOWN ? SWT.UP : SWT.DOWN);
  }
 else {
    table.setSortColumn(column);
    table.setSortDirection(SWT.UP);
  }
  viewer.refresh();
}
 

Example 15

From project swtbot, under directory /org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/.

Source file: SWTBotEclipseEditor.java

  22 
vote

/** 
 * Gets the quick fix table.
 * @param proposalShell the shell containing the quickfixes.
 * @return the table containing the quickfix.
 */
private SWTBotTable getProposalTable(){
  log.debug("Finding table containing proposals.");
  try {
    Table table=bot.widget(widgetOfType(Table.class),activatePopupShell().widget);
    SWTBotTable swtBotTable=new SWTBotTable(table);
    log.debug(MessageFormat.format("Found table containing proposals -- {0}",getRows(swtBotTable)));
    return swtBotTable;
  }
 catch (  Exception e) {
    throw new QuickFixNotFoundException("Quickfix options not found. Giving up.",e);
  }
}
 

Example 16

From project TadpoleForDBTools, under directory /com.hangum.db.browser.rap.core/src/com/hangum/tadpole/rdb/core/editors/main/.

Source file: MainEditor.java

  22 
vote

/** 
 * sql history ? ???????.
 */
public void selectHistoryPage(){
  if (tabFolderResult.getSelectionIndex() != 1) {
    tabFolderResult.setSelection(1);
  }
  if (listSQLHistory.size() >= 1) {
    Table tb=tableViewerSQLHistory.getTable();
    tb.select(0);
    tb.setFocus();
  }
}
 

Example 17

From project Utah-Tools-Decision-Support, under directory /core/edu.utah.cdmcc.decisionsupport.application.core/src/edu/utah/cdmcc/decisionsupport/viewers/.

Source file: PatientListSelectionDialog.java

  22 
vote

@Override protected Control createDialogArea(final Composite parent){
  Table table=new PatientTable(parent).getTable();
  fTableViewer=new TableViewer(table);
  fTableViewer.setLabelProvider(new PatientSelectLabelProvider());
  fTableViewer.setContentProvider(new PatientContentProvider());
  fTableViewer.setInput(ApplicationControllers.getPatientController().getPatients());
  fTableViewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      okPressed();
    }
  }
);
  return parent;
}
 

Example 18

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.datatools.enablement.simpledb.ui/src/com/amazonaws/eclipse/datatools/enablement/simpledb/ui/editor/.

Source file: QueryEditor.java

  21 
vote

/** 
 * Creates the results table
 */
private void createResultsTable(final Composite resultsComposite){
  TableColumnLayout tableColumnLayout=new TableColumnLayout();
  resultsComposite.setLayout(tableColumnLayout);
  this.viewer=new TableViewer(resultsComposite);
  this.viewer.getTable().setLinesVisible(true);
  this.viewer.getTable().setHeaderVisible(true);
  this.contentProvider=new ContentProvider();
  this.viewer.setContentProvider(this.contentProvider);
  this.viewer.setLabelProvider(new LabelProvider());
  final Table table=this.viewer.getTable();
  final TableEditor editor=new TableEditor(table);
  editor.horizontalAlignment=SWT.LEFT;
  editor.grabHorizontal=true;
  TextCellEditorListener listener=new TextCellEditorListener(table,editor);
  table.addListener(SWT.MouseUp,listener);
  table.addListener(SWT.FocusOut,listener);
}
 

Example 19

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/preferences/.

Source file: CeylonRepoPreferencesBlock.java

  21 
vote

private void initLookupRepoTable(Composite composite){
  Label lookupRepoLabel=new Label(composite,SWT.LEFT | SWT.WRAP);
  lookupRepoLabel.setText("Lookup repositories on build path:");
  lookupRepoLabel.setLayoutData(swtDefaults().align(SWT.FILL,SWT.CENTER).span(2,1).grab(true,false).indent(0,10).create());
  lookupRepoTable=new Table(composite,SWT.MULTI | SWT.BORDER | SWT.V_SCROLL| SWT.H_SCROLL);
  lookupRepoTable.setLayoutData(swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).hint(250,200).create());
  lookupRepoTable.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      updateButtonState();
    }
  }
);
}
 

Example 20

From project dawn-ui, under directory /org.dawb.workbench.plotting/src/org/dawb/workbench/plotting/tools/.

Source file: EllipseFittingTool.java

  21 
vote

@Override public void createControl(Composite parent){
  composite=new Composite(parent,SWT.NONE);
  composite.setLayout(new FillLayout());
  viewer=new TableViewer(composite,SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL| SWT.V_SCROLL| SWT.BORDER);
  createColumns(viewer);
  Table t=viewer.getTable();
  t.setLinesVisible(true);
  t.setHeaderVisible(true);
  createActions();
  getSite().setSelectionProvider(viewer);
  viewer.setContentProvider(new IStructuredContentProvider(){
    @Override public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @Override public void dispose(){
    }
    @Override public Object[] getElements(    Object inputElement){
      return ellipses.toArray();
    }
  }
);
  viewer.setInput(ellipses);
  parent.layout();
}
 

Example 21

From project droolsjbpm-tools, under directory /drools-eclipse/org.guvnor.tools/src/org/guvnor/tools/utils/.

Source file: PlatformUtils.java

  21 
vote

public static Table createResourceHistoryTable(Composite parent){
  int style=SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL| SWT.FULL_SELECTION| SWT.HIDE_SELECTION;
  Table table=new Table(parent,style);
  GridData gridData=new GridData(GridData.FILL_BOTH);
  gridData.grabExcessVerticalSpace=true;
  gridData.horizontalSpan=3;
  table.setLayoutData(gridData);
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  TableColumn column=new TableColumn(table,SWT.LEFT,0);
  column.setResizable(true);
  column.setText(Messages.getString("history.revision"));
  column.setWidth(100);
  column=new TableColumn(table,SWT.LEFT,1);
  column.setResizable(true);
  column.setText(Messages.getString("history.date"));
  column.setWidth(175);
  column=new TableColumn(table,SWT.LEFT,2);
  column.setResizable(true);
  column.setText(Messages.getString("history.author"));
  column.setWidth(200);
  column=new TableColumn(table,SWT.CENTER,3);
  column.setResizable(true);
  column.setText(Messages.getString("history.comment"));
  column.setWidth(350);
  return table;
}
 

Example 22

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/editor/.

Source file: ApplicationDetailsPart.java

  21 
vote

private TableViewer createTableViewer(Composite parent,String[] columnNames,String[] columnTooltips,int[] columnWeights){
  Table table=toolkit.createTable(parent,SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(table);
  table.setHeaderVisible(true);
  for (int i=0; i < columnNames.length; i++) {
    TableColumn col=new TableColumn(table,SWT.NONE);
    col.setWidth(columnWeights[i]);
    col.setText(columnNames[i]);
    if (columnTooltips == null) {
      col.setToolTipText(null);
    }
 else {
      col.setToolTipText(columnTooltips[i]);
    }
  }
  TableViewer tableViewer=new TableViewer(table);
  tableViewer.setColumnProperties(columnNames);
  return tableViewer;
}
 

Example 23

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.frameworks.ui/src/org/springsource/ide/eclipse/commons/frameworks/ui/internal/wizard/.

Source file: GenericWizardCommandListPage.java

  21 
vote

/** 
 * Sets the main column in the viewer that lists all the commands and adds a sorter.
 * @param tableviewer
 */
protected void setTableColumnAndLayout(final TableViewer tableviewer){
  tableviewer.setSorter(new ViewerSorter(){
    public int compare(    Viewer viewer,    Object command1,    Object command2){
      if (viewer instanceof TableViewer) {
        Table table=((TableViewer)viewer).getTable();
        if (command1 instanceof IFrameworkCommandDescriptor && command2 instanceof IFrameworkCommandDescriptor) {
          int sortDirection=table.getSortDirection();
          String commandName1=((IFrameworkCommandDescriptor)command1).getName();
          String commandName2=((IFrameworkCommandDescriptor)command2).getName();
          return sortDirection == SWT.UP ? commandName1.compareToIgnoreCase(commandName2) : commandName2.compareToIgnoreCase(commandName1);
        }
      }
      return super.compare(viewer,command1,command2);
    }
  }
);
  final Table table=tableviewer.getTable();
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,getMinTableHeight()).applyTo(table);
  TableLayout tableLayout=new TableLayout();
  tableLayout.addColumnData(new ColumnWeightData(getMinCommandColumnWeight(),true));
  TableColumn commandColumn=new TableColumn(table,SWT.NONE);
  table.setLayout(tableLayout);
  commandColumn.setText("Commands");
  commandColumn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      int dir=table.getSortDirection();
      dir=dir == SWT.UP ? SWT.DOWN : SWT.UP;
      table.setSortDirection(dir);
      tableviewer.refresh();
    }
  }
);
  table.setSortColumn(commandColumn);
  table.setSortDirection(SWT.UP);
  table.setHeaderVisible(false);
  table.layout(true);
  tableviewer.refresh();
}
 

Example 24

From project eik, under directory /plugins/info.evanchik.eclipse.karaf.ui/src/main/java/info/evanchik/eclipse/karaf/ui/.

Source file: KarafConfigurationTab.java

  21 
vote

/** 
 * @param group
 */
private void createAvailableFeaturesControls(final Group group){
  GridData gd;
  availableFeaturesViewer=CheckboxTableViewer.newCheckList(group,SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
  final Table tree=availableFeaturesViewer.getTable();
  final TableColumn column1=new TableColumn(tree,SWT.LEFT);
  column1.setText("Feature");
  column1.setWidth(250);
  final TableColumn column2=new TableColumn(tree,SWT.LEFT);
  column2.setText("Version");
  column2.setWidth(150);
  final TableColumn column3=new TableColumn(tree,SWT.LEFT);
  column3.setText("Repository");
  column3.setWidth(150);
  gd=new GridData(GridData.FILL_BOTH);
  gd.heightHint=200;
  tree.setLayoutData(gd);
  tree.setHeaderVisible(true);
  availableFeaturesViewer.setContentProvider(new AvailableFeaturesContentProvider());
  availableFeaturesViewer.setLabelProvider(new AvailableFeaturesLabelProvider());
  availableFeaturesViewer.setInput(null);
  availableFeaturesViewer.addCheckStateListener(new ICheckStateListener(){
    @Override public void checkStateChanged(    final CheckStateChangedEvent event){
      final AvailableFeature f=(AvailableFeature)event.getElement();
      if (event.getChecked()) {
        if (!bootFeaturesList.contains(f.getFeatureName())) {
          bootFeaturesList.add(f.getFeatureName());
          bootFeaturesViewer.refresh();
        }
      }
 else {
        bootFeaturesList.remove(f.getFeatureName());
        bootFeaturesViewer.refresh();
      }
      KarafConfigurationTab.this.updateLaunchConfigurationDialog();
    }
  }
);
}
 

Example 25

From project EMF-IncQuery, under directory /plugins/org.eclipse.viatra2.emf.incquery.tooling.gui/src/org/eclipse/viatra2/emf/incquery/gui/wizards/internal/.

Source file: ElementSelectionDialog.java

  21 
vote

private void createElementTable(Composite parent){
  this.tableViewer=new TableViewer(parent,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.FULL_SELECTION| SWT.BORDER);
  this.tableViewer.setContentProvider(this.contentProvider);
  importFilter=new ImportFilter();
  this.tableViewer.addFilter(importFilter);
  TableViewerColumn column=new TableViewerColumn(tableViewer,SWT.NONE);
  column.getColumn().setWidth(400);
  column.getColumn().setText(this.header);
  column.setLabelProvider(labelProvider);
  final Table table=tableViewer.getTable();
  table.setLayoutData(new GridData(GridData.FILL_BOTH));
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  table.addMouseListener(new MouseAdapter(){
    @Override public void mouseDoubleClick(    MouseEvent e){
      if (table.getSelectionCount() > 0) {
        okPressed();
      }
    }
  }
);
  tableViewer.setInput(elements);
}
 

Example 26

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/uk/ac/gda/ui/dialog/.

Source file: VisitIDDialog.java

  21 
vote

/** 
 * Create contents of the dialog.
 * @param parent
 */
@Override protected Control createDialogArea(Composite parent){
  Composite container=(Composite)super.createDialogArea(parent);
  final Label l=new Label(container,SWT.NULL);
  l.setText("You can collect data under any of the following visits. Please select the visit you wish to use.");
  final Table table=new Table(container,SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL| SWT.FULL_SELECTION| SWT.HIDE_SELECTION);
  final GridData gridData=new GridData(GridData.FILL_BOTH);
  gridData.grabExcessVerticalSpace=true;
  gridData.horizontalSpan=2;
  table.setLayoutData(gridData);
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  this.userTable=new TableViewer(table);
  userTable.setUseHashlookup(true);
  createTableColumns();
  createContentProvider();
  userTable.setInput(visits);
  return container;
}
 

Example 27

From project iee, under directory /org.eclipse.iee.editor.monitoring/src/org/eclipse/iee/editor/monitoring/views/.

Source file: EditorContainersMonitoringView.java

  21 
vote

protected void initContainerTableView(Composite parent){
  fContainersTableViewer=new TableViewer(parent,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
  final Table table=fContainersTableViewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  String[] columnNames=new String[]{"Container ID","Offset","Line number"};
  int[] columnWidths=new int[]{300,100,100};
  int[] columnAlignments=new int[]{SWT.LEFT,SWT.LEFT,SWT.LEFT};
  for (int i=0; i < columnNames.length; i++) {
    TableColumn tableColumn=new TableColumn(table,columnAlignments[i]);
    tableColumn.setText(columnNames[i]);
    tableColumn.setWidth(columnWidths[i]);
  }
  fContainersTableViewer.setContentProvider(new ContainerContentProvider());
  fContainersTableViewer.setLabelProvider(new ContainersLabelProvider());
}
 

Example 28

From project incubator, under directory /net.karlmartens.ui/src/net/karlmartens/ui/widget/.

Source file: GridChooser.java

  21 
vote

private void updateButtons(){
  final Table selected=_selected.getTable();
  final int itemCount=selected.getItemCount();
  boolean firstSelected=false;
  boolean lastSelected=false;
  for (  int idx : selected.getSelectionIndices()) {
    firstSelected|=idx == 0;
    lastSelected|=idx == (itemCount - 1);
  }
  final boolean hasSelection=!_selected.getSelection().isEmpty();
  _left.setEnabled(hasSelection);
  _up.setEnabled(hasSelection && !firstSelected);
  _top.setEnabled(hasSelection && !firstSelected);
  _down.setEnabled(hasSelection && !lastSelected);
  _bottom.setEnabled(hasSelection && !lastSelected);
  _right.setEnabled(!_available.getSelection().isEmpty());
}
 

Example 29

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/.

Source file: RefSpecPanel.java

  21 
vote

private void createTable(final Group tableGroup){
  final Composite tablePanel=new Composite(tableGroup,SWT.NONE);
  final GridData layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
  layoutData.heightHint=TABLE_PREFERRED_HEIGHT;
  layoutData.widthHint=TABLE_PREFERRED_WIDTH;
  tablePanel.setLayoutData(layoutData);
  tableViewer=new TableViewer(tablePanel,SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER| SWT.V_SCROLL);
  ColumnViewerToolTipSupport.enableFor(tableViewer);
  final Table table=tableViewer.getTable();
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  createTableColumns(tablePanel);
  createCellEditors(table);
  tableViewer.setContentProvider(new IStructuredContentProvider(){
    public Object[] getElements(    final Object inputElement){
      return ((List)inputElement).toArray();
    }
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
  }
);
  tableViewer.setInput(specs);
  tableViewer.setComparer(new IElementComparer(){
    public boolean equals(    Object a,    Object b){
      return a == b;
    }
    public int hashCode(    Object element){
      return element.hashCode();
    }
  }
);
}
 

Example 30

From project neoclipse, under directory /org.neo4j.neoclipse/src/main/java/org/neo4j/neoclipse/editor/.

Source file: SqlEditorView.java

  21 
vote

private void displayResultSet(CypherResultSet cypherResultSet){
  List<Map<String,Object>> resultSetList=cypherResultSet.getIterator();
  Collection<String> columns=cypherResultSet.getColumns();
  jsonString=ApplicationUtil.toJson(resultSetList);
  messageStatus.setText(cypherResultSet.getMessage() != null ? cypherResultSet.getMessage() : "");
  TableViewer tableViewer=new TableViewer(tabFolder,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI| SWT.VIRTUAL| SWT.FULL_SELECTION);
  createColumns(tableViewer,columns);
  tableViewer.setContentProvider(new ArrayContentProvider());
  Table table=tableViewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  tableViewer.setInput(resultSetList);
  getSite().setSelectionProvider(tableViewer);
  CTabItem resultsTabItem=tabFolder.getSelection();
  if (resultsTabItem == null) {
    resultsTabItem=new CTabItem(tabFolder,SWT.NONE);
    resultsTabItem.setText("Results");
    tabFolder.setSelection(resultsTabItem);
  }
  resultsTabItem.setControl(table);
  enableDisableToolBars(true);
}
 

Example 31

From project org.openscada.orilla, under directory /org.openscada.ae.ui.views/src/org/openscada/ae/ui/views/views/.

Source file: EventPoolView.java

  21 
vote

private void insertElements(final Set<DecoratedEvent> decoratedEvents){
  final Table table=this.eventsTable.getTableViewer().getTable();
  TableItem item=null;
  try {
    item=table.getItem(table.getTopIndex());
  }
 catch (  final IllegalArgumentException e) {
  }
  this.pool.addAll(decoratedEvents);
  if (item != null) {
    try {
      if (this.eventsTable.isScrollLock()) {
        table.setTopIndex(table.indexOf(item));
      }
    }
 catch (    final IllegalArgumentException e) {
    }
  }
}
 

Example 32

From project PSP-NetParty, under directory /src/pspnetparty/client/swt/.

Source file: LobbyServerSelectDialog.java

  21 
vote

@Override protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  composite.setLayout(new GridLayout(1,false));
  TableViewer viewer=new TableViewer(composite,SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
  Table table=viewer.getTable();
  table.setHeaderVisible(true);
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  TableColumn titleColumn=new TableColumn(table,SWT.LEFT);
  titleColumn.setText("??????");
  TableColumn userCountColumn=new TableColumn(table,SWT.RIGHT);
  userCountColumn.setText("???????");
  TableColumn addressColumn=new TableColumn(table,SWT.LEFT);
  addressColumn.setText("??????");
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(LobbyServerInfo.LABEL_PROVIDER);
  viewer.setInput(serverList);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent e){
      IStructuredSelection selection=(IStructuredSelection)e.getSelection();
      selectedServer=(LobbyServerInfo)selection.getFirstElement();
      getButton(OK).setEnabled(selectedServer != null);
    }
  }
);
  viewer.addDoubleClickListener(new IDoubleClickListener(){
    @Override public void doubleClick(    DoubleClickEvent e){
      IStructuredSelection selection=(IStructuredSelection)e.getSelection();
      selectedServer=(LobbyServerInfo)selection.getFirstElement();
      setReturnCode(OK);
      close();
    }
  }
);
  addressColumn.pack();
  userCountColumn.pack();
  titleColumn.pack();
  table.select(0);
  return composite;
}
 

Example 33

From project radrails, under directory /plugins/com.aptana.rdt.profiling/src/com/aptana/rdt/internal/profiling/.

Source file: ExecutionStatisticsView.java

  21 
vote

private TableViewer createStatisticsTable(Composite parent){
  TableViewer view=new TableViewer(parent,SWT.SINGLE | SWT.FULL_SELECTION);
  Table serverTable=view.getTable();
  serverTable.setHeaderVisible(true);
  serverTable.setLinesVisible(true);
  serverTable.setLayoutData(new GridData(GridData.FILL_BOTH));
  TableColumn classCol=new TableColumn(serverTable,SWT.LEFT);
  classCol.setText("Class");
  classCol.setWidth(150);
  TableColumn nameCol=new TableColumn(serverTable,SWT.LEFT);
  nameCol.setText("Method");
  nameCol.setWidth(150);
  TableColumn selfPercentCol=new TableColumn(serverTable,SWT.LEFT);
  selfPercentCol.setText("Self Time [%]");
  selfPercentCol.setWidth(100);
  TableColumn statusCol=new TableColumn(serverTable,SWT.LEFT);
  statusCol.setText("Invocations");
  statusCol.setWidth(50);
  TableColumn selfCol=new TableColumn(serverTable,SWT.LEFT);
  selfCol.setText("Self time");
  selfCol.setWidth(50);
  TableColumn waitCol=new TableColumn(serverTable,SWT.LEFT);
  waitCol.setText("Wait time");
  waitCol.setWidth(50);
  TableColumn childCol=new TableColumn(serverTable,SWT.LEFT);
  childCol.setText("Child time");
  childCol.setWidth(50);
  TableColumn avgTimeCol=new TableColumn(serverTable,SWT.LEFT);
  avgTimeCol.setText("Time per invocation");
  avgTimeCol.setWidth(150);
  view.setLabelProvider(new ExecutionLabelProvider());
  view.setContentProvider(new ExecutionContentProvider());
  TableViewerSorter.bind(view);
  return view;
}
 

Example 34

From project recommenders, under directory /plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/providers/.

Source file: OverridesProvider.java

  21 
vote

private void addDirectives(final MethodPattern pattern,final int index){
  final int patternPercentage=(int)Math.rint(100 * pattern.getNumberOfObservations() / totalNumberOfExamples);
  final String text=format("Pattern #%d (%d%% - %d examples):",index,patternPercentage,pattern.getNumberOfObservations());
  createLabel(container,text,true,false,SWT.COLOR_DARK_GRAY,true);
  final Composite group=createGridComposite(container,1,0,0,0,0);
  final List<Entry<IMethodName,Double>> s=Lists.newLinkedList(pattern.getMethods().entrySet());
  Collections.sort(s,new Comparator<Entry<IMethodName,Double>>(){
    @Override public int compare(    final Entry<IMethodName,Double> o1,    final Entry<IMethodName,Double> o2){
      return o1.getKey().getName().compareTo(o2.getKey().getName());
    }
  }
);
  final Table table=new Table(group,SWT.NONE | SWT.HIDE_SELECTION);
  table.setBackground(ExtdocUtils.createColor(SWT.COLOR_INFO_BACKGROUND));
  table.setLayoutData(GridDataFactory.fillDefaults().indent(10,0).create());
  final TableColumn column1=new TableColumn(table,SWT.NONE);
  final TableColumn column2=new TableColumn(table,SWT.NONE);
  final TableColumn column3=new TableColumn(table,SWT.NONE);
  final TableColumn column4=new TableColumn(table,SWT.NONE);
  for (  final Entry<IMethodName,Double> entry : s) {
    final int percentage=(int)Math.rint(entry.getValue() * 100);
    final String phraseText=percentageToRecommendationPhrase(percentage);
    final String stats=format(" -   (%d %%)",percentage);
    final Link bar=createMethodLink(table,entry.getKey(),resolver,workspaceBus);
    final TableItem item=new TableItem(table,SWT.NONE);
    item.setText(new String[]{phraseText,"override",bar.getText(),stats});
    item.setFont(0,JFaceResources.getBannerFont());
    item.setForeground(createColor(COLOR_INFO_FOREGROUND));
    final TableEditor editor=new TableEditor(table);
    editor.grabHorizontal=editor.grabVertical=true;
    editor.setEditor(bar,item,2);
  }
  column1.pack();
  column2.pack();
  column3.pack();
  column4.pack();
  new Label(container,SWT.SEPARATOR | SWT.HORIZONTAL);
}
 

Example 35

From project scisoft-ui, under directory /uk.ac.diamond.scisoft.analysis.rcp/src/uk/ac/diamond/scisoft/analysis/rcp/inspector/.

Source file: AxisSelectionTable.java

  21 
vote

/** 
 * @param parent
 * @param listener 
 */
public AxisSelectionTable(Composite parent,ICellEditorListener listener){
  super(parent,SWT.NONE);
  cListener=listener;
  axesSelector=new TableViewer(this,SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL| SWT.H_SCROLL| SWT.FULL_SELECTION| SWT.HIDE_SELECTION);
  setLayout(new FillLayout());
  asColumns=new ArrayList<TableColumn>();
  TableViewerColumn tVCol=new TableViewerColumn(axesSelector,SWT.NONE);
  TableColumn tCol=tVCol.getColumn();
  asColumns.add(tCol);
  tCol.setText("Dim");
  tCol.setToolTipText("Dimension of dataset array");
  tCol.setWidth(40);
  tCol.setResizable(false);
  int columns=5;
  for (int i=1; i < columns; i++) {
    tVCol=new TableViewerColumn(axesSelector,SWT.NONE);
    tCol=tVCol.getColumn();
    asColumns.add(tCol);
    tCol.setText(String.valueOf(i));
    tCol.setWidth(asWidth);
    tCol.setMoveable(false);
    tVCol.setEditingSupport(new AxisSelectionEditing(axesSelector,i,cListener));
  }
  final Table tab=axesSelector.getTable();
  tab.setHeaderVisible(true);
  axesSelector.setContentProvider(new AxisSelectionContentProvider());
  lProvider=new AxisSelectionLabelProvider(axes);
  axesSelector.setLabelProvider(lProvider);
}
 

Example 36

From project tabris-demos, under directory /com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/.

Source file: VisualGuideDemo.java

  21 
vote

private void createTable(){
  final Shell shell=new Shell(display,SWT.NONE);
  shell.setLayout(new FillLayout());
  Table table=new Table(shell,SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
  table.setToolTipText("A Table");
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  String[] titles={"Column0","Column1","Column2"};
  for (int i=0; i < titles.length; i++) {
    TableColumn column=new TableColumn(table,SWT.NONE);
    column.setText(titles[i]);
  }
  int count=128;
  for (int i=0; i < count; i++) {
    TableItem item=new TableItem(table,SWT.NONE);
    item.setText(0,"row " + i + " item 0");
    item.setText(1,"row " + i + " item 1");
    item.setText(2,"row " + i + " item 2");
  }
  for (int i=0; i < titles.length; i++) {
    table.getColumn(i).pack();
  }
  shell.pack();
  shell.open();
}
 

Example 37

From project texlipse, under directory /net.sourceforge.texlipse/source/net/sourceforge/texlipse/tableview/views/.

Source file: TexTableView.java

  21 
vote

/** 
 * This is a callback that will allow us to create the viewer and initialize it.
 */
public void createPartControl(Composite parent){
  GridData gridData=new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_BOTH);
  parent.setLayoutData(gridData);
  GridLayout layout=new GridLayout(1,false);
  layout.marginWidth=4;
  parent.setLayout(layout);
  Table table=createTable(parent);
  viewer=new TableViewer(table);
  viewer.setUseHashlookup(true);
  viewer.setColumnProperties(columnNames);
  viewer.setContentProvider(new ViewContentProvider());
  viewer.setLabelProvider(new ViewLabelProvider());
  viewer.setInput(rowList);
  CellEditor[] editors=new CellEditor[TexRow.COLUMNS];
  for (int i=0; i < TexRow.COLUMNS; i++) {
    editors[i]=new TextCellEditor(table);
    ((Text)editors[i].getControl()).setTextLimit(256);
    editors[i].getControl().addKeyListener(new TexCellListener(viewer,rowList,i));
  }
  viewer.setCellEditors(editors);
  viewer.setCellModifier(new TexCellModifier(viewer,rowList));
}
 

Example 38

From project trademaker, under directory /src/org/lifeform/gui/dialog/.

Source file: StockTableTree.java

  21 
vote

/** 
 * Creates the main window's contents
 * @param parent the main window
 * @return Control
 */
@Override protected Control createContents(final Composite parent){
  ttv=new TableTreeViewer(parent);
  ttv.getTableTree().setLayoutData(new GridData(GridData.FILL_BOTH));
  ttv.setContentProvider(new StockTreeContentProvider());
  ttv.setLabelProvider(new StockTreeLabelProvider());
  ttv.setInput(new StockTableModel());
  Table table=ttv.getTableTree().getTable();
  new TableColumn(table,SWT.LEFT).setText("Quote Name");
  new TableColumn(table,SWT.LEFT).setText("Full Name");
  new TableColumn(table,SWT.RIGHT).setText("Points");
  new TableColumn(table,SWT.RIGHT).setText("Rebounds");
  new TableColumn(table,SWT.RIGHT).setText("Assists");
  ttv.expandAll();
  for (int i=0, n=table.getColumnCount(); i < n; i++) {
    table.getColumn(i).pack();
  }
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  parent.pack();
  ttv.reveal(ttv.getElementAt(0));
  return ttv.getTableTree();
}
 

Example 39

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/.

Source file: AstTreeViewPart.java

  20 
vote

@Override public void createPartControl(Composite parent){
  display=parent.getDisplay();
  IEditorPart part=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
  if (part instanceof ITextEditor) {
    SelectionListenerWithASTManager.getDefault().addListener((ITextEditor)part,this);
  }
  table=new Table(parent,SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  String[] titles={"Annotation Name","Annotation Value"};
  for (  String title : titles) {
    TableColumn column=new TableColumn(table,SWT.NONE);
    column.setText(title);
  }
  for (int i=0; i < titles.length; i++) {
    table.getColumn(i).pack();
  }
  table.setSize(table.computeSize(SWT.DEFAULT,200));
}
 

Example 40

From project dawn-isenciaui, under directory /com.teaminabox.eclipse.wiki/src/com/teaminabox/eclipse/wiki/preferences/.

Source file: WikiSpacePreferencePage.java

  20 
vote

private void createControl(final Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=1;
  layout.marginHeight=0;
  layout.marginWidth=0;
  container.setLayout(layout);
  Composite basicComposite=new Composite(container,SWT.NONE);
  layout=new GridLayout(2,false);
  layout.marginHeight=0;
  layout.marginWidth=0;
  basicComposite.setLayout(layout);
  Label label=new Label(basicComposite,SWT.WRAP);
  label.setText(WikiPlugin.getResourceString("WikiSpacePreferencePage.description"));
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  label.setLayoutData(gd);
  table=new Table(basicComposite,SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  TableLayout tableLayout=new TableLayout();
  table.setLayout(tableLayout);
  table.setLayoutData(new GridData(GridData.FILL_BOTH));
  prefixColumn=new TableColumn(table,SWT.NONE);
  prefixColumn.setText(WikiPlugin.getResourceString("WikiSpacePreferencePage.prefix"));
  urlColumn=new TableColumn(table,SWT.NONE);
  urlColumn.setText(WikiPlugin.getResourceString("WikiSpacePreferencePage.url"));
  createButtons(basicComposite);
  load();
}
 

Example 41

From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/editorpage/imagecombo/.

Source file: ImageCombo.java

  20 
vote

void createPopup(int selectionIndex){
  popup=new Shell(getShell(),SWT.NO_TRIM | SWT.ON_TOP);
  int style=getStyle();
  int listStyle=SWT.SINGLE | SWT.V_SCROLL;
  if ((style & SWT.FLAT) != 0)   listStyle|=SWT.FLAT;
  if ((style & SWT.RIGHT_TO_LEFT) != 0)   listStyle|=SWT.RIGHT_TO_LEFT;
  if ((style & SWT.LEFT_TO_RIGHT) != 0)   listStyle|=SWT.LEFT_TO_RIGHT;
  table=new Table(popup,listStyle);
  if (font != null)   table.setFont(font);
  if (foreground != null)   table.setForeground(foreground);
  if (background != null)   table.setBackground(background);
  int[] popupEvents={SWT.Close,SWT.Paint,SWT.Deactivate};
  for (int i=0; i < popupEvents.length; i++)   popup.addListener(popupEvents[i],listener);
  int[] listEvents={SWT.MouseUp,SWT.Selection,SWT.Traverse,SWT.KeyDown,SWT.KeyUp,SWT.FocusIn,SWT.Dispose};
  for (int i=0; i < listEvents.length; i++)   table.addListener(listEvents[i],listener);
  if (selectionIndex != -1)   table.setSelection(selectionIndex);
}
 

Example 42

From project Eclipse, under directory /com.mobilesorcery.sdk.ui/src/com/mobilesorcery/sdk/ui/internal/properties/.

Source file: BuildConfigurationsPropertyPage.java

  20 
vote

@Override public Control createDialogArea(Composite parent){
  getShell().setText("Edit Build Configuration");
  Composite main=(Composite)super.createDialogArea(parent);
  Label nameLabel=new Label(main,SWT.NONE);
  nameLabel.setText("Configuration &Name:");
  name=new Text(main,SWT.SINGLE | SWT.BORDER);
  name.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  name.setText(configuration.getId());
  name.selectAll();
  Label cfgTypesLabel=new Label(main,SWT.NONE);
  cfgTypesLabel.setText("Configuration &Types:");
  cfgTypesTable=new Table(main,SWT.CHECK | SWT.BORDER | SWT.V_SCROLL| SWT.H_SCROLL);
  GridData cfgTypesData=new GridData(GridData.FILL_HORIZONTAL);
  cfgTypesData.heightHint=UIUtils.getDefaultListHeight() / 2;
  cfgTypesTable.setLayoutData(cfgTypesData);
  TreeSet<String> sortedCfgTypes=new TreeSet<String>(Arrays.asList(CoreMoSyncPlugin.getDefault().getBuildConfigurationTypes()));
  for (  String cfgType : sortedCfgTypes) {
    TableItem cfgTypeItem=new TableItem(cfgTypesTable,SWT.NONE);
    cfgTypeItem.setText(cfgType);
    cfgTypeItem.setData(cfgType);
    cfgTypeItem.setChecked(configuration.getTypes().contains(cfgType));
  }
  return main;
}
 

Example 43

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/preferences/hsimpls/.

Source file: ImplementationsBlock.java

  20 
vote

private void createTable(final Composite parent){
  int style=SWT.CHECK | SWT.BORDER | SWT.MULTI| SWT.FULL_SELECTION;
  table=new Table(parent,style);
  GridData gridData=new GridData(GridData.FILL_BOTH);
  gridData.widthHint=450;
  table.setLayoutData(gridData);
  table.setFont(parent.getFont());
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    final KeyEvent event){
      if (event.character == SWT.DEL && event.stateMask == 0) {
        removeSelectedInstallations();
      }
    }
  }
);
}
 

Example 44

From project m2eclipse-webby, under directory /org.sonatype.m2e.webby/src/org/sonatype/m2e/webby/internal/view/.

Source file: WebbyView.java

  20 
vote

@Override public void createPartControl(Composite parent){
  parent.setLayout(new GridLayout());
  table=new Table(parent,SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
  table.setFont(parent.getFont());
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  TableColumn col=new TableColumn(table,SWT.LEFT);
  col.setText("Context");
  col.setMoveable(true);
  col.setWidth(200);
  col=new TableColumn(table,SWT.RIGHT);
  col.setText("Port");
  col.setMoveable(true);
  col.setWidth(100);
  col=new TableColumn(table,SWT.LEFT);
  col.setText("Container");
  col.setMoveable(true);
  col.setWidth(200);
  table.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      updateActions();
    }
    @Override public void widgetDefaultSelected(    SelectionEvent e){
      browse((e.stateMask & EXTERNAL_BROWSER_MOD_MASK) != 0);
    }
  }
);
  for (  IWebApp webApp : webAppRegistry.getWebApps()) {
    add(webApp);
  }
  webAppRegistry.addListener(this);
  createActions();
  createToolbar();
  hookContextMenu();
}
 

Example 45

From project mylyn.incubator, under directory /org.eclipse.mylyn.monitor.usage/src/org/eclipse/mylyn/internal/monitor/usage/wizards/.

Source file: UsageDataOverviewPage.java

  20 
vote

private void createTable(Composite parent){
  int style=SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL| SWT.V_SCROLL| SWT.FULL_SELECTION| SWT.HIDE_SELECTION;
  table=new Table(parent,style);
  TableLayout tlayout=new TableLayout();
  table.setLayout(tlayout);
  GridData wd=new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL | GridData.GRAB_HORIZONTAL| GridData.GRAB_VERTICAL);
  table.setLayoutData(wd);
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  TableColumn column=new TableColumn(table,SWT.LEFT,0);
  column.setText(columnNames[0]);
  column.setWidth(60);
  column.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      tableViewer.setSorter(new InteractionEventSummarySorter(InteractionEventSummarySorter.TYPE));
    }
  }
);
  column=new TableColumn(table,SWT.LEFT,1);
  column.setText(columnNames[1]);
  column.setWidth(370);
  column.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      tableViewer.setSorter(new InteractionEventSummarySorter(InteractionEventSummarySorter.NAME));
    }
  }
);
  column=new TableColumn(table,SWT.LEFT,2);
  column.setText(columnNames[2]);
  column.setWidth(50);
  column.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      tableViewer.setSorter(new InteractionEventSummarySorter(InteractionEventSummarySorter.USAGE_COUNT));
    }
  }
);
}
 

Example 46

From project Newsreader, under directory /bundles/org.eclipse.ecf.salvo.ui/src/org/eclipse/ecf/salvo/ui/internal/dialogs/.

Source file: ThisUserArticlesComposite.java

  20 
vote

private void initUIComponents(){
  try {
    this.setLayout(new GridLayout());
{
      articleTable=new Table(this,SWT.BORDER);
      articleTable.setHeaderVisible(true);
      articleTable.setLinesVisible(true);
      articleTable.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
      subjectColumn=new TableColumn(articleTable,SWT.NONE);
      subjectColumn.setText("Subject");
      subjectColumn.setWidth(300);
      DateColumn=new TableColumn(articleTable,SWT.NONE);
      DateColumn.setText("Date");
      DateColumn.setWidth(50);
      articleTable.addSelectionListener(new SelectionListener(){
        public void widgetSelected(        SelectionEvent arg0){
          showArticleBody();
        }
        public void widgetDefaultSelected(        SelectionEvent arg0){
        }
      }
);
    }
{
      articleBodyComposite=new Composite(this,SWT.BORDER);
      articleBodyComposite.setLayout(new GridLayout());
      articleBodyComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    }
    this.layout();
  }
 catch (  Exception e) {
    Debug.log(getClass(),e);
  }
}
 

Example 47

From project substeps-eclipse-plugin, under directory /com.technophobia.substeps.testlauncher/src/main/java/com/technophobia/substeps/junit/ui/.

Source file: FailureTrace.java

  20 
vote

public FailureTrace(final Composite parent,final Clipboard clipboard,final ToolBar toolBar,final SubstepsIconProvider iconProvider,final NotifyingUiUpdater<String> infoMessageUpdater,final Supplier<SubstepsRunSession> substepsRunSessionSupplier){
  Assert.isNotNull(clipboard);
  this.infoMessageNotifier=infoMessageUpdater;
  this.substepsRunSessionSupplier=substepsRunSessionSupplier;
  final ToolBarManager failureToolBarmanager=new ToolBarManager(toolBar);
  failureToolBarmanager.add(new EnableStackFilterAction(this,iconProvider));
  compareAction=new CompareResultsAction(parent.getShell(),failedTestSupplier(),iconProvider);
  compareAction.setEnabled(false);
  failureToolBarmanager.add(compareAction);
  failureToolBarmanager.update(true);
  this.table=new Table(parent,SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
  this.clipboard=clipboard;
  this.parent=parent;
  final OpenStrategy handler=new OpenStrategy(table);
  handler.addOpenListener(new IOpenEventListener(){
    @Override public void handleOpen(    final SelectionEvent e){
      if (table.getSelectionIndex() == 0 && failure.isComparisonFailure()) {
        compareAction.run();
      }
      if (table.getSelection().length != 0) {
        final Action a=createOpenEditorAction(getSelectedText());
        if (a != null)         a.run();
      }
    }
  }
);
  initMenu();
  failureTableDisplay=new FailureTableDisplay(table,iconProvider);
}
 

Example 48

From project TableAllocationProj, under directory /TableAllocationProj/src/.

Source file: TestShell.java

  20 
vote

/** 
 * Create the shell.
 * @param display
 */
public TestShell(Display display){
  super(display,SWT.SHELL_TRIM);
  setLayout(null);
  ScrolledComposite scrolledComposite=new ScrolledComposite(this,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
  scrolledComposite.setBounds(3,3,300,200);
  scrolledComposite.setExpandHorizontal(true);
  scrolledComposite.setExpandVertical(true);
  table=new Table(scrolledComposite,SWT.BORDER | SWT.FULL_SELECTION);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  TableColumn tblclmnId=new TableColumn(table,SWT.NONE);
  tblclmnId.setWidth(100);
  tblclmnId.setText("id");
  TableColumn tblclmnName=new TableColumn(table,SWT.NONE);
  tblclmnName.setWidth(100);
  tblclmnName.setText("name");
  tableItem=new TableItem(table,SWT.NONE);
  tableItem.setText("123123");
  TableItem tableItem_1=new TableItem(table,SWT.NONE);
  tableItem_1.setText(new String[]{"123","312","1123","32"});
  TableColumn tblclmnSome=new TableColumn(table,SWT.NONE);
  tblclmnSome.setWidth(100);
  tblclmnSome.setText("some");
  scrolledComposite.setContent(table);
  scrolledComposite.setMinSize(table.computeSize(SWT.DEFAULT,SWT.DEFAULT));
  Button btnNewButton=new Button(this,SWT.NONE);
  btnNewButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
    }
  }
);
  btnNewButton.setBounds(26,209,80,27);
  btnNewButton.setText("New Button");
  text=new Text(this,SWT.BORDER);
  text.setBounds(130,209,73,23);
  m_bindingContext=initDataBindings();
}
 

Example 49

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/wizards/timeseries/.

Source file: ImportCSVPage.java

  19 
vote

public static void renewTable(Table table){
  for (  TableColumn tblCol : table.getColumns()) {
    tblCol.dispose();
  }
  table.removeAll();
}
 

Example 50

From project grails-ide, under directory /org.grails.ide.eclipse.editor.gsp/src/org/grails/ide/eclipse/editor/gsp/wizard/.

Source file: NewGSPTemplatesWizardPage.java

  19 
vote

/** 
 * Correctly resizes the table so no phantom columns appear
 * @param parent the parent control
 * @param buttons the buttons
 * @param table the table
 * @param column1 the first column
 * @param column2 the second column
 * @param column3 the third column
 */
private void configureTableResizing(final Composite parent,final Table table,final TableColumn column1,final TableColumn column2){
  parent.addControlListener(new ControlAdapter(){
    public void controlResized(    ControlEvent e){
      Rectangle area=parent.getClientArea();
      Point preferredSize=table.computeSize(SWT.DEFAULT,SWT.DEFAULT);
      int width=area.width - 2 * table.getBorderWidth();
      if (preferredSize.y > area.height) {
        Point vBarSize=table.getVerticalBar().getSize();
        width-=vBarSize.x;
      }
      Point oldSize=table.getSize();
      if (oldSize.x > width) {
        column1.setWidth(width / 2);
        column2.setWidth(width / 2);
        table.setSize(width,area.height);
      }
 else {
        table.setSize(width,area.height);
        column1.setWidth(width / 2);
        column2.setWidth(width / 2);
      }
    }
  }
);
}
 

Example 51

From project gted, under directory /net.sf.gted.editor/src/net/sf/gted/editor/entry/detail/.

Source file: EntryDetailsPage.java

  19 
vote

/** 
 * Create a references table viewer. @note the given viewer will be overriden.
 * @param viewer table viewer reference which should be recreated
 * @param entry current selected po entry
 * @param table the tabe
 * @param columnNames column names
 * @param poFile source po file
 */
protected void createReferencesViewer(TableViewer viewer,POEntry entry,Table table,String[] columnNames,final IFile poFile){
  viewer=new TableViewer(table);
  viewer.setUseHashlookup(true);
  viewer.setColumnProperties(columnNames);
  viewer.setContentProvider(new ReferenceTableContentProvider());
  viewer.setLabelProvider(new ReferenceTableLabelProvider());
  viewer.setInput(entry);
  viewer.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    final DoubleClickEvent event){
      final Object obj=((StructuredSelection)event.getSelection()).getFirstElement();
      if (obj instanceof POReference) {
        final POReference reference=(POReference)obj;
        final Integer lineNumber=reference.lineAsInteger();
        String filename=applySourceFilePathPrefixIfPresent(reference);
        final IFile sourcefile=poFile.getProject().getFile(filename);
        OpenEditorHelper.openEditor(sourcefile,lineNumber);
      }
    }
  }
);
}
 

Example 52

From project m2e-apt, under directory /org.jboss.tools.maven.apt.ui/src/org/jboss/tools/maven/apt/ui/preferences/xpl/.

Source file: SWTUtil.java

  19 
vote

public static int getTableHeightHint(Table table,int rows){
  if (table.getFont().equals(JFaceResources.getDefaultFont()))   table.setFont(JFaceResources.getDialogFont());
  int result=table.getItemHeight() * rows + table.getHeaderHeight();
  if (table.getLinesVisible())   result+=table.getGridLineWidth() * (rows - 1);
  return result;
}
 

Example 53

From project marabou, under directory /src/main/java/net/launchpad/marabou/audio/.

Source file: AudioFileItem.java

  19 
vote

/** 
 * Reads values of various audio files via the jaudiotagger lib
 * @param fileToOpen full path of the file to be opened
 * @param table the table which holds the new tableItem
 * @param style style for the tableItem
 * @throws InvalidDataException 
 * @throws CannotReadException
 * @throws IOException
 * @throws TagException
 * @throws ReadOnlyFileException
 * @throws InvalidAudioFrameException
 */
public AudioFileItem(String fileToOpen,Table table,int style) throws InvalidDataException, IOException {
  if (fileToOpen != null) {
    try {
      mp3=new Mp3File(fileToOpen);
    }
 catch (    UnsupportedTagException e) {
      e.printStackTrace();
    }
catch (    InvalidDataException e) {
      throw new InvalidDataException();
    }
catch (    IOException e) {
      throw new IOException();
    }
    this.tag=mp3.getId3v2Tag();
    item=new TableItem(table,style);
  }
}
 

Example 54

From project mylyn.context, under directory /org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/editors/.

Source file: InvisibleContextElementsPart.java

  19 
vote

private void createColumn(TableColumnLayout layout,final int index,String label,int weight,final Table table,final InteractionElementTableSorter invisibleTableSorter){
  final TableColumn column=new TableColumn(table,SWT.LEFT,index);
  column.setText(label);
  column.setToolTipText(label);
  column.setResizable(true);
  layout.setColumnData(column,new ColumnPixelData(weight,true));
  column.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      invisibleTableSorter.setCriteria(index);
      table.setSortColumn(column);
      if (invisibleTableSorter.isDecending()) {
        table.setSortDirection(SWT.UP);
      }
 else {
        table.setSortDirection(SWT.DOWN);
      }
      invisibleTable.refresh();
    }
  }
);
}
 

Example 55

From project titanium_studio_sdk, under directory /samples/publish/plugins/com.appcelerator.titanium.publish.sample/src/com/appcelerator/titanium/publish/sample/preferences/.

Source file: SamplePreferencePage.java

  19 
vote

@Override protected void createPublishTargetTableColumns(Table table){
  for (int i=0; i < COLUMN_HEADERS.length; ++i) {
    TableColumn column=new TableColumn(table,SWT.LEFT);
    column.setText(COLUMN_HEADERS[i]);
    column.setResizable(true);
    column.setWidth(convertWidthInCharsToPixels(COLUMN_CHAR_WIDTHS[i]));
    column.addSelectionListener(new SelectionListener(){
      public void widgetDefaultSelected(      SelectionEvent e){
        columnSelected((TableColumn)e.widget);
      }
      public void widgetSelected(      SelectionEvent e){
        columnSelected((TableColumn)e.widget);
      }
    }
);
  }
}