Search in sources :

Example 26 with PatternFilter

use of org.eclipse.ui.dialogs.PatternFilter in project egit by eclipse.

the class SourceBranchPage method createControl.

@Override
public void createControl(final Composite parent) {
    final Composite panel = new Composite(parent, SWT.NULL);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    panel.setLayout(layout);
    label = new Label(panel, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    FilteredCheckboxTree fTree = new FilteredCheckboxTree(panel, null, SWT.NONE, new PatternFilter()) {

        /*
			 * Overridden to check page when refreshing is done.
			 */
        @Override
        protected WorkbenchJob doCreateRefreshJob() {
            WorkbenchJob refreshJob = super.doCreateRefreshJob();
            refreshJob.addJobChangeListener(new JobChangeAdapter() {

                @Override
                public void done(IJobChangeEvent event) {
                    if (event.getResult().isOK()) {
                        getDisplay().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                checkPage();
                            }
                        });
                    }
                }
            });
            return refreshJob;
        }
    };
    refsViewer = fTree.getCheckboxTreeViewer();
    ITreeContentProvider provider = new ITreeContentProvider() {

        @Override
        public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
        // nothing
        }

        @Override
        public void dispose() {
        // nothing
        }

        @Override
        public Object[] getElements(Object input) {
            return ((List) input).toArray();
        }

        @Override
        public boolean hasChildren(Object element) {
            return false;
        }

        @Override
        public Object getParent(Object element) {
            return null;
        }

        @Override
        public Object[] getChildren(Object parentElement) {
            return null;
        }
    };
    refsViewer.setContentProvider(provider);
    refsViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (((Ref) element).getName().startsWith(Constants.R_HEADS))
                return ((Ref) element).getName().substring(Constants.R_HEADS.length());
            return ((Ref) element).getName();
        }

        @Override
        public Image getImage(Object element) {
            return RepositoryTreeNodeType.REF.getIcon();
        }
    });
    refsViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            checkPage();
        }
    });
    final Composite bPanel = new Composite(panel, SWT.NONE);
    bPanel.setLayout(new RowLayout());
    selectB = new Button(bPanel, SWT.PUSH);
    selectB.setText(UIText.SourceBranchPage_selectAll);
    selectB.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            refsViewer.setAllChecked(true);
            checkPage();
        }
    });
    unselectB = new Button(bPanel, SWT.PUSH);
    unselectB.setText(UIText.SourceBranchPage_selectNone);
    unselectB.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            refsViewer.setAllChecked(false);
            checkPage();
        }
    });
    bPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    Dialog.applyDialogFont(panel);
    setControl(panel);
    checkPage();
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) PatternFilter(org.eclipse.ui.dialogs.PatternFilter) FilteredCheckboxTree(org.eclipse.egit.ui.internal.components.FilteredCheckboxTree) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) Label(org.eclipse.swt.widgets.Label) CachedCheckboxTreeViewer(org.eclipse.egit.ui.internal.components.CachedCheckboxTreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) Image(org.eclipse.swt.graphics.Image) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(java.util.List) ArrayList(java.util.ArrayList) Composite(org.eclipse.swt.widgets.Composite) WorkbenchJob(org.eclipse.ui.progress.WorkbenchJob) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) Ref(org.eclipse.jgit.lib.Ref) GridData(org.eclipse.swt.layout.GridData) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 27 with PatternFilter

use of org.eclipse.ui.dialogs.PatternFilter in project egit by eclipse.

the class GitProjectsImportPage method createProjectsList.

/**
 * Create the checkbox list for the found projects.
 *
 * @param workArea
 */
private void createProjectsList(Composite workArea) {
    Label title = new Label(workArea, SWT.NONE);
    title.setText(UIText.WizardProjectsImportPage_ProjectsListTitle);
    Composite listComposite = new Composite(workArea, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.makeColumnsEqualWidth = false;
    listComposite.setLayout(layout);
    listComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
    PatternFilter filter = new PatternFilter() {

        @Override
        public boolean isElementVisible(Viewer viewer, Object element) {
            if (getCheckedProjects().contains(element))
                return true;
            if (element instanceof ProjectRecord) {
                ProjectRecord p = (ProjectRecord) element;
                if (wordMatches(p.getProjectName()))
                    return true;
                String projectPath = p.getProjectSystemFile().getParent();
                if (projectPath.startsWith(lastPath)) {
                    String distinctPath = projectPath.substring(lastPath.length());
                    return wordMatches(distinctPath);
                } else {
                    return wordMatches(projectPath);
                }
            }
            return false;
        }
    };
    filter.setIncludeLeadingWildcard(true);
    FilteredCheckboxTree filteredTree = new FilteredCheckboxTree(listComposite, null, SWT.NONE, filter);
    filteredTree.setInitialText(UIText.WizardProjectsImportPage_filterText);
    projectsList = filteredTree.getCheckboxTreeViewer();
    GridData listData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
    projectsList.getControl().setLayoutData(listData);
    projectsList.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            ProjectRecord element = (ProjectRecord) event.getElement();
            if (isProjectInWorkspace(element.getProjectName())) {
                projectsList.setChecked(element, false);
            }
            enableSelectAllButtons();
        }
    });
    // a bug in the CachedCheckboxTreeView requires us to not return null
    final Object[] children = new Object[0];
    projectsList.setContentProvider(new ITreeContentProvider() {

        @Override
        public Object[] getChildren(Object parentElement) {
            return children;
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return selectedProjects;
        }

        @Override
        public boolean hasChildren(Object element) {
            return false;
        }

        @Override
        public Object getParent(Object element) {
            return null;
        }

        @Override
        public void dispose() {
        // ignore
        }

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        // ignore
        }
    });
    projectsList.getTree().addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkPageComplete();
        }
    });
    projectsList.setLabelProvider(new ProjectLabelProvider());
    projectsList.setInput(this);
    projectsList.setComparator(new ViewerComparator());
    createSelectionButtons(listComposite);
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) PatternFilter(org.eclipse.ui.dialogs.PatternFilter) Composite(org.eclipse.swt.widgets.Composite) FilteredCheckboxTree(org.eclipse.egit.ui.internal.components.FilteredCheckboxTree) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) CachedCheckboxTreeViewer(org.eclipse.egit.ui.internal.components.CachedCheckboxTreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent)

Example 28 with PatternFilter

use of org.eclipse.ui.dialogs.PatternFilter in project egit by eclipse.

the class FilteredBranchesWidget method create.

Control create(Composite parent) {
    Composite area = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(area);
    area.setLayout(new GridLayout(1, false));
    PatternFilter filter = new PatternFilter() {

        @Override
        protected boolean isLeafMatch(Viewer viewer, Object element) {
            TreeViewer treeViewer = (TreeViewer) viewer;
            int numberOfColumns = treeViewer.getTree().getColumnCount();
            boolean isMatch = false;
            for (int columnIndex = 0; columnIndex < numberOfColumns; columnIndex++) {
                ColumnLabelProvider labelProvider = (ColumnLabelProvider) treeViewer.getLabelProvider(columnIndex);
                String labelText = labelProvider.getText(element);
                isMatch |= wordMatches(labelText);
            }
            return isMatch;
        }
    };
    filter.setIncludeLeadingWildcard(true);
    final FilteredTree tree = new FilteredTree(area, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION, filter, true);
    tree.setQuickSelectionMode(true);
    branchesViewer = tree.getViewer();
    branchesViewer.getTree().setLinesVisible(false);
    branchesViewer.getTree().setHeaderVisible(true);
    comparator = new BranchComparator();
    branchesViewer.setComparator(comparator);
    DecoratedBranchLabelProvider nameLabelProvider = new DecoratedBranchLabelProvider(gfRepo.getRepository(), prefix);
    TreeColumn nameColumn = createColumn(UIText.BranchSelectionTree_NameColumn, branchesViewer, nameLabelProvider);
    TreeColumn idColumn = createColumn(UIText.BranchSelectionTree_IdColumn, branchesViewer, new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof Ref) {
                ObjectId objectId = ((Ref) element).getObjectId();
                if (objectId == null) {
                    // $NON-NLS-1$
                    return "";
                }
                return objectId.abbreviate(7).name();
            }
            return super.getText(element);
        }
    });
    ColumnLabelProvider dateLabelProvider = new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof Ref) {
                String name = ((Ref) element).getName().substring(Constants.R_HEADS.length());
                RevCommit revCommit = gfRepo.findHead(name);
                if (revCommit == null) {
                    // $NON-NLS-1$
                    return "";
                }
                return getDateFormatter().formatDate(revCommit.getCommitterIdent());
            }
            return super.getText(element);
        }
    };
    TreeColumn dateColumn = createColumn(UIText.FilteredBranchesWidget_lastModified, branchesViewer, dateLabelProvider);
    setSortedColumn(dateColumn, dateLabelProvider);
    TreeColumn msgColumn = createColumn(UIText.BranchSelectionTree_MessageColumn, branchesViewer, new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof Ref) {
                String name = ((Ref) element).getName().substring(Constants.R_HEADS.length());
                RevCommit revCommit = gfRepo.findHead(name);
                if (revCommit == null) {
                    // $NON-NLS-1$
                    return "";
                }
                return revCommit.getShortMessage();
            }
            return super.getText(element);
        }
    });
    GridDataFactory.fillDefaults().grab(true, true).applyTo(branchesViewer.getControl());
    branchesViewer.setContentProvider(new BranchListContentProvider());
    branchesViewer.setInput(refs);
    // Layout tree for maximum width of message column
    TreeColumnLayout layout = new TreeColumnLayout();
    nameColumn.pack();
    layout.setColumnData(nameColumn, new ColumnWeightData(0, nameColumn.getWidth()));
    idColumn.pack();
    layout.setColumnData(idColumn, new ColumnWeightData(0, idColumn.getWidth()));
    dateColumn.pack();
    layout.setColumnData(dateColumn, new ColumnWeightData(0, dateColumn.getWidth()));
    layout.setColumnData(msgColumn, new ColumnWeightData(100));
    branchesViewer.getTree().getParent().setLayout(layout);
    branchesViewer.addFilter(createFilter());
    return area;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) PatternFilter(org.eclipse.ui.dialogs.PatternFilter) Composite(org.eclipse.swt.widgets.Composite) ObjectId(org.eclipse.jgit.lib.ObjectId) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) Ref(org.eclipse.jgit.lib.Ref) TreeColumn(org.eclipse.swt.widgets.TreeColumn) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 29 with PatternFilter

use of org.eclipse.ui.dialogs.PatternFilter in project egit by eclipse.

the class ReflogView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    dateFormatter = PreferenceBasedDateFormatter.create();
    GridLayoutFactory.fillDefaults().applyTo(parent);
    toolkit = new FormToolkit(parent.getDisplay());
    parent.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            toolkit.dispose();
        }
    });
    form = toolkit.createForm(parent);
    Image repoImage = UIIcons.REPOSITORY.createImage();
    UIUtils.hookDisposal(form, repoImage);
    Image commitImage = UIIcons.CHANGESET.createImage();
    UIUtils.hookDisposal(form, commitImage);
    form.setImage(repoImage);
    form.setText(UIText.StagingView_NoSelectionTitle);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(form);
    toolkit.decorateFormHeading(form);
    GridLayoutFactory.fillDefaults().applyTo(form.getBody());
    Composite tableComposite = toolkit.createComposite(form.getBody());
    tableComposite.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
    final TreeColumnLayout layout = new TreeColumnLayout();
    FilteredTree filteredTree = new FilteredTree(tableComposite, SWT.NONE | SWT.BORDER | SWT.FULL_SELECTION, new PatternFilter(), true) {

        @Override
        protected void createControl(Composite composite, int treeStyle) {
            super.createControl(composite, treeStyle);
            treeComposite.setLayout(layout);
        }
    };
    toolkit.adapt(filteredTree);
    refLogTableTreeViewer = filteredTree.getViewer();
    refLogTableTreeViewer.getTree().setLinesVisible(true);
    refLogTableTreeViewer.getTree().setHeaderVisible(true);
    refLogTableTreeViewer.setContentProvider(new ReflogViewContentProvider());
    ColumnViewerToolTipSupport.enableFor(refLogTableTreeViewer);
    TreeViewerColumn toColumn = createColumn(layout, UIText.ReflogView_CommitColumnHeader, 10, SWT.LEFT);
    toColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof ReflogEntry) {
                final ReflogEntry entry = (ReflogEntry) element;
                return entry.getNewId().abbreviate(7).name();
            }
            return null;
        }

        @Override
        public String getToolTipText(Object element) {
            if (element instanceof ReflogEntry) {
                final ReflogEntry entry = (ReflogEntry) element;
                return entry.getNewId().name();
            }
            return null;
        }

        @Override
        public Image getImage(Object element) {
            if (element instanceof ReflogEntry) {
                return commitImage;
            }
            return null;
        }
    });
    TreeViewerColumn commitMessageColumn = createColumn(layout, UIText.ReflogView_CommitMessageColumnHeader, 40, SWT.LEFT);
    commitMessageColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof ReflogEntry) {
                final ReflogEntry entry = (ReflogEntry) element;
                RevCommit c = getCommit(entry);
                // $NON-NLS-1$
                return c == null ? "" : c.getShortMessage();
            } else if (element instanceof IWorkbenchAdapter) {
                return ((IWorkbenchAdapter) element).getLabel(element);
            }
            return null;
        }

        private RevCommit getCommit(final ReflogEntry entry) {
            try (RevWalk walk = new RevWalk(getRepository())) {
                walk.setRetainBody(true);
                return walk.parseCommit(entry.getNewId());
            } catch (IOException ignored) {
                // ignore
                return null;
            }
        }
    });
    TreeViewerColumn dateColumn = createColumn(layout, UIText.ReflogView_DateColumnHeader, 15, SWT.LEFT);
    dateColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof ReflogEntry) {
                final ReflogEntry entry = (ReflogEntry) element;
                final PersonIdent who = entry.getWho();
                return dateFormatter.formatDate(who);
            }
            return null;
        }

        @Override
        public Image getImage(Object element) {
            return null;
        }
    });
    TreeViewerColumn messageColumn = createColumn(layout, UIText.ReflogView_MessageColumnHeader, 40, SWT.LEFT);
    messageColumn.setLabelProvider(new ColumnLabelProvider() {

        private ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources());

        @Override
        public String getText(Object element) {
            if (element instanceof ReflogEntry) {
                final ReflogEntry entry = (ReflogEntry) element;
                return entry.getComment();
            }
            return null;
        }

        @Override
        public Image getImage(Object element) {
            if (!(element instanceof ReflogEntry)) {
                return null;
            }
            String comment = ((ReflogEntry) element).getComment();
            if (// $NON-NLS-1$ //$NON-NLS-2$
            comment.startsWith("commit:") || comment.startsWith("commit (initial):"))
                return (Image) resourceManager.get(UIIcons.COMMIT);
            if (// $NON-NLS-1$
            comment.startsWith("commit (amend):"))
                return (Image) resourceManager.get(UIIcons.AMEND_COMMIT);
            if (// $NON-NLS-1$
            comment.startsWith("pull"))
                return (Image) resourceManager.get(UIIcons.PULL);
            if (// $NON-NLS-1$
            comment.startsWith("clone"))
                return (Image) resourceManager.get(UIIcons.CLONEGIT);
            if (// $NON-NLS-1$
            comment.startsWith("rebase"))
                return (Image) resourceManager.get(UIIcons.REBASE);
            if (// $NON-NLS-1$
            comment.startsWith("merge"))
                return (Image) resourceManager.get(UIIcons.MERGE);
            if (// $NON-NLS-1$
            comment.startsWith("fetch"))
                return (Image) resourceManager.get(UIIcons.FETCH);
            if (// $NON-NLS-1$
            comment.startsWith("branch"))
                return (Image) resourceManager.get(UIIcons.CREATE_BRANCH);
            if (// $NON-NLS-1$
            comment.startsWith("checkout"))
                return (Image) resourceManager.get(UIIcons.CHECKOUT);
            return null;
        }

        @Override
        public void dispose() {
            resourceManager.dispose();
            super.dispose();
        }
    });
    new OpenAndLinkWithEditorHelper(refLogTableTreeViewer) {

        @Override
        protected void linkToEditor(ISelection selection) {
        // Not supported
        }

        @Override
        protected void open(ISelection sel, boolean activate) {
            handleOpen(sel, OpenStrategy.activateOnOpen());
        }

        @Override
        protected void activate(ISelection selection) {
            handleOpen(selection, true);
        }

        private void handleOpen(ISelection selection, boolean activateOnOpen) {
            if (selection instanceof IStructuredSelection)
                if (selection.isEmpty())
                    return;
            Repository repo = getRepository();
            if (repo == null)
                return;
            try (RevWalk walk = new RevWalk(repo)) {
                for (Object element : ((IStructuredSelection) selection).toArray()) {
                    ReflogEntry entry = (ReflogEntry) element;
                    ObjectId id = entry.getNewId();
                    if (id == null || id.equals(ObjectId.zeroId()))
                        id = entry.getOldId();
                    if (id != null && !id.equals(ObjectId.zeroId()))
                        CommitEditor.openQuiet(new RepositoryCommit(repo, walk.parseCommit(id)), activateOnOpen);
                }
            } catch (IOException e) {
                Activator.logError(UIText.ReflogView_ErrorOnOpenCommit, e);
            }
        }
    };
    uiPrefsListener = new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            String property = event.getProperty();
            if (UIPreferences.DATE_FORMAT.equals(property) || UIPreferences.DATE_FORMAT_CHOICE.equals(property)) {
                dateFormatter = PreferenceBasedDateFormatter.create();
                refLogTableTreeViewer.refresh();
            }
        }
    };
    Activator.getDefault().getPreferenceStore().addPropertyChangeListener(uiPrefsListener);
    selectionChangedListener = new ISelectionListener() {

        @Override
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
            if (part instanceof IEditorPart) {
                IEditorInput input = ((IEditorPart) part).getEditorInput();
                if (input instanceof IFileEditorInput)
                    reactOnSelection(new StructuredSelection(((IFileEditorInput) input).getFile()));
            } else
                reactOnSelection(selection);
        }
    };
    IWorkbenchPartSite site = getSite();
    ISelectionService service = CommonUtils.getService(site, ISelectionService.class);
    service.addPostSelectionListener(selectionChangedListener);
    // Use current selection to populate reflog view
    UIUtils.notifySelectionChangedWithCurrentSelection(selectionChangedListener, site);
    site.setSelectionProvider(new RepositorySelectionProvider(refLogTableTreeViewer, () -> getRepository()));
    addRefsChangedListener = Repository.getGlobalListenerList().addRefsChangedListener(this);
    // Toolbar
    IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
    switchRepositoriesAction = new RepositoryToolbarAction(false, () -> getRepository(), repo -> reactOnSelection(new StructuredSelection(repo)));
    toolbar.add(switchRepositoriesAction);
    getViewSite().getActionBars().updateActionBars();
    // register context menu
    MenuManager menuManager = new MenuManager();
    menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    Tree tree = refLogTableTreeViewer.getTree();
    tree.setMenu(menuManager.createContextMenu(tree));
    MenuManager resetManager = ResetMenu.createMenu(getSite());
    menuManager.add(resetManager);
    getSite().registerContextMenu(POPUP_MENU_ID, menuManager, refLogTableTreeViewer);
}
Also used : OpenAndLinkWithEditorHelper(org.eclipse.ui.OpenAndLinkWithEditorHelper) AdapterUtils(org.eclipse.egit.core.AdapterUtils) DisposeEvent(org.eclipse.swt.events.DisposeEvent) UIPreferences(org.eclipse.egit.ui.UIPreferences) IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) ResourceManager(org.eclipse.jface.resource.ResourceManager) DisposeListener(org.eclipse.swt.events.DisposeListener) IToolBarManager(org.eclipse.jface.action.IToolBarManager) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) CommitEditor(org.eclipse.egit.ui.internal.commit.CommitEditor) RepositoryState(org.eclipse.jgit.lib.RepositoryState) OpenAndLinkWithEditorHelper(org.eclipse.ui.OpenAndLinkWithEditorHelper) RevWalk(org.eclipse.jgit.revwalk.RevWalk) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) ISelectionListener(org.eclipse.ui.ISelectionListener) Composite(org.eclipse.swt.widgets.Composite) PreferenceBasedDateFormatter(org.eclipse.egit.ui.internal.PreferenceBasedDateFormatter) ColumnViewerToolTipSupport(org.eclipse.jface.viewers.ColumnViewerToolTipSupport) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) IEditorPart(org.eclipse.ui.IEditorPart) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) IWorkbenchAdapter(org.eclipse.ui.model.IWorkbenchAdapter) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) TreeColumn(org.eclipse.swt.widgets.TreeColumn) RefsChangedListener(org.eclipse.jgit.events.RefsChangedListener) Separator(org.eclipse.jface.action.Separator) IEditorInput(org.eclipse.ui.IEditorInput) PlatformUI(org.eclipse.ui.PlatformUI) MenuManager(org.eclipse.jface.action.MenuManager) Constants(org.eclipse.jgit.lib.Constants) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) ResetMenu(org.eclipse.egit.ui.internal.actions.ResetMenu) GridLayoutFactory(org.eclipse.jface.layout.GridLayoutFactory) ListenerHandle(org.eclipse.jgit.events.ListenerHandle) OpenStrategy(org.eclipse.jface.util.OpenStrategy) PersonIdent(org.eclipse.jgit.lib.PersonIdent) Window(org.eclipse.jface.window.Window) UIText(org.eclipse.egit.ui.internal.UIText) ReflogInput(org.eclipse.egit.ui.internal.reflog.ReflogViewContentProvider.ReflogInput) Tree(org.eclipse.swt.widgets.Tree) IFormColors(org.eclipse.ui.forms.IFormColors) SWT(org.eclipse.swt.SWT) ISelection(org.eclipse.jface.viewers.ISelection) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IShowInTarget(org.eclipse.ui.part.IShowInTarget) UIIcons(org.eclipse.egit.ui.internal.UIIcons) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISelectionService(org.eclipse.ui.ISelectionService) RepositoryMapping(org.eclipse.egit.core.project.RepositoryMapping) RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) RepositorySelectionProvider(org.eclipse.egit.ui.internal.selection.RepositorySelectionProvider) ViewPart(org.eclipse.ui.part.ViewPart) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Activator(org.eclipse.egit.ui.Activator) Image(org.eclipse.swt.graphics.Image) JFaceResources(org.eclipse.jface.resource.JFaceResources) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IFileEditorInput(org.eclipse.ui.IFileEditorInput) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ShowInContext(org.eclipse.ui.part.ShowInContext) ReflogEntry(org.eclipse.jgit.lib.ReflogEntry) ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) IWorkbenchActionConstants(org.eclipse.ui.IWorkbenchActionConstants) ControlContribution(org.eclipse.jface.action.ControlContribution) GridDataFactory(org.eclipse.jface.layout.GridDataFactory) RefsChangedEvent(org.eclipse.jgit.events.RefsChangedEvent) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) IOException(java.io.IOException) CommonUtils(org.eclipse.egit.ui.internal.CommonUtils) ObjectId(org.eclipse.jgit.lib.ObjectId) Form(org.eclipse.ui.forms.widgets.Form) RowLayout(org.eclipse.swt.layout.RowLayout) PatternFilter(org.eclipse.ui.dialogs.PatternFilter) IContextService(org.eclipse.ui.contexts.IContextService) IResource(org.eclipse.core.resources.IResource) UIUtils(org.eclipse.egit.ui.UIUtils) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) RepositoryToolbarAction(org.eclipse.egit.ui.internal.components.RepositoryMenuUtil.RepositoryToolbarAction) LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter) Repository(org.eclipse.jgit.lib.Repository) Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) DisposeListener(org.eclipse.swt.events.DisposeListener) PatternFilter(org.eclipse.ui.dialogs.PatternFilter) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) RepositorySelectionProvider(org.eclipse.egit.ui.internal.selection.RepositorySelectionProvider) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Image(org.eclipse.swt.graphics.Image) ISelectionListener(org.eclipse.ui.ISelectionListener) IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) ReflogEntry(org.eclipse.jgit.lib.ReflogEntry) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IFileEditorInput(org.eclipse.ui.IFileEditorInput) ISelection(org.eclipse.jface.viewers.ISelection) ISelectionService(org.eclipse.ui.ISelectionService) Tree(org.eclipse.swt.widgets.Tree) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) RevCommit(org.eclipse.jgit.revwalk.RevCommit) IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) RepositoryToolbarAction(org.eclipse.egit.ui.internal.components.RepositoryMenuUtil.RepositoryToolbarAction) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ObjectId(org.eclipse.jgit.lib.ObjectId) IOException(java.io.IOException) ResourceManager(org.eclipse.jface.resource.ResourceManager) LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) IEditorPart(org.eclipse.ui.IEditorPart) RevWalk(org.eclipse.jgit.revwalk.RevWalk) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) Repository(org.eclipse.jgit.lib.Repository) PersonIdent(org.eclipse.jgit.lib.PersonIdent) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IWorkbenchAdapter(org.eclipse.ui.model.IWorkbenchAdapter) MenuManager(org.eclipse.jface.action.MenuManager) IEditorInput(org.eclipse.ui.IEditorInput) Separator(org.eclipse.jface.action.Separator)

Example 30 with PatternFilter

use of org.eclipse.ui.dialogs.PatternFilter in project bndtools by bndtools.

the class RunDescriptorTargetLocationPage method getProjectTreeFilters.

private ViewerFilter[] getProjectTreeFilters() {
    PatternFilter bndrunFilter = new PatternFilter() {

        @Override
        protected boolean isLeafMatch(Viewer viewer, Object element) {
            return element instanceof IFile && FILE_EXTENSION.equals(((IFile) element).getFileExtension());
        }

        @Override
        public boolean isElementSelectable(Object element) {
            return element instanceof IFile;
        }
    };
    bndrunFilter.setPattern("*");
    return new ViewerFilter[] { bndrunFilter };
}
Also used : PatternFilter(org.eclipse.ui.dialogs.PatternFilter) IFile(org.eclipse.core.resources.IFile) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer)

Aggregations

PatternFilter (org.eclipse.ui.dialogs.PatternFilter)31 FilteredTree (org.eclipse.ui.dialogs.FilteredTree)23 Composite (org.eclipse.swt.widgets.Composite)20 GridLayout (org.eclipse.swt.layout.GridLayout)12 TreeViewer (org.eclipse.jface.viewers.TreeViewer)11 Viewer (org.eclipse.jface.viewers.Viewer)11 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)9 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)9 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)8 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)8 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)7 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 GridData (org.eclipse.swt.layout.GridData)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 Label (org.eclipse.swt.widgets.Label)6 Tree (org.eclipse.swt.widgets.Tree)6 CachedCheckboxTreeViewer (org.eclipse.egit.ui.internal.components.CachedCheckboxTreeViewer)5 FilteredCheckboxTree (org.eclipse.egit.ui.internal.components.FilteredCheckboxTree)5