Java Code Examples for com.intellij.util.ReflectionUtil#createInstance()

The following examples show how to use com.intellij.util.ReflectionUtil#createInstance() . 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: ModuleExtensionProviderEP.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public ModuleExtension<?> createImmutable(@Nonnull ModuleRootLayer modifiableRootModel) {
  try {
    Pair<Class<ModuleExtension>, Constructor<ModuleExtension>> value = myImmutableValue.getValue();
    if (value != null) {
      return ReflectionUtil.createInstance(value.getSecond(), key, modifiableRootModel);
    }
  }
  catch (Error e) {
    ModuleExtensionProviderEP.LOGGER.error("Problem with module extension: " + key, e);
  }
  return null;
}
 
Example 2
Source File: ModuleExtensionProviderEP.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public MutableModuleExtension<?> createMutable(@Nonnull ModuleRootLayer modifiableRootModel) {
  try {
    Pair<Class<MutableModuleExtension>, Constructor<MutableModuleExtension>> value = myMutableValue.getValue();
    if (value != null) {
      return ReflectionUtil.createInstance(value.getSecond(), key, modifiableRootModel);
    }
  }
  catch (Error e) {
    ModuleExtensionProviderEP.LOGGER.error("Problem with module extension: " + key, e);
  }
  return null;
}
 
Example 3
Source File: ElementTypeAsPsiFactory.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public PsiElement createElement(@Nonnull ASTNode astNode) {
  if (myConstructor == null) {
    return PsiUtilCore.NULL_PSI_ELEMENT;
  }
  return ReflectionUtil.createInstance(myConstructor, astNode);
}
 
Example 4
Source File: ApplicationStarter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private ApplicationPostStarter createPostStarter() {
  try {
    Constructor<? extends ApplicationPostStarter> constructor = myPostStarterClass.getConstructor(ApplicationStarter.class);
    constructor.setAccessible(true);
    return ReflectionUtil.createInstance(constructor, this);
  }
  catch (NoSuchMethodException e) {
    throw new Error(e);
  }
}
 
Example 5
Source File: BashElementTypes.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public ASTNode createCompositeNode() {
    return ReflectionUtil.createInstance(myConstructor);
}
 
Example 6
Source File: DependencyCacheEP.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DependencyCache create(Project project, String cacheDir) {
  return ReflectionUtil.createInstance(myClassValue.getValue(), project, cacheDir);
}