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 46993 Details for
Bug 148903
add option to submit context with bug report
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]
Attach context from editor
editor-attach-context.txt (text/plain), 18.18 KB, created by
Jeff Pound
on 2006-07-28 19:35:01 EDT
(
hide
)
Description:
Attach context from editor
Filename:
MIME Type:
Creator:
Jeff Pound
Created:
2006-07-28 19:35:01 EDT
Size:
18.18 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.tasks.ui >Index: src/org/eclipse/mylar/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.ui/src/org/eclipse/mylar/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java,v >retrieving revision 1.12 >diff -u -r1.12 AbstractRepositoryTaskEditor.java >--- src/org/eclipse/mylar/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java 28 Jul 2006 18:58:01 -0000 1.12 >+++ src/org/eclipse/mylar/internal/tasks/ui/editors/AbstractRepositoryTaskEditor.java 28 Jul 2006 23:35:11 -0000 >@@ -122,6 +122,7 @@ > /** > * @author Mik Kersten > * @author Rob Elves >+ * @author Jeff Pound (Attachment work) > */ > public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { > >@@ -314,8 +315,8 @@ > > } > >- private static final class AttachmentTableLabelProvider extends DecoratingLabelProvider implements ITableColorProvider, >- ITableLabelProvider { >+ private static final class AttachmentTableLabelProvider extends DecoratingLabelProvider implements >+ ITableColorProvider, ITableLabelProvider { > > public AttachmentTableLabelProvider(ILabelProvider provider, ILabelDecorator decorator) { > super(provider, decorator); >@@ -437,18 +438,17 @@ > return addCommentsTextBox.getText(); > } > >-// /** >-// * @return Any currently selected text. >-// */ >-// protected StyledText getCurrentText() { >-// return currentSelectedText; >-// } >+ // /** >+ // * @return Any currently selected text. >+ // */ >+ // protected StyledText getCurrentText() { >+ // return currentSelectedText; >+ // } > >- > protected void createFormContent(final IManagedForm managedForm) { > super.createFormContent(managedForm); > form = managedForm.getForm(); >- toolkit = managedForm.getToolkit(); >+ toolkit = managedForm.getToolkit(); > if (getRepositoryTaskData() == null) { > Composite composite = new Composite(form.getBody(), SWT.NULL); > composite.setLayout(new GridLayout()); >@@ -461,7 +461,7 @@ > editorComposite = form.getBody(); > editorComposite.setLayout(new GridLayout()); > editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); >- ///createContextMenu(editorComposite); >+ // /createContextMenu(editorComposite); > > createReportHeaderLayout(editorComposite); > Composite attribComp = createAttributeLayout(editorComposite); >@@ -477,40 +477,42 @@ > getSite().getPage().addSelectionListener(selectionListener); > getSite().setSelectionProvider(selectionProvider); > } >- >-// @Override >-// public void createPartControl(Composite parent) { >-// if (getRepositoryTaskData() == null) { >-// Composite composite = new Composite(parent, SWT.NULL); >-// composite.setLayout(new GridLayout()); >-// Label noBugLabel = new Label(composite, SWT.NULL); >-// noBugLabel.setText("Could not download task data, possibly due to timeout or connectivity problem.\n" >-// + "Please check connection and try again."); >-// return; >-// } >-// >-// toolkit = new FormToolkit(parent.getDisplay()); >-// form = toolkit.createScrolledForm(parent); >-// >-// editorComposite = form.getBody(); >-// editorComposite.setLayout(new GridLayout()); >-// editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); >-// createContextMenu(editorComposite); >-// >-// createReportHeaderLayout(editorComposite); >-// Composite attribComp = createAttributeLayout(editorComposite); >-// createCustomAttributeLayout(attribComp); >-// createDescriptionLayout(editorComposite); >-// createAttachmentLayout(editorComposite); >-// createCommentLayout(editorComposite, form); >-// createActionsLayout(editorComposite); >-// >-// // editorComposite.setMenu(contextMenuManager.createContextMenu(editorComposite)); >-// >-// form.reflow(true); >-// getSite().getPage().addSelectionListener(selectionListener); >-// getSite().setSelectionProvider(selectionProvider); >-// } >+ >+ // @Override >+ // public void createPartControl(Composite parent) { >+ // if (getRepositoryTaskData() == null) { >+ // Composite composite = new Composite(parent, SWT.NULL); >+ // composite.setLayout(new GridLayout()); >+ // Label noBugLabel = new Label(composite, SWT.NULL); >+ // noBugLabel.setText("Could not download task data, possibly due to timeout >+ // or connectivity problem.\n" >+ // + "Please check connection and try again."); >+ // return; >+ // } >+ // >+ // toolkit = new FormToolkit(parent.getDisplay()); >+ // form = toolkit.createScrolledForm(parent); >+ // >+ // editorComposite = form.getBody(); >+ // editorComposite.setLayout(new GridLayout()); >+ // editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ // createContextMenu(editorComposite); >+ // >+ // createReportHeaderLayout(editorComposite); >+ // Composite attribComp = createAttributeLayout(editorComposite); >+ // createCustomAttributeLayout(attribComp); >+ // createDescriptionLayout(editorComposite); >+ // createAttachmentLayout(editorComposite); >+ // createCommentLayout(editorComposite, form); >+ // createActionsLayout(editorComposite); >+ // >+ // // >+ // editorComposite.setMenu(contextMenuManager.createContextMenu(editorComposite)); >+ // >+ // form.reflow(true); >+ // getSite().getPage().addSelectionListener(selectionListener); >+ // getSite().setSelectionProvider(selectionProvider); >+ // } > > /** > * By default puts task number, date opened and date modified in header >@@ -656,36 +658,37 @@ > > public abstract void createCustomAttributeLayout(); > >-// protected void createContextMenu(final Composite comp) { >-// contextMenuManager = new MenuManager(CONTEXT_MENU_ID); >-// contextMenuManager.setRemoveAllWhenShown(true); >-// contextMenuManager.addMenuListener(new IMenuListener() { >-// public void menuAboutToShow(IMenuManager manager) { >-// manager.add(cutAction); >-// manager.add(copyAction); >-// manager.add(pasteAction); >-//// Clipboard clipboard = new Clipboard(comp.getDisplay()); >-//// TextTransfer textTransfer = TextTransfer.getInstance(); >-//// String textData = (String) clipboard.getContents(textTransfer); >-//// if (textData != null) { >-//// pasteAction.setEnabled(true); >-//// } else { >-//// pasteAction.setEnabled(false); >-//// } >-// >-// if (currentSelectedText == null || currentSelectedText.getSelectionText().length() == 0) { >-// copyAction.setEnabled(false); >-// } else { >-// copyAction.setEnabled(true); >-// } >-// // manager.add(revealAllAction); >-// manager.add(new Separator()); >-// manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); >-// } >-// }); >-// // getSite().registerContextMenu(CONTEXT_MENU_ID, contextMenuManager, >-// // getSite().getSelectionProvider()); >-// } >+ // protected void createContextMenu(final Composite comp) { >+ // contextMenuManager = new MenuManager(CONTEXT_MENU_ID); >+ // contextMenuManager.setRemoveAllWhenShown(true); >+ // contextMenuManager.addMenuListener(new IMenuListener() { >+ // public void menuAboutToShow(IMenuManager manager) { >+ // manager.add(cutAction); >+ // manager.add(copyAction); >+ // manager.add(pasteAction); >+ // // Clipboard clipboard = new Clipboard(comp.getDisplay()); >+ // // TextTransfer textTransfer = TextTransfer.getInstance(); >+ // // String textData = (String) clipboard.getContents(textTransfer); >+ // // if (textData != null) { >+ // // pasteAction.setEnabled(true); >+ // // } else { >+ // // pasteAction.setEnabled(false); >+ // // } >+ // >+ // if (currentSelectedText == null || >+ // currentSelectedText.getSelectionText().length() == 0) { >+ // copyAction.setEnabled(false); >+ // } else { >+ // copyAction.setEnabled(true); >+ // } >+ // // manager.add(revealAllAction); >+ // manager.add(new Separator()); >+ // manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); >+ // } >+ // }); >+ // // getSite().registerContextMenu(CONTEXT_MENU_ID, contextMenuManager, >+ // // getSite().getSelectionProvider()); >+ // } > > /** > * Adds a text field to display and edit the bug's summary. >@@ -928,6 +931,7 @@ > final LocalAttachment att = naw.getAttachment(); > att.setReport(getRepositoryTaskData()); > getRepositoryTaskData().setNewAttachment(att); >+ setAttachContext(att.isPatch()); > > // TODO: Add row to table > // RepositoryTaskData data = getRepositoryTaskData(); >@@ -1006,8 +1010,8 @@ > GridData sectionCompositeData = new GridData(GridData.FILL_HORIZONTAL); > sectionComposite.setLayoutData(sectionCompositeData); > >- TextViewer viewer = addRepositoryTextViewer(repository, sectionComposite, getRepositoryTaskData().getDescription(), >- SWT.MULTI | SWT.WRAP); >+ TextViewer viewer = addRepositoryTextViewer(repository, sectionComposite, getRepositoryTaskData() >+ .getDescription(), SWT.MULTI | SWT.WRAP); > final StyledText styledText = viewer.getTextWidget(); > styledText.addListener(SWT.FocusIn, new DescriptionListener()); > styledText.setLayout(new GridLayout()); >@@ -1103,7 +1107,8 @@ > ecComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > expandableComposite.setClient(ecComposite); > >- TextViewer viewer = addRepositoryTextViewer(repository, ecComposite, taskComment.getText(), SWT.MULTI | SWT.WRAP); >+ TextViewer viewer = addRepositoryTextViewer(repository, ecComposite, taskComment.getText(), SWT.MULTI >+ | SWT.WRAP); > styledText = viewer.getTextWidget(); > GridDataFactory.fillDefaults().hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(styledText); > >@@ -1250,7 +1255,6 @@ > */ > protected abstract String getTitleString(); > >- > /** > * This refreshes the text in the title label of the info area (it contains > * elements which can change). >@@ -1366,23 +1370,24 @@ > form.setFocus(); > } > >-// /** >-// * Updates the dirty status of this editor page. The dirty status is true if >-// * the bug report has been modified but not saved. The title of the editor >-// * is also updated to reflect the status. >-// * >-// * @param newDirtyStatus >-// * is true when the bug report has been modified but not saved >-// */ >-// public void changeDirtyStatus(boolean newDirtyStatus) { >-// isDirty = newDirtyStatus; >-//// if (parentEditor == null) { >-//// firePropertyChange(PROP_DIRTY); >-//// } else { >-//// parentEditor.markDirty(); >-//// } >-// getManagedForm().dirtyStateChanged(); >-// } >+ // /** >+ // * Updates the dirty status of this editor page. The dirty status is true >+ // if >+ // * the bug report has been modified but not saved. The title of the editor >+ // * is also updated to reflect the status. >+ // * >+ // * @param newDirtyStatus >+ // * is true when the bug report has been modified but not saved >+ // */ >+ // public void changeDirtyStatus(boolean newDirtyStatus) { >+ // isDirty = newDirtyStatus; >+ // // if (parentEditor == null) { >+ // // firePropertyChange(PROP_DIRTY); >+ // // } else { >+ // // parentEditor.markDirty(); >+ // // } >+ // getManagedForm().dirtyStateChanged(); >+ // } > > /** > * Updates the title of the editor to reflect dirty status. If the bug >@@ -1511,7 +1516,7 @@ > > protected StyledText addCommentsTextBox = null; > >-// protected Text descriptionTextBox = null; >+ // protected Text descriptionTextBox = null; > protected TextViewer newDescriptionTextViewer = null; > > // private FormText previousText = null; >@@ -1662,6 +1667,17 @@ > return isDisposed; > } > >+ // The implementation of the attach context UI is connector dependant. >+ protected boolean getAttachContext() { >+ return false; >+ } >+ >+ // The implementation of the attach context UI is connector dependant. >+ // this method is called when a user attaches a patch to the task >+ protected void setAttachContext(boolean attachContext) { >+ >+ } >+ > public void close() { > Display activeDisplay = getSite().getShell().getDisplay(); > activeDisplay.asyncExec(new Runnable() { >@@ -1720,7 +1736,7 @@ > public void setDescriptionText(String text) { > this.newDescriptionTextViewer.setDocument(new Document(text)); > } >- >+ > // private class DisplayableLocalAttachment extends RepositoryAttachment { > // private static final long serialVersionUID = 900218036143022422L; > // >#P org.eclipse.mylar.bugzilla.ui >Index: src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.bugzilla.ui/src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java,v >retrieving revision 1.80 >diff -u -r1.80 ExistingBugEditor.java >--- src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java 28 Jul 2006 18:57:53 -0000 1.80 >+++ src/org/eclipse/mylar/internal/bugzilla/ui/editor/ExistingBugEditor.java 28 Jul 2006 23:35:14 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.mylar.internal.bugzilla.ui.editor; > >+import java.io.File; > import java.io.IOException; > import java.io.UnsupportedEncodingException; > import java.text.SimpleDateFormat; >@@ -29,6 +30,7 @@ > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.mylar.context.core.ContextCorePlugin; > import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin; > import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement; > import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportSubmitForm; >@@ -42,6 +44,8 @@ > import org.eclipse.mylar.internal.tasks.ui.editors.RepositoryTaskSelection; > import org.eclipse.mylar.internal.tasks.ui.views.DatePicker; > import org.eclipse.mylar.internal.tasks.ui.views.TaskRepositoriesView; >+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; >+import org.eclipse.mylar.tasks.core.ITask; > import org.eclipse.mylar.tasks.core.RepositoryOperation; > import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute; > import org.eclipse.mylar.tasks.core.RepositoryTaskData; >@@ -78,6 +82,7 @@ > * > * @author Mik Kersten (hardening of prototype) > * @author Rob Elves (adaption to Eclipse Forms) >+ * @authos Jeff Pound (Attachment work) > */ > public class ExistingBugEditor extends AbstractRepositoryTaskEditor { > >@@ -97,6 +102,8 @@ > > protected Control[] radioOptions; > >+ protected Button attachContextButton; >+ > protected List keyWordsList; > > protected Text keywordsText; >@@ -136,14 +143,15 @@ > // config.setLeftLabel("Local Bug Report"); > // config.setRightLabel("Remote Bug Report"); > // config.setLeftImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT)); >- // config.setRightImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT)); >+ // config.setRightImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT)); > // compareInput = new BugzillaCompareInput(config); > } > > @Override > public void init(IEditorSite site, IEditorInput input) { >- if (!(input instanceof ExistingBugEditorInput)) >- return;//MylarStatusHandler.log("Invalid Input: Must be ExistingBugEditorInput", this); >+ if (!(input instanceof ExistingBugEditorInput)) >+ return;// MylarStatusHandler.log("Invalid Input: Must be >+ // ExistingBugEditorInput", this); > > editorInput = (AbstractBugEditorInput) input; > taskData = editorInput.getRepositoryTaskData(); >@@ -163,6 +171,7 @@ > @Override > protected void addRadioButtons(Composite buttonComposite) { > addSelfToCC(buttonComposite); >+ addAttachContextButton(buttonComposite); > FormToolkit toolkit = new FormToolkit(buttonComposite.getDisplay()); > int i = 0; > Button selected = null; >@@ -254,6 +263,19 @@ > toolkit.paintBordersFor(buttonComposite); > } > >+ private void addAttachContextButton(Composite buttonComposite) { >+ ITask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask( >+ AbstractRepositoryTask.getHandle(repository.getUrl(), taskData.getId())); >+ File contextFile = ContextCorePlugin.getContextManager().getFileForContext(task.getHandleIdentifier()); >+ >+ FormToolkit toolkit = new FormToolkit(buttonComposite.getDisplay()); >+ attachContextButton = toolkit.createButton(buttonComposite, "Attach context to repository task", SWT.CHECK); >+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); >+ data.horizontalSpan = 4; >+ attachContextButton.setLayoutData(data); >+ attachContextButton.setEnabled(contextFile != null && contextFile.exists()); >+ } >+ > private void addSelfToCC(Composite composite) { > // if they aren't already on the cc list create an add self check box > FormToolkit toolkit = new FormToolkit(composite.getDisplay()); >@@ -262,7 +284,7 @@ > if (repository.getUserName() == null) { > return; > } >- >+ > if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { > return; > } >@@ -384,6 +406,18 @@ > public void run() { > if (event.getJob().getResult().getCode() == Status.OK > && event.getJob().getResult().getMessage() != null) {// >+ // Attach context >+ if (getAttachContext()) { >+ ITask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask( >+ AbstractRepositoryTask.getHandle(repository.getUrl(), taskData.getId())); >+ try { >+ bugzillaRepositoryClient.attachContext(repository, (AbstractRepositoryTask) task, >+ ""); >+ } catch (Exception e) { >+ // TODO >+ e.printStackTrace(); >+ } >+ } > close(); > return; > } else if (event.getJob().getResult().getCode() == Status.INFO) { >@@ -404,7 +438,6 @@ > }; > > bugzillaRepositoryClient.submitBugReport(bugzillaReportSubmitForm, submitJobListener); >- > } > > @Override >@@ -591,7 +624,7 @@ > } > > protected void addCCList(FormToolkit toolkit, String ccValue, Composite attributesComposite) { >- //newLayout(attributesComposite, 1, "Add CC:", PROPERTY); >+ // newLayout(attributesComposite, 1, "Add CC:", PROPERTY); > toolkit.createLabel(attributesComposite, "Add CC:"); > ccText = toolkit.createText(attributesComposite, ccValue); > ccText.setFont(TEXT_FONT); >@@ -956,6 +989,19 @@ > return editorInput.getRepositoryTaskData(); > } > >+ public boolean getAttachContext() { >+ if (attachContextButton == null) { >+ return false; >+ } >+ return attachContextButton.getSelection(); >+ } >+ >+ public void setAttachContext(boolean attachContext) { >+ if (attachContextButton != null && attachContextButton.isEnabled()) { >+ attachContextButton.setSelection(attachContext); >+ } >+ } >+ > // TODO used for spell checking. Add back when we want to support this > // protected Button checkSpellingButton; > //
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 148903
: 46993 |
46994
|
47078