diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java')
-rw-r--r-- | org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java deleted file mode 100644 index 6dc4033b9..000000000 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaMylarBridge.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia 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 - * - * Contributors: - * University Of British Columbia - initial API and implementation - *******************************************************************************/ -/* - * Created on Oct 1, 2004 - */ -package org.eclipse.mylar.tasks.bugzilla; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IMember; - - -/** - * Class to handle the bridge between mylar and bugzilla - * - * @author Shawn Minto - */ -public class BugzillaMylarBridge { - - /** The hash of all of the landmarks and their related search hits */ - private HashMap<String, Map<Integer, List<BugzillaReportNode>>> landmarksHash; - /** - * The currently running search jobs so that we can cancel it if necessary <br> KEY: IMember VALUE: Job - */ - public static HashMap<String, Job> runningJobs = new HashMap<String, Job>(); - - /** - * Constructor - */ - public BugzillaMylarBridge() { - landmarksHash = new HashMap<String, Map<Integer, List<BugzillaReportNode>>>(); - } - - - /** - * Remove a landmark from the hash - * - * @param removed - * This landmark to remove (IJavaElement) - */ - public void removeFromLandmarksHash(IJavaElement removed) { - landmarksHash.remove(removed.getHandleIdentifier()); - } - - /** - * Remove all of the landmarks from the hash that are in the list - * - * @param removed - * This list of landmarks to remove (IJavaElements) - */ - public void removeFromLandmarksHash(List<IJavaElement> removed) { - - for(IJavaElement je : removed) { - landmarksHash.remove(je.getHandleIdentifier()); - } - } - - /** - * Add data to the landmarks hash - * - * @param doiList - * The list of BugzillaSearchHitDoiInfo - * @param m - * The member that this list is for - */ - public void addToLandmarksHash(List<BugzillaReportNode> doiList, IMember m, int scope) { - Map<Integer, List<BugzillaReportNode>> searches = landmarksHash.get(m.getHandleIdentifier()); - - if(searches == null){ - searches = new HashMap<Integer, List<BugzillaReportNode>>(); - } - searches.put(scope, doiList); - landmarksHash.put(m.getHandleIdentifier(), searches); - } - - /** - * Get the doiList for the given IMember from the landmarks hash - * - * @param m - * The member to get the doiList for - * @return The doiList or null if it doesn't exist - */ - public List<BugzillaReportNode> getFromLandmarksHash(IMember m, int scope) { - Map<Integer, List<BugzillaReportNode>> scopes = landmarksHash.get(m.getHandleIdentifier()); - if(scopes == null) - return null; - else - return scopes.get(scope); - } - - /** - * Determine whether the current element has a search job running for it - * - * @param e - * The element that we want to know whether there is a search job - * or not - * @return <code>true</code> if it does else <code>false</code> - */ - public static boolean doesJobExist(String handle) { - return runningJobs.containsKey(handle); - } - - /** - * Remove search job for the given element - * - * @param m - * The element that we want to make sure that the search is - * canceled for - */ - public static void removeSearchJob(String handle) { - - // make sure that there wasn't a previous search job that we know - // of. If there was, cancel it - if (doesJobExist(handle)) { - // get the search job and wait until it is cancelled - Job prevJob = runningJobs.get(handle); - prevJob.cancel(); - runningJobs.remove(handle); - } - } - - /** - * Add a search job to our list - * @param handle The handle of the element that we are searching for - * @param searchJob The job that represents the search - */ - public static void addJob(String handle, Job searchJob) { - runningJobs.put(handle, searchJob); - } -}
\ No newline at end of file |