Java Code Examples for consulo.util.dataholder.Key#create()

The following examples show how to use consulo.util.dataholder.Key#create() . 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: StandardPatternsTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSave() throws Throwable {
  Key<String> key = Key.create("abc");
  final ProcessingContext context = new ProcessingContext();
  assertFalse(string().contains("abc").save(key).accepts(null));
  assertNull(context.get(key));

  assertFalse(string().contains("abc").save(key).accepts("def"));
  assertNull(context.get(key));

  final String s = "defabcdef";
  assertTrue(string().contains("abc").save(key).accepts(s, context));
  assertSame(s, context.get(key));
}
 
Example 2
Source File: AnActionEvent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> Key<T> injectedId(Key<T> dataId) {
  synchronized (ourInjectedKeys) {
    Key injected = ourInjectedKeys.get(dataId);
    if (injected == null) {
      injected = Key.create(ourInjectedPrefix + dataId);

      ourInjectedKeys.put(dataId, injected);
      ourUnInjectedKeys.put(injected, dataId);
    }
    return injected;
  }
}
 
Example 3
Source File: PsiFileGistImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
PsiFileGistImpl(@Nonnull String id, int version, @Nonnull DataExternalizer<Data> externalizer, @Nonnull NullableFunction<PsiFile, Data> calculator) {
  myCalculator = (project, file) -> {
    PsiFile psiFile = getPsiFile(project, file);
    return psiFile == null ? null : calculator.fun(psiFile);
  };
  myPersistence = GistManager.getInstance().newVirtualFileGist(id, version, externalizer, myCalculator);
  myCacheKey = Key.create("PsiFileGist " + id);
}
 
Example 4
Source File: CompositeExtensionPointName.java    From consulo with Apache License 2.0 4 votes vote down vote up
private CompositeExtensionPointNameWithArea(@Nonnull String name, Class<E> clazz) {
  super(name, clazz);
  myCompositeValueKey = Key.create("CompositeExtensionPoint#" + name);
}
 
Example 5
Source File: LanguageExtension.java    From consulo with Apache License 2.0 4 votes vote down vote up
public LanguageExtension(@NonNls final String epName, @Nullable final T defaultImplementation) {
  super(epName);
  myDefaultImplementation = defaultImplementation;
  IN_LANGUAGE_CACHE = Key.create("EXTENSIONS_IN_LANGUAGE_" + epName);
}
 
Example 6
Source File: SmartPointerManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Inject
public SmartPointerManagerImpl(@Nonnull Project project) {
  myProject = project;
  myPsiDocManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(project);
  POINTERS_KEY = Key.create("SMART_POINTERS " + (project.isDefault() ? "default" : project.hashCode()));
}
 
Example 7
Source File: UnknownBeforeRunTaskProvider.java    From consulo with Apache License 2.0 4 votes vote down vote up
public UnknownBeforeRunTaskProvider(String mirrorProviderName) {
  myId = Key.create(mirrorProviderName);
}
 
Example 8
Source File: FileIncludeManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private IncludeCacheHolder(String compileTimeKey, String runtimeKey) {
  COMPILE_TIME_KEY = Key.create(compileTimeKey);
  RUNTIME_KEY = Key.create(runtimeKey);
}