diff options
23 files changed, 231 insertions, 46 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java index 315fc6a5d..7520244f7 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java @@ -177,6 +177,8 @@ public class BugzillaAttributeMapper extends TaskAttributeMapper { return BugzillaAttribute.THETEXT.getKey(); } else if (key.equals(TaskAttribute.COMMENT_ISPRIVATE)) { return BugzillaAttribute.IS_PRIVATE.getKey(); + } else if (key.equals(TaskAttribute.COMMENT_ID)) { + return BugzillaAttribute.COMMENTID.getKey(); } else if (key.equals(TaskAttribute.DATE_CREATION)) { return BugzillaAttribute.CREATION_TS.getKey(); } else if (key.equals(TaskAttribute.DESCRIPTION)) { diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java index d175dace8..6ae759235 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java @@ -1458,6 +1458,24 @@ public class BugzillaClient { fields.put("requestee-" + flagnumber.getValue(), new NameValuePair("requestee-" //$NON-NLS-1$//$NON-NLS-2$ + flagnumber.getValue(), requestee.getValue() != null ? requestee.getValue() : "")); //$NON-NLS-1$ } + } else if (id.startsWith(TaskAttribute.PREFIX_COMMENT)) { + TaskAttribute commentID = a.getAttribute(BugzillaAttribute.COMMENTID.getKey()); + if (commentID != null) { + String valueID = commentID.getValue(); + TaskAttribute definedIsPrivate = a.getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_DEFINED_ISPRIVATE + + valueID); + if (definedIsPrivate != null) { + fields.put(definedIsPrivate.getId(), new NameValuePair(definedIsPrivate.getId(), + definedIsPrivate.getValue() != null ? definedIsPrivate.getValue() : "")); //$NON-NLS-1$ + } + TaskAttribute isPrivate = a.getAttribute(IBugzillaConstants.BUGZILLA_PREFIX_ISPRIVATE + + valueID); + if (isPrivate != null) { + fields.put(isPrivate.getId(), new NameValuePair(isPrivate.getId(), + isPrivate.getValue() != null ? isPrivate.getValue() : "")); //$NON-NLS-1$ + } + continue; + } } else if (id.startsWith("task.common.")) { //$NON-NLS-1$ // Don't post any remaining non-bugzilla specific attributes continue; diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java index 379be9610..69d3c9db4 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java @@ -266,6 +266,12 @@ public interface IBugzillaConstants { public static final String BUGZILLA_PARAM_USE_SEE_ALSO = "bugzilla.param.use_see_also"; //$NON-NLS-1$ + public static final String BUGZILLA_INSIDER_GROUP = "bugzilla.insider.group"; //$NON-NLS-1$ + + public static final String BUGZILLA_PREFIX_DEFINED_ISPRIVATE = "defined_isprivate_"; //$NON-NLS-1$ + + public static final String BUGZILLA_PREFIX_ISPRIVATE = "isprivate_"; //$NON-NLS-1$ + // Bugzilla Task Attribute Editor Types public static final String EDITOR_TYPE_KEYWORDS = "bugzilla.editor.keywords"; //$NON-NLS-1$ diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java index 70f7b1d2e..4c54c9633 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java @@ -20,6 +20,7 @@ import java.util.Locale; import java.util.Map; import org.eclipse.mylyn.tasks.core.IRepositoryPerson; +import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper; @@ -79,15 +80,23 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { private final BugzillaRepositoryConnector connector; + private boolean useIsPrivate; + + private final TaskAttributeMapper mapper; + private final SimpleDateFormat simpleFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); //$NON-NLS-1$ public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector, Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields, BugzillaRepositoryConnector connector) { + this.mapper = mapper; this.taskDataMap = taskDataMap; this.customFields = customFields; this.collector = collector; this.connector = connector; + TaskRepository taskRepository = mapper.getTaskRepository(); + String useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_INSIDER_GROUP); + useIsPrivate = (useParam == null || (useParam != null && useParam.equals("true"))); //$NON-NLS-1$ } public boolean errorOccurred() { @@ -666,14 +675,23 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { TaskAttribute attribute = repositoryTaskData.getRoot().createAttribute( TaskAttribute.PREFIX_COMMENT + commentNum); TaskCommentMapper taskComment = TaskCommentMapper.createFrom(attribute); - taskComment.setCommentId(commentNum + ""); //$NON-NLS-1$ + taskComment.setCommentId(comment.id + ""); //$NON-NLS-1$ taskComment.setNumber(commentNum); IRepositoryPerson author = repositoryTaskData.getAttributeMapper() .getTaskRepository() .createPerson(comment.author); author.setName(comment.authorName); taskComment.setAuthor(author); - taskComment.setIsPrivate(comment.isPrivate.equals("1")); //$NON-NLS-1$ + if (useIsPrivate) { + taskComment.setIsPrivate(comment.isPrivate.equals("1")); //$NON-NLS-1$ + } else { + if (comment.isPrivate.equals("1")) { //$NON-NLS-1$ + TaskRepository taskRepository = mapper.getTaskRepository(); + taskRepository.setProperty(IBugzillaConstants.BUGZILLA_INSIDER_GROUP, "true"); //$NON-NLS-1$ + useIsPrivate = true; + } + taskComment.setIsPrivate(null); + } TaskAttribute attrTimestamp = attribute.createAttribute(BugzillaAttribute.BUG_WHEN.getKey()); attrTimestamp.setValue(comment.createdTimeStamp); taskComment.setCreationDate(repositoryTaskData.getAttributeMapper().getDateValue(attrTimestamp)); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaTaskCompletionTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaTaskCompletionTest.java index 50a9c46de..fcbd9504b 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaTaskCompletionTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaTaskCompletionTest.java @@ -61,7 +61,7 @@ public class BugzillaTaskCompletionTest extends TestCase { taskData.getRoot() .createAttribute(BugzillaAttribute.BUG_STATUS.getKey()) .setValue(IBugzillaConstants.VALUE_STATUS_RESOLVED); - TaskAttribute attrComment = taskData.getRoot().createAttribute("commentId"); + TaskAttribute attrComment = taskData.getRoot().createAttribute(BugzillaAttribute.COMMENTID.getKey()); attrComment.getMetaData().setType(TaskAttribute.TYPE_COMMENT); TaskAttribute attrCreationDate = attrComment.createAttribute(BugzillaAttribute.BUG_WHEN.getKey()); attrCreationDate.setValue("2009-12-11 12:00"); @@ -81,7 +81,7 @@ public class BugzillaTaskCompletionTest extends TestCase { BugzillaFixture.TEST_BUGZILLA_LATEST_URL, "1"); TaskAttribute status = taskData.getRoot().createAttribute(BugzillaAttribute.BUG_STATUS.getKey()); status.setValue("REOPENED"); - TaskAttribute attrComment = taskData.getRoot().createAttribute("commentId"); + TaskAttribute attrComment = taskData.getRoot().createAttribute(BugzillaAttribute.COMMENTID.getKey()); attrComment.getMetaData().setType(TaskAttribute.TYPE_COMMENT); TaskAttribute attrCreationDate = attrComment.createAttribute(BugzillaAttribute.BUG_WHEN.getKey()); attrCreationDate.setValue("2008-12-11 12:00"); 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 diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java index 33eb8f039..fbfffecf6 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java @@ -33,6 +33,8 @@ public class TaskComment implements ITaskComment { private int number; + private String commentID; + private final ITask task; private final TaskAttribute taskAttribute; @@ -122,4 +124,11 @@ public class TaskComment implements ITaskComment { this.isPrivate = isPrivate; } + public void setCommentID(String commentID) { + this.commentID = commentID; + } + + public String getCommentID() { + return commentID; + } } diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/Messages.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/Messages.java index b484be0d4..91921cd27 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/Messages.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/Messages.java @@ -40,6 +40,8 @@ public class Messages extends NLS { public static String DefaultTaskSchema_Filename_Label; + public static String DefaultTaskSchema_ID; + public static String DefaultTaskSchema_ID_Label; public static String DefaultTaskSchema_Key_Label; diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/messages.properties b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/messages.properties index 44dfb70cb..de29d6f96 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/messages.properties +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/messages.properties @@ -20,6 +20,7 @@ DefaultTaskSchema_Deprecated_Label=Deprecated DefaultTaskSchema_Description_Label=Description DefaultTaskSchema_Due_Label=Due DefaultTaskSchema_Filename_Label=Filename +DefaultTaskSchema_ID=ID DefaultTaskSchema_ID_Label=ID DefaultTaskSchema_Key_Label=Key DefaultTaskSchema_Keywords_Label=Keywords diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java index 38bf89ae8..27606f4fc 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java @@ -110,4 +110,9 @@ public interface ITaskComment { */ public abstract void setIsPrivate(Boolean isPrivate); + /** + * @since 3.7 + */ + public abstract void setCommentID(String commentID); + }
\ No newline at end of file diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/DefaultTaskSchema.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/DefaultTaskSchema.java index a52f294ae..74c9bdc83 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/DefaultTaskSchema.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/DefaultTaskSchema.java @@ -154,4 +154,10 @@ public final class DefaultTaskSchema extends AbstractTaskSchema { public final Field TASK_URL = createField(TaskAttribute.TASK_URL, Messages.DefaultTaskSchema_URL_Label, TaskAttribute.TYPE_URL, Flag.READ_ONLY); + /** + * @since 3.7 + */ + public final Field COMMENT_ID = createField(TaskAttribute.COMMENT_ID, Messages.DefaultTaskSchema_ID, TaskAttribute.TYPE_INTEGER, + Flag.READ_ONLY); + } diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java index db152281d..efe0e2318 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java @@ -131,6 +131,11 @@ public final class TaskAttribute { public static final String COMMENT_ISPRIVATE = "task.common.comment.isprivate"; //$NON-NLS-1$ /** + * @since 3.7 + */ + public static final String COMMENT_ID = "task.common.comment.id"; //$NON-NLS-1$ + + /** * Key for the meta datum that determines if an attribute is disabled. This is used to indicate that an attribute * should not be modified, e.g. due to work-flow state but it may still be generally writeable. * diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java index f50b43c45..185b098e1 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java @@ -125,6 +125,10 @@ public class TaskCommentMapper { if (child != null) { comment.setCreationDate(mapper.getDateValue(child)); } + child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_ID); + if (child != null) { + comment.setCommentId(mapper.getValue(child)); + } child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_NUMBER); if (child != null) { comment.setNumber(mapper.getIntegerValue(child)); @@ -149,8 +153,12 @@ public class TaskCommentMapper { TaskData taskData = taskAttribute.getTaskData(); TaskAttributeMapper mapper = taskData.getAttributeMapper(); taskAttribute.getMetaData().defaults().setType(TaskAttribute.TYPE_COMMENT); + if (getNumber() != null) { + mapper.setIntegerValue(taskAttribute, getNumber()); + } if (getCommentId() != null) { - mapper.setValue(taskAttribute, getCommentId()); + TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.COMMENT_ID).createAttribute(taskAttribute); + mapper.setValue(child, getCommentId()); } if (getAuthor() != null) { TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.COMMENT_AUTHOR).createAttribute( @@ -193,6 +201,9 @@ public class TaskCommentMapper { if (getNumber() != null) { taskComment.setNumber(getNumber()); } + if (getCommentId() != null) { + taskComment.setCommentID(getCommentId()); + } if (getUrl() != null) { taskComment.setUrl(getUrl()); } diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/lock.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/lock.gif Binary files differnew file mode 100644 index 000000000..1075ee458 --- /dev/null +++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/lock.gif diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/unlock.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/unlock.gif Binary files differnew file mode 100644 index 000000000..73f3c2d02 --- /dev/null +++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/unlock.gif diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java index 56bc96677..739db8c59 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java @@ -139,8 +139,6 @@ public class Messages extends NLS { public static String TaskEditorCommentPart_Expand_Comments; - public static String TaskEditorCommentPart_Privat_Comment_ToolTip_Text; - public static String TaskEditorDescriptionPart_Description; public static String TaskEditorDescriptionPart_Detector; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java index 4c36c1bc4..0a3ac52b7 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java @@ -39,14 +39,11 @@ import org.eclipse.mylyn.tasks.core.data.TaskDataModel; import org.eclipse.mylyn.tasks.ui.TasksUiImages; import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; -import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -290,7 +287,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { } - private class CommentViewer { + protected class CommentViewer { private Composite buttonComposite; @@ -376,9 +373,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { buttonComposite.setVisible(commentComposite.isExpanded()); ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); - ReplyToCommentAction replyAction = new ReplyToCommentAction(this, taskComment); - replyAction.setImageDescriptor(TasksUiImages.COMMENT_REPLY_SMALL); - toolBarManager.add(replyAction); + addActionsToToolbar(toolBarManager, taskComment, this); toolBarManager.createControl(buttonComposite); return buttonComposite; @@ -414,30 +409,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { sb.append(", "); //$NON-NLS-1$ sb.append(EditorUtil.formatDateTime(taskComment.getCreationDate())); } -// We need the CommentID for change the value of private -// this is only for an test included -// Maybe we need this for bug# 284026 -// TaskAttribute commentID = taskComment.getTaskAttribute().getAttribute("commentid"); -// if (commentID != null) { -// String value = commentID.getValue(); -// sb.append(" (ID " + value + ")"); -// } - if (taskComment.getIsPrivate() != null && taskComment.getIsPrivate()) { - if (privateFont == null) { - Font a = formHyperlink.getFont(); - FontData[] fd = a.getFontData(); - for (FontData fontData : fd) { - fontData.setStyle(SWT.ITALIC | SWT.BOLD); - } - privateFont = new Font(formHyperlink.getDisplay(), fd); - } - formHyperlink.setFont(privateFont); - toolTipText = NLS.bind(Messages.TaskEditorCommentPart_Privat_Comment_ToolTip_Text, toolTipText); - } else { - formHyperlink.setFont(commentComposite.getFont()); - } formHyperlink.setToolTipText(toolTipText); - formHyperlink.setText(sb.toString()); formHyperlink.setEnabled(true); formHyperlink.setUnderlined(false); @@ -499,12 +471,10 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { return commentAttribute; } - @SuppressWarnings("unused") public TaskComment getTaskComment() { return taskComment; } - @SuppressWarnings("unused") public Control getControl() { return commentComposite; } @@ -571,8 +541,6 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { private CommentActionGroup actionGroup; - private Font privateFont; - private boolean suppressExpandViewers; public TaskEditorCommentPart() { @@ -585,6 +553,13 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { setPartName(Messages.TaskEditorCommentPart_Comments); } + protected void addActionsToToolbar(ToolBarManager toolBarManager, final TaskComment taskComment, + CommentViewer commentViewer) { + ReplyToCommentAction replyAction = new ReplyToCommentAction(commentViewer, taskComment); + replyAction.setImageDescriptor(TasksUiImages.COMMENT_REPLY_SMALL); + toolBarManager.add(replyAction); + } + private void collapseAllComments() { try { getTaskEditorPage().setReflow(false); @@ -697,9 +672,6 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart { if (actionGroup != null) { actionGroup.dispose(); } - if (privateFont != null) { - privateFont.dispose(); - } } private void expandAllComments(boolean expandViewers) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties index b5f6db24f..be369cb33 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties @@ -75,7 +75,6 @@ TaskEditorCommentPart_1=) TaskEditorCommentPart_Collapse_Comments=Collapse Comments TaskEditorCommentPart_Comments=Comments TaskEditorCommentPart_Expand_Comments=Expand Comments -TaskEditorCommentPart_Privat_Comment_ToolTip_Text=Private Comment from {0} TaskEditorDescriptionPart_Description=Description TaskEditorDescriptionPart_Detector=Detector: diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java index 5fecec7ce..558ca16b9 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java @@ -198,6 +198,17 @@ public class TasksUiImages { */ public static final ImageDescriptor BANNER_REPORT_BUG = create(WIZBAN, "bug-wizard.gif"); //$NON-NLS-1$ + /** + * @since 3.7 + */ + + public static final ImageDescriptor LOCK_CLOSE = create(TOOL, "lock.gif"); //$NON-NLS-1$ + + /** + * @since 3.7 + */ + public static final ImageDescriptor LOCK_OPEN = create(TOOL, "unlock.gif"); //$NON-NLS-1$ + public static Image getImageForPriority(PriorityLevel priorityLevel) { if (priorityLevel == null) { return null; |