From 14acef8cd3f830ea325423dfe4aaf8e2fc4f825e Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 17 Jun 2014 19:46:43 +0400 Subject: [PATCH] Cleanup (formatting; pointless code) --- .../ide/RecentProjectsManagerBase.java | 31 +++++++------------ .../ide/actions/RecentProjectsGroup.java | 13 ++------ .../src/messages/IdeBundle.properties | 2 ++ 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java index e77e289f1740..1a6bffbcd297 100644 --- a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java +++ b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package com.intellij.ide; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.Separator; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.PersistentStateComponent; @@ -169,9 +168,7 @@ public abstract class RecentProjectsManagerBase implements ProjectManagerListene } /** - * @param addClearListItem - used for detecting whether the "Clear List" action should be added - * to the end of the returned list of actions - * @return + * @param addClearListItem whether the "Clear List" action should be added to the end of the list. */ public AnAction[] getRecentProjectsActions(boolean addClearListItem) { final Set paths; @@ -188,10 +185,10 @@ public abstract class RecentProjectsManagerBase implements ProjectManagerListene paths.remove(null); paths.removeAll(openedPaths); - ArrayList actions = new ArrayList(); + List actions = new ArrayList(); Set duplicates = getDuplicateProjectNames(openedPaths, paths); for (final String path : paths) { - final String projectName = getProjectName(path); + String projectName = getProjectName(path); String displayName; synchronized (myStateLock) { displayName = myState.names.get(path); @@ -212,19 +209,13 @@ public abstract class RecentProjectsManagerBase implements ProjectManagerListene return AnAction.EMPTY_ARRAY; } - ArrayList list = new ArrayList(); - for (AnAction action : actions) { - list.add(action); - } if (addClearListItem) { AnAction clearListAction = new DumbAwareAction(IdeBundle.message("action.clear.list")) { + @Override public void actionPerformed(AnActionEvent e) { - final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT), - "Would you like to clear the list of recent projects?", - "Clear Recent Projects List", - Messages.getQuestionIcon()); - - if (rc == Messages.OK) { + String message = IdeBundle.message("action.clear.list.message"); + String title = IdeBundle.message("action.clear.list.title"); + if (Messages.showOkCancelDialog(e.getProject(), message, title, Messages.getQuestionIcon()) == Messages.OK) { synchronized (myStateLock) { myState.recentPaths.clear(); } @@ -233,11 +224,11 @@ public abstract class RecentProjectsManagerBase implements ProjectManagerListene } }; - list.add(Separator.getInstance()); - list.add(clearListAction); + actions.add(Separator.getInstance()); + actions.add(clearListAction); } - return list.toArray(new AnAction[list.size()]); + return actions.toArray(new AnAction[actions.size()]); } private void markPathRecent(String path) { diff --git a/platform/platform-impl/src/com/intellij/ide/actions/RecentProjectsGroup.java b/platform/platform-impl/src/com/intellij/ide/actions/RecentProjectsGroup.java index 3d1a8c14574d..0a2ac7fe1c52 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/RecentProjectsGroup.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/RecentProjectsGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,15 +28,8 @@ import org.jetbrains.annotations.Nullable; public class RecentProjectsGroup extends ActionGroup implements DumbAware { public RecentProjectsGroup() { - super(); - - final Presentation templatePresentation = getTemplatePresentation(); - // Let's make tile more macish - if (SystemInfo.isMac) { - templatePresentation.setText(ActionsBundle.message("group.reopen.mac.text")); - } else { - templatePresentation.setText(ActionsBundle.message("group.reopen.win.text")); - } + Presentation presentation = getTemplatePresentation(); + presentation.setText(ActionsBundle.message(SystemInfo.isMac ? "group.reopen.mac.text": "group.reopen.win.text")); } @NotNull diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index af0753197a74..1d8ac1ae2a7a 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -40,6 +40,8 @@ checkbox.synchronize.files.on.frame.activation=Synchronize files on frame activa checkbox.reopen.last.project.on.startup=Reopen last project on startup treenode.loading= loading... action.clear.list=_Clear List +action.clear.list.message=Would you like to clear the list of recent projects? +action.clear.list.title=Clear Recent Projects List action.descriptor.action=Action: {0} action.descriptor.typing=Typing: "{0}" action.descriptor.keystroke=Keystroke: "{0}"