Java 类com.intellij.uiDesigner.make.FormSourceCodeGenerator 实例源码

项目:intellij-ce-playground    文件:GuiDesignerConfigurable.java   
/**
 * Removes all generated sources
 */
private void vanishGeneratedSources() {
  final PsiShortNamesCache cache = PsiShortNamesCache.getInstance(myProject);
  final PsiMethod[] methods = cache.getMethodsByName(AsmCodeGenerator.SETUP_METHOD_NAME, GlobalSearchScope.projectScope(myProject));

  CodeInsightUtil.preparePsiElementsForWrite(methods);

  for (int i = 0; i < methods.length; i++) {
    final PsiMethod method = methods[i];
    final PsiClass aClass = method.getContainingClass();
    if (aClass != null) {
      try {
        final PsiFile psiFile = aClass.getContainingFile();
        LOG.assertTrue(psiFile != null);
        final VirtualFile vFile = psiFile.getVirtualFile();
        LOG.assertTrue(vFile != null);
        myProgressWindow.setText(UIDesignerBundle.message("progress.converting", vFile.getPresentableUrl()));
        myProgressWindow.setFraction(((double)i) / ((double)methods.length));
        if (vFile.isWritable()) {
          FormSourceCodeGenerator.cleanup(aClass);
        }
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    }
  }
}
项目:tools-idea    文件:GuiDesignerConfigurable.java   
/**
 * Removes all generated sources
 */
private void vanishGeneratedSources() {
  final PsiShortNamesCache cache = PsiShortNamesCache.getInstance(myProject);
  final PsiMethod[] methods = cache.getMethodsByName(AsmCodeGenerator.SETUP_METHOD_NAME, GlobalSearchScope.projectScope(myProject));

  CodeInsightUtil.preparePsiElementsForWrite(methods);

  for (int i = 0; i < methods.length; i++) {
    final PsiMethod method = methods[i];
    final PsiClass aClass = method.getContainingClass();
    if (aClass != null) {
      try {
        final PsiFile psiFile = aClass.getContainingFile();
        LOG.assertTrue(psiFile != null);
        final VirtualFile vFile = psiFile.getVirtualFile();
        LOG.assertTrue(vFile != null);
        myProgressWindow.setText(UIDesignerBundle.message("progress.converting", vFile.getPresentableUrl()));
        myProgressWindow.setFraction(((double)i) / ((double)methods.length));
        if (vFile.isWritable()) {
          FormSourceCodeGenerator.cleanup(aClass);
        }
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    }
  }
}
项目:consulo-ui-designer    文件:GuiDesignerConfigurable.java   
/**
 * Removes all generated sources
 */
private void vanishGeneratedSources()
{
    final PsiShortNamesCache cache = PsiShortNamesCache.getInstance(myProject);
    final PsiMethod[] methods = cache.getMethodsByName(AsmCodeGenerator.SETUP_METHOD_NAME,
            GlobalSearchScope.projectScope(myProject));

    CodeInsightUtil.preparePsiElementsForWrite(methods);

    for(int i = 0; i < methods.length; i++)
    {
        final PsiMethod method = methods[i];
        final PsiClass aClass = method.getContainingClass();
        if(aClass != null)
        {
            try
            {
                final PsiFile psiFile = aClass.getContainingFile();
                LOG.assertTrue(psiFile != null);
                final VirtualFile vFile = psiFile.getVirtualFile();
                LOG.assertTrue(vFile != null);
                myProgressWindow.setText(UIDesignerBundle.message("progress.converting",
                        vFile.getPresentableUrl()));
                myProgressWindow.setFraction(((double) i) / ((double) methods.length));
                if(vFile.isWritable())
                {
                    FormSourceCodeGenerator.cleanup(aClass);
                }
            }
            catch(IncorrectOperationException e)
            {
                LOG.error(e);
            }
        }
    }
}