Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 41432 Details for
Bug 133764
Form based editor for Jira tasks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch to org.eclipse.mylar.jira
133764.patch (text/plain), 36.63 KB, created by
Brock Janiczak
on 2006-05-15 05:45:01 EDT
(
hide
)
Description:
patch to org.eclipse.mylar.jira
Filename:
MIME Type:
Creator:
Brock Janiczak
Created:
2006-05-15 05:45:01 EDT
Size:
36.63 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.jira >Index: plugin.xml >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/plugin.xml,v >retrieving revision 1.10 >diff -u -r1.10 plugin.xml >--- plugin.xml 22 Feb 2006 16:38:42 -0000 1.10 >+++ plugin.xml 15 May 2006 09:43:32 -0000 >@@ -33,5 +33,19 @@ > </description> > </decorator> > </extension> >+ <extension >+ point="org.eclipse.ui.editors"> >+ <editor >+ class="org.eclipse.mylar.internal.jira.ui.JiraTaskEditor" >+ default="false" >+ id="org.eclipse.mylar.jira.JiraTaskEditor" >+ name="Jira Task Editor"/> >+ </extension> >+ <extension >+ point="org.eclipse.mylar.tasklist.editors"> >+ <editorFactory >+ class="org.eclipse.mylar.internal.jira.ui.JiraTaskEditorFactory" >+ id="org.eclipse.mylar.jira.ui.JiraTaskEditorFactory"/> >+ </extension> > > </plugin> >Index: src/org/eclipse/mylar/internal/jira/JiraServerFacade.java >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/src/org/eclipse/mylar/internal/jira/JiraServerFacade.java,v >retrieving revision 1.14 >diff -u -r1.14 JiraServerFacade.java >--- src/org/eclipse/mylar/internal/jira/JiraServerFacade.java 6 Apr 2006 06:33:45 -0000 1.14 >+++ src/org/eclipse/mylar/internal/jira/JiraServerFacade.java 15 May 2006 09:43:32 -0000 >@@ -20,7 +20,6 @@ > import org.eclipse.mylar.provisional.tasklist.TaskRepository; > import org.tigris.jira.core.JiraCorePlugin; > import org.tigris.jira.core.ServerManager; >-import org.tigris.jira.core.service.CachedRpcJiraServer; > import org.tigris.jira.core.service.JiraServer; > import org.tigris.jira.core.service.exceptions.AuthenticationException; > import org.tigris.jira.core.service.exceptions.ServiceUnavailableException; >@@ -57,7 +56,6 @@ > repository.getUserName(), repository.getPassword()); > serverManager.addServer(server); > } >- server.login(); > return server; > } catch (ServiceUnavailableException sue) { > throw sue; >@@ -117,11 +115,7 @@ > String serverHostname = getServerHost(repository); > JiraServer server = serverManager.getServer(serverHostname); > if (server != null) { >- removeServer(server); >- server = serverManager.createServer(serverHostname, repository.getUrl(), false, >- repository.getUserName(), repository.getPassword()); >- serverManager.addServer(server); >- server.login(); >+ server.refreshDetails(); > } > } > >@@ -135,10 +129,7 @@ > /** Returns true if all of the serverURL, user name, and password are valid */ > public boolean validateServerAndCredentials(String serverUrl, String user, String password) { > try { >- // TODO: use test method on ServerManager >- CachedRpcJiraServer jiraServer = new CachedRpcJiraServer("ConnectionTest", serverUrl, false, user, password); >- jiraServer.login(); >- jiraServer.logout(); >+ serverManager.testConnection(serverUrl, user, password); > } catch (Exception e) { > return false; > } >Index: src/org/eclipse/mylar/internal/jira/JiraQueryHit.java >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/src/org/eclipse/mylar/internal/jira/JiraQueryHit.java,v >retrieving revision 1.1 >diff -u -r1.1 JiraQueryHit.java >--- src/org/eclipse/mylar/internal/jira/JiraQueryHit.java 14 Mar 2006 01:22:27 -0000 1.1 >+++ src/org/eclipse/mylar/internal/jira/JiraQueryHit.java 15 May 2006 09:43:32 -0000 >@@ -47,7 +47,7 @@ > if (existingTask instanceof JiraTask) { > task = (JiraTask) existingTask; > } else { >- task = new JiraTask(getHandleIdentifier(), description, true); >+ task = new JiraTask(getHandleIdentifier(), issue.getKey(), description, true); > MylarTaskListPlugin.getTaskListManager().getTaskList().addTask(task); > } > } >Index: src/org/eclipse/mylar/internal/jira/JiraTaskExternalizer.java >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/src/org/eclipse/mylar/internal/jira/JiraTaskExternalizer.java,v >retrieving revision 1.24 >diff -u -r1.24 JiraTaskExternalizer.java >--- src/org/eclipse/mylar/internal/jira/JiraTaskExternalizer.java 28 Apr 2006 17:49:36 -0000 1.24 >+++ src/org/eclipse/mylar/internal/jira/JiraTaskExternalizer.java 15 May 2006 09:43:33 -0000 >@@ -64,6 +64,8 @@ > private static final String KEY_FILTER_DESCRIPTION = "FilterDesc"; > > private static final String KEY_FILTER_CUSTOM = "FilterCustom"; >+ >+ private static final String KEY_KEY = "Key"; > > > public boolean canReadQuery(Node node) { >@@ -204,6 +206,8 @@ > > public Element createTaskElement(ITask task, Document doc, Element parent) { > Element node = super.createTaskElement(task, doc, parent); >+ >+ node.setAttribute(KEY_KEY, ((JiraTask)task).getKey()); > return node; > } > >@@ -214,6 +218,7 @@ > Element element = (Element) node; > String handle; > String label; >+ String key; > if (element.hasAttribute(KEY_HANDLE)) { > handle = element.getAttribute(KEY_HANDLE); > } else { >@@ -224,7 +229,12 @@ > } else { > throw new TaskExternalizationException("Description not stored for bug report"); > } >- JiraTask task = new JiraTask(handle, label, false); >+ if (element.hasAttribute(KEY_KEY)) { >+ key = element.getAttribute(KEY_KEY); >+ } else { >+ throw new TaskExternalizationException("Key not stored on bug report"); >+ } >+ JiraTask task = new JiraTask(handle, key, label, false); > readTaskInfo(task, taskList, element, parent, category); > > // TODO: remove, should be done by readTaskInfo >Index: src/org/eclipse/mylar/internal/jira/MylarJiraPlugin.java >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/src/org/eclipse/mylar/internal/jira/MylarJiraPlugin.java,v >retrieving revision 1.9 >diff -u -r1.9 MylarJiraPlugin.java >--- src/org/eclipse/mylar/internal/jira/MylarJiraPlugin.java 14 Mar 2006 02:57:43 -0000 1.9 >+++ src/org/eclipse/mylar/internal/jira/MylarJiraPlugin.java 15 May 2006 09:43:33 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.mylar.internal.jira; > > import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.resource.ImageRegistry; > import org.eclipse.ui.plugin.AbstractUIPlugin; > import org.osgi.framework.BundleContext; > >@@ -62,6 +63,16 @@ > * @return the image descriptor > */ > public static ImageDescriptor getImageDescriptor(String path) { >- return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.mylar.sandbox.jira", path); >+ return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.mylar.jira", path); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) >+ */ >+ @Override >+ protected void initializeImageRegistry(ImageRegistry reg) { >+ reg.put("icons/obj16/comment.gif", getImageDescriptor("icons/obj16/comment.gif")); >+ reg.put("icons/obj16/jira.png", getImageDescriptor("icons/obj16/jira.png")); >+ > } > } >Index: src/org/eclipse/mylar/internal/jira/JiraTask.java >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/src/org/eclipse/mylar/internal/jira/JiraTask.java,v >retrieving revision 1.14 >diff -u -r1.14 JiraTask.java >--- src/org/eclipse/mylar/internal/jira/JiraTask.java 14 Mar 2006 02:57:43 -0000 1.14 >+++ src/org/eclipse/mylar/internal/jira/JiraTask.java 15 May 2006 09:43:32 -0000 >@@ -20,6 +20,8 @@ > */ > public class JiraTask extends AbstractRepositoryTask { > >+ private final String key; >+ > public enum PriorityLevel { > BLOCKER, CRITICAL, MAJOR, MINOR, TRIVIAL; > >@@ -87,8 +89,9 @@ > /** > * The handle is also the task's Jira url > */ >- public JiraTask(String handle, String label, boolean newTask) { >+ public JiraTask(String handle, String key, String label, boolean newTask) { > super(handle, label, newTask); >+ this.key = key; > } > > @Override >@@ -104,4 +107,11 @@ > public String getRepositoryKind() { > return MylarJiraPlugin.REPOSITORY_KIND; > } >+ >+ /** >+ * @return the key >+ */ >+ public String getKey() { >+ return this.key; >+ } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/META-INF/MANIFEST.MF,v >retrieving revision 1.57 >diff -u -r1.57 MANIFEST.MF >--- META-INF/MANIFEST.MF 13 May 2006 02:08:25 -0000 1.57 >+++ META-INF/MANIFEST.MF 15 May 2006 09:43:32 -0000 >@@ -13,7 +13,8 @@ > org.eclipse.mylar.tasklist, > org.eclipse.mylar.core, > org.tigris.jira.core;bundle-version="[0.8.0,1.0.0)", >- org.tigris.jira.core.soap;bundle-version="[0.8.0,1.0.0)" >+ org.tigris.jira.core.soap;bundle-version="[0.8.0,1.0.0)", >+ org.eclipse.ui.forms > Eclipse-AutoStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > Export-Package: org.eclipse.mylar.internal.jira, >Index: src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditorFactory.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditorFactory.java >diff -N src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditorFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditorFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+package org.eclipse.mylar.internal.jira.ui; >+ >+import org.eclipse.mylar.internal.jira.JiraTask; >+import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory; >+import org.eclipse.mylar.internal.tasklist.ui.editors.MylarTaskEditor; >+import org.eclipse.mylar.provisional.tasklist.ITask; >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.IEditorPart; >+ >+public class JiraTaskEditorFactory implements ITaskEditorFactory { >+ >+ public JiraTaskEditorFactory() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory#canCreateEditorFor(org.eclipse.mylar.provisional.tasklist.ITask) >+ */ >+ public boolean canCreateEditorFor(ITask task) { >+ return task instanceof JiraTask; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory#createEditor(org.eclipse.mylar.internal.tasklist.ui.editors.MylarTaskEditor) >+ */ >+ public IEditorPart createEditor(MylarTaskEditor parentEditor) { >+ return new JiraTaskEditor(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory#createEditorInput(org.eclipse.mylar.provisional.tasklist.ITask) >+ */ >+ public IEditorInput createEditorInput(ITask task) { >+ return new JiraIssueEditorInput((JiraTask) task); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory#getTitle() >+ */ >+ public String getTitle() { >+ return "Jira"; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory#notifyEditorActivationChange(org.eclipse.ui.IEditorPart) >+ */ >+ public void notifyEditorActivationChange(IEditorPart editor) { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory#providesOutline() >+ */ >+ public boolean providesOutline() { >+ return true; >+ } >+ >+} >Index: icons/obj16/comment.gif >=================================================================== >RCS file: icons/obj16/comment.gif >diff -N icons/obj16/comment.gif >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ icons/obj16/comment.gif 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+GIF89a³3Åääå{»åÌÌÌ»»»xxxäÿÿ¯¯®¨ÔÿöööÜÝÜÿÿÿÿñÜÆÅÅÿÿÿ!ù,_ðdªB GhL(2Â!x[lKI)t`ßíÿ >+`èÑÈ$ÒWñ-Ð'Ó¨Àᦾv«enh.Wmã Åò«lðøj@ÈïsZïíùrvx; >Index: src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditor.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditor.java >diff -N src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/jira/ui/JiraTaskEditor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,429 @@ >+package org.eclipse.mylar.internal.jira.ui; >+ >+import java.text.DateFormat; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.jface.layout.GridDataFactory; >+import org.eclipse.jface.resource.JFaceResources; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.mylar.internal.jira.JiraServerFacade; >+import org.eclipse.mylar.internal.jira.JiraTask; >+import org.eclipse.mylar.internal.jira.MylarJiraPlugin; >+import org.eclipse.mylar.internal.tasklist.ui.editors.MylarTaskEditor; >+import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask; >+import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin; >+import org.eclipse.mylar.provisional.tasklist.TaskRepository; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.CLabel; >+import org.eclipse.swt.custom.ScrolledComposite; >+import org.eclipse.swt.events.ControlAdapter; >+import org.eclipse.swt.events.ControlEvent; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.graphics.Point; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Link; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.IEditorSite; >+import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.forms.events.ExpansionAdapter; >+import org.eclipse.ui.forms.events.ExpansionEvent; >+import org.eclipse.ui.forms.events.IExpansionListener; >+import org.eclipse.ui.forms.widgets.ExpandableComposite; >+import org.eclipse.ui.forms.widgets.Form; >+import org.eclipse.ui.forms.widgets.FormToolkit; >+import org.eclipse.ui.forms.widgets.ImageHyperlink; >+import org.eclipse.ui.forms.widgets.ScrolledForm; >+import org.eclipse.ui.forms.widgets.Section; >+import org.eclipse.ui.internal.forms.widgets.FormUtil; >+import org.eclipse.ui.part.EditorPart; >+import org.eclipse.ui.views.contentoutline.IContentOutlinePage; >+import org.tigris.jira.core.model.Comment; >+import org.tigris.jira.core.model.Issue; >+import org.tigris.jira.core.model.Status; >+import org.tigris.jira.core.service.JiraServer; >+ >+/** >+ * @author Brock Janiczak >+ */ >+public class JiraTaskEditor extends EditorPart { >+ >+ private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); >+ >+ private JiraIssueEditorInput input; >+ private Text comment; >+ private boolean isDirty = false; >+ private Image commentImage; >+ private Font commentFont; >+ >+ private Map commentToControlMap = new HashMap(); >+ >+ private JiraServer server; >+ private Issue issue; >+ >+ private ScrolledComposite sc; >+ >+ private Section commentsSection; >+ >+ /** >+ * >+ */ >+ public JiraTaskEditor() { >+// commentImage = MylarJiraPlugin.getImageDescriptor("icons/ctool16/comment.gif").createImage(); >+// commentFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void doSave(IProgressMonitor monitor) { >+ server.addCommentToIssue(issue, comment.getText()); >+ comment.setText(""); >+ isDirty = false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.EditorPart#doSaveAs() >+ */ >+ public void doSaveAs() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) >+ */ >+ public void init(IEditorSite site, IEditorInput input) throws PartInitException { >+ this.input = (JiraIssueEditorInput)input; >+ setSite(site); >+ setInput(input); >+ setPartName(this.input.getName()); >+ JiraTask task = this.input.getTask(); >+ TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(task.getRepositoryKind(), task.getRepositoryUrl()); >+ server = JiraServerFacade.getDefault().getJiraServer(repository); >+ issue = server.getIssue(task.getKey()); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.EditorPart#isDirty() >+ */ >+ public boolean isDirty() { >+ int charCount = comment.getCharCount(); >+ isDirty = charCount > 0; >+ return isDirty; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() >+ */ >+ public boolean isSaveAsAllowed() { >+ return false; >+ } >+ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createPartControl(Composite parent) { >+ FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay()); >+ >+ Form form = toolkit.createForm(parent); >+ form.setText(issue.getKey() + ": " + issue.getSummary()); >+ >+ GridLayout formLayout = new GridLayout(1, true); >+ >+ final Composite formBody = form.getBody(); >+ formBody.setLayout(formLayout); >+ >+ Section summarySection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); >+ summarySection.setText("Summary"); >+ summarySection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); >+ >+ Composite summary = toolkit.createComposite(summarySection); >+ summary.setLayout(new GridLayout(6, false)); >+ >+ Label lblCreated = toolkit.createLabel(summary, "Created:"); >+ lblCreated.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label created = toolkit.createLabel(summary, DATE_FORMAT.format(issue.getCreated())); >+ >+ Label lblUpdated = toolkit.createLabel(summary, "Updated:"); >+ lblUpdated.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label updated = toolkit.createLabel(summary, DATE_FORMAT.format(issue.getUpdated())); >+ >+ if (issue.getDue() != null) { >+ Label lblDue= toolkit.createLabel(summary, "Due:"); >+ lblDue.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label due= toolkit.createLabel(summary, DATE_FORMAT.format(issue.getDue())); >+ } else { >+ Label spacer = toolkit.createLabel(summary, ""); >+ spacer.setLayoutData(GridDataFactory.fillDefaults().span(2,1).create()); >+ } >+ >+ >+ Label lblStatus = toolkit.createLabel(summary, "Status:"); >+ lblStatus.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label status = toolkit.createLabel(summary, issue.getStatus().getName()); >+ >+ Label lblResolution = toolkit.createLabel(summary, "Resolution:"); >+ lblResolution.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ if (issue.getResolution() != null) { >+ Label resolution = toolkit.createLabel(summary, issue.getResolution().getName()); >+ resolution.setToolTipText(issue.getResolution().getDescription()); >+ } else { >+ Label resolution = toolkit.createLabel(summary, "Unresolved"); >+ } >+ >+ Label lblPriority = toolkit.createLabel(summary, "Priority:"); >+ lblPriority.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ if (issue.getPriority() != null) { >+ Label priority = toolkit.createLabel(summary, issue.getPriority().getName()); >+ priority.setToolTipText(issue.getPriority().getDescription()); >+ } else { >+ Label priority = toolkit.createLabel(summary, "No Priority"); >+ } >+ >+ Label lblReporter = toolkit.createLabel(summary, "Reporter:"); >+ lblReporter.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label reporter = toolkit.createLabel(summary, issue.getReporter()); >+ >+ Label lblAssignee = toolkit.createLabel(summary, "Assignee"); >+ lblAssignee.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label assignee = toolkit.createLabel(summary, issue.getAssignee()); >+ >+ // spacer >+ Label spacer2 = toolkit.createLabel(summary, ""); >+ spacer2.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create()); >+ >+ StringBuffer sbComponents = new StringBuffer(); >+ if (issue.getComponents().length > 0) { >+ for (int i = 0; i < issue.getComponents().length; i++) { >+ if (i != 0) { >+ sbComponents.append(", "); >+ } >+ >+ sbComponents.append(issue.getComponents()[i].getName()); >+ } >+ } else { >+ sbComponents.append("None"); >+ } >+ >+ Label lblComponents = toolkit.createLabel(summary, "Components"); >+ lblComponents.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label components = toolkit.createLabel(summary, sbComponents.toString()); >+ >+ >+ StringBuffer sbAffectsVersions = new StringBuffer(); >+ if (issue.getReportedVersions().length > 0) { >+ for (int i = 0; i < issue.getReportedVersions().length; i++) { >+ if (i != 0) { >+ sbAffectsVersions.append(", "); >+ } >+ >+ sbAffectsVersions.append(issue.getReportedVersions()[i].getName()); >+ } >+ } else { >+ sbAffectsVersions.append("None"); >+ } >+ >+ Label lblAffectsVersion = toolkit.createLabel(summary, "Affects Versions"); >+ lblAffectsVersion.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label affectsVersions = toolkit.createLabel(summary, sbAffectsVersions.toString()); >+ >+ >+ StringBuffer sbFixVersions = new StringBuffer(); >+ if (issue.getFixVersions().length > 0) { >+ for (int i = 0; i < issue.getFixVersions().length; i++) { >+ if (i != 0) { >+ sbFixVersions.append(", "); >+ } >+ >+ sbFixVersions.append(issue.getFixVersions()[i].getName()); >+ } >+ } else { >+ sbFixVersions.append("None"); >+ } >+ >+ Label lblFixVersions = toolkit.createLabel(summary, "Fix Versions"); >+ lblFixVersions.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); >+ Label fixVersions = toolkit.createLabel(summary, sbFixVersions.toString()); >+ >+ summarySection.setClient(summary); >+ >+ // created, updated, due (optional) >+ >+ final Section descriptionSection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); >+ descriptionSection.setExpanded(true); >+ descriptionSection.setText("Description"); >+ final GridData dgd = GridDataFactory.fillDefaults().grab(true, false).create(); >+ descriptionSection.setLayoutData(dgd); >+ >+ Composite c = toolkit.createComposite(descriptionSection); >+ GridLayout gl = new GridLayout(1, true); >+ gl.marginHeight = 0; >+ gl.marginWidth = 0; >+ c.setLayout(gl); >+ >+ Text description = toolkit.createText(c, issue.getDescription(), SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); >+ description.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).minSize(200, 80).hint(200, 80).create()); >+ >+ description.setText(issue.getDescription()); >+ description.setEditable(false); >+ description.setFont(JFaceResources.getTextFont()); >+ descriptionSection.setClient(c); >+ >+ commentsSection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); >+ commentsSection.setExpanded(true); >+ ImageHyperlink sortOrder = toolkit.createImageHyperlink(commentsSection, SWT.NONE); >+ sortOrder.setText("Direction"); >+ >+ commentsSection.setTextClient(sortOrder); >+ commentsSection.setText("Comments"); >+ commentsSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); >+ >+ sc = new ScrolledComposite(commentsSection, SWT.H_SCROLL | SWT.V_SCROLL); >+ sc.setExpandHorizontal(true); >+ sc.setExpandVertical(true); >+ >+ sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ final Composite c1 = toolkit.createComposite(sc); >+ GridLayout commentsLayout = new GridLayout(1, true); >+ commentsLayout.marginWidth = 0; >+ commentsLayout.marginHeight = 0; >+ >+ c1.setLayout(commentsLayout); >+ >+ for (int i = 0; i < issue.getComments().length; i++) { >+ Comment comment = issue.getComments()[i]; >+ >+ ExpandableComposite expandableComposite = toolkit.createExpandableComposite(c1, ExpandableComposite.TREE_NODE); >+ expandableComposite.setText("Comment by " + comment.getAuthor() + " [" + DATE_FORMAT.format(comment.getCreated()) + "]"); >+ expandableComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); >+ expandableComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); >+ >+ Text t = toolkit.createText(expandableComposite, comment.getComment(), SWT.MULTI | SWT.WRAP); >+ t.setEditable(false); >+ t.setFont(JFaceResources.getTextFont()); >+ >+ expandableComposite.setClient(t); >+ expandableComposite.addExpansionListener(new ExpansionAdapter() { >+ >+ @Override >+ public void expansionStateChanged(ExpansionEvent e) { >+ sc.layout(true, true); >+ } >+ >+ }); >+ commentToControlMap.put(comment, expandableComposite); >+ >+ t.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); >+ >+ if (i == issue.getComments().length - 1) { >+ expandableComposite.setExpanded(true); >+ } >+ >+ } >+ >+ commentsSection.setClient(sc); >+ >+ sc.addControlListener(new ControlAdapter() { >+ >+ public void controlResized(ControlEvent e) { >+ Point size = c1.computeSize(sc.getClientArea().width, SWT.DEFAULT); >+ sc.setMinSize(size); >+ } >+ >+ }); >+ >+ final Section commentSection = toolkit.createSection(formBody, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); >+ commentSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); >+ commentSection.setText("Add Comment"); >+ commentSection.setExpanded(false); >+ commentSection.addExpansionListener(new ExpansionAdapter() { >+ >+ public void expansionStateChanged(ExpansionEvent e) { >+ formBody.layout(true); >+ } >+ }); >+ >+ final Composite commentArea = toolkit.createComposite(commentSection); >+ GridLayout commentAreaLayout = new GridLayout(1, false); >+ commentAreaLayout.marginHeight = 0; >+ commentAreaLayout.marginWidth = 0; >+ commentAreaLayout.verticalSpacing = 0; >+ commentAreaLayout.horizontalSpacing = 0; >+ commentArea.setLayout(commentAreaLayout); >+ >+ commentSection.setClient(commentArea); >+ >+ comment = new Text(commentArea, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); >+ comment.setFont(JFaceResources.getTextFont()); >+ final GridData commentGd = new GridData(SWT.FILL, SWT.FILL, true, false); >+ commentGd.heightHint = 80; >+ comment.setLayoutData(commentGd); >+ >+ comment.addModifyListener(new ModifyListener() { >+ >+ public void modifyText(ModifyEvent e) { >+ int charCount = comment.getCharCount(); >+ if ((isDirty && charCount == 0) || (!isDirty && charCount > 0)) { >+ firePropertyChange(PROP_DIRTY); >+ } >+ } >+ >+ }); >+ sc.setContent(c1); >+ sc.setMinSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT)); >+ } >+ >+ public void revealComment(Comment comment) { >+ Control control = (Control) this.commentToControlMap.get(comment); >+ if (control != null) { >+ commentsSection.setExpanded(true); >+ ((ExpandableComposite)control).setExpanded(true); >+ // XXX Clone or create a new version of this >+ FormUtil.ensureVisible(sc, control); >+ sc.layout(true, true); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus() >+ */ >+ public void setFocus() { >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.WorkbenchPart#dispose() >+ */ >+ public void dispose() { >+ super.dispose(); >+// commentImage.dispose(); >+ >+ // Don't dispose JFace resources >+// commentFont.dispose(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class) >+ */ >+ public Object getAdapter(Class adapter) { >+ if (IContentOutlinePage.class.equals(adapter)) { >+ return new JiraIssueContentOutlinePage(this, this.issue); >+ } >+ >+ return super.getAdapter(adapter); >+ } >+ >+} >Index: src/org/eclipse/mylar/internal/jira/ui/JiraIssueContentOutlinePage.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/jira/ui/JiraIssueContentOutlinePage.java >diff -N src/org/eclipse/mylar/internal/jira/ui/JiraIssueContentOutlinePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/jira/ui/JiraIssueContentOutlinePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,136 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 Jira Dashboard project. >+ * 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: >+ * Brock Janiczak - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.mylar.internal.jira.ui; >+ >+import java.text.DateFormat; >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.List; >+ >+import org.eclipse.jface.viewers.IOpenListener; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.ITreeContentProvider; >+import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.jface.viewers.OpenEvent; >+import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.mylar.internal.jira.MylarJiraPlugin; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.views.contentoutline.ContentOutlinePage; >+import org.tigris.jira.core.model.Comment; >+import org.tigris.jira.core.model.Issue; >+ >+/** >+ * @author Brock Janiczak >+ */ >+public class JiraIssueContentOutlinePage extends ContentOutlinePage { >+ >+ private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); >+ >+ private final Issue issue; >+ >+ private Image commentImage; >+ private Image jiraImage; >+ >+ private final JiraTaskEditor editor; >+ >+ public JiraIssueContentOutlinePage(Issue issue) { >+ this(null, issue); >+ } >+ >+ public JiraIssueContentOutlinePage(JiraTaskEditor editor, Issue issue) { >+ this.editor = editor; >+ this.issue = issue; >+ commentImage = MylarJiraPlugin.getDefault().getImageRegistry().get("icons/obj16/comment.gif"); >+ jiraImage = MylarJiraPlugin.getDefault().getImageRegistry().get("icons/obj16/jira.png"); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.views.contentoutline.ContentOutlinePage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ super.createControl(parent); >+ >+ TreeViewer treeViewer = getTreeViewer(); >+ >+ treeViewer.setContentProvider(new ITreeContentProvider() { >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public void dispose() { >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ List elements = new ArrayList(); >+ elements.add(issue.getSummary()); >+ elements.addAll(Arrays.asList(issue.getComments())); >+ >+ // root elements are summary, environment, description and "comments" >+ >+ return elements.toArray(); >+ } >+ >+ public boolean hasChildren(Object element) { >+ // "comments" has children >+ return false; >+ } >+ >+ public Object getParent(Object element) { >+ return null; >+ } >+ >+ public Object[] getChildren(Object parentElement) { >+ // Get all of the comments from the comment list >+ return new Object[0]; >+ } >+ >+ }); >+ treeViewer.setLabelProvider(new LabelProvider() { >+ >+ public String getText(Object element) { >+ if (element instanceof Comment) { >+ Comment comment = (Comment)element; >+ return DATE_FORMAT.format(comment.getCreated()) + " " + comment.getAuthor(); >+ } >+ return super.getText(element); >+ } >+ >+ public Image getImage(Object element) { >+ if (element instanceof Comment) { >+ return commentImage; >+ } else { >+ // TODO the summary should be a placeholder object >+ return jiraImage; >+ } >+ } >+ >+ }); >+ >+ treeViewer.addOpenListener(new IOpenListener() { >+ >+ public void open(OpenEvent event) { >+ if (editor == null) { >+ return; >+ } >+ >+ Object selection = ((IStructuredSelection)event.getSelection()).getFirstElement(); >+ if (selection instanceof Comment) { >+ editor.revealComment((Comment)selection); >+ } >+ } >+ >+ }); >+ treeViewer.setInput(issue); >+ } >+ >+} >Index: src/org/eclipse/mylar/internal/jira/ui/JiraIssueEditorInput.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/jira/ui/JiraIssueEditorInput.java >diff -N src/org/eclipse/mylar/internal/jira/ui/JiraIssueEditorInput.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/jira/ui/JiraIssueEditorInput.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 Jira Dashboard project. >+ * 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: >+ * Brock Janiczak - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.mylar.internal.jira.ui; >+ >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.mylar.internal.jira.JiraTask; >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.IPersistableElement; >+ >+public class JiraIssueEditorInput implements IEditorInput { >+ >+ private final JiraTask task; >+ >+ public JiraIssueEditorInput(JiraTask task) { >+ this.task = task; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IEditorInput#exists() >+ */ >+ public boolean exists() { >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor() >+ */ >+ public ImageDescriptor getImageDescriptor() { >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IEditorInput#getName() >+ */ >+ public String getName() { >+ return task.getHandleIdentifier(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IEditorInput#getPersistable() >+ */ >+ public IPersistableElement getPersistable() { >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IEditorInput#getToolTipText() >+ */ >+ public String getToolTipText() { >+ return task.getDescription(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) >+ */ >+ public Object getAdapter(Class adapter) { >+ return Platform.getAdapterManager().getAdapter(this, adapter); >+ } >+ >+ /* (non-Javadoc) >+ * @see java.lang.Object#equals(java.lang.Object) >+ */ >+ @Override >+ public boolean equals(Object obj) { >+ if (!(obj instanceof JiraIssueEditorInput)) { >+ return false; >+ } >+ >+ JiraIssueEditorInput that = (JiraIssueEditorInput) obj; >+ return (this.task.getHandleIdentifier().equals(that.task.getHandleIdentifier()) && >+ this.task.getRepositoryUrl().equals(that.task.getRepositoryUrl())); >+ } >+ >+ /* (non-Javadoc) >+ * @see java.lang.Object#hashCode() >+ */ >+ @Override >+ public int hashCode() { >+ return this.task.getHandleIdentifier().hashCode() + this.task.getRepositoryUrl().hashCode(); >+ } >+ >+ /** >+ * @return the task >+ */ >+ public JiraTask getTask() { >+ return this.task; >+ } >+ >+} >Index: icons/obj16/jira.png >=================================================================== >RCS file: icons/obj16/jira.png >diff -N icons/obj16/jira.png >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ icons/obj16/jira.png 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+PNG >+ >+ >+IHDR(-SsBITÛáOà<PLTE3fßåìp?©@f¿ÌÙ@pÿÿÿ²Å_!Mz?¦¼ïòõÏÙâ0YPs¯¿Ï²ÐÙãï÷÷` 0Sè´ pHYsÒÝ~ü tEXtSoftwareMacromedia Fireworks MX»*$tEXtCreation Time09/22/04\áýA?IDATxM? C;"QÂýïúÇäGA¶¬Ð¥)éÛÁÎyðì:_ èdÎdJáP#jã¢VÁân÷íÞÅ<ZH È,)´aÚô6û³F¬Æì®ø6IäX?ÊH,`+û,Ŷ?$p©^ãü >+½ IEND®B`
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 133764
:
38655
|
41397
| 41432 |
42096
|
42132