Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2011-06-19 16:13:16 +0000
committerfbecker2011-06-19 16:13:16 +0000
commitcd5ac74522082b60791daf8818e4802888858eaa (patch)
tree96ff45d3159f991fd3cff3f0921c6b2360d394b4 /org.eclipse.mylyn.bugzilla.ui/src
parent87164a13614071c3244a2b87ebb124a5ebe6422e (diff)
downloadorg.eclipse.mylyn.tasks-cd5ac74522082b60791daf8818e4802888858eaa.tar.gz
org.eclipse.mylyn.tasks-cd5ac74522082b60791daf8818e4802888858eaa.tar.xz
org.eclipse.mylyn.tasks-cd5ac74522082b60791daf8818e4802888858eaa.zip
ASSIGNED - bug 349620: improve UI for showing private comments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349620
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java91
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java16
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java11
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties2
5 files changed, 123 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java
new file mode 100644
index 000000000..c13ea6f52
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.ui.editor;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
+import org.eclipse.mylyn.internal.tasks.core.TaskComment;
+import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorCommentPart;
+import org.eclipse.mylyn.tasks.core.ITaskComment;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.ui.TasksUiImages;
+
+public class BugzillaTaskEditorCommentPart extends TaskEditorCommentPart {
+ private class LockAction extends Action {
+ private final ITaskComment taskComment;
+
+ public LockAction(ITaskComment taskComment) {
+ this.taskComment = taskComment;
+ updateActionState();
+ }
+
+ private void updateActionState() {
+ if (taskComment.getIsPrivate() != null) {
+ if (taskComment.getIsPrivate()) {
+ this.setImageDescriptor(TasksUiImages.LOCK_CLOSE);
+ this.setToolTipText("private Comment");
+ } else {
+ this.setImageDescriptor(TasksUiImages.LOCK_OPEN);
+ this.setToolTipText("public Comment");
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ if (taskComment.getIsPrivate() != null) {
+ taskComment.setIsPrivate(!taskComment.getIsPrivate());
+ TaskAttribute isprivate = taskComment.getTaskAttribute().getMappedAttribute(
+ TaskAttribute.COMMENT_ISPRIVATE);
+ if (isprivate == null) {
+ isprivate = taskComment.getTaskAttribute().createMappedAttribute(TaskAttribute.COMMENT_ISPRIVATE);
+ }
+ isprivate.setValue(taskComment.getIsPrivate() ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ TaskAttribute commentID = taskComment.getTaskAttribute().getMappedAttribute(TaskAttribute.COMMENT_ID);
+ if (commentID != null) {
+ String value = commentID.getValue();
+ TaskAttribute definedIsPrivate = taskComment.getTaskAttribute().getAttribute(
+ IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + value);
+ if (definedIsPrivate == null) {
+ definedIsPrivate = taskComment.getTaskAttribute().createAttribute(
+ IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + value);
+ }
+ TaskAttribute isPrivate = taskComment.getTaskAttribute().getAttribute(
+ IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + value);
+ if (isPrivate == null) {
+ isPrivate = taskComment.getTaskAttribute().createAttribute(
+ IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + value);
+ }
+ definedIsPrivate.setValue("1"); //$NON-NLS-1$
+ isPrivate.setValue(taskComment.getIsPrivate() ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ getModel().attributeChanged(taskComment.getTaskAttribute());
+ updateActionState();
+ }
+ }
+ }
+
+ public BugzillaTaskEditorCommentPart() {
+ // ignore
+ }
+
+ @Override
+ protected void addActionsToToolbar(ToolBarManager toolBarManager, TaskComment taskComment,
+ CommentViewer commentViewer) {
+ if (taskComment.getIsPrivate() != null) {
+ LockAction lockAction = new LockAction(taskComment);
+ toolBarManager.add(lockAction);
+ }
+ super.addActionsToToolbar(toolBarManager, taskComment, commentViewer);
+ }
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index 256693d11..77f0f3c51 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -97,13 +97,18 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
@Override
protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors();
-
+ boolean hasPartComments = false;
// remove unnecessary default editor parts
for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) {
descriptors.remove(taskEditorPartDescriptor);
break;
}
+ if (taskEditorPartDescriptor.getId().equals(ID_PART_COMMENTS)) {
+ descriptors.remove(taskEditorPartDescriptor);
+ hasPartComments = true;
+ break;
+ }
}
// Add Bugzilla Planning part
@@ -135,6 +140,15 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
}.setPath(ID_PART_ATTRIBUTES + "/" + PATH_PLANNING)); //$NON-NLS-1$
}
}
+ if (hasPartComments) {
+ descriptors.add(new TaskEditorPartDescriptor(ID_PART_COMMENTS) {
+ @Override
+ public AbstractTaskEditorPart createPart() {
+ return new BugzillaTaskEditorCommentPart();
+ }
+ }.setPath(PATH_COMMENTS));
+
+ }
} catch (CoreException e) {
// ignore
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
index bb87f010f..840e8874e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
@@ -123,6 +123,8 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
private Button use_see_also;
+ private Button insidergroup;
+
public BugzillaRepositorySettingsPage(TaskRepository taskRepository) {
super(TITLE, DESCRIPTION, taskRepository);
setNeedsAnonymousLogin(true);
@@ -260,6 +262,14 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
for (BugzillaLanguageSettings bugzillaLanguageSettings : BugzillaRepositoryConnector.getLanguageSettings()) {
languageSettingCombo.add(bugzillaLanguageSettings.getLanguageName());
}
+ Label insidergroupLabel = new Label(parent, SWT.NONE);
+ insidergroupLabel.setText(Messages.BugzillaRepositorySettingsPage_insiderGroup);
+ insidergroupLabel.setToolTipText(Messages.BugzillaRepositorySettingsPage_insiderGroup_ToolTip);
+ insidergroup = new Button(parent, SWT.CHECK);
+ if (repository != null) {
+ boolean insider = Boolean.parseBoolean(repository.getProperty(IBugzillaConstants.BUGZILLA_INSIDER_GROUP));
+ insidergroup.setSelection(insider);
+ }
Group workflowGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
workflowGroup.setLayout(new GridLayout(2, false));
@@ -721,6 +731,7 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
Boolean.toString(!usebugaliases.getSelection()));
repository.setProperty(IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO,
Boolean.toString(!use_see_also.getSelection()));
+ repository.setProperty(IBugzillaConstants.BUGZILLA_INSIDER_GROUP, Boolean.toString(insidergroup.getSelection()));
}
@Override
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
index f243dbf99..ae296231b 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
@@ -89,6 +89,10 @@ public class Messages extends NLS {
public static String BugzillaRepositorySettingsPage_Error_updating_repository_configuration;
+ public static String BugzillaRepositorySettingsPage_insiderGroup;
+
+ public static String BugzillaRepositorySettingsPage_insiderGroup_ToolTip;
+
public static String BugzillaRepositorySettingsPage_local_users_enabled;
public static String BugzillaRepositorySettingsPage_override_auto_detection_of_platform;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties
index d6554b8d1..542a311ab 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties
@@ -43,6 +43,8 @@ BugzillaRepositorySettingsPage_DescriptorFileNotExists=Descriptor File does not
BugzillaRepositorySettingsPage_DownloadText=Download From Server
BugzillaRepositorySettingsPage_DownloadToolTip=The Administrator must create the file\nso this may fail\!
BugzillaRepositorySettingsPage_Error_updating_repository_configuration=Error updating repository configuration
+BugzillaRepositorySettingsPage_insiderGroup=insider group
+BugzillaRepositorySettingsPage_insiderGroup_ToolTip=User ID is member of the insider group
BugzillaRepositorySettingsPage_local_users_enabled=Local users enabled:
BugzillaRepositorySettingsPage_override_auto_detection_of_platform=Override auto detection of Platform and OS for new bug reports.
BugzillaRepositorySettingsPage_RequiresBugzilla3_6=Requires Bugzilla > 3.6\nThe description file is not used

Back to the top