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 82013 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]
add use of selected commenttext
patch169426.txt (text/plain), 17.50 KB, created by
Frank Becker
on 2007-11-02 18:31:09 EDT
(
hide
)
Description:
add use of selected commenttext
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2007-11-02 18:31:09 EDT
Size:
17.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java,v >retrieving revision 1.101 >diff -u -r1.101 BugzillaClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 17 Oct 2007 18:22:35 -0000 1.101 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 2 Nov 2007 22:27:53 -0000 >@@ -50,6 +50,7 @@ > import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery; > import org.eclipse.mylyn.tasks.core.ITaskAttachment; > import org.eclipse.mylyn.tasks.core.ITaskCollector; >+import org.eclipse.mylyn.tasks.core.LanguageSettings; > import org.eclipse.mylyn.tasks.core.QueryHitCollector; > import org.eclipse.mylyn.tasks.core.RepositoryOperation; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; >@@ -160,7 +161,7 @@ > > private boolean lastModifiedSupported = true; > >- private BugzillaLanguageSettings languageSettings; >+ private LanguageSettings languageSettings; > > private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { > public BugzillaRetryHandler() { >@@ -183,11 +184,11 @@ > public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, > String characterEncoding) { > this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(), >- BugzillaCorePlugin.getLanguageSettings("en")); >+ BugzillaCorePlugin.getDefault().getLanguageSetting("en")); > } > > public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, >- String characterEncoding, Map<String, String> configParameters, BugzillaLanguageSettings languageSettings) { >+ String characterEncoding, Map<String, String> configParameters, LanguageSettings languageSettings) { > this.username = username; > this.password = password; > this.repositoryUrl = url; >@@ -835,8 +836,13 @@ > && ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE > && ((HtmlTag) token.getValue()).isEndTag()) { > >- if (!taskData.isNew() >- && (title.toLowerCase(Locale.ENGLISH).indexOf(languageSettings.getProcessed()) != -1)) { >+ boolean found = false; >+ for (Iterator<String> iterator = languageSettings.getProcessed().iterator(); iterator.hasNext() && !found;) { >+ String value = iterator.next().toLowerCase(Locale.ENGLISH); >+ found = found || title.indexOf(value) != -1; >+ } >+ >+ if (!taskData.isNew() && found) { > existingBugPosted = true; > } else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null > && postfix2 != null) { >@@ -1048,30 +1054,59 @@ > } else if (token.getType() == Token.TAG > && ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE > && ((HtmlTag) token.getValue()).isEndTag()) { >- >- if (title.indexOf(languageSettings.getLogin()) != -1 >- || (title.indexOf(languageSettings.getInvalid()) != -1 && title.indexOf(languageSettings.getPassword()) != -1) >- || title.indexOf(languageSettings.getCheckEmail()) != -1 >- || (languageSettings.getLogin2() != null && title.indexOf(languageSettings.getLogin2()) != -1)) { >+ >+ boolean found = false; >+ for (Iterator<String> iterator = languageSettings.getErrorLogin().iterator(); iterator.hasNext() && !found;) { >+ String value = iterator.next().toLowerCase(Locale.ENGLISH); >+ found = found || title.indexOf(value) != -1; >+ int i = 12; >+ i = i +2; >+ } >+ if (found) { > authenticated = false; > throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); >- } else if (title.indexOf(languageSettings.getMidairCollision()) != -1) { >+ } >+ found = false; >+ for (Iterator<String> iterator = languageSettings.getErrorCollision().iterator(); iterator.hasNext() && !found;) { >+ String value = iterator.next().toLowerCase(Locale.ENGLISH); >+ found = found || title.indexOf(value) != -1; >+ } >+ if (found) { > throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); >- } else if (title.indexOf(languageSettings.getCommentRequired()) != -1) { >+ } >+ found = false; >+ for (Iterator<String> iterator = languageSettings.getErrorCommentReqired().iterator(); iterator.hasNext() && !found;) { >+ String value = iterator.next().toLowerCase(Locale.ENGLISH); >+ found = found || title.indexOf(value) != -1; >+ } >+ if (found) { > throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); >- } else if (title.indexOf(languageSettings.getLoggedOut()) != -1) { >+ } >+ found = false; >+ for (Iterator<String> iterator = languageSettings.getErrorLoggedOut().iterator(); iterator.hasNext() && !found;) { >+ String value = iterator.next().toLowerCase(Locale.ENGLISH); >+ found = found || title.indexOf(value) != -1; >+ } >+ if (found) { > authenticated = false; > // throw new > // BugzillaException(IBugzillaConstants.LOGGED_OUT); > throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, > RepositoryStatus.REPOSITORY_LOGGED_OUT, > "You have been logged out. Please retry operation.")); >- } else if (title.indexOf(IBugzillaConstants.CHANGES_SUBMITTED) != -1) { >+ } >+ found = false; >+ for (Iterator<String> iterator = languageSettings.getChangesSubmitted().iterator(); iterator.hasNext() && !found;) { >+ String value = iterator.next().toLowerCase(Locale.ENGLISH); >+ found = found || title.indexOf(value) != -1; >+ } >+ if (found) { > return; > } >+ isTitle = false; > } > } > } >@@ -1100,7 +1135,7 @@ > method = getConnectGzip(url); > if (method != null) { > BugzillaTaskHistoryParser parser = new BugzillaTaskHistoryParser( >- method.getResponseBodyAsUnzippedStream(), characterEncoding); >+ method.getResponseBodyAsUnzippedStream(), characterEncoding,languageSettings); > try { > return parser.retrieveHistory(); > } catch (LoginException e) { >#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 2 Nov 2007 22:28:10 -0000 >@@ -665,4 +665,19 @@ > } > } > >+ 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.242 >diff -u -r1.242 AbstractRepositoryTaskEditor.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 2 Nov 2007 17:04:27 -0000 1.242 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 2 Nov 2007 22:28:07 -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; >@@ -303,6 +305,8 @@ > > private boolean ignoreLocationEvents = false; > >+ private TaskComment selectedComment = null; >+ > /** > * @author Raphael Ackermann (bug 195514) > */ >@@ -347,7 +351,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) { >@@ -2126,6 +2130,20 @@ > > 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 2 Nov 2007 22:27:56 -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; >@@ -98,6 +100,8 @@ > private GlobalAction pasteAction; > > private GlobalAction selectAllAction; >+ >+ private NewBugFromCommentAction newBugFromCommentAction = new NewBugFromCommentAction(); > > public TaskEditorActionContributor() { > >@@ -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,122 @@ >+/******************************************************************************* >+ * 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; >+ >+/** >+ * @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.tasklist.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() { >+ 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 textToInsert ; >+ if (selectedCommentText != null && !selectedCommentText.equals("")) { >+ textToInsert = selectedCommentText; >+ } else { >+ textToInsert = taskComment.getText(); >+ } >+ String description = "From task: " + connector.getTaskUrl(taskData.getRepositoryUrl(), taskData.getId()) >+ + " comment#" + taskComment.getNumber() + "\n\nselected original-comment:\n" + textToInsert; >+ >+ 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; >+ } >+ >+ summary = taskData.getSummary(); >+ editor.setSummaryText(summary); >+ editor.setDescriptionText(description); >+ >+ } >+ } >+ >+ 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