Codota Logo
JavaDirectoryService.createClass
Code IndexAdd Codota to your IDE (free)

How to use
createClass
method
in
com.intellij.psi.JavaDirectoryService

Best Java code snippets using com.intellij.psi.JavaDirectoryService.createClass (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: zzz40500/GsonFormat

psiClass = JavaDirectoryService.getInstance().createClass(psiDirectory, className);
FileEditorManager manager = FileEditorManager.getInstance(project);
manager.openFile(psiClass.getContainingFile().getVirtualFile(), true, true);
origin: dhleong/intellivim

final String className = resolveClassName();
final PsiClass created = JavaDirectoryService.getInstance()
    .createClass(dest, className, templateName, false);
return SimpleResult.success(new LocationResult(created));
origin: JetBrains/Grammar-Kit

 @Override
 protected void run(Result result) throws Throwable {
  IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
  PsiJavaCodeReferenceElement ref = baseClass == null ? null : elementFactory.createReferenceElementByFQClassName(
    baseClass, GlobalSearchScope.allScope(project));
  try {
   PsiClass resultClass = JavaDirectoryService.getInstance().createClass(targetDirectory, className);
   resultRef.set(resultClass);
   if (ref != null) {
    PsiElement baseClass = ref.resolve();
    boolean isInterface = baseClass instanceof PsiClass && ((PsiClass) baseClass).isInterface();
    PsiReferenceList targetReferenceList = isInterface ? resultClass.getImplementsList() : resultClass.getExtendsList();
    assert targetReferenceList != null;
    targetReferenceList.add(ref);
   }
   if (consumer != null) {
    consumer.consume(resultClass);
   }
  }
  catch (final IncorrectOperationException e) {
   ApplicationManager.getApplication().invokeLater(
    () -> Messages.showErrorDialog(project, "Unable to create class " + className + "\n" + e.getLocalizedMessage(), title));
  }
 }
}.execute();
com.intellij.psiJavaDirectoryServicecreateClass

Javadoc

Creates a class with the specified name in the directory.

Popular methods of JavaDirectoryService

  • getInstance
  • getPackage
    Returns the package corresponding to the directory.
  • getLanguageLevel
  • isSourceRoot
    Checks if the directory is a source root for the project to which it belongs.

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • getSharedPreferences (Context)
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now