当前位置: 首页>>代码示例>>Java>>正文


Java ProjectManager类代码示例

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


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

示例1: getWorkDir

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
public File getWorkDir() {
    Project p = this.project;
    if (p == null) {
        p = ProjectManager.getInstance().getDefaultProject();
        Project[] ps = ProjectManager.getInstance().getOpenProjects();
        if (ps != null) {
            for (Project t : ps) {
                if (!t.isDefault()) {
                    p = t;
                }
            }
        }
    }
    File dir = new File(p.getBasePath(), Project.DIRECTORY_STORE_FOLDER);
    return dir;
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:17,代码来源:IMWindowFactory.java

示例2: initComponent

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
@Override
public void initComponent() {
    MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    connection = bus.connect();

    ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerListener() {
        @Override
        public void projectOpened(Project project) {
            Config config = Config.getInstance(project);

            if(config == null) {
                return;
            }

            if(!config.isConfigFilled()) {
                Notifications.Bus.notify(
                        new Notification("Settings Error", "Gherkin TS Runner", "Settings have to be filled.", NotificationType.WARNING)
                );
                return;
            }

            connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new GherkinFileEditorManagerListener(project));
        }
    });

}
 
开发者ID:KariiO,项目名称:Gherkin-TS-Runner,代码行数:27,代码来源:MainComponent.java

示例3: findAntResult

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
private void findAntResult(final Map<Project, AntGenResult> resultMap) {
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        final HybrisProjectSettings hybrisProjectSettings =
            HybrisProjectSettingsComponent.getInstance(project).getState();

        if (!hybrisProjectSettings.isHybrisProject()) {
            continue;
        }

        final File file = new File(project.getBasePath() + "/" + hybrisProjectSettings.getHybrisDirectory() + "/temp/ant.ser");
        if (file.exists()) {
            AntGenResult result = null;
            try (
                final FileInputStream fileIn = new FileInputStream(file);
                final ObjectInputStream in = new ObjectInputStream(fileIn)
            ) {
                result = (AntGenResult) in.readObject();
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
            FileUtil.delete(file);
            resultMap.put(project, result);
            return;
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:HybrisAntBuildListener.java

示例4: triggerNextAction

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
private void triggerNextAction() {
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        final STATES state = project.getUserData(STATE);
        if (state == null) {
            continue;
        }
        switch (state) {
            case CLEAN_ALL_NEEDED:
                project.putUserData(STATE, STATES.REFRESH_NEEDED);
                triggerCleanAll(project);
                return;
            case REFRESH_NEEDED:
                project.putUserData(STATE, null);
                ProjectRefreshAction.triggerAction(getDataContext(project));
                return;
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:19,代码来源:HybrisAntBuildListener.java

示例5: beforeProjectGenerated

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
@Nullable
@Override
public BooleanFunction<PythonProjectGenerator> beforeProjectGenerated(@Nullable Sdk sdk) {
  return generator -> {
    final List<Integer> enrolledCoursesIds = myGenerator.getEnrolledCoursesIds();
    final Course course = myGenerator.getSelectedCourse();
    if (course == null || !(course instanceof RemoteCourse)) return true;
    if (((RemoteCourse)course).getId() > 0 && !enrolledCoursesIds.contains(((RemoteCourse)course).getId())) {
      ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
        ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
        return StudyUtils.execCancelable(() -> EduStepicConnector.enrollToCourse(((RemoteCourse)course).getId(),
                                                                                 StudySettings.getInstance().getUser()));
      }, "Creating Course", true, ProjectManager.getInstance().getDefaultProject());
    }
    return true;
  };
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:PyStudyDirectoryProjectGenerator.java

示例6: focusOpenProject

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
public static boolean focusOpenProject(int courseId, int stepId) {
  Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
  for (Project project : openProjects) {
    if (!project.isDefault()) {
      StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
      if (taskManager != null) {
        Course course = taskManager.getCourse();
        RemoteCourse remoteCourse = course instanceof RemoteCourse ? (RemoteCourse)course : null;
        if (remoteCourse != null && remoteCourse.getId() == courseId) {
          ApplicationManager.getApplication().invokeLater(() -> {
            requestFocus(project);
            navigateToStep(project, course, stepId);
          });
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:EduBuiltInServerUtils.java

示例7: EduCreateNewStepikProjectDialog

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
public EduCreateNewStepikProjectDialog(int courseId) {
  this();

  StepicUser user = EduStepicAuthorizedClient.getCurrentUser();
  Project defaultProject = ProjectManager.getInstance().getDefaultProject();
  ApplicationManager.getApplication().invokeAndWait(() ->
    ProgressManager.getInstance()
      .runProcessWithProgressSynchronously(() -> {
        ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
        execCancelable(() -> {
          try {
            Course course = EduStepicConnector.getCourseFromStepik(user, courseId);
            if (course != null) {
              setTitle("New Project - " + course.getName());
            }

            setCourse(course);
          }
          catch (IOException e) {
            LOG.warn("Tried to create a project for course with id=" + courseId, e);
          }
          return null;
        });
      }, "Getting Available Courses", true, defaultProject)
  );
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:27,代码来源:EduCreateNewStepikProjectDialog.java

示例8: initCoursesCombobox

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
private void initCoursesCombobox() {
  myAvailableCourses =
    myGenerator.getCoursesUnderProgress(!isLocal, "Getting Available Courses", ProjectManager.getInstance().getDefaultProject());
  if (myAvailableCourses.contains(Course.INVALID_COURSE)) {
    setError(CONNECTION_ERROR);
  }
  else {
    addCoursesToCombobox(myAvailableCourses);
    final Course selectedCourse = StudyUtils.getFirst(myAvailableCourses);
    if (selectedCourse == null) return;
    setAuthors(selectedCourse);
    myDescriptionPane.setText(selectedCourse.getDescription());
    myDescriptionPane.setEditable(false);
    //setting the first course in list as selected
    myGenerator.setSelectedCourse(selectedCourse);
    if (myGenerator.getSelectedCourse() != null) {
      myCoursesComboBox.setSelectedItem(myGenerator.getSelectedCourse());
    }
    if (selectedCourse.isAdaptive() && !myGenerator.isLoggedIn()) {
      setError(LOGIN_TO_STEPIC_MESSAGE);
    }
    else {
      setOK();
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:27,代码来源:StudyNewProjectPanel.java

示例9: getProjectForFile

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
/**
 * Look through all open projects and see if git head symlink file is contained in it.
 */
private Project getProjectForFile(VirtualFile gitHeadFile) {
  //
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    try {
      VirtualFile[] contentRootArray = ProjectRootManager.getInstance(project).getContentRoots();
      for (VirtualFile virtualFile : contentRootArray) {
        String expectedLoc = virtualFile.getCanonicalPath() + "/.git/HEAD";
        if (expectedLoc.equals(gitHeadFile.getCanonicalPath())) {
          return project;
        }
      }
    } catch (Exception e) {
      // ignore
    }
  }
  return null;
}
 
开发者ID:PracticeInsight,项目名称:branch-window-title,代码行数:21,代码来源:BranchNameFrameTitleBuilder.java

示例10: after

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
public void after(List<? extends VFileEvent> events) {
    String sources = Utils.getPropertyValue("sources", true);
    List<String> sourcesList = Utils.getSourcesList(sources);
    for (VFileEvent e : events) {
        VirtualFile virtualFile = e.getFile();
        if (virtualFile != null && sourcesList.contains(virtualFile.getName()) && SOURCE_FOLDER_DEFAULT.equals(virtualFile.getParent().getName())) {
            Project[] projects = ProjectManager.getInstance().getOpenProjects();
            Project project = null;
            if (projects.length == 1) {
                project = projects[0];
            }
            System.out.println("Changed file " + virtualFile.getCanonicalPath());
            Crowdin crowdin = new Crowdin();
            String branch = Utils.getCurrentBranch(project);
            crowdin.uploadFile(virtualFile, branch);
        }
    }
}
 
开发者ID:crowdin,项目名称:android-studio-plugin,代码行数:19,代码来源:FileChangeListener.java

示例11: actionPerformed

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  final File projectDir = new File(ProjectUtil.getBaseDir(), INTRODUCTION_FOLDER);
  if (projectDir.exists()) {
    ProjectUtil.openProject(projectDir.getPath(), null, false);
  }
  else {
    final PyStudyDirectoryProjectGenerator generator = new PyStudyDirectoryProjectGenerator();
    CourseInfo introCourse = getIntroCourseInfo(generator.getCourses());
    if (introCourse == null) {
      return;
    }
    final GenerateProjectCallback callback = new GenerateProjectCallback();
    final ProjectSpecificSettingsStep step = new ProjectSpecificSettingsStep(generator, callback);
    step.createPanel(); // initialize panel to set location
    step.setLocation(projectDir.toString());
    generator.setSelectedCourse(introCourse);

    final Project project = ProjectManager.getInstance().getDefaultProject();
    final List<Sdk> sdks = PyConfigurableInterpreterList.getInstance(project).getAllPythonSdks();
    Sdk sdk = sdks.isEmpty() ? null : sdks.iterator().next();
    step.setSdk(sdk);
    callback.consume(step);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PyStudyIntroductionCourseAction.java

示例12: getExtraPathForAllOpenModules

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
@NotNull
public static List<VirtualFile> getExtraPathForAllOpenModules() {
  final List<VirtualFile> results = new ArrayList<VirtualFile>();
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    for (Module module : ModuleManager.getInstance(project).getModules()) {
      final BuildoutFacet buildoutFacet = getInstance(module);
      if (buildoutFacet != null) {
        for (String path : buildoutFacet.getConfiguration().getPaths()) {
          final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
          if (file != null) {
            results.add(file);
          }
        }
      }
    }
  }
  return results;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:BuildoutFacet.java

示例13: actionPerformed

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
public void actionPerformed(@NotNull AnActionEvent e) {
  Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  if (project == null) {
    project = ProjectManager.getInstance().getDefaultProject();
  }

  final long startTime = System.nanoTime();
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      final long endTime = System.nanoTime();
      if (ApplicationManagerEx.getApplicationEx().isInternal()) {
        System.out.println("Displaying settings dialog took " + ((endTime - startTime) / 1000000) + " ms");
      }
    }
  });
  ShowSettingsUtil.getInstance().showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ShowSettingsAction.java

示例14: updateToolWindows

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
public static void updateToolWindows() {
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    for (String id : toolWindowManager.getToolWindowIds()) {
      final ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
      for (Content content : toolWindow.getContentManager().getContents()) {
        final JComponent component = content.getComponent();
        if (component != null) {
          IJSwingUtilities.updateComponentTreeUI(component);
        }
      }
      final JComponent c = toolWindow.getComponent();
      if (c != null) {
        IJSwingUtilities.updateComponentTreeUI(c);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LafManagerImpl.java

示例15: createOptionsPanel

import com.intellij.openapi.project.ProjectManager; //导入依赖的package包/类
@Override
public JComponent createOptionsPanel() {
  final JButton editDependencies = new JButton(InspectionsBundle.message("inspection.dependency.configure.button.text"));
  editDependencies.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(editDependencies));
      if (project == null) project = ProjectManager.getInstance().getDefaultProject();
      ShowSettingsUtil.getInstance().editConfigurable(editDependencies, new DependencyConfigurable(project));
    }
  });

  JPanel depPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
  depPanel.add(editDependencies);
  return depPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DependencyInspection.java


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