Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'rdt/org.eclipse.ptp.rdt.editor/src/org/eclipse/ptp/rdt/editor/info/RemoteCInfoProviderUtilities.java')
-rw-r--r--rdt/org.eclipse.ptp.rdt.editor/src/org/eclipse/ptp/rdt/editor/info/RemoteCInfoProviderUtilities.java25
1 files changed, 10 insertions, 15 deletions
diff --git a/rdt/org.eclipse.ptp.rdt.editor/src/org/eclipse/ptp/rdt/editor/info/RemoteCInfoProviderUtilities.java b/rdt/org.eclipse.ptp.rdt.editor/src/org/eclipse/ptp/rdt/editor/info/RemoteCInfoProviderUtilities.java
index aa62be7a9..35ed1eb8d 100644
--- a/rdt/org.eclipse.ptp.rdt.editor/src/org/eclipse/ptp/rdt/editor/info/RemoteCInfoProviderUtilities.java
+++ b/rdt/org.eclipse.ptp.rdt.editor/src/org/eclipse/ptp/rdt/editor/info/RemoteCInfoProviderUtilities.java
@@ -52,23 +52,18 @@ public class RemoteCInfoProviderUtilities {
return editorProviders;
}
- public static IRemoteCEditorInfoProvider getApplicableEditorInfoProvider(List<IRemoteCEditorInfoProvider> infoProviders,
- IEditorInput input) {
- List<IRemoteCEditorInfoProvider> handled = new ArrayList<IRemoteCEditorInfoProvider>();
- List<IRemoteCEditorInfoProvider> ambiguous = new ArrayList<IRemoteCEditorInfoProvider>();
-
+ public static IRemoteCEditorInfoProvider getApplicableEditorInfoProvider(List<IRemoteCEditorInfoProvider> infoProviders, IEditorInput input) {
+ IRemoteCEditorInfoProvider winner = null;
+ int highestVal = 0;
for (IRemoteCEditorInfoProvider provider: infoProviders) {
- if (provider.isApplicableEditorInput(input)==IRemoteCEditorInfoProvider.HANDLES_INPUT)
- handled.add(provider);
- else if (provider.isApplicableEditorInput(input)==IRemoteCEditorInfoProvider.INPUT_AMBIGUOUS)
- ambiguous.add(provider);
- }
- if (handled.size()==1)
- return handled.get(0);
- else {
- //TODO: prompt the user for which context they would prefer for the editor
+ int applicable = Math.min(100, provider.isApplicableEditorInput(input));
+ if(applicable <= 0)
+ continue;
+ if(applicable > highestVal)
+ winner = provider;
}
- return null;
+
+ return winner;
}
}

Back to the top