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 83199 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 use of the new API
patch169426.txt (text/plain), 9.62 KB, created by
Frank Becker
on 2007-11-18 14:16:17 EST
(
hide
)
Description:
Patch with use of the new API
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2007-11-18 14:16:17 EST
Size:
9.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java,v >retrieving revision 1.13 >diff -u -r1.13 TaskFormPage.java >--- src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java 23 Oct 2007 21:43:32 -0000 1.13 >+++ src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java 18 Nov 2007 19:11:45 -0000 >@@ -664,5 +664,20 @@ > return new DefaultInformationControl(shell); > } > } >+ >+ public String getSeletedTextFromActualEdit() { >+ Control focusControl = getFocusControl(); >+ if (focusControl == null) >+ return null; >+ if (focusControl instanceof StyledText) { >+ StyledText text = (StyledText) focusControl; >+ for (TextViewer viewer : textViewers) { >+ if (viewer.getTextWidget() == text) { >+ return text.getSelectionText(); >+ } >+ } >+ } >+ return null; >+ } > > } >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.243 >diff -u -r1.243 AbstractRepositoryTaskEditor.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 3 Nov 2007 00:05:03 -0000 1.243 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 18 Nov 2007 19:11:45 -0000 >@@ -127,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; >@@ -302,6 +304,8 @@ > protected Label duplicateDetectorLabel; > > private boolean ignoreLocationEvents = false; >+ >+ private TaskComment selectedComment = null; > > /** > * @author Raphael Ackermann (bug 195514) >@@ -348,7 +352,7 @@ > > public ISelection getSelection() { > return new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(), >- taskData.getRepositoryKind(), "", true, taskData.getSummary()); >+ taskData.getRepositoryKind(), "", selectedComment, taskData.getSummary()); > } > > public void removeSelectionChangedListener(ISelectionChangedListener listener) { >@@ -2127,6 +2131,18 @@ > > TextViewer viewer = addTextViewer(repository, ecComposite, taskComment.getText().trim(), SWT.MULTI > | SWT.WRAP); >+ viewer.getTextWidget().addFocusListener(new FocusListener() { >+ >+ public void focusGained(FocusEvent e) { >+ selectedComment = taskComment; >+ >+ } >+ >+ public void focusLost(FocusEvent e) { >+ selectedComment = null; >+ } >+ }); >+ > // viewer.getControl().setBackground(new > // Color(expandableComposite.getDisplay(), 123, 34, 155)); > StyledText styledText = viewer.getTextWidget(); >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.37 >diff -u -r1.37 TaskEditorActionContributor.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java 1 Nov 2007 18:35:43 -0000 1.37 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java 18 Nov 2007 19:11:42 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.mylyn.internal.tasks.ui.actions.AttachAction; > import org.eclipse.mylyn.internal.tasks.ui.actions.AttachScreenshotAction; > 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; >@@ -42,6 +43,7 @@ > import org.eclipse.mylyn.tasks.core.AbstractTask; > import org.eclipse.mylyn.tasks.core.AbstractTaskCategory; > import org.eclipse.mylyn.tasks.core.AbstractTaskContainer; >+import org.eclipse.mylyn.tasks.core.TaskComment; > import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor; > import org.eclipse.mylyn.tasks.ui.editors.NewTaskEditorInput; >@@ -86,6 +88,8 @@ > private SynchronizeEditorAction synchronizeEditorAction = new SynchronizeEditorAction(); > > private ShowInTaskListAction showInTaskListAction = new ShowInTaskListAction(); >+ >+ private NewBugFromCommentAction newBugFromCommentAction = new NewBugFromCommentAction(); > > private GlobalAction cutAction; > >@@ -220,6 +224,30 @@ > manager.add(synchronizeEditorAction); > manager.add(openWithBrowserAction); > >+ if (this.getEditor().getActivePageInstance() instanceof AbstractRepositoryTaskEditor) { >+ if (this.getEditor().getSelection() instanceof RepositoryTaskSelection) { >+ RepositoryTaskSelection repositoryTaskSelection = (RepositoryTaskSelection) this.getEditor() >+ .getSelection(); >+ TaskComment comment = repositoryTaskSelection.getComment(); >+ >+ if (comment != null) { >+ newBugFromCommentAction.setTaskComment(comment); >+ AbstractRepositoryTaskEditor editor = (AbstractRepositoryTaskEditor) this.getEditor() >+ .getActivePageInstance(); >+ if (getEditor().getActivePageInstance() instanceof TaskFormPage) { >+ TaskFormPage editor1 = (TaskFormPage) getEditor().getActivePageInstance(); >+ String selText = editor1.getSeletedTextFromActualEdit(); >+ newBugFromCommentAction.setSelectedCommentText(selText); >+ } >+ IEditorInput input = editor.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,87 @@ >+/******************************************************************************* >+ * 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.mylyn.internal.tasks.ui.TasksUiImages; >+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.core.TaskSelection; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >+import org.eclipse.swt.SWT; >+ >+/** >+ * @author Frank Becker >+ */ >+public class NewBugFromCommentAction extends Action { >+ >+ private static final String LABEL = "New Task from Comment"; >+ >+ public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.CreateNewFromComment"; >+ >+ private TaskComment taskComment; >+ >+ protected RepositoryTaskData taskData; >+ >+ protected String selectedCommentText; >+ >+ 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() { >+ >+ AbstractRepositoryConnector connector = null; >+ TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager(); >+ connector = repositoryManager.getRepositoryConnector(taskData.getRepositoryKind()); >+ String textToInsert ; >+ if (selectedCommentText != null && !selectedCommentText.equals("")) { >+ textToInsert = selectedCommentText; >+ } else { >+ textToInsert = taskComment.getText(); >+ } >+ >+ StringBuilder sb = new StringBuilder(); >+ sb.append("\n-- Created from Comment --\nURL: "); >+ sb.append(connector.getTaskUrl(taskData.getRepositoryUrl(), taskData.getId())); >+ sb.append("\nComment: "); >+ sb.append(taskComment.getNumber()); >+ sb.append("\nOriginal Comment\n"); >+ sb.append(textToInsert); >+ >+ TaskSelection taskSelection = new TaskSelection("", sb.toString()); >+ NewTaskAction action = new NewTaskAction(); >+ action.showWizard(taskSelection); >+ } >+ >+ public void setTaskComment(TaskComment taskComment) { >+ this.taskComment = taskComment; >+ } >+ >+ public void setTaskData(RepositoryTaskData taskData) { >+ this.taskData = taskData; >+ } >+ >+ public void setSelectedCommentText(String selectedCommentText) { >+ this.selectedCommentText = selectedCommentText; >+ } >+ >+}
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