Search in sources :

Example 1 with ResourceWorkingSetFilter

use of org.eclipse.ui.ResourceWorkingSetFilter in project translationstudio8 by heartsome.

the class WorkingSetActionProvider method setWorkingSetFilter.

private void setWorkingSetFilter(IWorkingSet workingSet, boolean firstTime) {
    ResourceWorkingSetFilter workingSetFilter = null;
    ViewerFilter[] filters = viewer.getFilters();
    for (int i = 0; i < filters.length; i++) {
        if (filters[i] instanceof ResourceWorkingSetFilter) {
            workingSetFilter = (ResourceWorkingSetFilter) filters[i];
            break;
        }
    }
    if (workingSetFilter == null) {
        if (firstTime) {
            filterService.addActiveFilterIds(new String[] { WORKING_SET_FILTER_ID });
            filterService.updateViewer();
            setWorkingSetFilter(workingSet, !FIRST_TIME);
            return;
        }
        WorkbenchNavigatorPlugin.log(//$NON-NLS-1$
        "Required filter " + WORKING_SET_FILTER_ID + //$NON-NLS-1$
        " is not present. Working set support will not function correctly.", //$NON-NLS-1$
        new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.PLUGIN_ID, ""));
        return;
    }
    workingSetFilter.setWorkingSet(emptyWorkingSet ? null : workingSet);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ResourceWorkingSetFilter(org.eclipse.ui.ResourceWorkingSetFilter)

Example 2 with ResourceWorkingSetFilter

use of org.eclipse.ui.ResourceWorkingSetFilter in project pmd-eclipse-plugin by pmd.

the class BaseVisitor method isFileInWorkingSet.

/**
 * Test if a file is in the PMD working set
 *
 * @param file
 * @return true if the file should be checked
 */
private boolean isFileInWorkingSet(final IFile file) throws PropertiesException {
    boolean fileInWorkingSet = true;
    IWorkingSet workingSet = projectProperties.getProjectWorkingSet();
    if (workingSet != null) {
        ResourceWorkingSetFilter filter = new ResourceWorkingSetFilter();
        filter.setWorkingSet(workingSet);
        fileInWorkingSet = filter.select(null, null, file);
    }
    return fileInWorkingSet;
}
Also used : ResourceWorkingSetFilter(org.eclipse.ui.ResourceWorkingSetFilter) IWorkingSet(org.eclipse.ui.IWorkingSet)

Example 3 with ResourceWorkingSetFilter

use of org.eclipse.ui.ResourceWorkingSetFilter in project pmd-eclipse-plugin by pmd.

the class CPDVisitor method setWorkingSet.

/**
 * @param workingSet
 *            WorkingSet of the visited project.
 */
public void setWorkingSet(IWorkingSet workingSet) {
    this.workingSetFilter = new ResourceWorkingSetFilter();
    this.workingSetFilter.setWorkingSet(workingSet);
}
Also used : ResourceWorkingSetFilter(org.eclipse.ui.ResourceWorkingSetFilter)

Aggregations

ResourceWorkingSetFilter (org.eclipse.ui.ResourceWorkingSetFilter)3 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 IWorkingSet (org.eclipse.ui.IWorkingSet)1