use of org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor in project webtools.sourceediting by eclipse.
the class FindOccurrencesHandler method getProcessorForCurrentSelection.
/**
* Get the appropriate find occurrences processor
*
* @param document -
* assumes not null
* @param textSelection
* @return
*/
private FindOccurrencesProcessor getProcessorForCurrentSelection(IDocument document, ITextSelection textSelection) {
// check if we have an action that's enabled on the current partition
ITypedRegion tr = getPartition(document, textSelection);
// $NON-NLS-1$
String partition = tr != null ? tr.getType() : "";
Iterator it = getProcessors().iterator();
FindOccurrencesProcessor processor = null;
while (it.hasNext()) {
processor = (FindOccurrencesProcessor) it.next();
// we just choose the first action that can handle the partition
if (processor.enabledForParitition(partition))
return processor;
}
List extendedFindOccurrencesProcessors = ExtendedConfigurationBuilder.getInstance().getConfigurations(FindOccurrencesProcessor.class.getName(), partition);
for (int i = 0; i < extendedFindOccurrencesProcessors.size(); i++) {
Object o = extendedFindOccurrencesProcessors.get(i);
if (o instanceof FindOccurrencesProcessor) {
/*
* We just choose the first registered processor that
* explicitly says it can handle the partition
*/
processor = (FindOccurrencesProcessor) o;
if (processor.enabledForParitition(partition))
return processor;
}
}
return null;
}
Aggregations