Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2016-09-22 14:48:58 -0400
committerGerrit Code Review @ Eclipse.org2016-10-06 15:04:48 -0400
commit2abd17c2ef00212b7ebd680d0c866ced9195d167 (patch)
tree06e073ca34ef3ac80958dc38f5965d53497135b2
parente73deec9f6c8974fcb6c787067bc7be9b8fd1b30 (diff)
downloadorg.eclipse.mylyn.tasks-2abd17c2ef00212b7ebd680d0c866ced9195d167.tar.gz
org.eclipse.mylyn.tasks-2abd17c2ef00212b7ebd680d0c866ced9195d167.tar.xz
org.eclipse.mylyn.tasks-2abd17c2ef00212b7ebd680d0c866ced9195d167.zip
Bug 501868: In "copy details" please add "ID and Summary"
- Added "ID and Summary" field. - Following bugzilla convention, I capitalized "Bug" (from "bug") - NOTE: 'SUMMARY' was already in the code base, but it was not used, maybe left overs from the past... I basically recycled and re-used SUMMARY. Patch set 3: - Removed the task ID and Summary seperattor introduced in patchset 1. - Refactored/Renamed a bunch of variables. - Removed comment out line in ID_SUMMARY_URL - Refactored Mode enum to remove switch statement. Patch set 4: - Renamed "Bug" back to "bug" in BugzillaRepositoryConnector - In CopyTaskDetailsAction, capitalized prefix as per suggestion. Patch set 5: - Updated test cases to use renamed enum. Change-Id: I1441c0e4fc975eba225ac79077ff65a26074cc13 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=501868 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java20
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java36
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties4
5 files changed, 39 insertions, 39 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java
index 840b8e3c6..e6e44c4c2 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/CopyDetailsActionTest.java
@@ -14,8 +14,6 @@ package org.eclipse.mylyn.tasks.tests;
import java.net.MalformedURLException;
import java.net.URL;
-import junit.framework.TestCase;
-
import org.eclipse.mylyn.commons.ui.ClipboardCopier;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
@@ -27,6 +25,8 @@ import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
import org.eclipse.mylyn.tasks.tests.connector.MockTask;
import org.eclipse.mylyn.tasks.ui.TasksUi;
+import junit.framework.TestCase;
+
/**
* @author Steffen Pingel
* @author Thomas Ehrnhoefer
@@ -81,12 +81,12 @@ public class CopyDetailsActionTest extends TestCase {
return "http://321.com";
}
};
- AbstractRepositoryConnector oldConnector = TasksUi.getRepositoryManager().getRepositoryConnector(
- MockRepositoryConnector.CONNECTOR_KIND);
+ AbstractRepositoryConnector oldConnector = TasksUi.getRepositoryManager()
+ .getRepositoryConnector(MockRepositoryConnector.CONNECTOR_KIND);
try {
((TaskRepositoryManager) TasksUi.getRepositoryManager()).addRepositoryConnector(connector);
assertEquals("321: s321" + ClipboardCopier.LINE_SEPARATOR + "http://321.com",
- CopyTaskDetailsAction.getTextForTask(task, Mode.SUMMARY_URL));
+ CopyTaskDetailsAction.getTextForTask(task, Mode.ID_SUMMARY_URL));
} finally {
if (oldConnector != null) {
((TaskRepositoryManager) TasksUi.getRepositoryManager()).addRepositoryConnector(oldConnector);
@@ -115,13 +115,13 @@ public class CopyDetailsActionTest extends TestCase {
};
- AbstractRepositoryConnector oldConnector = TasksUi.getRepositoryManager().getRepositoryConnector(
- MockRepositoryConnector.CONNECTOR_KIND);
+ AbstractRepositoryConnector oldConnector = TasksUi.getRepositoryManager()
+ .getRepositoryConnector(MockRepositoryConnector.CONNECTOR_KIND);
try {
((TaskRepositoryManager) TasksUi.getRepositoryManager()).addRepositoryConnector(connector);
- assertEquals("123: Ticket 123" + ClipboardCopier.LINE_SEPARATOR
- + "http://mock-repo-evolved.com/tickets/123",
- CopyTaskDetailsAction.getTextForTask(task, Mode.SUMMARY_URL));
+ assertEquals(
+ "123: Ticket 123" + ClipboardCopier.LINE_SEPARATOR + "http://mock-repo-evolved.com/tickets/123",
+ CopyTaskDetailsAction.getTextForTask(task, Mode.ID_SUMMARY_URL));
assertEquals("http://mock-repo-evolved.com/tickets/123",
CopyTaskDetailsAction.getTextForTask(task, Mode.URL));
} finally {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
index fc8c514ce..0c78f58e8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
@@ -13,6 +13,7 @@ package org.eclipse.mylyn.internal.tasks.ui.actions;
import java.net.URL;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.Assert;
import org.eclipse.mylyn.commons.ui.ClipboardCopier;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
@@ -35,7 +36,16 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
public static final String ID = "org.eclipse.mylyn.tasklist.actions.copy"; //$NON-NLS-1$
public enum Mode {
- KEY, URL, SUMMARY, SUMMARY_URL
+ KEY(Messages.CopyTaskDetailsAction_ID_Menu_Label), URL(
+ Messages.CopyTaskDetailsAction_Url_Menu_Label), ID_SUMMARY(
+ Messages.CopyTaskDetailsAction_ID_Summary_Menu_Label), ID_SUMMARY_URL(
+ Messages.CopyTaskDetailsAction_ID_Summary_and_Url_Menu_Label);
+
+ private String message;
+
+ private Mode(String message) {
+ this.message = message;
+ }
}
private Mode mode;
@@ -52,20 +62,7 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
public void setMode(Mode mode) {
Assert.isNotNull(mode);
this.mode = mode;
- switch (mode) {
- case KEY:
- setText(Messages.CopyTaskDetailsAction_ID_Menu_Label);
- break;
- case URL:
- setText(Messages.CopyTaskDetailsAction_Url_Menu_Label);
- break;
- case SUMMARY:
- setText(Messages.CopyTaskDetailsAction_Summary_Menu_Label);
- break;
- case SUMMARY_URL:
- setText(Messages.CopyTaskDetailsAction_Summary_and_Url_Menu_Label);
- break;
- }
+ setText(mode.message);
}
@Override
@@ -78,7 +75,7 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
}
public static String getTextForTask(Object object) {
- return getTextForTask(object, Mode.SUMMARY_URL);
+ return getTextForTask(object, Mode.ID_SUMMARY_URL);
}
// TODO move to TasksUiUtil / into core
@@ -101,11 +98,11 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
}
}
break;
- case SUMMARY:
+ case ID_SUMMARY:
if (object instanceof ITask) {
ITask task = (ITask) object;
if (task.getTaskKey() != null) {
- sb.append(TasksUiInternal.getTaskPrefix(task.getConnectorKind()));
+ sb.append(StringUtils.capitalize(TasksUiInternal.getTaskPrefix(task.getConnectorKind())));
sb.append(task.getTaskKey());
sb.append(": "); //$NON-NLS-1$
}
@@ -115,11 +112,10 @@ public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
sb.append(element.getSummary());
}
break;
- case SUMMARY_URL:
+ case ID_SUMMARY_URL:
if (object instanceof ITask) {
ITask task = (ITask) object;
if (task.getTaskKey() != null) {
- //sb.append(TasksUiInternal.getTaskPrefix(task.getConnectorKind()));
sb.append(task.getTaskKey());
sb.append(": "); //$NON-NLS-1$
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
index 13ecb040a..4e801e99f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
@@ -79,9 +79,9 @@ public class Messages extends NLS {
public static String CopyTaskDetailsAction_ID_Menu_Label;
- public static String CopyTaskDetailsAction_Summary_and_Url_Menu_Label;
+ public static String CopyTaskDetailsAction_ID_Summary_and_Url_Menu_Label;
- public static String CopyTaskDetailsAction_Summary_Menu_Label;
+ public static String CopyTaskDetailsAction_ID_Summary_Menu_Label;
public static String CopyTaskDetailsAction_Url_Menu_Label;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java
index c24421630..ca55186ad 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RepositoryElementActionGroup.java
@@ -76,7 +76,9 @@ public class RepositoryElementActionGroup {
private final CopyTaskDetailsAction copyKeyAction;
- private final CopyTaskDetailsAction copyDetailsAction;
+ private final CopyTaskDetailsAction copyKeySummaryAction;
+
+ private final CopyTaskDetailsAction copyKeySummaryURLAction;
private final OpenTaskListElementAction openAction;
@@ -118,9 +120,10 @@ public class RepositoryElementActionGroup {
copyKeyAction = add(new CopyTaskDetailsAction(Mode.KEY));
copyUrlAction = add(new CopyTaskDetailsAction(Mode.URL));
- copyDetailsAction = add(new CopyTaskDetailsAction(Mode.SUMMARY_URL));
+ copyKeySummaryAction = add(new CopyTaskDetailsAction(Mode.ID_SUMMARY));
+ copyKeySummaryURLAction = add(new CopyTaskDetailsAction(Mode.ID_SUMMARY_URL));
if (!isInEditor()) {
- copyDetailsAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
+ copyKeySummaryURLAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
}
removeFromCategoryAction = add(new RemoveFromCategoryAction());
@@ -224,7 +227,8 @@ public class RepositoryElementActionGroup {
Messages.RepositoryElementActionGroup_Copy_Detail_Menu_Label, CopyTaskDetailsAction.ID);
copyDetailsSubMenu.add(copyKeyAction);
copyDetailsSubMenu.add(copyUrlAction);
- copyDetailsSubMenu.add(copyDetailsAction);
+ copyDetailsSubMenu.add(copyKeySummaryAction);
+ copyDetailsSubMenu.add(copyKeySummaryURLAction);
manager.appendToGroup(ID_SEPARATOR_EDIT, copyDetailsSubMenu);
}
if (isInTaskList() && !selection.isEmpty()) {
@@ -395,7 +399,7 @@ public class RepositoryElementActionGroup {
}
public CopyTaskDetailsAction getCopyDetailsAction() {
- return copyDetailsAction;
+ return copyKeySummaryURLAction;
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
index 80ee0049d..da90ded41 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
@@ -45,8 +45,8 @@ CopyCommenterNameAction_Copy_User_Name=Copy User Name
CopyCommenterNameAction_Copy_User_Name_Tooltip=Copy User Name of Comment Author to Clipboard
CopyTaskDetailsAction_ID_Menu_Label=ID
-CopyTaskDetailsAction_Summary_and_Url_Menu_Label=Summary and URL
-CopyTaskDetailsAction_Summary_Menu_Label=Summary
+CopyTaskDetailsAction_ID_Summary_and_Url_Menu_Label=ID, Summary and URL
+CopyTaskDetailsAction_ID_Summary_Menu_Label=ID and Summary
CopyTaskDetailsAction_Url_Menu_Label=URL
DeleteAction_Also_delete_from_repository_X=Also delete from repository. {0}

Back to the top