org.eclipse.jface.action.ControlContribution Java Examples

The following examples show how to use org.eclipse.jface.action.ControlContribution. 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: AbapGitStagingView.java    From ADT_Frontend with MIT License 6 votes vote down vote up
/**
 * Adds a filter text box in the view toolbar
 */
private ControlContribution createObjectsFilterText() {
	//create filter text composite
	ControlContribution filterTextboxContribution = new ControlContribution("AbapGitStagingView.filterText") { //$NON-NLS-1$
		protected Control createControl(Composite parent) {
			Composite filterComposite = AbapGitStagingView.this.toolkit.createComposite(parent, 0);
			GridLayoutFactory.fillDefaults().numColumns(2).applyTo(filterComposite);
			filterComposite.setBackground(null);

			AbapGitStagingView.this.filterText = new Text(filterComposite, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
			AbapGitStagingView.this.filterText.setMessage(Messages.AbapGitStaging_object_filter_text);
			GridData data = new GridData(SWT.LEFT, SWT.TOP, true, false);
			data.minimumWidth = 150;
			AbapGitStagingView.this.filterText.setLayoutData(data);

			AbapGitStagingView.this.filterText.addModifyListener(e -> applyFilter());
			return filterComposite;
		}
	};
	return filterTextboxContribution;
}
 
Example #2
Source File: SvnWizardLockPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void addResourcesArea(Composite composite) {  
	ResourceSelectionTree.IToolbarControlCreator toolbarControlCreator = new ResourceSelectionTree.IToolbarControlCreator() {
  public void createToolbarControls(ToolBarManager toolbarManager) {
    toolbarManager.add(new ControlContribution("stealLock") {
      protected Control createControl(Composite parent) {
        stealButton = new Button(parent, SWT.CHECK);
        stealButton.setText(Policy.bind("LockDialog.stealLock")); //$NON-NLS-1$		
        return stealButton;
      }
    });
  }
  public int getControlCount() {
    return 1;
  }
};
	resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE, "These files will be locked:", files, new HashMap(), null, false, toolbarControlCreator, null); //$NON-NLS-1$    	
	resourceSelectionTree.setShowRemoveFromViewAction(false);
}