本文整理汇总了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());
}
}
示例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);
}
}
示例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, '/'));
}
示例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;
}
});
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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";
}
示例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";
}