• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProjectImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.project.impl.ProjectImpl的典型用法代码示例。如果您正苦于以下问题:Java ProjectImpl类的具体用法?Java ProjectImpl怎么用?Java ProjectImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProjectImpl类属于com.intellij.openapi.project.impl包,在下文中一共展示了ProjectImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readProjectName

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RecentProjectsManagerBase.java


示例2: documentChanged

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PsiDocumentManagerImpl.java


示例3: loadProjectFromTemplate

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ProjectStoreImpl.java


示例4: save

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ProjectStoreImpl.java


示例5: readProjectName

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:RecentProjectsManagerBase.java


示例6: closeAndDeleteProject

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:LightPlatformTestCase.java


示例7: checkProjectLeak

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:LeakHunter.java


示例8: testContextFileName

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ContextTest.java


示例9: getProject

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:14,代码来源:ProjectViewUi.java


示例10: readJdomExternalizables

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ModuleTestCase.java


示例11: setUpProject

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:LoadProjectTest.java


示例12: closeAndDeleteProject

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:LightPlatformTestCase.java


示例13: readProjectName

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:ProjectStoreImpl.java


示例14: loadProjectFromTemplate

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@Override
public void loadProjectFromTemplate(@Nonnull ProjectImpl defaultProject) {
  defaultProject.save();

  Element element = ((DefaultProjectStoreImpl)defaultProject.getStateStore()).getStateCopy();
  if (element != null) {
    getDefaultFileStorage().setDefaultState(element);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ProjectStoreImpl.java


示例15: doSave

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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();
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:ProjectStoreImpl.java


示例16: documentChanged

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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;
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:32,代码来源:PsiDocumentManagerImpl.java


示例17: setUpProject

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:LoadProjectTest.java


示例18: setUpProject

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:LoadProjectTest.java


示例19: projectOpened

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
@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);
          }
        });
      }
    });
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:62,代码来源:FileEditorManagerImpl.java


示例20: testOnBreakpointListChangedSetsErrorMessageAndUpdatesBreakpointPresentation

import com.intellij.openapi.project.impl.ProjectImpl; //导入依赖的package包/类
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();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:43,代码来源:CloudDebugProcessTest.java



注:本文中的com.intellij.openapi.project.impl.ProjectImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Storage类代码示例发布时间:2022-05-22
下一篇:
Java ObjectTreeParser类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap