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


Java RecentProjectsManager类代码示例

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


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

示例1: update

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
  removeAll();
  final List<ProjectGroup> groups = new ArrayList<ProjectGroup>(RecentProjectsManager.getInstance().getGroups());
  Collections.sort(groups, new Comparator<ProjectGroup>() {
    @Override
    public int compare(ProjectGroup o1, ProjectGroup o2) {
      return StringUtil.naturalCompare(o1.getName(), o2.getName());
    }
  });
  for (ProjectGroup group : groups) {
    add(new MoveProjectToGroupAction(group));
  }
  if (groups.size() > 0) {
    add(Separator.getInstance());
    add(new RemoveSelectedProjectsFromGroupsAction());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MoveProjectToGroupActionGroup.java

示例2: updateRecentProjectsMenu

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu () {
  RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
  if (projectsManager == null) return;
  final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
  recentProjectsMenu.removeAll();

  for (final AnAction action : recentProjectActions) {
    MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext(null)));
      }
    });
    recentProjectsMenu.add(menuItem);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MacDockDelegate.java

示例3: updateLastProjectLocation

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
public static void updateLastProjectLocation(final String projectFilePath) {
  File lastProjectLocation = new File(projectFilePath);
  if (lastProjectLocation.isFile()) {
    lastProjectLocation = lastProjectLocation.getParentFile(); // for directory-based project storage
  }
  if (lastProjectLocation == null) { // the immediate parent of the ipr file
    return;
  }
  lastProjectLocation = lastProjectLocation.getParentFile(); // the candidate directory to be saved
  if (lastProjectLocation == null) {
    return;
  }
  String path = lastProjectLocation.getPath();
  try {
    path = FileUtil.resolveShortWindowsName(path);
  }
  catch (IOException e) {
    LOG.info(e);
    return;
  }
  RecentProjectsManager.getInstance().setLastProjectCreationLocation(path.replace(File.separatorChar, '/'));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ProjectUtil.java

示例4: closeProject

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
public void closeProject() {
  execute(new GuiTask() {
    @Override
    protected void executeInEDT() throws Throwable {
      closeAndDispose(getProject());
      RecentProjectsManager.getInstance().updateLastProjectPath();
      WelcomeFrame.showIfNoProjectOpened();
    }
  });
  pause(new Condition("Waiting for 'Welcome' page to show up") {
    @Override
    public boolean test() {
      for (Frame frame : Frame.getFrames()) {
        if (frame instanceof WelcomeFrame && frame.isShowing()) {
          return true;
        }
      }
      return false;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdeFrameFixture.java

示例5: updateRecentProjectsMenu

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu () {
  RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
  if (projectsManager == null) return;
  final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
  recentProjectsMenu.removeAll();

  for (final AnAction action : recentProjectActions) {
    MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext((Component)null)));
      }
    });
    recentProjectsMenu.add(menuItem);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:MacDockDelegate.java

示例6: updateRecentProjectsMenu

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu() {
  if (ApplicationProperties.isInSandbox()) {
    return;
  }

  final AnAction[] recentProjectActions = RecentProjectsManager.getInstance().getRecentProjectsActions(false);
  RecentTasks.clear();
  String name = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US);
  File exePath = new File(PathManager.getAppHomeDirectory(), name + (SystemInfo.is64Bit ? "64" : "") + ".exe");
  if(!exePath.exists()) {
    throw new IllegalArgumentException("Executable is not exists. Path: " + exePath.getPath());
  }
  String launcher = RecentTasks.getShortenPath(exePath.getPath());
  Task[] tasks = new Task[recentProjectActions.length];
  for (int i = 0; i < recentProjectActions.length; i++) {
    ReopenProjectAction rpa = (ReopenProjectAction)recentProjectActions[i];
    tasks[i] = new Task(launcher, RecentTasks.getShortenPath(rpa.getProjectPath()), rpa.getTemplatePresentation().getText());
  }
  RecentTasks.addTasks(tasks);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:WinDockDelegate.java

示例7: save

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void save() {
  if (ApplicationManagerEx.getApplicationEx().isDoNotSave()) {
    // no need to save
    return;
  }

  if (!mySavingInProgress.compareAndSet(false, true)) {
    return;
  }

  try {
    if (isToSaveProjectName()) {
      try {
        String basePath = getStateStore().getProjectBasePath();
        File baseDir = basePath == null ? null : new File(basePath);
        if (baseDir != null && baseDir.exists()) {
          File ideaDir = new File(baseDir, DIRECTORY_STORE_FOLDER);
          if (ideaDir.exists() && ideaDir.isDirectory()) {
            FileUtil.writeToFile(new File(ideaDir, NAME_FILE), getName());
            myOldName = null;

            RecentProjectsManager.getInstance().clearNameCache();
          }
        }
      }
      catch (Throwable e) {
        LOG.error("Unable to store project name", e);
      }
    }

    StoreUtil.save(ServiceKt.getStateStore(this), this);
  }
  finally {
    mySavingInProgress.set(false);
    ApplicationManager.getApplication().getMessageBus().syncPublisher(ProjectSaved.TOPIC).saved(this);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ProjectImpl.java

示例8: actionPerformed

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final List<AnAction> elements = getSelectedElements(e);
  for (AnAction element : elements) {
    if (element instanceof ReopenProjectAction) {
      for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
        group.removeProject(((ReopenProjectAction)element).getProjectPath());
      }
    }
  }

  rebuildRecentProjectsList(e);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:RemoveSelectedProjectsFromGroupsAction.java

示例9: getGroup

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
private static ProjectGroup getGroup(String name) {
  for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
    if (group.getName().equals(name)) {
      return group;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CreateNewProjectGroupAction.java

示例10: actionPerformed

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final List<AnAction> elements = getSelectedElements(e);
  for (AnAction element : elements) {
    if (element instanceof ReopenProjectAction) {
      final String path = ((ReopenProjectAction)element).getProjectPath();
      for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
        group.removeProject(path);
        myGroup.addProject(path);
      }
    }
  }
  rebuildRecentProjectsList(e);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MoveProjectToGroupAction.java

示例11: removeRecentProjectElement

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
protected static void removeRecentProjectElement(Object element) {
  final RecentProjectsManager manager = RecentProjectsManager.getInstance();
  if (element instanceof ReopenProjectAction) {
    manager.removePath(((ReopenProjectAction)element).getProjectPath());
  } else if (element instanceof ProjectGroupActionGroup) {
    final ProjectGroup group = ((ProjectGroupActionGroup)element).getGroup();
    for (String path : group.getProjects()) {
      manager.removePath(path);
    }
    manager.removeGroup(group);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:RecentProjectPanel.java

示例12: rebuildRecentProjectDataModel

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
public static void rebuildRecentProjectDataModel(@NotNull DefaultListModel model) {
  model.clear();
  for (AnAction action : RecentProjectsManager.getInstance().getRecentProjectsActions(false, FlatWelcomeFrame.isUseProjectGroups())) {
    //noinspection unchecked
    model.addElement(action);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RecentProjectsWelcomeScreenActionBase.java

示例13: updateRecentProjectsMenu

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu () {
  final AnAction[] recentProjectActions = RecentProjectsManager.getInstance().getRecentProjectsActions(false);
  RecentTasks.clear();
  Task[] tasks = new Task[recentProjectActions.length];
  for (int i = 0; i < recentProjectActions.length; i ++) {
    ReopenProjectAction rpa = (ReopenProjectAction)recentProjectActions[i];
    tasks[i] = new Task(javaExe, argsToExecute + RecentTasks.getShortenPath(rpa.getProjectPath()), rpa.getTemplatePresentation().getText());
  }
  RecentTasks.addTasks(tasks);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:WinDockDelegate.java

示例14: getBaseDir

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
public static String getBaseDir() {
  final String lastProjectLocation = RecentProjectsManager.getInstance().getLastProjectCreationLocation();
  if (lastProjectLocation != null) {
    return lastProjectLocation.replace('/', File.separatorChar);
  }
  final String userHome = SystemProperties.getUserHome();
  //noinspection HardCodedStringLiteral
  return userHome.replace('/', File.separatorChar) + File.separator + ApplicationNamesInfo.getInstance().getLowercaseProductName() +
         "Projects";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ProjectUtil.java

示例15: getProjectFileDirectory

import com.intellij.ide.RecentProjectsManager; //导入依赖的package包/类
@NotNull
public String getProjectFileDirectory() {
  if (myProjectFileDirectory != null) {
    return myProjectFileDirectory;
  }
  final String lastProjectLocation = RecentProjectsManager.getInstance().getLastProjectCreationLocation();
  if (lastProjectLocation != null) {
    return lastProjectLocation.replace('/', File.separatorChar);
  }
  final String userHome = SystemProperties.getUserHome();
  //noinspection HardCodedStringLiteral
  String productName = ApplicationNamesInfo.getInstance().getLowercaseProductName();
  return userHome.replace('/', File.separatorChar) + File.separator + productName.replace(" ", "") + "Projects";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:WizardContext.java


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