org.eclipse.jface.viewers.ColumnViewer Java Examples

The following examples show how to use org.eclipse.jface.viewers.ColumnViewer. 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: ColoringLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void update() {
	ColumnViewer viewer= getViewer();

	if (viewer == null) {
		return;
	}
	
	boolean needsUpdate= false;
	
	boolean showColoredLabels= ColoredViewersManager.showColoredLabels();
	if (showColoredLabels != isOwnerDrawEnabled()) {
		setOwnerDrawEnabled(showColoredLabels);
		needsUpdate= true;
	} else if (showColoredLabels) {
		needsUpdate= true;
	}
	if (needsUpdate) {
		fireLabelProviderChanged(new LabelProviderChangedEvent(this));
	}
}
 
Example #2
Source File: DecoratingFileSearchLabelProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void refresh() {
    ColumnViewer viewer = getViewer();

    if (viewer == null) {
        return;
    }
    boolean showColoredLabels = showColoredLabels();
    if (showColoredLabels != isOwnerDrawEnabled()) {
        setOwnerDrawEnabled(showColoredLabels);
        viewer.refresh();
    } else if (showColoredLabels) {
        viewer.refresh();
    }
}
 
Example #3
Source File: ContractInputController.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public ContractInput addChildInput(final ColumnViewer viewer) {
    final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.isEmpty()) {
        return null;
    }

    final ContractInput parentInput = (ContractInput) selection.getFirstElement();
    final ContractInput defaultInput = createDefaultInput(ModelHelper.getFirstContainerOfType(parentInput, Contract.class));
    CustomEMFEditObservables.observeList(parentInput, ProcessPackage.Literals.CONTRACT_INPUT__INPUTS).add(defaultInput);
    viewer.getControl().getDisplay().asyncExec(new EditNameRunnable(viewer, defaultInput));
    return defaultInput;
}
 
Example #4
Source File: CustomerUserInformationDefinitionNameValidator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public CustomerUserInformationDefinitionNameValidator(final Organization organization, final ColumnViewer viewer) {
    final StructuredSelection structuredSelection = (StructuredSelection) viewer.getSelection();
    final CustomUserInfoDefinition selectedCustomUserDef = (CustomUserInfoDefinition) structuredSelection.getFirstElement();
    final String selectedDefinitionName = selectedCustomUserDef.getName();

    if (organization != null && organization.getCustomUserInfoDefinitions() != null
            && organization.getCustomUserInfoDefinitions().getCustomUserInfoDefinition() != null) {
        for (final CustomUserInfoDefinition def : organization.getCustomUserInfoDefinitions().getCustomUserInfoDefinition()) {
            if (!def.getName().equalsIgnoreCase(selectedDefinitionName)) {
                exisingNames.add(def.getName().toLowerCase());
            }
        }
    }
}
 
Example #5
Source File: AutoCompleteTextCellEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public AutoCompleteTextCellEditor(ColumnViewer viewer) {
    super((Composite) viewer.getControl());
    Optional<KeyStroke> eclipseContentAssistKeyStroke = retrieveEclipseContentAssistKeyStroke();
    if (eclipseContentAssistKeyStroke.isPresent()) {
        contentAssistKeyStroke = eclipseContentAssistKeyStroke.get();
    } else {
        BonitaStudioLog.warning(
                "Unable to retrieve eclipse content assist binding. Content assist won't be available in editors. Check key binding for the `Content Assist` command in the eclipse preferences.",
                UIPlugin.PLUGIN_ID);
    }
}
 
Example #6
Source File: TextCellEditingSupport.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * The default constructor.
 * 
 * @param viewer
 *            The viewer that is using this <code>EditingSupport</code>.
 *            <code>Control</code>s required by this class will be
 *            constructed under this viewer's <code>Control</code> (usually
 *            a <code>Table</code>).
 * @param contentProvider
 *            The content provider. The methods required as an
 *            <code>EditingSupport</code> are passed to this content
 *            provider.
 */
public TextCellEditingSupport(ColumnViewer viewer,
		ICellContentProvider contentProvider) {
	super(viewer);

	this.contentProvider = contentProvider;

	// Get the viewer's Composite so we can create the CellEditors.
	Composite parent = (Composite) viewer.getControl();

	// Create the TextCellEditor.
	textCell = new TextCellEditor(parent, SWT.LEFT);

	return;
}
 
Example #7
Source File: CustomCheckBoxColumnLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public CustomCheckBoxColumnLabelProvider(final ColumnViewer viewer, final EStructuralFeature feature,
        final IObservableSet knowElements) {
    super(viewer);
    if (knowElements != null && feature != null) {
        EMFObservables.observeMap(knowElements, feature).addMapChangeListener(this);
    }
}
 
Example #8
Source File: CheckboxCellContentProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * The default constructor.
 * 
 * @param viewer
 *            The viewer whose contents are managed by this provider.
 */
public CheckboxCellContentProvider(ColumnViewer viewer) {

	// Make sure the checkbox Images have been registered before calls to
	// getImage(Object).
	registerImages(viewer.getControl().getDisplay(), viewer.getControl()
			.getBackground());

	return;
}
 
Example #9
Source File: CustomPropertyColumnLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void initialize(final ColumnViewer viewer, final ViewerColumn column) {
    super.initialize(viewer, column);
    if (knowElements != null && feature != null) {
        EMFObservables.observeMap(knowElements, feature).addMapChangeListener(this);
    }
}
 
Example #10
Source File: ModulaSearchLabelProvider.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private void refresh() {
    ColumnViewer viewer= getViewer();

    if (viewer == null) {
        return;
    }
    M2LabelProvider.clrMatch = null; // to re-read
    boolean showColoredLabels= showColoredLabels();
    if (showColoredLabels != isOwnerDrawEnabled()) {
        setOwnerDrawEnabled(showColoredLabels);
        viewer.refresh();
    } else if (showColoredLabels) {
        viewer.refresh();
    }
}
 
Example #11
Source File: DecoratingFileSearchLabelProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initialize(ColumnViewer viewer, ViewerColumn column) {
    PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
    JFaceResources.getColorRegistry().addListener(this);

    setOwnerDrawEnabled(showColoredLabels());

    super.initialize(viewer, column);
}
 
Example #12
Source File: ContractInputController.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void remove(final ColumnViewer viewer) {
    final IObservableValue contractObservable = (IObservableValue) viewer.getInput();
    final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    final List<?> selectedInput = selection.toList();
    Contract contract = (Contract) contractObservable.getValue();
    if (openConfirmation(selectedInput)) {
        final RefactorContractInputOperation refactorOperation = newRefactorOperation(contract);
        final TransactionalEditingDomain editingDomain = editingDomain(contract);
        refactorOperation.setEditingDomain(editingDomain);
        refactorOperation.setAskConfirmation(shouldAskConfirmation());
        final CompoundCommand compoundCommand = refactorOperation.getCompoundCommand();
        for (final Object input : selectedInput) {
            final ContractInput contractInput = (ContractInput) input;
            contract = ModelHelper.getFirstContainerOfType(contractInput, Contract.class);
            //Parent input has been removed in current selection
            if (contract == null) {
                continue;
            }
            refactorOperation.addItemToRefactor(null, contractInput);
            compoundCommand.append(DeleteCommand.create(editingDomain, contractInput));
            final Collection<ContractConstraint> constraintsReferencingInput = constraintsReferencingSingleInput(contract, contractInput);
            if (!constraintsReferencingInput.isEmpty()) {
                compoundCommand.append(DeleteCommand.create(editingDomain, constraintsReferencingInput));
            }
        }
        try {
            if (refactorOperation.canExecute()) {
                progressService.run(true, true, refactorOperation);
            }
        } catch (final InvocationTargetException | InterruptedException e) {
            BonitaStudioLog.error("Failed to remove contract input.", e);
            openErrorDialog(e);
        }
    }
}
 
Example #13
Source File: AddRowOnEnterCellNavigationStrategy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean isNavigationEvent(final ColumnViewer viewer, final Event event) {
    switch (event.keyCode) {
        case SWT.CR:
            return true;
        case SWT.DEL:
            return true;
        default:
            return super.isNavigationEvent(viewer, event);
    }
}
 
Example #14
Source File: ExpressionCollectionEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public ExpressionCollectionEditingSupport(final ColumnViewer viewer,
        final int colIndex, final EditingDomain editingDomain, final SelectionListener removeRowListener) {
    super(viewer);
    this.colIndex = colIndex;
    filters = new ArrayList<ViewerFilter>();
    this.editingDomain = editingDomain;
    this.removeRowListener = removeRowListener;
}
 
Example #15
Source File: EmulatedNativeCheckBoxLabelProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public EmulatedNativeCheckBoxLabelProvider(ColumnViewer viewer) {
    if (JFaceResources.getImageRegistry().getDescriptor(CHECKED_KEY) == null) {
        workaround(viewer.getControl().getDisplay());
        JFaceResources.getImageRegistry().put(CHECKED_KEY, makeShot(viewer.getControl(), true));
        JFaceResources.getImageRegistry().put(UNCHECK_KEY, makeShot(viewer.getControl(), false));
    }
}
 
Example #16
Source File: GridViewerEditor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
GridViewerEditor(ColumnViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	super(viewer, editorActivationStrategy, feature);
	this.selectionFollowsEditor = (feature & SELECTION_FOLLOWS_EDITOR) == SELECTION_FOLLOWS_EDITOR;
	this.gridEditor = new GridEditor((Grid) viewer.getControl());
}
 
Example #17
Source File: InputNameObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public InputNameObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc,
        final IRefactorOperationFactory contractInputRefactorOperationFactory,
        final IProgressService progressService) {
    super(viewer, ProcessPackage.Literals.CONTRACT_INPUT__NAME, messageManager, dbc);
    this.progressService = progressService;
    this.contractInputRefactorOperationFactory = contractInputRefactorOperationFactory;
}
 
Example #18
Source File: GenericEditingSupport.java    From offspring with MIT License 5 votes vote down vote up
public GenericEditingSupport(ColumnViewer viewer,
    IGenericTableColumn column) {
  super(viewer);
  this.editor = new TextCellEditor((Composite) viewer.getControl(),
      column.getAlignMent());
  this.column = column;
}
 
Example #19
Source File: ColoringLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initialize(ColumnViewer viewer, ViewerColumn column) {
	ColoredViewersManager.install(this);
	setOwnerDrawEnabled(ColoredViewersManager.showColoredLabels());

	super.initialize(viewer, column);
}
 
Example #20
Source File: ContractConstraintController.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ContractConstraint add(final ColumnViewer viewer) {
    final IObservableList constraintsObservable = (IObservableList) viewer.getInput();
    final ContractConstraint defaultConstraint = createDefaultConstraint();
    constraintsObservable.add(defaultConstraint);
    viewer.editElement(defaultConstraint, 0);
    return defaultConstraint;
}
 
Example #21
Source File: AddRowOnEnterCellNavigationStrategy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ViewerCell findSelectedCell(final ColumnViewer viewer, final ViewerCell currentSelectedCell, final Event event) {
    setCancelEvent(false);
    if (currentSelectedCell != null) {
        switch (event.keyCode) {
            case SWT.CR:
                return addNewRow(currentSelectedCell, event);
            case SWT.DEL:
                return removeRow(currentSelectedCell);
            default:
                break;
        }
    }
    return super.findSelectedCell(viewer, currentSelectedCell, event);
}
 
Example #22
Source File: Viewers.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public static <T> void sortByDouble(ColumnViewer viewer, ITableLabelProvider labelProvider, int... cols) {
	for (int col : cols) {
		LabelComparator<T> s = new LabelComparator<>(col, labelProvider);
		s.asNumbers = true;
		addComparator(viewer, s);
	}
}
 
Example #23
Source File: PaginationContainer.java    From offspring with MIT License 5 votes vote down vote up
/**
 * The TableViewer is already constructed and uses this composite as it's
 * parent. This works because in the constructor we create all other children
 * of this composite so they will be rendered before the table viewer. You
 * dont need to set any layout data on the table viewer, this method will take
 * care of that.
 * 
 * @param viewer
 */
public void setTableViewer(ColumnViewer viewer, int pageSize) {
  this.viewer = viewer;
  IStructuredContentProvider inner = ((IGenericViewer) viewer)
      .getGenericTable().getContentProvider();

  if (inner instanceof IPageableStructeredContentProvider) {
    ((IPageableStructeredContentProvider) inner).setPageSize(pageSize);
  }

  contentProvider = new PaginatedContentProvider(this, inner, pageSize);
  viewer.setContentProvider(contentProvider);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
      .span(5, 1).applyTo(viewer.getControl());
}
 
Example #24
Source File: ContractInputController.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ContractInput add(final ColumnViewer viewer) {
    final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    final IObservableValue contractObservable = (IObservableValue) viewer.getInput();
    final ContractInput parentInput = (ContractInput) selection.getFirstElement();
    final Contract contract = (Contract) contractObservable.getValue();
    final ContractInput defaultInput = createDefaultInput(contract);
    final EObject targetContainer = targetContainer(parentInput, contract);
    CustomEMFEditObservables.observeList(targetContainer, inputContainerFeature(targetContainer)).add(defaultInput);
    viewer.getControl().getDisplay().asyncExec(new EditNameRunnable(viewer, defaultInput));
    return defaultInput;
}
 
Example #25
Source File: ParameterDescriptionEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public ParameterDescriptionEditingSupport(final ColumnViewer viewer, final TransactionalEditingDomain transactionalEditingDomain) {
	super(viewer);
	this.transactionalEditingDomain = transactionalEditingDomain;
}
 
Example #26
Source File: LabOrderEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public LabOrderEditingSupport(ColumnViewer viewer){
	super(viewer);
	
	setUpCellEditor(viewer);
	addValidator();
}
 
Example #27
Source File: InputTypeEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public InputTypeEditingSupport(ColumnViewer viewer,DataBindingContext context) {
    super(viewer,context);
    this.context = context ;
}
 
Example #28
Source File: IntroduceParameterObjectWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private ParameterInfoEditingSupport(CellEditor textEditor, ColumnViewer tv) {
	super(tv);
	fTextEditor= textEditor;
}
 
Example #29
Source File: ErrorMessageObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public ErrorMessageObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc) {
    super(viewer, ProcessPackage.Literals.CONTRACT_CONSTRAINT__ERROR_MESSAGE, messageManager, dbc);
}
 
Example #30
Source File: AbstractCheckboxLabelProvider.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public AbstractCheckboxLabelProvider(final ColumnViewer viewer) {
}