Java Code Examples for org.eclipse.swt.SWT#ICON_SEARCH

The following examples show how to use org.eclipse.swt.SWT#ICON_SEARCH . These examples are extracted from open source projects. 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 Project: ADT_Frontend   File: AbapGitStagingView.java    License: 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
private void createSearchText(final Composite composite) {
    searchText = new Text(composite, SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL);
    searchText.setMessage(Messages.search);
    searchText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    searchFilter = new ViewerFilter() {

        @Override
        public boolean select(final Viewer arg0, final Object arg1, final Object element) {
            if (!searchText.getText().isEmpty()) {
                final String searchQuery = searchText.getText().toLowerCase();
                final IRepositoryFileStore file = (IRepositoryFileStore) element;
                return file.getName().toLowerCase().contains(searchQuery);
            }
            return true;
        }
    };

    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            tableViewer.refresh();
        }
    });
}
 
Example 3
private void createFilter(final Composite listComposite) {
    final Text fileStoreListFilter = new Text(listComposite,
            SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
    fileStoreListFilter.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    fileStoreListFilter.setMessage(WorkbenchMessages.FilteredTree_FilterMessage);
    fileStoreListFilter.addModifyListener(new ModifyListener() {

        private ViewerFilter filter;

        @Override
        public void modifyText(final ModifyEvent e) {
            final String textForFiltering = fileStoreListFilter.getText();
            if (filter != null) {
                fileStoreListViewer.removeFilter(filter);
            }
            if (textForFiltering != null
                    && !textForFiltering.isEmpty()) {
                filter = new ViewerFilterOnFileStoreName(textForFiltering);
                fileStoreListViewer.addFilter(filter);
            }

        }
    });
}
 
Example 4
@Override
protected Text createFilterText(final Composite parent) {
	final Text filterText = new Text(parent, SWT.SEARCH | SWT.ICON_SEARCH);
	filterText.setMessage("Search keyword");
	Dialog.applyDialogFont(filterText);

	final GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.horizontalAlignment = GridData.FILL;
	data.verticalAlignment = GridData.CENTER;
	filterText.setLayoutData(data);

	filterText.addKeyListener(new KeyAdapter() {
		@Override
		public void keyPressed(final KeyEvent e) {
			if (e.keyCode == 0x0D) {
				gotoSelectedElement();
			}
			if (e.keyCode == SWT.ARROW_DOWN) {
				getTreeViewer().getTree().setFocus();
			}
			if (e.keyCode == SWT.ARROW_UP) {
				getTreeViewer().getTree().setFocus();
			}
			if (e.character == 0x1B) {
				dispose();
			}
		}
	});
	return filterText;
}
 
Example 5
protected void createFilterComposite(final Composite topComposite) {
    final Text findText = new Text(topComposite, SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
    findText.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).align(SWT.RIGHT, SWT.CENTER).hint(150, SWT.DEFAULT).create());
    findText.setMessage(Messages.find);
    findText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            searchQuery = findText.getText();
            tableViewer.refresh();

        }
    });
}
 
Example 6
private void createProjectIdSection() {
  Label projectIdLabel = new Label(this, SWT.LEAD);
  projectIdLabel.setText(Messages.getString("project"));
  projectIdLabel.setToolTipText(Messages.getString("tooltip.project.id"));
  GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).span(1, 2)
      .applyTo(projectIdLabel);

  Composite linkComposite = new Composite(this, SWT.NONE);
  Link createNewProject = new Link(linkComposite, SWT.WRAP);
  createNewProject.setText(Messages.getString("projectselector.createproject",
                                              CREATE_GCP_PROJECT_URL));
  createNewProject.setToolTipText(Messages.getString("projectselector.createproject.tooltip"));
  FontUtil.convertFontToItalic(createNewProject);
  createNewProject.addSelectionListener(new OpenUriSelectionListener(
      () -> accountSelector.getSelectedEmail().isEmpty()
          ? Collections.emptyMap()
          : Collections.singletonMap("authuser", accountSelector.getSelectedEmail()),
      new ErrorDialogErrorHandler(getShell())));
  GridDataFactory.fillDefaults().applyTo(linkComposite);
  GridLayoutFactory.fillDefaults().generateLayout(linkComposite);

  Composite projectSelectorComposite = new Composite(this, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(projectSelectorComposite);
  GridDataFactory.fillDefaults().grab(true, false).applyTo(projectSelectorComposite);

  final Text filterField = new Text(projectSelectorComposite,
      SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
  filterField.setMessage(Messages.getString("projectselector.filter"));
  GridDataFactory.fillDefaults().applyTo(filterField);

  new Label(projectSelectorComposite, SWT.NONE); // spacer

  projectSelector = new ProjectSelector(projectSelectorComposite);
  GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 200)
      .applyTo(projectSelector);

  final Button refreshProjectsButton = new Button(projectSelectorComposite, SWT.NONE);
  refreshProjectsButton.setImage(refreshIcon);
  GridDataFactory.swtDefaults().align(SWT.END, SWT.BEGINNING).applyTo(refreshProjectsButton);
  refreshProjectsButton.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent event) {
      refreshProjectsForSelectedCredential();
    }
  });

  accountSelector.addSelectionListener(
      new RefreshProjectOnAccountSelection(refreshProjectsButton));

  projectSelector.addSelectionChangedListener(
      new ProjectSelectorSelectionChangedListener(accountSelector,
                                                  projectRepository,
                                                  projectSelector));
  filterField.addModifyListener(event -> {
    projectSelector.setFilter(filterField.getText());
  });
}
 
Example 7
private Text createText(final Composite parent) {
	final Text text = new Text(parent, SWT.SEARCH | SWT.ICON_SEARCH);
	final String message = "GAML reference (" + GamaKeyBindings.SEARCH_STRING + ")";
	text.setMessage(message);
	return text;
}
 
Example 8
protected void createTree(Composite composite) {
	final Text searchText = new Text(composite,SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL) ;
	searchText.setMessage(Messages.search) ;
	searchText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()) ;

	searchFilter = new ViewerFilter() {

		@Override
		public boolean select(Viewer arg0, Object arg1, Object element) {
			if(!searchText.getText().isEmpty()){
				String searchQuery = searchText.getText().toLowerCase() ;
				IRepositoryFileStore file = (IRepositoryFileStore) element ;
				return file.getName().toLowerCase().contains(searchQuery) ;
			}
			return true;
		}
	};

	//new Label(composite,SWT.NONE) ; //FILLER

	languageViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL) ;
	languageViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 190).create()) ;
	languageViewer.getTable().setLinesVisible(true) ;
	languageViewer.getTable().setHeaderVisible(false) ;
	final TableLayout layout = new TableLayout() ;
	layout.addColumnData(new ColumnWeightData(65)) ;
	languageViewer.getTable().setLayout(layout) ;
	languageViewer.setContentProvider(new ArrayContentProvider()) ;
	languageViewer.setLabelProvider(new FileStoreLabelProvider()) ;
	languageViewer.addFilter(searchFilter) ;
	if(filter != null){
		languageViewer.addFilter(filter);
	}
	languageViewer.setInput(libStore.getChildren()) ;
	languageViewer.getTable().setFocus() ;


	searchText.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			languageViewer.refresh() ;
		}
	}) ;

}
 
Example 9
protected StructuredViewer createViewer(final Composite parent) {
    final Composite viewerComposite = new Composite(parent, SWT.NONE);
    viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewerComposite.setLayout(
            GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).margins(0, 0).spacing(0, 5).create());

    final Text searchBox = new Text(viewerComposite, SWT.SEARCH | SWT.ICON_SEARCH | SWT.BORDER | SWT.CANCEL);
    searchBox.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    searchBox.setMessage(Messages.search);

    final Composite tableViewerComposite = new Composite(viewerComposite, SWT.NONE);
    tableViewerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    tableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final TableViewer tableViewer = new TableViewer(tableViewerComposite,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    final Table table = tableViewer.getTable();
    table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 270).create());
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.addFilter(new ViewerFilter() {

        @Override
        public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
            return viewerSelect(element, searchQuery);
        }
    });

    searchBox.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            searchQuery = searchBox.getText();
            tableViewer.refresh();
        }

    });

    return tableViewer;
}
 
Example 10
private void createDBConnectorsList(Composite parent) {
    final Composite connectorListComposite = new Composite(parent, SWT.NONE);
    connectorListComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    connectorListComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    final Text searchField = new Text(connectorListComposite,
            SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
    searchField.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    searchField.setMessage(Messages.search);
    viewer = new TableViewer(connectorListComposite, SWT.BORDER | SWT.FULL_SELECTION);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(200, SWT.DEFAULT).create());
    viewer.setLabelProvider(new DabaBaseConnectorDefinitionLabelProvider());
    viewer.setContentProvider(new DatabaseConnectorDefinitionContentProvider());
    viewer.setInput(getCategory());
    connectorFilter = new DbConnectorsPreferenceFilter();
    viewer.addFilter(connectorFilter);
    searchField.addKeyListener(new KeyAdapter() {

        /*
         * (non-Javadoc)
         * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
         */
        @Override
        public void keyReleased(KeyEvent e) {
            connectorFilter.setSearchText(searchField.getText());
            viewer.refresh();
        }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            final ConnectorDefinition def = getSelectedConnector();
            if (def != null) {
                final String defId = def.getId();
                automaticallyAddDriver.setSelection(getAutoAddDriverProperty(defId));
                driversLabelProvider.setDefaultDriver(getDefaultDriver(defId));
                driverManagerViewer.setInput(defId);
            }
        }
    });
}