org.eclipse.ui.navigator.PipelinedViewerUpdate Java Examples

The following examples show how to use org.eclipse.ui.navigator.PipelinedViewerUpdate. 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: JavaSynchronizationContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts the viewer update to use java elements.
 *
 * @param update
 *            the viewer update to convert
 * @return <code>true</code> if any elements have been converted,
 *         <code>false</code> otherwise
 */
private boolean convertToJavaElements(final PipelinedViewerUpdate update) {
	final Set<IJavaElement> result= new HashSet<IJavaElement>();
	for (final Iterator<IAdaptable> iterator= update.getRefreshTargets().iterator(); iterator.hasNext();) {
		final Object element= iterator.next();
		if (element instanceof IProject) {
			final IJavaElement project= asJavaProject((IProject) element);
			if (project != null) {
				iterator.remove();
				result.add(project);
			}
		}
	}
	update.getRefreshTargets().addAll(result);
	return !result.isEmpty();
}
 
Example #2
Source File: PythonModelProviderTest.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Test if intercepting an object that does not have a parent works.
 */
public void testInterceptRefresh() throws Exception {
    PythonNature nature = createNature(TestDependent.TEST_PYSRC_NAVIGATOR_LOC + "projroot/source/python");

    project = new ProjectStub(new File(TestDependent.TEST_PYSRC_NAVIGATOR_LOC + "projroot"), nature);
    provider = new PythonModelProvider();

    PipelinedViewerUpdate update = new PipelinedViewerUpdate();
    Set<Object> refreshTargets = update.getRefreshTargets();
    refreshTargets.add(project);
    refreshTargets.add(null);
    refreshTargets.add("string");
    provider.interceptRefresh(update);
    assertEquals(2, refreshTargets.size());
    for (Object wrappedResource : refreshTargets) {
        assertTrue(wrappedResource == project || wrappedResource.equals("string"));
    }
}
 
Example #3
Source File: PythonModelProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean interceptRefresh(PipelinedViewerUpdate refreshSynchronization) {
    if (DEBUG) {
        System.out.println("interceptRefresh");
    }
    return convertToPythonElementsUpdateOrRefresh(refreshSynchronization.getRefreshTargets());
}
 
Example #4
Source File: PythonModelProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean interceptUpdate(PipelinedViewerUpdate updateSynchronization) {
    if (DEBUG) {
        debug("Before interceptUpdate", updateSynchronization);
    }
    boolean ret = convertToPythonElementsUpdateOrRefresh(updateSynchronization.getRefreshTargets());
    if (DEBUG) {
        debug("After interceptUpdate", updateSynchronization);
    }
    return ret;
}
 
Example #5
Source File: PythonModelProvider.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Helper for debugging the things we have in an update
 */
private void debug(String desc, PipelinedViewerUpdate updateSynchronization) {
    System.out.println("\nDesc:" + desc);
    System.out.println("Refresh targets:");
    for (Object o : updateSynchronization.getRefreshTargets()) {
        System.out.println(o);
    }
}
 
Example #6
Source File: N4JSProjectExplorerContentProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean interceptRefresh(final PipelinedViewerUpdate aRefreshSynchronization) {
	return true;
}
 
Example #7
Source File: N4JSProjectExplorerContentProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean interceptUpdate(final PipelinedViewerUpdate anUpdateSynchronization) {
	return true;
}
 
Example #8
Source File: ProjectExplorerContentProvider.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean interceptRefresh(
        PipelinedViewerUpdate aRefreshSynchronization) {
    return false;
}
 
Example #9
Source File: ProjectExplorerContentProvider.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
    return false;
}
 
Example #10
Source File: TmfNavigatorContentProvider.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean interceptRefresh(PipelinedViewerUpdate aRefreshSynchronization) {
    return false;
}
 
Example #11
Source File: TmfNavigatorContentProvider.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
    return false;
}
 
Example #12
Source File: JavaSynchronizationContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean interceptRefresh(final PipelinedViewerUpdate update) {
	return convertToJavaElements(update);
}
 
Example #13
Source File: JavaSynchronizationContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean interceptUpdate(final PipelinedViewerUpdate anUpdateSynchronization) {
	return convertToJavaElements(anUpdateSynchronization);
}
 
Example #14
Source File: JavaNavigatorContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public boolean interceptUpdate(PipelinedViewerUpdate updateSynchronization) {
	return convertToJavaElements(updateSynchronization.getRefreshTargets());
}
 
Example #15
Source File: JavaNavigatorContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
public boolean interceptRefresh(PipelinedViewerUpdate refreshSynchronization) {
	return convertToJavaElements(refreshSynchronization.getRefreshTargets());

}