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 82039 Details for
Bug 152869
allow to create new issues from JUnit stack trace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
patch152869.txt (text/plain), 15.02 KB, created by
Frank Becker
on 2007-11-03 18:54:22 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2007-11-03 18:54:22 EDT
Size:
15.02 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 3 Nov 2007 22:47:41 -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.bugzilla.ide >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ide/plugin.xml,v >retrieving revision 1.6 >diff -u -r1.6 plugin.xml >--- plugin.xml 24 Aug 2007 18:50:04 -0000 1.6 >+++ plugin.xml 3 Nov 2007 22:47:49 -0000 >@@ -13,6 +13,89 @@ > > <extension > point="org.eclipse.mylyn.tasks.core.templates"> >+ <language >+ name="en" >+ repositoryKind="bugzilla"> >+ <error_login >+ value="Login"> >+ </error_login> >+ <error_login >+ value="log in"> >+ </error_login> >+ <error_login >+ value="check e-mail"> >+ </error_login> >+ <error_login >+ value="Invalid Username Or Password"> >+ </error_login> >+ <error_collision >+ value="Mid-air collision!"> >+ </error_collision> >+ <error_comment_required >+ value="Comment Required"> >+ </error_comment_required> >+ <error_logged_out >+ value="logged out"> >+ </error_logged_out> >+ <bad_login >+ value="Login"> >+ </bad_login> >+ <bad_login >+ value="check e-mail"> >+ </bad_login> >+ <bad_login >+ value="Invalid Username Or Password"> >+ </bad_login> >+ <bad_login >+ value="error"> >+ </bad_login> >+ <processed >+ value="processed"> >+ </processed> >+ <changes_submitted >+ value="Changes submitted"> >+ </changes_submitted> >+ </language> >+ <language >+ name="de" >+ repositoryKind="bugzilla"> >+ <error_login >+ value="Anmeldename erforderlich"> >+ </error_login> >+ <error_login >+ value="check e-mail"> >+ </error_login> >+ <error_login >+ value="Ungâºtiger Benutzername oder ungâºltiges Passwort"> >+ </error_login> >+ <error_collision >+ value="Kollision!"> >+ </error_collision> >+ <error_comment_required >+ value="Kommentar erforderlich"> >+ </error_comment_required> >+ <error_logged_out >+ value="Abgemeldet"> >+ </error_logged_out> >+ <bad_login >+ value="Anmeldename erforderlich"> >+ </bad_login> >+ <bad_login >+ value="check e-mail"> >+ </bad_login> >+ <bad_login >+ value="Ungütiger Benutzername oder ungültiges Passwort"> >+ </bad_login> >+ <bad_login >+ value="error"> >+ </bad_login> >+ <processed >+ value="bearbeitet"> >+ </processed> >+ <changes_submitted >+ value="sind gespeichert"> >+ </changes_submitted> >+ </language> > <repository > addAutomatically="true" > characterEncoding="ISO-8859-1" >@@ -34,5 +117,20 @@ > menubarPath="org.eclipse.pde.runtime.LogView"/> > </viewerContribution> > </extension> >+ >+ <extension point="org.eclipse.ui.popupMenus"> >+ <viewerContribution >+ id="org.eclipse.mylyn.tasklist.ui.objectContribution" >+ targetID="org.eclipse.jdt.junit.ResultView"> >+ <action >+ class="org.eclipse.mylyn.internal.bugzilla.ide.actions.NewTaskFromFailureAction" >+ icon="icons/etool16/task-repository-new.gif" >+ id="org.eclipse.mylyn.tasklist.actions.newTaskFromFailureLog" >+ label="Report as Bug" >+ menubarPath="org.eclipse.jdt.junit.ResultView"/> >+ </viewerContribution> >+ </extension> >+ >+ > > </plugin> >Index: src/org/eclipse/mylyn/internal/bugzilla/ide/actions/NewTaskFromFailureAction.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/bugzilla/ide/actions/NewTaskFromFailureAction.java >diff -N src/org/eclipse/mylyn/internal/bugzilla/ide/actions/NewTaskFromFailureAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/bugzilla/ide/actions/NewTaskFromFailureAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,111 @@ >+/******************************************************************************* >+ * 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.bugzilla.ide.actions; >+ >+import org.eclipse.jdt.internal.junit.model.TestCaseElement; >+import org.eclipse.jdt.internal.junit.model.TestElement; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.jface.viewers.TreeSelection; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants; >+import org.eclipse.mylyn.internal.tasks.ui.wizards.NewTaskWizard; >+import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor; >+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; >+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.IViewActionDelegate; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.ViewPluginAction; >+ >+/** >+ * Creates a new task from the selected JUnit Test. >+ * >+ * @author Frank Becker >+ */ >+public class NewTaskFromFailureAction implements IViewActionDelegate, ISelectionChangedListener { >+ >+ public static final String ID = "org.eclipse.mylyn.tasklist.ui.repositories.actions.create"; >+ >+ public void run(IAction action) { >+ String traceString = null; >+ TestCaseElement testCaseElement = null; >+ if (action instanceof ViewPluginAction) { >+ ViewPluginAction a = (ViewPluginAction)action; >+ ISelection selection = a.getSelection(); >+ if (selection instanceof TreeSelection) { >+ TreeSelection t = (TreeSelection) selection; >+ TestElement testElement= (TestElement) t.getFirstElement(); >+ if (testElement instanceof TestCaseElement) { >+ testCaseElement= (TestCaseElement) testElement; >+ traceString = testCaseElement.getTrace(); >+ } >+ } >+ } >+ if (traceString == null || testCaseElement == null) { >+ return; >+ } >+ 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 = ""; >+ String description = "\n\n-- Error Log from JUnit --\nClass: " + testCaseElement.getTestClassName() >+ + "\nMethod: " + testCaseElement.getTestMethodName() + "\nActual: " + testCaseElement.getActual() >+ + "\nExpected: " + testCaseElement.getExpected() + "\nStack Trace:\n" + traceString; >+ >+ try { >+ TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); >+ editor = (AbstractRepositoryTaskEditor) taskEditor.getActivePageInstance(); >+ } catch (ClassCastException e) { >+ 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 selectionChanged(SelectionChangedEvent event) { >+ // ignore >+ } >+ >+ public void init(IViewPart view) { >+ // ignore >+ } >+ >+ public void selectionChanged(IAction action, ISelection selection) { >+ // ignore >+ } >+}
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 152869
: 82039 |
82040
|
82041
|
82042
|
82059
|
82060
|
82927