Java 类com.intellij.openapi.project.impl.ProjectImpl 实例源码

项目:intellij-ce-playground    文件:RecentProjectsManagerBase.java   
private static String readProjectName(@NotNull String path) {
  final File file = new File(path);
  if (file.isDirectory()) {
    final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE);
    if (nameFile.exists()) {
      try {
        final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(nameFile), CharsetToolkit.UTF8_CHARSET));
        try {
          String name = in.readLine();
          if (!StringUtil.isEmpty(name)) {
            return name.trim();
          }
        }
        finally {
          in.close();
        }
      }
      catch (IOException ignored) { }
    }
    return file.getName();
  }
  else {
    return FileUtilRt.getNameWithoutExtension(file.getName());
  }
}
项目:intellij-ce-playground    文件:PsiDocumentManagerImpl.java   
@Override
public void documentChanged(DocumentEvent event) {
  super.documentChanged(event);
  // optimisation: avoid documents piling up during batch processing
  if (FileDocumentManagerImpl.areTooManyDocumentsInTheQueue(myUncommittedDocuments)) {
    if (myUnitTestMode) {
      myStopTrackingDocuments = true;
      try {
        LOG.error("Too many uncommitted documents for " + myProject + ":\n" + StringUtil.join(myUncommittedDocuments, "\n") + 
                  "\n\n Project creation trace: " + myProject.getUserData(ProjectImpl.CREATION_TRACE));
      }
      finally {
        //noinspection TestOnlyProblems
        clearUncommittedDocuments();
      }
    }
    // must not commit during document save
    if (PomModelImpl.isAllowPsiModification()) {
      commitAllDocuments();
    }
  }
}
项目:tools-idea    文件:ProjectStoreImpl.java   
@Override
public void loadProjectFromTemplate(@NotNull final ProjectImpl defaultProject) {
  final StateStorage stateStorage = getStateStorageManager().getFileStateStorage(DEFAULT_STATE_STORAGE);

  assert stateStorage instanceof XmlElementStorage;
  XmlElementStorage xmlElementStorage = (XmlElementStorage)stateStorage;

  defaultProject.save();
  final IProjectStore projectStore = defaultProject.getStateStore();
  assert projectStore instanceof DefaultProjectStoreImpl;
  DefaultProjectStoreImpl defaultProjectStore = (DefaultProjectStoreImpl)projectStore;
  final Element element = defaultProjectStore.getStateCopy();
  if (element != null) {
    xmlElementStorage.setDefaultState(element);
  }
}
项目:tools-idea    文件:ProjectStoreImpl.java   
@NotNull
@Override
public SaveSession save() throws IOException {
  final ProjectImpl.UnableToSaveProjectNotification[] notifications =
    NotificationsManager.getNotificationsManager().getNotificationsOfType(ProjectImpl.UnableToSaveProjectNotification.class, myProject);
  if (notifications.length > 0) throw new SaveCancelledException();

  final ReadonlyStatusHandler.OperationStatus operationStatus = ensureConfigFilesWritable();
  if (operationStatus == null) {
    throw new IOException();
  }
  else if (operationStatus.hasReadonlyFiles()) {
    ProjectImpl.dropUnableToSaveProjectNotification(myProject, operationStatus.getReadonlyFiles());
    throw new SaveCancelledException();
  }

  beforeSave();

  super.save();

  return this;
}
项目:tools-idea    文件:RecentProjectsManagerBase.java   
private static String readProjectName(String path) {
  final File file = new File(path);
  if (file.isDirectory()) {
    final File nameFile = new File(new File(path, Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE);
    if (nameFile.exists()) {
      try {
        final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(nameFile), "UTF-8"));
        try {
          final String name = in.readLine();
          if (name != null && name.length() > 0) return name.trim();
        }
        finally {
          in.close();
        }
      }
      catch (IOException ignored) { }
    }
    return file.getName();
  }
  else {
    return FileUtil.getNameWithoutExtension(file.getName());
  }
}
项目:consulo    文件:LightPlatformTestCase.java   
@RequiredWriteAction
public static synchronized void closeAndDeleteProject() {
  if (ourProject != null) {
    ApplicationManager.getApplication().assertWriteAccessAllowed();
    for (Sdk registeredSdk : ourRegisteredSdks) {
      SdkTable.getInstance().removeSdk(registeredSdk);
    }
    ((ProjectImpl)ourProject).setTemporarilyDisposed(false);
    final VirtualFile projFile = ((ProjectEx)ourProject).getStateStore().getProjectFile();
    final File projectFile = projFile == null ? null : VfsUtilCore.virtualToIoFile(projFile);
    if (!ourProject.isDisposed()) Disposer.dispose(ourProject);

    if (projectFile != null) {
      FileUtil.delete(projectFile);
    }
    ourProject = null;
  }
}
项目:intellij-ce-playground    文件:LeakHunter.java   
@TestOnly
public static void checkProjectLeak() throws Exception {
  Processor<Project> isReallyLeak = new Processor<Project>() {
    @Override
    public boolean process(Project project) {
      return !project.isDefault() && !((ProjectImpl)project).isLight();
    }
  };
  Collection<Object> roots = new ArrayList<Object>(Arrays.asList(ApplicationManager.getApplication(), Extensions.getRootArea()));
  ClassLoader classLoader = LeakHunter.class.getClassLoader();
  Vector<Class> allLoadedClasses = ReflectionUtil.getField(classLoader.getClass(), classLoader, Vector.class, "classes");
  roots.addAll(allLoadedClasses); // inspect static fields of all loaded classes
  checkLeak(roots, ProjectImpl.class, isReallyLeak);
}
项目:intellij-ce-playground    文件:ContextTest.java   
public void testContextFileName() throws Exception {
  ProjectImpl project = (ProjectImpl)getProject();
  String name = project.getName();
  try {
    project.setProjectName("invalid | name");
    getContextManager().saveContext("foo", "bar");
  }
  finally {
    project.setProjectName(name);
  }
}
项目:intellij    文件:ProjectViewUi.java   
/**
 * To support the custom language features, we need a ProjectImpl, and it's not desirable to
 * create one from scratch.<br>
 *
 * @return the current, non-default project, if one exists, else the default project.
 */
public static Project getProject() {
  Project project = (Project) DataManager.getInstance().getDataContext().getData("project");
  if (project != null && project instanceof ProjectImpl) {
    return project;
  }
  return ProjectManager.getInstance().getDefaultProject();
}
项目:tools-idea    文件:ModuleTestCase.java   
protected void readJdomExternalizables(final ModuleImpl module) {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      final ProjectImpl project = (ProjectImpl)myProject;
      project.setOptimiseTestLoadSpeed(false);
      final ModuleRootManagerImpl moduleRootManager = (ModuleRootManagerImpl)ModuleRootManager.getInstance(module);
      module.getStateStore().initComponent(moduleRootManager, false);
      project.setOptimiseTestLoadSpeed(true);
    }
  });
}
项目:tools-idea    文件:LoadProjectTest.java   
@Override
protected void setUpProject() throws Exception {
  String projectPath = PathManagerEx.getTestDataPath() + "/model/model.ipr";
  myProject = ProjectManager.getInstance().loadAndOpenProject(projectPath);
  MutablePicoContainer container = (MutablePicoContainer)getProject().getPicoContainer();
  container.unregisterComponent(FileEditorManager.class.getName());
  ((ProjectImpl)getProject()).registerComponentImplementation(FileEditorManager.class, FileEditorManagerImpl.class);
}
项目:tools-idea    文件:LightPlatformTestCase.java   
public static synchronized void closeAndDeleteProject() {
  if (ourProject != null) {
    ApplicationManager.getApplication().assertWriteAccessAllowed();
    ((ProjectImpl)ourProject).setTemporarilyDisposed(false);
    final VirtualFile projFile = ((ProjectEx)ourProject).getStateStore().getProjectFile();
    final File projectFile = projFile == null ? null : VfsUtilCore.virtualToIoFile(projFile);
    if (!ourProject.isDisposed()) Disposer.dispose(ourProject);

    if (projectFile != null) {
      FileUtil.delete(projectFile);
    }
    ourProject = null;
  }
}
项目:consulo-tasks    文件:ContextTest.java   
public void testContextFileName() throws Exception {
  ProjectImpl project = (ProjectImpl)getProject();
  String name = project.getName();
  try {
    project.setProjectName("invalid | name");
    getContextManager().saveContext("foo", "bar");
  }
  finally {
    project.setProjectName(name);
  }
}
项目:consulo    文件:ProjectStoreImpl.java   
public static String readProjectName(@Nonnull File file) {
  if (file.isDirectory()) {
    final File nameFile = new File(new File(file, Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE);
    if (nameFile.exists()) {
      try {
        return FileUtil.loadFile(nameFile, true);
      }
      catch (IOException ignored) {
      }
    }
  }
  return file.getName();
}
项目:consulo    文件:ProjectStoreImpl.java   
@Override
public void loadProjectFromTemplate(@Nonnull ProjectImpl defaultProject) {
  defaultProject.save();

  Element element = ((DefaultProjectStoreImpl)defaultProject.getStateStore()).getStateCopy();
  if (element != null) {
    getDefaultFileStorage().setDefaultState(element);
  }
}
项目:consulo    文件:ProjectStoreImpl.java   
@Override
protected final void doSave(@Nullable List<SaveSession> saveSessions, @Nonnull List<Pair<SaveSession, VirtualFile>> readonlyFiles) {
  ProjectImpl.UnableToSaveProjectNotification[] notifications =
          NotificationsManager.getNotificationsManager().getNotificationsOfType(ProjectImpl.UnableToSaveProjectNotification.class, myProject);
  if (notifications.length > 0) {
    throw new SaveCancelledException();
  }

  beforeSave(readonlyFiles);

  super.doSave(saveSessions, readonlyFiles);

  if (!readonlyFiles.isEmpty()) {
    ReadonlyStatusHandler.OperationStatus status;
    AccessToken token = ReadAction.start();
    try {
      status = ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(getFilesList(readonlyFiles));
    }
    finally {
      token.finish();
    }

    if (status.hasReadonlyFiles()) {
      ProjectImpl.dropUnableToSaveProjectNotification(myProject, status.getReadonlyFiles());
      throw new SaveCancelledException();
    }
    else {
      List<Pair<SaveSession, VirtualFile>> oldList = new ArrayList<>(readonlyFiles);
      readonlyFiles.clear();
      for (Pair<SaveSession, VirtualFile> entry : oldList) {
        executeSave(entry.first, readonlyFiles);
      }

      if (!readonlyFiles.isEmpty()) {
        ProjectImpl.dropUnableToSaveProjectNotification(myProject, getFilesList(readonlyFiles));
        throw new SaveCancelledException();
      }
    }
  }
}
项目:consulo    文件:PsiDocumentManagerImpl.java   
@Override
public void documentChanged(DocumentEvent event) {
  super.documentChanged(event);
  // optimisation: avoid documents piling up during batch processing
  if (isUncommited(event.getDocument()) && FileDocumentManagerImpl.areTooManyDocumentsInTheQueue(myUncommittedDocuments)) {
    if (myUnitTestMode) {
      myStopTrackingDocuments = true;
      try {
        LOG.error("Too many uncommitted documents for " + myProject + "(" +myUncommittedDocuments.size()+")"+
                  ":\n" + StringUtil.join(myUncommittedDocuments, "\n") +
                  "\n\n Project creation trace: " + myProject.getUserData(ProjectImpl.CREATION_TRACE));
      }
      finally {
        //noinspection TestOnlyProblems
        clearUncommittedDocuments();
      }
    }
    // must not commit during document save
    if (PomModelImpl.isAllowPsiModification()
        // it can happen that document(forUseInNonAWTThread=true) outside write action caused this
        && ApplicationManager.getApplication().isWriteAccessAllowed()) {
      // commit one document to avoid OOME
      for (Document document : myUncommittedDocuments) {
        if (document != event.getDocument()) {
          doCommitWithoutReparse(document);
          break;
        }
      }
    }
  }
}
项目:consulo-java    文件:LoadProjectTest.java   
@Override
protected void setUpProject() throws Exception {
  String projectPath = "/model/model.ipr";
  myProject = ProjectManager.getInstance().loadAndOpenProject(projectPath);
  MutablePicoContainer container = (MutablePicoContainer)getProject().getPicoContainer();
  container.unregisterComponent(FileEditorManager.class.getName());
  ((ProjectImpl)getProject()).registerComponentImplementation(FileEditorManager.class, FileEditorManagerImpl.class);
}
项目:intellij-ce-playground    文件:LoadProjectTest.java   
@Override
protected void setUpProject() throws Exception {
  String projectPath = PathManagerEx.getTestDataPath() + "/model/model.ipr";
  myProject = ProjectManager.getInstance().loadAndOpenProject(projectPath);
  ((ProjectImpl)getProject()).registerComponentImplementation(FileEditorManager.class, FileEditorManagerImpl.class);
}
项目:intellij-ce-playground    文件:FileEditorManagerImpl.java   
@Override
  public void projectOpened() {
    //myFocusWatcher.install(myWindows.getComponent ());
    getMainSplitters().startListeningFocus();

    MessageBusConnection connection = myProject.getMessageBus().connect(myProject);

    final FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
    if (fileStatusManager != null) {
      /**
       * Updates tabs colors
       */
      final MyFileStatusListener myFileStatusListener = new MyFileStatusListener();
      fileStatusManager.addFileStatusListener(myFileStatusListener, myProject);
    }
    connection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener());
    connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyRootsListener());

    /**
     * Updates tabs names
     */
    final MyVirtualFileListener myVirtualFileListener = new MyVirtualFileListener();
    VirtualFileManager.getInstance().addVirtualFileListener(myVirtualFileListener, myProject);
    /**
     * Extends/cuts number of opened tabs. Also updates location of tabs.
     */
    final MyUISettingsListener myUISettingsListener = new MyUISettingsListener();
    UISettings.getInstance().addUISettingsListener(myUISettingsListener, myProject);

    StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
      @Override
      public void run() {
        if (myProject.isDisposed()) return;
        setTabsMode(UISettings.getInstance().EDITOR_TAB_PLACEMENT != UISettings.TABS_NONE);

        ToolWindowManager.getInstance(myProject).invokeLater(new Runnable() {
          @Override
          public void run() {
            CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
              @Override
              public void run() {

                ApplicationManager.getApplication().invokeLater(new Runnable() {
                  @Override
                  public void run() {
                    long currentTime = System.nanoTime();
                    Long startTime = myProject.getUserData(ProjectImpl.CREATION_TIME);
                    if (startTime != null) {
                      LOG.info("Project opening took " + (currentTime - startTime.longValue()) / 1000000 + " ms");
                      PluginManagerCore.dumpPluginClassStatistics();
                    }
                  }
                }, myProject.getDisposed());
// group 1
              }
            }, "", null);
          }
        });
      }
    });
  }
项目:google-cloud-intellij    文件:CloudDebugProcessTest.java   
public void testOnBreakpointListChangedSetsErrorMessageAndUpdatesBreakpointPresentation()
    throws Exception {
  // override the default XBreakpointManager implementation with mock to use Mockito.verify()
  XBreakpointManager breakpointManager = mock(XBreakpointManager.class);
  XDebuggerManager debuggerManager = mock(XDebuggerManager.class);
  when(debuggerManager.getBreakpointManager()).thenReturn(breakpointManager);
  ((ProjectImpl) getProject()).registerComponentInstance(XDebuggerManager.class, debuggerManager);

  ArrayList<Breakpoint> breakpoints = new ArrayList<Breakpoint>();
  Breakpoint breakpoint = new Breakpoint();
  breakpoint
      .setId("breakpointId")
      .setIsFinalState(Boolean.TRUE)
      .setStatus(new StatusMessage().setIsError(Boolean.TRUE));
  breakpoints.add(breakpoint);
  CloudDebugProcessState processState = mock(CloudDebugProcessState.class);
  when(processState.getCurrentServerBreakpointList())
      .thenReturn(ContainerUtil.immutableList(breakpoints));

  XLineBreakpointImpl xLineBreakpointImpl = mock(XLineBreakpointImpl.class);
  CloudLineBreakpoint cloudLineBreakpoint =
      mockCloudLineBreakpoint("mock error message", xLineBreakpointImpl);
  when(xLineBreakpointImpl.getUserData(com.intellij.debugger.ui.breakpoints.Breakpoint.DATA_KEY))
      .thenReturn(cloudLineBreakpoint);
  CloudBreakpointHandler breakpointHandler = mock(CloudBreakpointHandler.class);
  when(breakpointHandler.getEnabledXBreakpoint(breakpoint)).thenReturn(xLineBreakpointImpl);

  process.setBreakpointHandler(breakpointHandler);
  process.initialize(processState);

  process.onBreakpointListChanged(mock(CloudDebugProcessState.class));

  verify(cloudLineBreakpoint).setErrorMessage(eq("General error"));
  verify(cloudLineBreakpoint).getXBreakpoint();
  verify(cloudLineBreakpoint).getSetIcon(Matchers.anyBoolean());
  verify(cloudLineBreakpoint).getErrorMessage();
  verify(breakpointManager)
      .updateBreakpointPresentation(
          same(xLineBreakpointImpl), any(Icon.class), eq("General error"));

  process.getStateController().stopBackgroundListening();
}
项目:tools-idea    文件:IdeaProjectStoreImpl.java   
public IdeaProjectStoreImpl(final ProjectImpl project) {
  super(project);
}
项目:tools-idea    文件:MockProjectStore.java   
@Override
public void loadProjectFromTemplate(@NotNull ProjectImpl project) {
  throw new UnsupportedOperationException("Method loadProjectFromTemplate is not yet implemented in " + getClass().getName());
}
项目:tools-idea    文件:LeakHunter.java   
@TestOnly
public static void checkProjectLeak() throws Exception {
  checkLeak(ApplicationManager.getApplication(), ProjectImpl.class);
  checkLeak(Extensions.getRootArea(), ProjectImpl.class, NOT_DEFAULT_PROJECT);
}
项目:tools-idea    文件:FileEditorManagerImpl.java   
public void projectOpened() {
    //myFocusWatcher.install(myWindows.getComponent ());
    getMainSplitters().startListeningFocus();

    MessageBusConnection connection = myProject.getMessageBus().connect(myProject);

    final FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
    if (fileStatusManager != null) {
      /**
       * Updates tabs colors
       */
      final MyFileStatusListener myFileStatusListener = new MyFileStatusListener();
      fileStatusManager.addFileStatusListener(myFileStatusListener, myProject);
    }
    connection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener());
    connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyRootsListener());

    /**
     * Updates tabs names
     */
    final MyVirtualFileListener myVirtualFileListener = new MyVirtualFileListener();
    VirtualFileManager.getInstance().addVirtualFileListener(myVirtualFileListener, myProject);
    /**
     * Extends/cuts number of opened tabs. Also updates location of tabs.
     */
    final MyUISettingsListener myUISettingsListener = new MyUISettingsListener();
    UISettings.getInstance().addUISettingsListener(myUISettingsListener, myProject);

    StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
      public void run() {

        setTabsMode(UISettings.getInstance().EDITOR_TAB_PLACEMENT != UISettings.TABS_NONE);

        ToolWindowManager.getInstance(myProject).invokeLater(new Runnable() {
          public void run() {
            CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
              public void run() {

                LaterInvocator.invokeLater(new Runnable() {
                  public void run() {
                    long currentTime = System.nanoTime();
                    Long startTime = myProject.getUserData(ProjectImpl.CREATION_TIME);
                    if (startTime != null) {
                      LOG.info("Project opening took " + (currentTime - startTime.longValue()) / 1000000 + " ms");
                      PluginManager.dumpPluginClassStatistics();
                    }
                  }
                });
// group 1
              }
            }, "", null);
          }
        });
      }
    });
  }
项目:tools-idea    文件:ProjectStoreImpl.java   
ProjectStoreImpl(final ProjectImpl project) {
  super(project);
  myProject = project;
}
项目:tools-idea    文件:ProjectStoreImpl.java   
private ReadonlyStatusHandler.OperationStatus ensureConfigFilesWritable() {
  return ApplicationManager.getApplication().runReadAction(new Computable<ReadonlyStatusHandler.OperationStatus>() {
    @Override
    public ReadonlyStatusHandler.OperationStatus compute() {
      final List<IFile> filesToSave;
      try {
        filesToSave = getAllStorageFilesToSave(true);
        final Iterator<IFile> iterator = filesToSave.iterator();
        while (iterator.hasNext()) {
          if (!iterator.next().exists()) {
            iterator.remove();
          }
        }
      }
      catch (IOException e) {
        LOG.error(e);
        return null;
      }

      List<VirtualFile> readonlyFiles = new ArrayList<VirtualFile>();

      if (myProject.isToSaveProjectName()) {
        final VirtualFile baseDir = getProjectBaseDir();
        if (baseDir != null && baseDir.isValid()) {
          filesToSave.add(FileSystem.FILE_SYSTEM
                            .createFile(new File(new File(baseDir.getPath(), Project.DIRECTORY_STORE_FOLDER), ProjectImpl.NAME_FILE).getPath()));
        }
      }

      for (IFile file : filesToSave) {
        final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);

        if (virtualFile != null) {
          virtualFile.refresh(false, false);
          if (virtualFile.isValid() && !virtualFile.isWritable()) {
            readonlyFiles.add(virtualFile);
          }
        }
      }

      if (readonlyFiles.size() == 0) {
        final VirtualFile projectBaseDir = getProjectBaseDir();
        if (projectBaseDir != null && projectBaseDir.isValid()) {
          if (!projectBaseDir.isWritable()) {
            readonlyFiles.add(projectBaseDir);
          }

          final LocalFileSystem instance = LocalFileSystem.getInstance();
          final VirtualFile ideaDir1 =
            instance.findFileByIoFile(new File(projectBaseDir.getPath(), Project.DIRECTORY_STORE_FOLDER));
          if (ideaDir1 != null && ideaDir1.isValid()) {
            if (!ideaDir1.isWritable()) {
              readonlyFiles.add(ideaDir1);
            }
          } else {
            final VirtualFile ideaDir2 =
              instance.findFileByIoFile(new File(new File(projectBaseDir.getPath()).getParent(), Project.DIRECTORY_STORE_FOLDER));
            if (ideaDir2 != null && ideaDir2.isValid()) {
              if (!ideaDir2.isWritable()) {
                readonlyFiles.add(ideaDir2);
              }
            }
          }
        }
      }

      return ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(readonlyFiles);
    }
  });
}
项目:tools-idea    文件:DefaultProjectStoreImpl.java   
public DefaultProjectStoreImpl(final ProjectImpl project, final ProjectManagerImpl projectManager) {
  super(project);
  myProjectManager = projectManager;

  myElement = projectManager.getDefaultProjectRootElement();
}
项目:tools-idea    文件:ProjectStateStorageManager.java   
public ProjectStateStorageManager(final TrackingPathMacroSubstitutor macroSubstitutor, ProjectImpl project) {
  super(macroSubstitutor, ROOT_TAG_NAME, project, project.getPicoContainer());
  myProject = project;
}
项目:tools-idea    文件:ProjectWithModulesStoreImpl.java   
public ProjectWithModulesStoreImpl(final ProjectImpl project) {
  super(project);
}
项目:consulo    文件:MockProjectStore.java   
@Override
public void loadProjectFromTemplate(@Nonnull ProjectImpl project) {
  throw new UnsupportedOperationException("Method loadProjectFromTemplate is not yet implemented in " + getClass().getName());
}
项目:consulo    文件:LightPlatformTestCase.java   
public static void doTearDown(@Nonnull final Project project, ApplicationStarter application, boolean checkForEditors) throws Exception {
  CodeStyleSettingsManager.getInstance(project).dropTemporarySettings();
  checkAllTimersAreDisposed();
  UsefulTestCase.doPostponedFormatting(project);

  LookupManager lookupManager = LookupManager.getInstance(project);
  if (lookupManager != null) {
    lookupManager.hideActiveLookup();
  }
  ((StartupManagerImpl)StartupManager.getInstance(project)).prepareForNextTest();
  InspectionProfileManager.getInstance().deleteProfile(PROFILE);
  assertNotNull("Application components damaged", ProjectManager.getInstance());

  new WriteCommandAction.Simple(project) {
    @Override
    @RequiredWriteAction
    protected void run() throws Throwable {
      if (ourSourceRoot != null) {
        try {
          final VirtualFile[] children = ourSourceRoot.getChildren();
          for (VirtualFile child : children) {
            child.delete(this);
          }
        }
        catch (IOException e) {
          //noinspection CallToPrintStackTrace
          e.printStackTrace();
        }
      }
      EncodingManager encodingManager = EncodingManager.getInstance();
      if (encodingManager instanceof EncodingManagerImpl) ((EncodingManagerImpl)encodingManager).clearDocumentQueue();

      FileDocumentManager manager = FileDocumentManager.getInstance();

      ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance()); // Flush postponed formatting if any.
      manager.saveAllDocuments();
      if (manager instanceof FileDocumentManagerImpl) {
        ((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments();
      }
    }
  }.execute().throwException();

  assertFalse(PsiManager.getInstance(project).isDisposed());
  if (!ourAssertionsInTestDetected) {
    if (IdeaLogger.ourErrorsOccurred != null) {
      throw IdeaLogger.ourErrorsOccurred;
    }
  }
  PsiDocumentManagerImpl documentManager = clearUncommittedDocuments(project);
  ((HintManagerImpl)HintManager.getInstance()).cleanup();

  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      ((UndoManagerImpl)UndoManager.getGlobalInstance()).dropHistoryInTests();
      ((UndoManagerImpl)UndoManager.getInstance(project)).dropHistoryInTests();

      UIUtil.dispatchAllInvocationEvents();
    }
  });

  TemplateDataLanguageMappings.getInstance(project).cleanupForNextTest();

  ProjectManagerEx.getInstanceEx().closeTestProject(project);
  //application.setDataProvider(null);
  ourTestCase = null;
  ((PsiManagerImpl)PsiManager.getInstance(project)).cleanupForNextTest();

  CompletionProgressIndicator.cleanupForNextTest();

  if (checkForEditors) {
    checkEditorsReleased();
  }
  if (isLight(project)) {
    // mark temporarily as disposed so that rogue component trying to access it will fail
    ((ProjectImpl)project).setTemporarilyDisposed(true);
    documentManager.clearUncommittedDocuments();
  }
}
项目:consulo    文件:LeakHunter.java   
@TestOnly
public static void checkProjectLeak(@Nonnull Object root) throws Exception {
  checkLeak(root, ProjectImpl.class);
}
项目:consulo    文件:FileEditorManagerImpl.java   
protected void projectOpened(@Nonnull MessageBusConnection connection) {
  //myFocusWatcher.install(myWindows.getComponent ());
  getMainSplitters().startListeningFocus();

  final FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
  if (fileStatusManager != null) {
    /*
      Updates tabs colors
     */
    final MyFileStatusListener myFileStatusListener = new MyFileStatusListener();
    fileStatusManager.addFileStatusListener(myFileStatusListener, myProject);
  }
  connection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener());
  connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyRootsListener());

  /*
    Updates tabs names
   */
  final MyVirtualFileListener myVirtualFileListener = new MyVirtualFileListener();
  VirtualFileManager.getInstance().addVirtualFileListener(myVirtualFileListener, myProject);
  /*
    Extends/cuts number of opened tabs. Also updates location of tabs.
   */
  connection.subscribe(UISettingsListener.TOPIC, new MyUISettingsListener());

  StartupManager.getInstance(myProject).registerPostStartupActivity((DumbAwareRunnable)() -> {
    if (myProject.isDisposed()) return;
    setTabsMode(UISettings.getInstance().getEditorTabPlacement() != UISettings.TABS_NONE);

    ToolWindowManager.getInstance(myProject).invokeLater(() -> {
      if (!myProject.isDisposed()) {
        CommandProcessor.getInstance().executeCommand(myProject, () -> {
          ApplicationManager.getApplication().invokeLater(() -> {
            long currentTime = System.nanoTime();
            Long startTime = myProject.getUserData(ProjectImpl.CREATION_TIME);
            if (startTime != null) {
              LOG.info("Project opening took " + (currentTime - startTime.longValue()) / 1000000 + " ms");
              PluginManagerCore.dumpPluginClassStatistics();
            }
          }, myProject.getDisposed());
          // group 1
        }, "", null);
      }
    });
  });
}
项目:consulo    文件:ProjectStoreImpl.java   
ProjectStoreImpl(@Nonnull ProjectImpl project, @Nonnull PathMacroManager pathMacroManager) {
  super(pathMacroManager);
  myProject = project;
}
项目:consulo    文件:DefaultProjectStoreImpl.java   
public DefaultProjectStoreImpl(@Nonnull ProjectImpl project, @Nonnull ProjectManagerImpl projectManager, @Nonnull PathMacroManager pathMacroManager) {
  super(project, pathMacroManager);

  myProjectManager = projectManager;
}
项目:consulo    文件:ProjectStateStorageManager.java   
public ProjectStateStorageManager(final TrackingPathMacroSubstitutor macroSubstitutor, ProjectImpl project) {
  super(macroSubstitutor, ROOT_TAG_NAME, project, project.getPicoContainer());
  myProject = project;
}
项目:tools-idea    文件:IProjectStore.java   
void loadProjectFromTemplate(@NotNull ProjectImpl project);
项目:consulo    文件:IProjectStore.java   
void loadProjectFromTemplate(@Nonnull ProjectImpl project);