@NotNull SearchScope getMaxSearchScopeToWarnOfFallingOutOf(@NotNull UsageTarget[] searchFor) { UsageTarget target = searchFor[0]; if (target instanceof TypeSafeDataProvider) { final SearchScope[] scope = new SearchScope[1]; ((TypeSafeDataProvider)target).calcData(UsageView.USAGE_SCOPE, new DataSink() { @Override public <T> void put(DataKey<T> key, T data) { scope[0] = (SearchScope)data; } }); return scope[0]; } return GlobalSearchScope.allScope(myProject); // by default do not warn of falling out of scope }
@Override public Object getData(@NonNls final String dataId) { final DialogWrapper wrapper = myDialogWrapper.get(); if (wrapper instanceof DataProvider) { return ((DataProvider) wrapper).getData(dataId); } else if (wrapper instanceof TypeSafeDataProvider) { TypeSafeDataProviderAdapter adapter = new TypeSafeDataProviderAdapter((TypeSafeDataProvider) wrapper); return adapter.getData(dataId); } return null; }
public Object getData(@NonNls final String dataId) { final DialogWrapper wrapper = myDialogWrapper.get(); if (wrapper instanceof DataProvider) { return ((DataProvider) wrapper).getData(dataId); } else if (wrapper instanceof TypeSafeDataProvider) { TypeSafeDataProviderAdapter adapter = new TypeSafeDataProviderAdapter((TypeSafeDataProvider) wrapper); return adapter.getData(dataId); } return null; }
@Nonnull SearchScope getMaxSearchScopeToWarnOfFallingOutOf(@Nonnull UsageTarget[] searchFor) { UsageTarget target = searchFor.length > 0 ? searchFor[0] : null; if (target instanceof TypeSafeDataProvider) { final SearchScope[] scope = new SearchScope[1]; ((TypeSafeDataProvider)target).calcData(UsageView.USAGE_SCOPE, new DataSink() { @Override public <T> void put(Key<T> key, T data) { scope[0] = (SearchScope)data; } }); return scope[0]; } return GlobalSearchScope.allScope(myProject); // by default do not warn of falling out of scope }
@Override public Object getData(@NonNls final Key dataId) { final DialogWrapper wrapper = myDialogWrapper.get(); if (wrapper instanceof DataProvider) { return ((DataProvider) wrapper).getData(dataId); } else if (wrapper instanceof TypeSafeDataProvider) { TypeSafeDataProviderAdapter adapter = new TypeSafeDataProviderAdapter((TypeSafeDataProvider) wrapper); return adapter.getData(dataId); } return null; }
public TypeSafeDataProviderAdapter(@NotNull TypeSafeDataProvider provider) { myProvider = provider; }
public TypeSafeDataProviderAdapter(final TypeSafeDataProvider provider) { myProvider = provider; }
public void addCustomDataProvider(TypeSafeDataProvider provider) { myCustomDataProviders.add(provider); }
public void calcData(final Key<?> key, final DataSink sink) { super.calcData(key, sink); for (final TypeSafeDataProvider customDataProvider : myCustomDataProviders) { customDataProvider.calcData(key, sink); } }