Java Code Examples for org.eclipse.jface.viewers.TableViewer#setUseHashlookup()

The following examples show how to use org.eclipse.jface.viewers.TableViewer#setUseHashlookup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuleTableViewer.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
private void createTableViewer() {
	
	tableViewer = new TableViewer(table);
	tableViewer.setUseHashlookup(true);
	
	tableViewer.setColumnProperties(columnNames);
	
	// Create the cell editors
	CellEditor[] editors = new CellEditor[columnNames.length];
	
	// Column 1 : nothing
	editors[0] = null;
	// Columns 2 : checkbox
	editors[1] = new CheckboxCellEditor(table);
	
	// Assign the cell editors to the viewer 
	tableViewer.setCellEditors(editors);
	// Set the cell modifier for the viewer
	tableViewer.setCellModifier(new ExtensionCellModifier(this));
}
 
Example 2
Source File: ModuleTableViewer.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
private void createTableViewer() {
	
	tableViewer = new TableViewer(table);
	tableViewer.setUseHashlookup(true);
	
	tableViewer.setColumnProperties(columnNames);
	
	// Create the cell editors
	CellEditor[] editors = new CellEditor[columnNames.length];
	
	// Column 1 : nothing
	editors[0] = null;
	// Columns 2,3,4 : checkboxes
	editors[1] = new CheckboxCellEditor(table);
	editors[2] = new CheckboxCellEditor(table);
	editors[3] = new CheckboxCellEditor(table);
	
	// Assign the cell editors to the viewer 
	tableViewer.setCellEditors(editors);
	// Set the cell modifier for the viewer
	tableViewer.setCellModifier(new ExtensionCellModifier(this));
	// Set the default sorter for the viewer 
	//tableViewer.setSorter(new ExtensionSorter(ExtensionSorter.NAME));
	
}
 
Example 3
Source File: MultiPageCSVEditor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 *
 */
private void createTablePage() {
	final Composite parent = getContainer();
	final Composite intermediate = new Composite(parent, SWT.NONE);
	final Composite composite = GamaToolbarFactory.createToolbars(this, intermediate);
	tableViewer =
			new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
	tableViewer.setUseHashlookup(true);
	final Table table = tableViewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
	// set the sorter for the table

	tableViewer.setComparator(tableSorter);
	// set a table filter
	tableViewer.addFilter(tableFilter);

	addPage(intermediate);
	setPageText(indexTBL, "Table");
}
 
Example 4
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintsDefinitionViewer(AbstractBdmFormPage formPage, Composite parent) {
    constraintViewer = new TableViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    constraintViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create());
    constraintViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, CONSTRAINTS_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(constraintViewer.getTable());
    ColumnViewerToolTipSupport.enableFor(constraintViewer);
    constraintViewer.setUseHashlookup(true);
    constraintViewer.getTable().setHeaderVisible(true);
    constraintViewer.getTable().setLinesVisible(true);
    constraintViewer.addFilter(createSearchFilter());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    layout.addColumnData(new ColumnWeightData(1, true));
    constraintViewer.getTable().setLayout(layout);

    createConstraintnameColumn(constraintViewer);
    createAttributesColumn(constraintViewer);

    constraintViewer.setContentProvider(new ObservableListContentProvider());
    constraintViewer.setInput(constraintsObservable);
    selectedConstraintObservable = ViewerProperties.singleSelection(UniqueConstraint.class).observe(constraintViewer);
}
 
Example 5
Source File: AdditionalResourcesConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createViewer(Composite parent) {
    viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    ColumnViewerToolTipSupport.enableFor(viewer);
    viewer.setUseHashlookup(true);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    layout.addColumnData(new ColumnWeightData(1, true));
    viewer.getTable().setLayout(layout);

    createNameColumn();
    createFileColumn();

    viewer.setContentProvider(new ArrayContentProvider());
}
 
Example 6
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createIndexViewer(Composite parent) {
    indexViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    indexViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).span(2, 1).hint(350, SWT.DEFAULT).create());
    indexViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, INDEX_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(indexViewer.getTable());
    ColumnViewerToolTipSupport.enableFor(indexViewer);
    indexViewer.setUseHashlookup(true);
    indexViewer.getTable().setHeaderVisible(true);
    indexViewer.getTable().setLinesVisible(true);
    indexViewer.addFilter(createSearchFilter());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    layout.addColumnData(new ColumnWeightData(1, true));
    indexViewer.getTable().setLayout(layout);

    createIndexNameColumn(indexViewer);
    createAttributesColumn(indexViewer);

    indexViewer.setContentProvider(new ObservableListContentProvider());
    indexViewer.setInput(indexObservable);
    selectedIndexObservable = ViewerProperties.singleSelection(Index.class).observe(indexViewer);
}
 
Example 7
Source File: ElementNamesConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * create a tableview for the existed table
 * 
 */
private void createTableViewer( )
{
	tableViewer = new TableViewer( table );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( elementNames );

	// Create the cell editors
	CellEditor[] editors = new CellEditor[elementNames.length];

	for ( int i = 0; i < elementNames.length; i++ )
	{
		TextCellEditor textEditor = new TextCellEditor( table );
		( (Text) textEditor.getControl( ) ).setTextLimit( 60 );
		if ( i == 1 )
		{
			// assure that the CUSTOM NAME column doesn't contain
			// ReportPlugin.PREFERENCE_DELIMITER
			( (Text) textEditor.getControl( ) ).addVerifyListener(

			new VerifyListener( ) {

				public void verifyText( VerifyEvent e )
				{
					e.doit = e.text.indexOf( ReportPlugin.PREFERENCE_DELIMITER ) < 0;
				}
			} );

		}
		editors[i] = textEditor;
	}

	// Assign the cell editors to the viewer
	tableViewer.setCellEditors( editors );
	// Set the cell modifier for the viewer
	tableViewer.setCellModifier( new ElementNamesCellModifier( this ) );
}
 
Example 8
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createAttributeTableViewer(Composite parent) {
    viewer = new TableViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ATTRIBUTE_LIST_VIEWER_ID);
    formPage.getToolkit().adapt(viewer.getTable());
    ColumnViewerToolTipSupport.enableFor(viewer);
    viewer.setUseHashlookup(true);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);
    viewer.addFilter(new SearchFilter<>(fieldToFilter));

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(5, true));
    layout.addColumnData(new ColumnWeightData(4, true));
    layout.addColumnData(new ColumnWeightData(3, true));
    layout.addColumnData(new ColumnWeightData(3, true));
    viewer.getTable().setLayout(layout);

    createNameColumn(viewer);
    createTypeColumn(viewer);
    createMultipleColumn(viewer);
    createMandatoryColumn(viewer);

    viewer.setContentProvider(new ObservableListContentProvider());
    viewer.setInput(fieldsObservable);
    selectedFieldObservable = ViewerProperties.singleSelection(Field.class).observe(viewer);

    addDragAndDropSupport();
}
 
Example 9
Source File: FileSearchPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureTableViewer(TableViewer viewer) {
    viewer.setUseHashlookup(true);
    FileLabelProvider innerLabelProvider = new FileLabelProvider(this, fCurrentSortOrder);
    viewer.setLabelProvider(innerLabelProvider);
    viewer.setContentProvider(new FileTableContentProvider(this));
    viewer.setComparator(new DecoratorIgnoringViewerSorter(innerLabelProvider));
    fContentProvider = (IFileSearchContentProvider) viewer.getContentProvider();
    addDragAdapters(viewer);
}
 
Example 10
Source File: FormPropertyDescriptor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the TableViewer and set all kinds of processors.
 * 
 */
private void createTableViewer( )
{

	tableViewer = new TableViewer( table );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( ( (IFormProvider) getDescriptorProvider( ) ).getColumnNames( ) );
	CellEditor[] editors = ( (IFormProvider) getDescriptorProvider( ) ).getEditors( table );
	if ( editors != null && editors.length > 0 )
	{
		tableViewer.setCellEditors( ( (IFormProvider) getDescriptorProvider( ) ).getEditors( table ) );
		tableViewer.setCellModifier( new FormCellModifier( ) );
	}
	else
	{
		tableViewer.setCellModifier( new FormCellModifier( ) {

			public boolean canModify( Object element, String property )
			{
				return false;
			}
		} );
	}
	tableViewer.setContentProvider( ( (AbstractFormHandleProvider) getDescriptorProvider( ) ).getFormContentProvider( this,
			getDescriptorProvider( ) ) );
	tableViewer.setLabelProvider( new FormLabelProvider( ) );

}
 
Example 11
Source File: SortingFormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the TableViewer and set all kinds of processors.
 * 
 */
private void createTableViewer( )
{
	tableViewer = new TableViewer( table );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( provider.getColumnNames( ) );
	tableViewer.setContentProvider( new FormContentProvider( ) );
	tableViewer.setLabelProvider( new FormLabelProvider( ) );
}
 
Example 12
Source File: FormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the TableViewer and set all kinds of processors.
 * 
 */
private void createTableViewer( )
{

	tableViewer = new TableViewer( table );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( provider.getColumnNames( ) );
	tableViewer.setCellEditors( provider.getEditors( table ) );
	tableViewer.setContentProvider( new FormContentProvider( ) );
	tableViewer.setLabelProvider( new FormLabelProvider( ) );
	tableViewer.setCellModifier( new FormCellModifier( ) );

}
 
Example 13
Source File: FormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the TableViewer and set all kinds of processors.
 * 
 */
private void createTableViewer( )
{

	tableViewer = new TableViewer( table );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( provider.getColumnNames( ) );
	tableViewer.setCellEditors( provider.getEditors( table ) );
	tableViewer.setContentProvider( new FormContentProvider( ) );
	tableViewer.setLabelProvider( new FormLabelProvider( ) );
	tableViewer.setCellModifier( new FormCellModifier( ) );

}
 
Example 14
Source File: ReportItemParametersDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the TableViewer and set all kinds of processors.
 */
private void createTableViewer( )
{
	tableViewer = new TableViewer( table );
	tableViewer.setUseHashlookup( true );
	tableViewer.setColumnProperties( columnNames );
	expressionCellEditor = new ExpressionDialogCellEditor( table );
	tableViewer.setCellEditors( new CellEditor[]{
			null, null, expressionCellEditor
	} );
	tableViewer.setContentProvider( new BindingContentProvider( ) );
	tableViewer.setLabelProvider( new BindingLabelProvider( ) );
	tableViewer.setCellModifier( new BindingCellModifier( ) );
}
 
Example 15
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureTableViewer(TableViewer viewer) {
	viewer.setUseHashlookup(true);
	fSortingLabelProvider= new SortingLabelProvider(this);
	viewer.setLabelProvider(new DecoratingJavaLabelProvider(fSortingLabelProvider, false));
	fContentProvider=new JavaSearchTableContentProvider(this);
	viewer.setContentProvider(fContentProvider);
	viewer.setComparator(new DecoratorIgnoringViewerSorter(fSortingLabelProvider));
	setSortOrder(fCurrentSortOrder);
	addDragAdapters(viewer);
}
 
Example 16
Source File: ChangeExceptionsControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createExceptionList(Composite parent) {
	final Table table= new Table(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	table.setLayoutData(new GridData(GridData.FILL_BOTH));

	fTableViewer= new TableViewer(table);
	fTableViewer.setUseHashlookup(true);
	fTableViewer.setContentProvider(new ExceptionInfoContentProvider());
	fTableViewer.setLabelProvider(new ExceptionInfoLabelProvider());
	fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			updateButtonsEnabledState();
		}
	});
}
 
Example 17
Source File: TypeScriptSearchResultPage.java    From typescript.java with MIT License 5 votes vote down vote up
protected void configureTableViewer(TableViewer viewer) {
	viewer.setUseHashlookup(true);
	TypeScriptSearchLabelProvider innerLabelProvider= new TypeScriptSearchLabelProvider(this, fCurrentSortOrder);
	viewer.setLabelProvider(new DecoratingTypeScriptSearchLabelProvider(innerLabelProvider));
	viewer.setContentProvider(new TypeScriptSearchTableContentProvider(this));
	viewer.setComparator(new DecoratorIgnoringViewerSorter(innerLabelProvider));
	fContentProvider= (ITypeScriptSearchContentProvider) viewer.getContentProvider();
	addDragAdapters(viewer);
}
 
Example 18
Source File: TexTableView.java    From texlipse with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This is a callback that will allow us
 * to create the viewer and initialize it.
 */
public void createPartControl(Composite parent) {
    // Create a composite to hold the children
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
            | GridData.FILL_BOTH);
    parent.setLayoutData(gridData);

    //only one component...
    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];

    //ICellEditorListeners
    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));
    }

    // Assign the cell editors to the viewer 
    viewer.setCellEditors(editors);

    // Set the cell modifier for the viewer
    viewer.setCellModifier(new TexCellModifier(viewer, rowList));

    // Set the default sorter for the viewer 
    //viewer.setSorter(new LaTeXRowSorter(LaTeXRowSorter.COLUMN_1));
}
 
Example 19
Source File: IndexEditionControl.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private void createAvailableAttributesTableViewer(Composite parent) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    section.setText(Messages.availableAttributes);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayout(GridLayoutFactory.fillDefaults().create());
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    availableAttributesTableViewer = new TableViewer(client,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
    availableAttributesTableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    availableAttributesTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, AVAILABLE_FIELDS_VIEWER_ID);
    formPage.getToolkit().adapt(availableAttributesTableViewer.getTable());
    ColumnViewerToolTipSupport.enableFor(availableAttributesTableViewer);
    availableAttributesTableViewer.setUseHashlookup(true);
    availableAttributesTableViewer.getTable().setLinesVisible(true);
    availableAttributesTableViewer.setFilters(indexableFieldFilter, indexedFieldsFilter());

    TableLayout layout = new TableLayout();
    layout.addColumnData(new ColumnWeightData(1, true));
    availableAttributesTableViewer.getTable().setLayout(layout);

    createAttributesColumn(availableAttributesTableViewer);

    availableAttributesTableViewer.setContentProvider(new ObservableListContentProvider());
    availableAttributesTableViewer.setInput(actualsFieldsObservable);
    selectedAvailableAttributeObservable = ViewersObservables.observeMultiSelection(availableAttributesTableViewer);

    availableAttributesTableViewer.getTable().addMouseMoveListener(e -> updateCursor(e, availableAttributesTableViewer));
    availableAttributesTableViewer.addDragSupport(DND.DROP_MOVE, new Transfer[] { FieldTransfer.getInstance() },
            dragSourceAdapter(selectedAvailableAttributeObservable));
    availableAttributesTableViewer.addDropSupport(DND.DROP_MOVE,
            new Transfer[] { FieldTransfer.getInstance() },
            new DropTargetAdapter() {

                @Override
                public void drop(DropTargetEvent event) {
                    dragLeave(event);
                    indexedFieldsObservable.removeAll((Collection<?>) event.data);
                }
            });

    section.setClient(client);
}
 
Example 20
Source File: AbstractWorkingSetWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 3 votes vote down vote up
private void createTable(Composite parent) {
	Label label= new Label(parent, SWT.WRAP);
	label.setText(WorkingSetMessages.JavaWorkingSetPage_workingSet_content);
	label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

	fTable= new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);

	GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true);
	fTable.getControl().setLayoutData(gd);

	fTable.setUseHashlookup(true);

	configureTable(fTable);

	fTable.setContentProvider(new IStructuredContentProvider() {

		public Object[] getElements(Object inputElement) {
			return fSelectedElements.toArray();
		}

		public void dispose() {
		}

		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}

	});
}