Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2012-02-18 19:27:17 +0000
committerFrank Becker2012-02-18 19:28:00 +0000
commite87b60aee18c81693c4b05cd784848a08bae2be7 (patch)
tree5dd553c45ae53e9adc305065c690204a017e6a8f /org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor
parentd1d4e9582e26e9c5564460124a812c2a9b708af5 (diff)
downloadorg.eclipse.mylyn.tasks-e87b60aee18c81693c4b05cd784848a08bae2be7.tar.gz
org.eclipse.mylyn.tasks-e87b60aee18c81693c4b05cd784848a08bae2be7.tar.xz
org.eclipse.mylyn.tasks-e87b60aee18c81693c4b05cd784848a08bae2be7.zip
ASSIGNED - bug 349620: improve UI for private comments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349620 Change-Id: I27dddbdee581dd279d6a0c43e932b38f22ff6305
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorDescriptionPart.java75
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java23
2 files changed, 98 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorDescriptionPart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorDescriptionPart.java
new file mode 100644
index 000000000..36acfd629
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorDescriptionPart.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.ui.editors.TaskEditorDescriptionPart;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.ui.TasksUiImages;
+
+public class BugzillaTaskEditorDescriptionPart extends TaskEditorDescriptionPart {
+ private class LockAction extends Action {
+
+ public LockAction() {
+ super();
+ updateActionState();
+ }
+
+ private void updateActionState() {
+ TaskAttribute isPrivate = getAttribute().getAttribute(IBugzillaConstants.BUGZILLA_DESCRIPTION_IS_PRIVATE);
+ if ("1".compareTo(isPrivate.getValue()) == 0) { //$NON-NLS-1$
+ this.setImageDescriptor(TasksUiImages.LOCK_CLOSE);
+ } else {
+ this.setImageDescriptor(TasksUiImages.LOCK_OPEN);
+ }
+ }
+
+ @Override
+ public void run() {
+ TaskAttribute isPrivateAttribute = getAttribute().getAttribute(
+ IBugzillaConstants.BUGZILLA_DESCRIPTION_IS_PRIVATE);
+ // isPrivateAttribute can not be null because we only add the Action when the Attribute exists
+ TaskAttribute idAttribute = getAttribute().getAttribute(IBugzillaConstants.BUGZILLA_DESCRIPTION_ID);
+ boolean oldValue = "1".compareTo(isPrivateAttribute.getValue()) == 0; //$NON-NLS-1$
+ isPrivateAttribute.setValue(!oldValue ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ String value = idAttribute.getValue();
+ TaskAttribute definedIsPrivate = getAttribute().getAttribute(
+ IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + value);
+ if (definedIsPrivate == null) {
+ definedIsPrivate = getAttribute().createAttribute(
+ IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + value);
+ }
+ TaskAttribute isPrivate = getAttribute().getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + value);
+ if (isPrivate == null) {
+ isPrivate = getAttribute().createAttribute(IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + value);
+ }
+ definedIsPrivate.setValue("1"); //$NON-NLS-1$
+ isPrivate.setValue(!oldValue ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ getModel().attributeChanged(getAttribute());
+ updateActionState();
+ }
+ }
+
+ @Override
+ protected void fillToolBar(ToolBarManager toolBar) {
+ String insidergroup = getModel().getTaskRepository().getProperty(IBugzillaConstants.BUGZILLA_INSIDER_GROUP);
+ TaskAttribute isPrivate = getAttribute().getAttribute(IBugzillaConstants.BUGZILLA_DESCRIPTION_IS_PRIVATE);
+ if (Boolean.parseBoolean(insidergroup) && isPrivate != null) {
+ LockAction lockAction = new LockAction();
+ toolBar.add(lockAction);
+ }
+ super.fillToolBar(toolBar);
+ }
+
+}
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 9385adb09..7bb256f27 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
@@ -75,6 +75,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.keys.IBindingService;
/**
@@ -120,6 +121,7 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors();
boolean hasPartComments = false;
boolean hasPartNewComment = false;
+ boolean hasPartDescription = false;
// remove unnecessary default editor parts
for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) {
@@ -141,6 +143,13 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
break;
}
}
+ for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
+ if (taskEditorPartDescriptor.getId().equals(ID_PART_DESCRIPTION)) {
+ descriptors.remove(taskEditorPartDescriptor);
+ hasPartDescription = true;
+ break;
+ }
+ }
// Add Bugzilla Planning part
try {
@@ -171,6 +180,20 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
}.setPath(ID_PART_ATTRIBUTES + "/" + PATH_PLANNING)); //$NON-NLS-1$
}
}
+ if (hasPartDescription) {
+ descriptors.add(new TaskEditorPartDescriptor(ID_PART_DESCRIPTION) {
+ @Override
+ public AbstractTaskEditorPart createPart() {
+ BugzillaTaskEditorDescriptionPart part = new BugzillaTaskEditorDescriptionPart();
+ if (getModel().getTaskData().isNew()) {
+ part.setExpandVertically(true);
+ part.setSectionStyle(ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
+ }
+ return part;
+ }
+ }.setPath(PATH_COMMENTS));
+
+ }
if (hasPartComments) {
descriptors.add(new TaskEditorPartDescriptor(ID_PART_COMMENTS) {
@Override

Back to the top