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 80500 Details for
Bug 169426
create a new bug from a comment
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 with Action in popup menu and buttontoolbar
patch169426.txt (text/plain), 12.99 KB, created by
Frank Becker
on 2007-10-16 17:33:13 EDT
(
hide
)
Description:
Patch with Action in popup menu and buttontoolbar
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2007-10-16 17:33:13 EDT
Size:
12.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java,v >retrieving revision 1.236 >diff -u -r1.236 AbstractRepositoryTaskEditor.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 16 Oct 2007 18:57:22 -0000 1.236 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 16 Oct 2007 21:25:50 -0000 >@@ -78,6 +78,7 @@ > import org.eclipse.mylyn.internal.tasks.ui.actions.AttachScreenshotAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.CopyAttachmentToClipboardJob; > import org.eclipse.mylyn.internal.tasks.ui.actions.DownloadAttachmentJob; >+import org.eclipse.mylyn.internal.tasks.ui.actions.NewBugFromCommentAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.ToggleTaskActivationAction; > import org.eclipse.mylyn.internal.tasks.ui.editors.AttachmentTableLabelProvider; >@@ -126,6 +127,8 @@ > import org.eclipse.swt.dnd.FileTransfer; > import org.eclipse.swt.dnd.TextTransfer; > import org.eclipse.swt.dnd.Transfer; >+import org.eclipse.swt.events.FocusEvent; >+import org.eclipse.swt.events.FocusListener; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.events.SelectionAdapter; >@@ -300,6 +303,8 @@ > > private boolean ignoreLocationEvents = false; > >+ private static final String LABEL_NEW_BUG = "Create New Bug"; >+ > /** > * @author Raphael Ackermann (bug 195514) > */ >@@ -859,7 +864,7 @@ > protected Composite createAttributeSection() { > attributesSection = createSection(editorComposite, getSectionLabel(SECTION_NAME.ATTRIBTUES_SECTION)); > attributesSection.setExpanded(expandedStateAttributes || hasAttributeChanges); >- >+ > Composite toolbarComposite = toolkit.createComposite(attributesSection); > toolbarComposite.setBackground(null); > RowLayout rowLayout = new RowLayout(); >@@ -937,10 +942,10 @@ > attributesData.horizontalSpan = 1; > attributesData.grabExcessVerticalSpace = false; > attribComp.setLayoutData(attributesData); >- >+ > return attribComp; > } >- >+ > /** > * Creates the attribute section, which contains most of the basic attributes of the task (some of which are > * editable). >@@ -1507,8 +1512,7 @@ > Button attachFileButton = toolkit.createButton(attachmentControlsComposite, "Add File...", SWT.PUSH); > attachFileButton.setImage(WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE)); > >- Button attachScreenshotButton = toolkit.createButton(attachmentControlsComposite, "Add Screenshot...", >- SWT.PUSH); >+ Button attachScreenshotButton = toolkit.createButton(attachmentControlsComposite, "Add Screenshot...", SWT.PUSH); > attachScreenshotButton.setImage(TasksUiImages.getImage(TasksUiImages.IMAGE_CAPTURE)); > > final AbstractTask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(), >@@ -1715,6 +1719,25 @@ > return replyLink; > } > >+ public ImageHyperlink createNewBugHyperlink(Composite composite, final TaskComment taskComment) { >+ final ImageHyperlink newLink = new ImageHyperlink(composite, SWT.NULL); >+ toolkit.adapt(newLink, true, true); >+ newLink.setImage(TasksUiImages.getImage(TasksUiImages.TASK_NEW)); >+ newLink.setToolTipText(LABEL_NEW_BUG); >+ // no need for the background - transparency will take care of it >+ newLink.setBackground(null); >+ // replyLink.setBackground(section.getTitleBarGradientBackground()); >+ newLink.addHyperlinkListener(new HyperlinkAdapter() { >+ public void linkActivated(HyperlinkEvent e) { >+ NewBugFromCommentAction newBugFromCommentAction = new NewBugFromCommentAction(); >+ newBugFromCommentAction.setTaskComment(taskComment); >+ newBugFromCommentAction.setTaskData(taskData); >+ newBugFromCommentAction.run(); >+ } >+ }); >+ return newLink; >+ } >+ > protected void addDuplicateDetection(Composite composite) { > List<AbstractDuplicateDetector> allCollectors = new ArrayList<AbstractDuplicateDetector>(); > if (getDuplicateSearchCollectorsList() != null) { >@@ -1914,6 +1937,28 @@ > } > } > >+ protected TaskComment selectedTaskComment; >+ >+ protected class CommentFocusListener implements FocusListener { >+ private TaskComment taskComment; >+ >+ public CommentFocusListener(TaskComment taskComment) { >+ this.taskComment = taskComment; >+ } >+ >+ public void focusGained(FocusEvent e) { >+ selectedTaskComment = taskComment; >+ } >+ >+ public void focusLost(FocusEvent e) { >+ selectedTaskComment = null; >+ } >+ } >+ >+ public TaskComment getSelectedTaskComment() { >+ return selectedTaskComment; >+ } >+ > protected boolean supportsCommentDelete() { > return false; > } >@@ -2061,6 +2106,8 @@ > final ImageHyperlink replyLink = createReplyHyperlink(taskComment.getNumber(), toolbarButtonComp, > taskComment.getText()); > >+ final ImageHyperlink newLink = createNewBugHyperlink(toolbarButtonComp, taskComment); >+ > expandableComposite.addExpansionListener(new ExpansionAdapter() { > > @Override >@@ -2083,12 +2130,14 @@ > @Override > public void linkEntered(HyperlinkEvent e) { > replyLink.setUnderlined(true); >+ newLink.setUnderlined(true); > super.linkEntered(e); > } > > @Override > public void linkExited(HyperlinkEvent e) { > replyLink.setUnderlined(false); >+ newLink.setUnderlined(false); > super.linkExited(e); > } > }); >@@ -2125,6 +2174,7 @@ > // code for outline > commentStyleText.add(styledText); > controlBySelectableObject.put(taskComment, styledText); >+ styledText.addFocusListener(new CommentFocusListener(taskComment)); > > // if (supportsCommentDelete()) { > // Button deleteButton = toolkit.createButton(ecComposite, null, >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java,v >retrieving revision 1.35 >diff -u -r1.35 TaskEditorActionContributor.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java 9 Oct 2007 19:58:14 -0000 1.35 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java 16 Oct 2007 21:25:46 -0000 >@@ -32,6 +32,7 @@ > import org.eclipse.mylyn.internal.tasks.ui.actions.AbstractTaskEditorAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.AttachFileAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction; >+import org.eclipse.mylyn.internal.tasks.ui.actions.NewBugFromCommentAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.OpenWithBrowserAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.ShowInTaskListAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction; >@@ -96,6 +97,8 @@ > > private GlobalAction selectAllAction; > >+ private NewBugFromCommentAction newBugFromCommentAction = new NewBugFromCommentAction(); >+ > public TaskEditorActionContributor() { > > cutAction = new GlobalAction(ActionFactory.CUT.getId()); >@@ -162,8 +165,9 @@ > } > > public void contextMenuAboutToShow(IMenuManager manager, boolean addClipboard) { >- if (editor != null) >+ if (editor != null) { > updateSelectableActions(editor.getSelection()); >+ } > if (addClipboard) { > addClipboardActions(manager); > } >@@ -213,6 +217,20 @@ > manager.add(openWithBrowserAction); > manager.add(attachFileAction); > manager.add(synchronizeEditorAction); >+ if (this.getEditor().getActivePageInstance() instanceof AbstractRepositoryTaskEditor) { >+ AbstractRepositoryTaskEditor abstractRepositoryTaskEditor = (AbstractRepositoryTaskEditor) this.getEditor() >+ .getActivePageInstance(); >+ if (abstractRepositoryTaskEditor.getSelectedTaskComment() != null) { >+ System.out.println("Comment selected"); >+ newBugFromCommentAction.setTaskComment(abstractRepositoryTaskEditor.getSelectedTaskComment()); >+ IEditorInput input = abstractRepositoryTaskEditor.getEditorInput(); >+ if (input instanceof RepositoryTaskEditorInput) { >+ RepositoryTaskEditorInput repositoryInput = (RepositoryTaskEditorInput) input; >+ newBugFromCommentAction.setTaskData(repositoryInput.getTaskData()); >+ } >+ manager.add(newBugFromCommentAction); >+ } >+ } > > if (task.isActive()) { > manager.add(new TaskDeactivateAction() { >Index: src/org/eclipse/mylyn/internal/tasks/ui/actions/NewBugFromCommentAction.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/actions/NewBugFromCommentAction.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/actions/NewBugFromCommentAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/actions/NewBugFromCommentAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,106 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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 >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.tasks.ui.actions; >+ >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages; >+import org.eclipse.mylyn.internal.tasks.ui.wizards.NewTaskWizard; >+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >+import org.eclipse.mylyn.tasks.core.TaskComment; >+import org.eclipse.mylyn.tasks.core.TaskRepositoryManager; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor; >+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.dnd.Clipboard; >+import org.eclipse.swt.dnd.TextTransfer; >+import org.eclipse.swt.dnd.Transfer; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PlatformUI; >+ >+public class NewBugFromCommentAction extends Action { >+ >+ private static final String LABEL = "New Task from Comment"; >+ >+ public static final String ID = "org.eclipse.mylyn.tasklist.actions.CreateNewFromComment"; >+ >+ private TaskComment taskComment; >+ protected RepositoryTaskData taskData; >+ >+ >+ public NewBugFromCommentAction() { >+ super(LABEL); >+ setId(ID); >+ setImageDescriptor(TasksUiImages.TASK_NEW); >+ >+ setAccelerator(SWT.MOD1 + SWT.MOD2 + 'n'); >+ } >+ >+ public void run(IAction action) { >+ run(); >+ } >+ >+ @Override >+ public void run() { >+ NewTaskWizard wizard = new NewTaskWizard(); >+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); >+ if (shell != null && !shell.isDisposed()) { >+ WizardDialog dialog = new WizardDialog(shell, wizard); >+ dialog.setBlockOnOpen(true); >+ if (dialog.open() == WizardDialog.CANCEL) { >+ return; >+ } >+ >+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ AbstractRepositoryTaskEditor editor = null; >+ String summary = ""; >+ >+ AbstractRepositoryConnector connector = null; >+ TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager(); >+ connector = repositoryManager.getRepositoryConnector(taskData.getRepositoryKind()); >+ >+ String description = "created from " + connector.getTaskUrl(taskData.getRepositoryUrl(), taskData.getId()) + " comment#" + taskComment.getNumber() >+ + "\n\noriginal-comment:\n" + taskComment.getText(); >+ >+ try { >+ TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); >+ editor = (AbstractRepositoryTaskEditor) taskEditor.getActivePageInstance(); >+ } catch (ClassCastException err) { >+ Clipboard clipboard = new Clipboard(page.getWorkbenchWindow().getShell().getDisplay()); >+ clipboard.setContents(new Object[] { summary + "\n" + description }, >+ new Transfer[] { TextTransfer.getInstance() }); >+ >+ MessageDialog.openInformation( >+ page.getWorkbenchWindow().getShell(), >+ ITasksUiConstants.TITLE_DIALOG, "This connector does not provide a rich task editor for creating tasks.\n\n" >+ + "The error contents have been placed in the clipboard so that you can paste them into the entry form."); >+ return; >+ } >+ >+ editor.setSummaryText(summary); >+ editor.setDescriptionText(description); >+ >+ } >+ } >+ >+ public void setTaskComment(TaskComment taskComment) { >+ this.taskComment = taskComment; >+ } >+ >+ public void setTaskData(RepositoryTaskData taskData) { >+ this.taskData = taskData; >+ } >+ >+}
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 169426
:
79776
|
79777
|
79787
|
79788
| 80500 |
80501
|
81215
|
81216
|
82013
|
82014
|
83199
|
83200
|
83394
|
83395