Java 类com.intellij.openapi.project.DefaultProjectFactory 实例源码

项目:intellij-ce-playground    文件:ClassFileDecompiler.java   
@Override
@NotNull
public CharSequence decompile(@NotNull VirtualFile file) {
  ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
  if (decompiler instanceof ClassFileDecompilers.Full) {
    PsiManager manager = PsiManager.getInstance(DefaultProjectFactory.getInstance().getDefaultProject());
    return ((ClassFileDecompilers.Full)decompiler).createFileViewProvider(file, manager, true).getContents();
  }

  if (decompiler instanceof ClassFileDecompilers.Light) {
    try {
      return ((ClassFileDecompilers.Light)decompiler).getText(file);
    }
    catch (ClassFileDecompilers.Light.CannotDecompileException e) {
      LOG.warn("decompiler: " + decompiler.getClass(), e);
    }
  }

  return ClsFileImpl.decompile(file);
}
项目:intellij-ce-playground    文件:IdeaDecompiler.java   
private static Map<String, Object> getOptions() {
  Map<String, Object> options = ContainerUtil.newHashMap();

  options.put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "0");
  options.put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "1");
  options.put(IFernflowerPreferences.REMOVE_SYNTHETIC, "1");
  options.put(IFernflowerPreferences.REMOVE_BRIDGE, "1");
  options.put(IFernflowerPreferences.LITERALS_AS_IS, "1");
  options.put(IFernflowerPreferences.NEW_LINE_SEPARATOR, "1");
  options.put(IFernflowerPreferences.BANNER, BANNER);
  options.put(IFernflowerPreferences.MAX_PROCESSING_METHOD, 60);

  Project project = DefaultProjectFactory.getInstance().getDefaultProject();
  CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
  CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(JavaFileType.INSTANCE);
  options.put(IFernflowerPreferences.INDENT_STRING, StringUtil.repeat(" ", indentOptions.INDENT_SIZE));

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    options.put(IFernflowerPreferences.UNIT_TEST_MODE, "1");
  }

  return Collections.unmodifiableMap(options);
}
项目:vso-intellij    文件:SimpleCheckoutStarter.java   
/**
 * Kicks off the SimpleCheckout workflow with the Git Url passed
 */
public void processCommand() {
    final Project project = DefaultProjectFactory.getInstance().getDefaultProject();
    final CheckoutProvider.Listener listener = ProjectLevelVcsManager.getInstance(project).getCompositeCheckoutListener();

    try {
        launchApplicationWindow();

        final SimpleCheckoutController controller = new SimpleCheckoutController(project, listener, gitUrl, ref);
        controller.showModalDialog();
    } catch (Throwable t) {
        //unexpected error occurred while doing simple checkout
        logger.warn("VSTS commandline checkout failed due to an unexpected error", t);
        VcsNotifier.getInstance(project).notifyError(TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_TITLE),
                TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_ERRORS_UNEXPECTED, t.getMessage()));
    }
}
项目:tools-idea    文件:FileContentImpl.java   
/**
 * @return psiFile associated with the content. If the file was not set on FileContentCreation, it will be created on the spot
 */
@NotNull
@Override
public PsiFile getPsiFile() {
  PsiFile psi = getUserData(IndexingDataKeys.PSI_FILE);

  if (psi == null) {
    psi = getUserData(CACHED_PSI);
  }

  if (psi == null) {
    Project project = getProject();
    if (project == null) {
      project = DefaultProjectFactory.getInstance().getDefaultProject();
    }
    final Language language = ((LanguageFileType)getFileTypeWithoutSubstitution()).getLanguage();
    final Language substitutedLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(language, getFile(), project);
    psi = PsiFileFactory.getInstance(project).createFileFromText(getFileName(), substitutedLanguage, getContentAsText(), false, false, true);

    psi.putUserData(IndexingDataKeys.VIRTUAL_FILE, getFile());
    putUserData(CACHED_PSI, psi);
  }
  return psi;
}
项目:educational-plugin    文件:StudyNewProjectPanel.java   
@Override
public void actionPerformed(ActionEvent e) {
  final List<Course> courses =
    myGenerator.getCoursesUnderProgress(true, "Refreshing Course List", DefaultProjectFactory.getInstance().getDefaultProject());
  if (!courses.contains(Course.INVALID_COURSE)) {
    refreshCoursesList(courses);
  }
}
项目:intellij-ce-playground    文件:ClsFileImpl.java   
@NotNull
public static CharSequence decompile(@NotNull VirtualFile file) {
  PsiManager manager = PsiManager.getInstance(DefaultProjectFactory.getInstance().getDefaultProject());
  final ClsFileImpl clsFile = new ClsFileImpl(new ClassFileViewProvider(manager, file), true);
  final StringBuilder buffer = new StringBuilder();
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    @Override
    public void run() {
      clsFile.appendMirrorText(0, buffer);
    }
  });
  return buffer;
}
项目:intellij-ce-playground    文件:FileContentImpl.java   
public PsiFile createFileFromText(@NotNull CharSequence text) {
  Project project = getProject();
  if (project == null) {
    project = DefaultProjectFactory.getInstance().getDefaultProject();
  }
  final Language language = ((LanguageFileType)getFileTypeWithoutSubstitution()).getLanguage();
  final VirtualFile file = getFile();
  final Language substitutedLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(language, file, project);
  return PsiFileFactory.getInstance(project).createFileFromText(getFileName(), substitutedLanguage, text, false, false, true, file);
}
项目:consulo    文件:FileContentImpl.java   
@RequiredReadAction
public PsiFile createFileFromText(@Nonnull CharSequence text) {
  Project project = getProject();
  if (project == null) {
    project = DefaultProjectFactory.getInstance().getDefaultProject();
  }
  return createFileFromText(project, text, (LanguageFileType)getFileTypeWithoutSubstitution(), myFile, myFileName);
}
项目:consulo-java    文件:ClsFileImpl.java   
@NotNull
public static CharSequence decompile(@NotNull VirtualFile file)
{
    PsiManager manager = PsiManager.getInstance(DefaultProjectFactory.getInstance().getDefaultProject());
    final ClsFileImpl clsFile = new ClsFileImpl(new ClassFileViewProvider(manager, file), true);
    final StringBuilder buffer = new StringBuilder();
    ApplicationManager.getApplication().runReadAction(() -> clsFile.appendMirrorText(0, buffer));
    return buffer;
}
项目:consulo-java    文件:ClassFileDecompiler.java   
@Override
@NotNull
public CharSequence decompile(@NotNull VirtualFile file)
{
    ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
    if(decompiler instanceof ClassFileDecompilers.Full)
    {
        PsiManager manager = PsiManager.getInstance(DefaultProjectFactory.getInstance().getDefaultProject());
        return ((ClassFileDecompilers.Full) decompiler).createFileViewProvider(file, manager, true).getContents();
    }

    return decompileText(file);
}
项目:intellij-ce-playground    文件:DirDiffViewer.java   
public DirDiffViewer(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
  myContext = context;
  myRequest = request;

  List<DiffContent> contents = request.getContents();
  DiffElement element1 = createDiffElement(contents.get(0));
  DiffElement element2 = createDiffElement(contents.get(1));

  Project project = context.getProject();
  if (project == null) project = DefaultProjectFactory.getInstance().getDefaultProject();

  DirDiffTableModel model = new DirDiffTableModel(project, element1, element2, new DirDiffSettings());

  myDirDiffPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
    @Override
    public Window getWindow() {
      return null;
    }

    @Override
    public Disposable getDisposable() {
      return DirDiffViewer.this;
    }

    @Override
    public void setTitle(String title) {
    }
  });

  myPanel = new JPanel(new BorderLayout());
  myPanel.add(myDirDiffPanel.getPanel(), BorderLayout.CENTER);
  DataManager.registerDataProvider(myPanel, new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      if (PlatformDataKeys.HELP_ID.is(dataId)) {
        return "reference.dialogs.diff.folder";
      }
      return myDirDiffPanel.getData(dataId);
    }
  });
}
项目:consulo    文件:DirDiffViewer.java   
public DirDiffViewer(@Nonnull DiffContext context, @Nonnull ContentDiffRequest request) {
  myContext = context;
  myRequest = request;

  List<DiffContent> contents = request.getContents();
  DiffElement element1 = createDiffElement(contents.get(0));
  DiffElement element2 = createDiffElement(contents.get(1));

  Project project = context.getProject();
  if (project == null) project = DefaultProjectFactory.getInstance().getDefaultProject();

  DirDiffTableModel model = new DirDiffTableModel(project, element1, element2, new DirDiffSettings());

  myDirDiffPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
    @Override
    public Window getWindow() {
      return null;
    }

    @Override
    public Disposable getDisposable() {
      return DirDiffViewer.this;
    }

    @Override
    public void setTitle(String title) {
    }
  });

  myPanel = new JPanel(new BorderLayout());
  myPanel.add(myDirDiffPanel.getPanel(), BorderLayout.CENTER);
  DataManager.registerDataProvider(myPanel, new DataProvider() {
    @Override
    public Object getData(@Nonnull @NonNls Key dataId) {
      if (PlatformDataKeys.HELP_ID == dataId) {
        return "reference.dialogs.diff.folder";
      }
      return myDirDiffPanel.getData(dataId);
    }
  });
}