1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-29 03:03:10 +02:00

Code streamlining.

This commit is contained in:
Sergey Prigogin 2011-03-06 23:41:45 +00:00
parent a421c6d1f1
commit 3d9f5a3c93

View file

@ -11,16 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.provider; package org.eclipse.cdt.internal.core.index.provider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.provider.IIndexProvider; import org.eclipse.cdt.core.index.provider.IIndexProvider;
import org.eclipse.cdt.core.index.provider.IReadOnlyPDOMProvider; import org.eclipse.cdt.core.index.provider.IReadOnlyPDOMProvider;
@ -44,8 +34,16 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.service.resolver.VersionRange; import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Version; import org.osgi.framework.Version;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* The IndexProviderManager is responsible for maintaining the set of index * The IndexProviderManager is responsible for maintaining the set of index
* fragments contributed via the CIndex extension point. * fragments contributed via the CIndex extension point.
@ -114,15 +112,13 @@ public final class IndexProviderManager implements IElementChangedListener {
provider = new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider); provider = new ReadOnlyPDOMProviderBridge((IReadOnlyPDOMProvider) provider);
providers.add(provider); providers.add(provider);
} else { } else {
CCorePlugin.log(MessageFormat.format( CCorePlugin.log(NLS.bind(Messages.IndexProviderManager_0,
Messages.IndexProviderManager_0, extension.getContributor().getName()));
new Object[] { extension.getContributor().getName() }
));
} }
} }
} }
} catch(CoreException ce) { } catch (CoreException e) {
CCorePlugin.log(ce); CCorePlugin.log(e);
} }
} }
@ -149,15 +145,15 @@ public final class IndexProviderManager implements IElementChangedListener {
for (int j= 0; j < fragments.length; j++) { for (int j= 0; j < fragments.length; j++) {
try { try {
processCandidate(id2fragment, fragments[j]); processCandidate(id2fragment, fragments[j]);
} catch(InterruptedException ie) { } catch (InterruptedException e) {
CCorePlugin.log(ie); // continue with next candidate CCorePlugin.log(e); // continue with next candidate
} catch(CoreException ce) { } catch (CoreException e) {
CCorePlugin.log(ce); // continue with next candidate CCorePlugin.log(e); // continue with next candidate
} }
} }
} }
} catch(CoreException ce) { } catch (CoreException e) {
CCorePlugin.log(ce); // move to next provider CCorePlugin.log(e); // move to next provider
} }
} }
@ -167,13 +163,9 @@ public final class IndexProviderManager implements IElementChangedListener {
if (entry.getValue() == null) { if (entry.getValue() == null) {
String key= entry.getKey(); String key= entry.getKey();
if (!compatibleFragmentUnavailable.contains(key)) { if (!compatibleFragmentUnavailable.contains(key)) {
String msg= MessageFormat.format( String msg= NLS.bind(
Messages.IndexProviderManager_NoCompatibleFragmentsAvailable, Messages.IndexProviderManager_NoCompatibleFragmentsAvailable, key);
new Object[]{key} CCorePlugin.log(new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, msg));
);
IStatus status= new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID,
IStatus.WARNING, msg, null);
CCorePlugin.log(status);
compatibleFragmentUnavailable.add(key); compatibleFragmentUnavailable.add(key);
} }
} else { } else {
@ -328,8 +320,7 @@ public final class IndexProviderManager implements IElementChangedListener {
switch (delta.getKind()) { switch (delta.getKind()) {
case ICElementDelta.REMOVED: case ICElementDelta.REMOVED:
List<ProvisionMapKey> toRemove = new ArrayList<ProvisionMapKey>(); List<ProvisionMapKey> toRemove = new ArrayList<ProvisionMapKey>();
for (Iterator<ProvisionMapKey> i = provisionMap.keySet().iterator(); i.hasNext(); ) { for (ProvisionMapKey key : provisionMap.keySet()) {
ProvisionMapKey key = i.next();
if (key.getProject().equals(cproject.getProject())) { if (key.getProject().equals(cproject.getProject())) {
toRemove.add(key); toRemove.add(key);
} }