當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。