Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 81795 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/bugs/extension/BugsImages.java (-43 / +47 lines)
Lines 1-43 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
11
12
package org.eclipse.team.bugs.extension;
12
package org.eclipse.team.bugs.extension;
13
13
14
import java.net.URL;
14
import java.net.URL;
15
15
16
import org.eclipse.jface.resource.ImageDescriptor;
16
import org.eclipse.core.runtime.Path;
17
import org.eclipse.team.bugs.internal.main.BugsPlugin;
17
import org.eclipse.core.runtime.Platform;
18
import org.eclipse.ui.internal.util.BundleUtility;
18
import org.eclipse.jface.resource.ImageDescriptor;
19
19
import org.eclipse.team.bugs.internal.main.BugsPlugin;
20
20
import org.osgi.framework.Bundle;
21
/**
21
22
 * 
22
23
 */
23
/**
24
public class BugsImages {
24
 * 
25
    
25
 */
26
    public static final ImageDescriptor REFRESH;
26
public class BugsImages {
27
    
27
    
28
	static {
28
    public static final ImageDescriptor REFRESH;
29
	    REFRESH= getDescriptor(BugsPlugin.ID, "icons/refresh.gif");
29
    
30
	}
30
	static {
31
	
31
	    REFRESH= getDescriptor(BugsPlugin.ID, "icons/refresh.gif");
32
	protected static ImageDescriptor getDescriptor(String pluginID, String localPath) {
32
	}
33
	    final URL url = BundleUtility.find(pluginID, localPath);
33
	
34
	    return ImageDescriptor.createFromURL(url);
34
	protected static ImageDescriptor getDescriptor(String pluginID, String localPath) {
35
	}
35
		Bundle bundle = Platform.getBundle(pluginID);
36
	
36
		Path path = new Path(localPath);
37
	/**
37
		final URL url = Platform.find(bundle, path);
38
	 * No need for instantiation
38
	    return ImageDescriptor.createFromURL(url);
39
	 */
39
	}
40
	protected BugsImages() {}
40
	
41
}    
41
	/**
42
42
	 * No need for instantiation
43
43
	 */
44
	protected BugsImages() {}
45
}    
46
47
(-)src/org/eclipse/team/bugs/internal/registry/AddProviderWizardDescription.java (-91 / +90 lines)
Lines 1-91 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.team.bugs.internal.registry;
11
package org.eclipse.team.bugs.internal.registry;
12
12
13
import org.eclipse.core.runtime.CoreException;
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IConfigurationElement;
14
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.Status;
16
import org.eclipse.core.runtime.Status;
17
import org.eclipse.jface.resource.ImageDescriptor;
17
import org.eclipse.jface.resource.ImageDescriptor;
18
import org.eclipse.jface.wizard.IWizard;
18
import org.eclipse.jface.wizard.IWizard;
19
import org.eclipse.team.bugs.internal.main.BugsPlugin;
19
import org.eclipse.team.bugs.internal.main.BugsPlugin;
20
import org.eclipse.ui.internal.WorkbenchPlugin;
20
21
21
/**
22
/**
22
 * Descriptor for accessing and creating synchronize wizards
23
 * Descriptor for accessing and creating synchronize wizards
23
 */
24
 */
24
public class AddProviderWizardDescription {
25
public class AddProviderWizardDescription {
25
	
26
	
26
	public  static final String ATT_ID = "id"; //$NON-NLS-1$
27
	public  static final String ATT_ID = "id"; //$NON-NLS-1$
27
	public  static final String ATT_NAME = "name"; //$NON-NLS-1$
28
	public  static final String ATT_NAME = "name"; //$NON-NLS-1$
28
	public  static final String ATT_ICON = "icon"; //$NON-NLS-1$
29
	public  static final String ATT_ICON = "icon"; //$NON-NLS-1$
29
	public  static final String ATT_CLASS = "class"; //$NON-NLS-1$
30
	public  static final String ATT_CLASS = "class"; //$NON-NLS-1$
30
	public  static final String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
31
	public  static final String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
31
	
32
	
32
	private String label;
33
	private String label;
33
	private String className;
34
	private String className;
34
	private String description;
35
	private String description;
35
	private String id;
36
	private String id;
36
	private ImageDescriptor imageDescriptor;
37
	private ImageDescriptor imageDescriptor;
37
	
38
	
38
	private IConfigurationElement configElement;
39
	private IConfigurationElement configElement;
39
	
40
	
40
	public AddProviderWizardDescription(IConfigurationElement e) throws CoreException {
41
	public AddProviderWizardDescription(IConfigurationElement e) throws CoreException {
41
		configElement = e;
42
		configElement = e;
42
		loadFromExtension();
43
		loadFromExtension();
43
	}
44
	}
44
	
45
	
45
	public IWizard createWizard() throws CoreException {
46
	public IWizard createWizard() throws CoreException {
46
		Object obj = configElement.createExecutableExtension(ATT_CLASS);
47
		Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
47
		return (IWizard) obj;
48
		return (IWizard) obj;
48
	}
49
	}
49
	
50
	
50
	private void loadFromExtension() throws CoreException {
51
	private void loadFromExtension() throws CoreException {
51
		String identifier = configElement.getAttribute(ATT_ID);
52
		String identifier = configElement.getAttribute(ATT_ID);
52
		label = configElement.getAttribute(ATT_NAME);
53
		label = configElement.getAttribute(ATT_NAME);
53
		className = configElement.getAttribute(ATT_CLASS);
54
		className = configElement.getAttribute(ATT_CLASS);
54
		description = configElement.getAttribute(ATT_DESCRIPTION);
55
		description = configElement.getAttribute(ATT_DESCRIPTION);
55
		
56
		
56
		// Sanity check.
57
		// Sanity check.
57
		if ((label == null) || (className == null) || (identifier == null) || (description == null)) {
58
		if ((label == null) || (className == null) || (identifier == null) || (description == null)) {
58
			throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getNamespace(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$
59
			throw new CoreException(new Status(IStatus.ERROR, configElement.getDeclaringExtension().getNamespace(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$
59
					null));
60
					null));
60
		}
61
		}
61
		
62
		
62
		id = identifier;
63
		id = identifier;
63
	}
64
	}
64
	
65
	
65
	public String getId() {
66
	public String getId() {
66
		return id;
67
		return id;
67
	}
68
	}
68
	
69
	
69
	public String getDescription() {
70
	public String getDescription() {
70
		return description;
71
		return description;
71
	}
72
	}
72
	
73
	
73
	public ImageDescriptor getImageDescriptor() {
74
	public ImageDescriptor getImageDescriptor() {
74
		if (imageDescriptor != null)
75
		if (imageDescriptor != null)
75
			return imageDescriptor;
76
			return imageDescriptor;
76
		String iconName = configElement.getAttribute(ATT_ICON);
77
		String iconName = configElement.getAttribute(ATT_ICON);
77
		if (iconName == null)
78
		if (iconName == null)
78
			return null;
79
			return null;
79
		imageDescriptor = BugsPlugin.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName);
80
		imageDescriptor = BugsPlugin.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), iconName);
80
		return imageDescriptor;
81
		return imageDescriptor;
81
	}
82
	}
82
83
83
	public String getName() {
84
	public String getName() {
84
		return label;
85
		return label;
85
	}
86
	}
86
	
87
	
87
	public String toString() {
88
	public String toString() {
88
		return "Synchronize Participant Creation Wizard(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$
89
		return "Synchronize Participant Creation Wizard(" + getId() + ")"; //$NON-NLS-2$//$NON-NLS-1$
89
	}
90
	}
90
}
91
}
(-)src/org/eclipse/team/bugs/internal/views/TreeManager.java (-61 / +60 lines)
Lines 1-62 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
11
12
package org.eclipse.team.bugs.internal.views;
12
package org.eclipse.team.bugs.internal.views;
13
13
14
import org.eclipse.swt.widgets.Tree;
14
import org.eclipse.swt.widgets.Tree;
15
import org.eclipse.team.bugs.extension.Providers;
15
import org.eclipse.team.bugs.extension.Providers;
16
import org.eclipse.team.bugs.model.IBugProvider;
16
import org.eclipse.team.bugs.model.IGenericModel;
17
import org.eclipse.team.bugs.model.IGenericModel;
17
import org.eclipse.team.bugs.model.IProviderListener;
18
import org.eclipse.team.bugs.model.IProviderListener;
18
19
19
20
20
class TreeManager implements IProviderListener {
21
class TreeManager implements IProviderListener {
21
    
22
    
22
    private BugView fView;
23
    private BugView fView;
23
    private Tree fTree;
24
    private Tree fTree;
24
25
25
    public TreeManager(BugView view) {
26
    public TreeManager(BugView view) {
26
        fView= view;
27
        fView= view;
27
        fTree= view.getViewer().getTree();
28
        fTree= view.getViewer().getTree();
28
    }
29
    }
29
30
30
    public void elementsAdded(IGenericModel parent, IGenericModel[] children) {
31
    public void elementsAdded(IGenericModel parent, IGenericModel[] children) {
31
        fTree.setRedraw(false);
32
        fTree.setRedraw(false);
32
        try {
33
        try {
33
            fView.getViewer().refresh(parent != null ? parent : (Object)Providers.getInstance());
34
            fView.getViewer().refresh(parent != null ? parent : (Object)Providers.getInstance());
34
        } finally {
35
        } finally {
35
			if (parent != null) {
36
			if (parent != null) {
36
				fView.getViewer().setExpandedState(parent.getProvider(), true);
37
				fView.getViewer().setExpandedState(parent.getProvider(), true);
37
			}
38
			}
38
			fTree.setRedraw(true);
39
			fTree.setRedraw(true);
39
        }
40
        }
40
    }
41
    }
41
42
42
    public void elementsChanged(IGenericModel[] elements) {
43
    public void elementsChanged(IGenericModel[] elements) {
43
        try {
44
        try {
44
            for (int i = 0; i < elements.length; i++) {
45
            for (int i = 0; i < elements.length; i++) {
45
                fView.getViewer().update(elements[i], null);
46
                fView.getViewer().update(elements[i], null);
46
            }
47
            }
47
        } finally {
48
        } finally {
48
			fView.getViewer().setExpandedState(elements[0].getProvider(), true);
49
			fView.getViewer().setExpandedState(elements[0].getProvider(), true);
49
            fTree.setRedraw(true);
50
            fTree.setRedraw(true);
50
        }
51
        }
51
    }
52
    }
52
53
53
    public void elementsRemoved(IGenericModel parent, IGenericModel[] children) {
54
    public void elementsRemoved(IGenericModel parent, IGenericModel[] children) {
54
        fTree.setRedraw(false);
55
        fTree.setRedraw(false);
55
        try {
56
        try {
56
            fView.getViewer().refresh( parent != null ? parent : (Object)Providers.getInstance());
57
            fView.getViewer().refresh( parent != null ? parent : (Object)Providers.getInstance());
57
        } finally {
58
        } finally {
58
            fTree.setRedraw(true);
59
            fTree.setRedraw(true);
59
        }
60
        }
60
    }
61
    }
62
}
61
}
(-)src/org/eclipse/team/bugs/internal/views/dnd/BugsDragDropAdapter.java (-32 / +32 lines)
Lines 1-32 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
11
12
package org.eclipse.team.bugs.internal.views.dnd;
12
package org.eclipse.team.bugs.internal.views.dnd;
13
13
14
import org.eclipse.swt.dnd.DropTargetEvent;
14
import org.eclipse.swt.dnd.DropTargetEvent;
15
import org.eclipse.team.bugs.model.IGenericModel;
15
import org.eclipse.team.bugs.model.IGenericModel;
16
16
17
/**
17
/**
18
 * 
18
 * 
19
 */
19
 */
20
public abstract class BugsDragDropAdapter {
20
public abstract class BugsDragDropAdapter {
21
21
22
    /**
22
    /**
23
     * Yields the model element for a given SWT item of the tree. 
23
     * Yields the model element for a given SWT item of the tree. 
24
     * TODO: This is not JFace API, we should find a way to do this in a better way.
24
     * TODO: This is not JFace API, we should find a way to do this in a better way.
25
     * 
25
     * 
26
     * @param item the SWT item.
26
     * @param event the SWT item.
27
     * @return the model element.
27
     * @return the model element.
28
     */
28
     */
29
    protected IGenericModel getModelElement(DropTargetEvent event) {
29
    protected IGenericModel getModelElement(DropTargetEvent event) {
30
        return event.item == null ? null : (IGenericModel)event.item.getData();
30
        return event.item == null ? null : (IGenericModel)event.item.getData();
31
    }
31
    }
32
}
32
}
(-)src/org/eclipse/team/bugs/internal/views/dnd/DragManager.java (-195 / +194 lines)
Lines 1-195 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
11
12
package org.eclipse.team.bugs.internal.views.dnd;
12
package org.eclipse.team.bugs.internal.views.dnd;
13
13
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.Arrays;
15
import java.util.Arrays;
16
import java.util.HashMap;
16
import java.util.HashMap;
17
import java.util.HashSet;
17
import java.util.HashSet;
18
import java.util.Iterator;
18
import java.util.Iterator;
19
import java.util.List;
19
import java.util.List;
20
import java.util.Map;
20
import java.util.Map;
21
import java.util.Set;
21
import java.util.Set;
22
22
23
import org.eclipse.jface.util.Assert;
23
import org.eclipse.jface.util.Assert;
24
import org.eclipse.swt.dnd.DND;
24
import org.eclipse.swt.dnd.DND;
25
import org.eclipse.swt.dnd.DragSource;
25
import org.eclipse.swt.dnd.DragSource;
26
import org.eclipse.swt.dnd.DragSourceEvent;
26
import org.eclipse.swt.dnd.DragSourceEvent;
27
import org.eclipse.swt.dnd.DragSourceListener;
27
import org.eclipse.swt.dnd.DragSourceListener;
28
import org.eclipse.swt.dnd.Transfer;
28
import org.eclipse.swt.dnd.Transfer;
29
import org.eclipse.swt.dnd.TransferData;
29
import org.eclipse.swt.dnd.TransferData;
30
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.team.bugs.internal.views.BugView;
31
import org.eclipse.team.bugs.internal.views.BugView;
32
import org.eclipse.team.bugs.model.IBugProvider;
32
import org.eclipse.team.bugs.model.IBugProvider;
33
33
34
/**
34
/**
35
 * This class listens to drag events on the bug view and dispatches the 
35
 * This class listens to drag events on the bug view and dispatches the 
36
 * event to the plugin implementing the selected provider. Every provider 
36
 * event to the plugin implementing the selected provider. Every provider 
37
 * can register exactly one listener.
37
 * can register exactly one listener.
38
 */
38
 */
39
public class DragManager implements DragSourceListener {
39
public class DragManager implements DragSourceListener {
40
    
40
    
41
    /**
41
    /**
42
     * A helper class to store the listeners, along with their supported
42
     * A helper class to store the listeners, along with their supported
43
     * transfers and operations.
43
     * transfers and operations.
44
     */
44
     */
45
    private static class ListenerInfo {
45
    private static class ListenerInfo {
46
        
46
        
47
        private Object fListener;
47
        private Object fListener;
48
        private Transfer [] fTransfers;
48
        private Transfer [] fTransfers;
49
        
49
        
50
        public Object getListener() {
50
        public Object getListener() {
51
            return fListener;
51
            return fListener;
52
        }
52
        }
53
        
53
        
54
        public Transfer [] getTransferTypes() {
54
        public Transfer [] getTransferTypes() {
55
            return fTransfers;
55
            return fTransfers;
56
        }
56
        }
57
        
57
        
58
        public boolean supports(TransferData transferData) {
58
        public boolean supports(TransferData transferData) {
59
            final List transfers= Arrays.asList(fTransfers);
59
            final List transfers= Arrays.asList(fTransfers);
60
            for (Iterator iter = transfers.iterator(); iter.hasNext();) {
60
            for (Iterator iter = transfers.iterator(); iter.hasNext();) {
61
                if (((Transfer)iter.next()).isSupportedType(transferData)) 
61
                if (((Transfer)iter.next()).isSupportedType(transferData)) 
62
                    return true;
62
                    return true;
63
            }
63
            }
64
            return false;
64
            return false;
65
        }
65
        }
66
        
66
        
67
        public ListenerInfo(Object listener, Transfer [] transferTypes) {
67
        public ListenerInfo(Object listener, Transfer [] transferTypes) {
68
            fListener= listener;
68
            fListener= listener;
69
            fTransfers= transferTypes;
69
            fTransfers= transferTypes;
70
        }
70
        }
71
    }
71
    }
72
    
72
    
73
    
73
    
74
    private final BugView fView;
74
    private final BugView fView;
75
    private final Control fControl;
75
    private final Control fControl;
76
    
76
    
77
    private DragSource fDragMoveSource;
77
    private DragSource fDragMoveSource;
78
    
78
    
79
    private final Map fListenerInfos;
79
    private final Map fListenerInfos;
80
80
81
    /**
81
    /**
82
     * The supported transfers. Duplicate entries mean that a transfer is supported by more than one
82
     * The supported transfers. Duplicate entries mean that a transfer is supported by more than one
83
     * listener.
83
     * listener.
84
     */
84
     */
85
    private final List fTransfers;
85
    private final List fTransfers;
86
    
86
    
87
    private ListenerInfo fCurrent;
87
    private ListenerInfo fCurrent;
88
    
88
    
89
    
89
    
90
    public DragManager(BugView view) {
90
    public DragManager(BugView view) {
91
        fView= view;
91
        fView= view;
92
        fListenerInfos= new HashMap();
92
        fListenerInfos= new HashMap();
93
        fTransfers= new ArrayList();
93
        fTransfers= new ArrayList();
94
        fControl= view.getViewer().getControl();
94
        fControl= view.getViewer().getControl();
95
        fCurrent= null;
95
        fCurrent= null;
96
        fDragMoveSource= new DragSource(fControl, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT | DND.DROP_TARGET_MOVE);
96
        fDragMoveSource= new DragSource(fControl, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT | DND.DROP_TARGET_MOVE);
97
        fDragMoveSource.addDragListener(this);
97
        fDragMoveSource.addDragListener(this);
98
    }
98
    }
99
99
100
    /** 
100
    /** 
101
     * The event is dispatched to the selected provider if the listener registered for this provider
101
     * The event is dispatched to the selected provider if the listener registered for this provider
102
     * matches the type of transfer and operation. Else, nothing is done.
102
     * matches the type of transfer and operation. Else, nothing is done.
103
     * @see org.eclipse.swt.dnd.DragSourceListener#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
103
     * @see org.eclipse.swt.dnd.DragSourceListener#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
104
     */
104
     */
105
    public void dragStart(DragSourceEvent event){
105
    public void dragStart(DragSourceEvent event){
106
        fCurrent= getListenerInfo();
106
        fCurrent= getListenerInfo();
107
        if (fCurrent == null) {
107
        if (fCurrent == null) {
108
            event.doit= false;
108
            event.doit= false;
109
        } else {
109
        } else {
110
            ((DragSourceListener)fCurrent.getListener()).dragStart(event);
110
            ((DragSourceListener)fCurrent.getListener()).dragStart(event);
111
            if (!event.doit)
111
            if (!event.doit)
112
                fCurrent= null;
112
                fCurrent= null;
113
        }
113
        }
114
    }
114
    }
115
    
115
    
116
    /** 
116
    /** 
117
     * The event is dispatched to the selected provider if the listener registered for this provider
117
     * The event is dispatched to the selected provider if the listener registered for this provider
118
     * matches the type of transfer and operation. Else, nothing is done.
118
     * matches the type of transfer and operation. Else, nothing is done.
119
     * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
119
     * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
120
     */
120
     */
121
    public void dragSetData(DragSourceEvent event){
121
    public void dragSetData(DragSourceEvent event){
122
        Assert.isNotNull(fCurrent);
122
        Assert.isNotNull(fCurrent);
123
        ((DragSourceListener)fCurrent.getListener()).dragSetData(event);
123
        ((DragSourceListener)fCurrent.getListener()).dragSetData(event);
124
    }
124
    }
125
125
126
    /** 
126
    /** 
127
     * The event is dispatched to the selected provider if the listener registered for this provider
127
     * The event is dispatched to the selected provider if the listener registered for this provider
128
     * matches the type of transfer and operation. Else, nothing is done.
128
     * matches the type of transfer and operation. Else, nothing is done.
129
     * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
129
     * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
130
     */
130
     */
131
    public void dragFinished(DragSourceEvent event){
131
    public void dragFinished(DragSourceEvent event){
132
        Assert.isNotNull(fCurrent);
132
        Assert.isNotNull(fCurrent);
133
        ((DragSourceListener)fCurrent.getListener()).dragFinished(event);
133
        ((DragSourceListener)fCurrent.getListener()).dragFinished(event);
134
        fCurrent= null;
134
        fCurrent= null;
135
    }
135
    }
136
136
137
    /**
137
    /**
138
     * Register a <code>DragSourceListener</code> for the given provider. For every provider, one listener
138
     * Register a <code>DragSourceListener</code> for the given provider. For every provider, one listener
139
     * can be registered. If this method is called and a listener for the given provider is already registered, 
139
     * can be registered. If this method is called and a listener for the given provider is already registered, 
140
     * the previous listener is removed and the new one is added.
140
     * the previous listener is removed and the new one is added.
141
     * @param provider the provider
141
     * @param provider the provider
142
     * @param operations the supported operations
142
     * @param transferTypes the supported types
143
     * @param transferTypes the supported types
143
     * @param listener the listener to be notified
144
     * @param listener the listener to be notified
144
     */
145
     */
145
    public void addDragSupport(IBugProvider provider, Transfer[] transferTypes, DragSourceListener listener) {
146
    public void addDragSupport(IBugProvider provider, Transfer[] transferTypes, DragSourceListener listener) {
146
	    if (fListenerInfos.containsKey(provider))
147
	    if (fListenerInfos.containsKey(provider))
147
	        internalRemoveSupport(provider);
148
	        internalRemoveSupport(provider);
148
        fListenerInfos.put(provider, new ListenerInfo(listener, transferTypes));
149
        fListenerInfos.put(provider, new ListenerInfo(listener, transferTypes));
149
        fTransfers.addAll(Arrays.asList(transferTypes));
150
        fTransfers.addAll(Arrays.asList(transferTypes));
150
        updateDragSource();
151
        updateDragSource();
151
	}
152
	}
152
    
153
    
153
    /**
154
    /**
154
     * Remove the listener for the given provider.
155
     * Remove the listener for the given provider.
155
     * @param provider the provider.
156
     * @param provider the provider.
156
     */
157
     */
157
    public void removeDragSupport(IBugProvider provider) {
158
    public void removeDragSupport(IBugProvider provider) {
158
        internalRemoveSupport(provider);
159
        internalRemoveSupport(provider);
159
        updateDragSource();
160
        updateDragSource();
160
    }
161
    }
161
    
162
    
162
    /**
163
    /**
163
     * Update the drag source with the set of all supported transfer types.
164
     * Update the drag source with the set of all supported transfer types.
164
     */
165
     */
165
    private void updateDragSource() {
166
    private void updateDragSource() {
166
        final Set set= new HashSet(fTransfers);
167
        final Set set= new HashSet(fTransfers);
167
        final Transfer [] transfers= new Transfer[set.size()];
168
        final Transfer [] transfers= new Transfer[set.size()];
168
        set.toArray(transfers);
169
        set.toArray(transfers);
169
        fDragMoveSource.setTransfer(transfers);
170
        fDragMoveSource.setTransfer(transfers);
170
    }
171
    }
171
172
172
    /**
173
    /**
173
     * A helper method to unregister the listener for a provider. 
174
     * A helper method to unregister the listener for a provider. 
174
     * @param provider the provider
175
     * @param provider the provider
175
     */
176
     */
176
    private void internalRemoveSupport(IBugProvider provider) {
177
    private void internalRemoveSupport(IBugProvider provider) {
177
        final ListenerInfo info= (ListenerInfo)fListenerInfos.remove(provider);
178
        final ListenerInfo info= (ListenerInfo)fListenerInfos.remove(provider);
178
        if (info == null)
179
        if (info == null)
179
            return;
180
            return;
180
        final Transfer [] transfers= info.getTransferTypes();
181
        final Transfer [] transfers= info.getTransferTypes();
181
        for (int i = 0; i < transfers.length; i++) {
182
        for (int i = 0; i < transfers.length; i++) {
182
            fTransfers.remove(transfers[i]);
183
            fTransfers.remove(transfers[i]);
183
        }
184
        }
184
    }
185
    }
185
    
186
    
186
    private ListenerInfo getListenerInfo() {
187
    private ListenerInfo getListenerInfo() {
187
        final IBugProvider provider= fView.getSelection().getSelectedProvider();
188
        final IBugProvider provider= fView.getSelection().getSelectedProvider();
188
189
189
        if (provider == null)
190
        if (provider == null)
190
            return null;
191
            return null;
191
    
192
    
192
        return (ListenerInfo)fListenerInfos.get(provider);
193
        return (ListenerInfo)fListenerInfos.get(provider);
193
    }
194
    }
194
}
195
}
(-)src/org/eclipse/team/bugs/internal/views/dnd/DropManager.java (-241 / +241 lines)
Lines 1-241 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
11
12
package org.eclipse.team.bugs.internal.views.dnd;
12
package org.eclipse.team.bugs.internal.views.dnd;
13
13
14
import java.util.AbstractCollection;
14
import java.util.AbstractCollection;
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.Arrays;
16
import java.util.Arrays;
17
import java.util.HashMap;
17
import java.util.HashMap;
18
import java.util.HashSet;
18
import java.util.HashSet;
19
import java.util.Iterator;
19
import java.util.Iterator;
20
import java.util.List;
20
import java.util.List;
21
import java.util.Map;
21
import java.util.Map;
22
import java.util.Set;
22
import java.util.Set;
23
23
24
import org.eclipse.swt.dnd.DND;
24
import org.eclipse.swt.dnd.DND;
25
import org.eclipse.swt.dnd.DropTarget;
25
import org.eclipse.swt.dnd.DropTarget;
26
import org.eclipse.swt.dnd.DropTargetEvent;
26
import org.eclipse.swt.dnd.DropTargetEvent;
27
import org.eclipse.swt.dnd.DropTargetListener;
27
import org.eclipse.swt.dnd.DropTargetListener;
28
import org.eclipse.swt.dnd.Transfer;
28
import org.eclipse.swt.dnd.Transfer;
29
import org.eclipse.swt.dnd.TransferData;
29
import org.eclipse.swt.dnd.TransferData;
30
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.team.bugs.internal.views.BugView;
31
import org.eclipse.team.bugs.internal.views.BugView;
32
import org.eclipse.team.bugs.model.IBugProvider;
32
import org.eclipse.team.bugs.model.IBugProvider;
33
import org.eclipse.team.bugs.model.IGenericModel;
33
import org.eclipse.team.bugs.model.IGenericModel;
34
34
35
/**
35
/**
36
 * 
36
 * 
37
 */
37
 */
38
public class DropManager implements DropTargetListener {
38
public class DropManager implements DropTargetListener {
39
    
39
    
40
    /**
40
    /**
41
     * A helper class to store the listeners, along with their supported
41
     * A helper class to store the listeners, along with their supported
42
     * transfers and operations.
42
     * transfers and operations.
43
     */
43
     */
44
    private static class ListenerInfo {
44
    private static class ListenerInfo {
45
        
45
        
46
        private DropTargetListener fListener;
46
        private DropTargetListener fListener;
47
        private int fOperations;
47
        private int fOperations;
48
        private Transfer [] fTransfers;
48
        private Transfer [] fTransfers;
49
        
49
        
50
        public DropTargetListener getListener() {
50
        public DropTargetListener getListener() {
51
            return fListener;
51
            return fListener;
52
        }
52
        }
53
        
53
        
54
        public int getOperations() {
54
        public int getOperations() {
55
            return fOperations;
55
            return fOperations;
56
        }
56
        }
57
        
57
        
58
        public Transfer [] getTransferTypes() {
58
        public Transfer [] getTransferTypes() {
59
            return fTransfers;
59
            return fTransfers;
60
        }
60
        }
61
        
61
        
62
        public boolean supports(TransferData [] transferData, int operations) {
62
        public boolean supports(TransferData [] transferData, int operations) {
63
            if ((fOperations & operations) == 0)
63
            if ((fOperations & operations) == 0)
64
                return false;
64
                return false;
65
            final List transfers= Arrays.asList(fTransfers);
65
            final List transfers= Arrays.asList(fTransfers);
66
            for (Iterator iter = transfers.iterator(); iter.hasNext();) {
66
            for (Iterator iter = transfers.iterator(); iter.hasNext();) {
67
                final Transfer transfer= (Transfer)iter.next();
67
                final Transfer transfer= (Transfer)iter.next();
68
                for (int i = 0; i < transferData.length; i++) {
68
                for (int i = 0; i < transferData.length; i++) {
69
                    if (transfer.isSupportedType(transferData[i])) {
69
                    if (transfer.isSupportedType(transferData[i])) {
70
                        return true;
70
                        return true;
71
                    }
71
                    }
72
                }
72
                }
73
            }
73
            }
74
            return false;
74
            return false;
75
        }
75
        }
76
        
76
        
77
        public ListenerInfo(DropTargetListener listener, int operations, Transfer [] transferTypes) {
77
        public ListenerInfo(DropTargetListener listener, int operations, Transfer [] transferTypes) {
78
            fListener= listener;
78
            fListener= listener;
79
            fOperations= operations;
79
            fOperations= operations;
80
            fTransfers= transferTypes;
80
            fTransfers= transferTypes;
81
        }
81
        }
82
    }
82
    }
83
    
83
    
84
    private final Map fListenerInfos;
84
    private final Map fListenerInfos;
85
    private final AbstractCollection fTransfers;
85
    private final AbstractCollection fTransfers;
86
    private final DropTarget fDropTarget;
86
    private final DropTarget fDropTarget;
87
    private Control fControl;
87
    private Control fControl;
88
    
88
    
89
    /**
89
    /**
90
     * @param viewer
90
     * @param view
91
     */
91
     */
92
    public DropManager(BugView view) {
92
    public DropManager(BugView view) {
93
        super();
93
        super();
94
        fListenerInfos= new HashMap();
94
        fListenerInfos= new HashMap();
95
        fTransfers= new ArrayList();
95
        fTransfers= new ArrayList();
96
        fControl= view.getViewer().getControl();
96
        fControl= view.getViewer().getControl();
97
        fDropTarget= new DropTarget(fControl, DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT | DND.DROP_TARGET_MOVE);
97
        fDropTarget= new DropTarget(fControl, DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT | DND.DROP_TARGET_MOVE);
98
        fDropTarget.setTransfer(new Transfer[0]);
98
        fDropTarget.setTransfer(new Transfer[0]);
99
        fDropTarget.addDropListener(this);
99
        fDropTarget.addDropListener(this);
100
    }
100
    }
101
101
102
    /**
102
    /**
103
     * Register a <code>DropTargetListener</code> for the given provider. For every provider, one listener
103
     * Register a <code>DropTargetListener</code> for the given provider. For every provider, one listener
104
     * can be registered. If this method is called and a listener for the given provider is already registered, 
104
     * can be registered. If this method is called and a listener for the given provider is already registered, 
105
     * the previous listener is removed and the new one is added.
105
     * the previous listener is removed and the new one is added.
106
     * @param provider the provider
106
     * @param provider the provider
107
     * @param operations the supported operations
107
     * @param operations the supported operations
108
     * @param transferTypes the supported types
108
     * @param transferTypes the supported types
109
     * @param listener the listener to be notified
109
     * @param listener the listener to be notified
110
     */
110
     */
111
    public void addDropSupport(IBugProvider provider, int operations, Transfer[] transferTypes, DropTargetListener listener) {
111
    public void addDropSupport(IBugProvider provider, int operations, Transfer[] transferTypes, DropTargetListener listener) {
112
	    if (fListenerInfos.containsKey(provider))
112
	    if (fListenerInfos.containsKey(provider))
113
	        internalRemoveSupport(provider);
113
	        internalRemoveSupport(provider);
114
        fListenerInfos.put(provider, new ListenerInfo(listener, operations, transferTypes));
114
        fListenerInfos.put(provider, new ListenerInfo(listener, operations, transferTypes));
115
        fTransfers.addAll(Arrays.asList(transferTypes));
115
        fTransfers.addAll(Arrays.asList(transferTypes));
116
        updateDropTarget();
116
        updateDropTarget();
117
	}
117
	}
118
    
118
    
119
    /**
119
    /**
120
     * Remove the listener for the given provider.
120
     * Remove the listener for the given provider.
121
     * @param provider the provider.
121
     * @param provider the provider.
122
     */
122
     */
123
    public void removeDropSupport(IBugProvider provider) {
123
    public void removeDropSupport(IBugProvider provider) {
124
        internalRemoveSupport(provider);
124
        internalRemoveSupport(provider);
125
        updateDropTarget();
125
        updateDropTarget();
126
    }
126
    }
127
    
127
    
128
    /**
128
    /**
129
     * Update the drag source with the set of all supported transfer types.
129
     * Update the drag source with the set of all supported transfer types.
130
     */
130
     */
131
    private void updateDropTarget() {
131
    private void updateDropTarget() {
132
        final Set set= new HashSet(fTransfers);
132
        final Set set= new HashSet(fTransfers);
133
        final Transfer [] transfers= new Transfer[set.size()];
133
        final Transfer [] transfers= new Transfer[set.size()];
134
        set.toArray(transfers);
134
        set.toArray(transfers);
135
        fDropTarget.setTransfer(transfers);
135
        fDropTarget.setTransfer(transfers);
136
    }
136
    }
137
137
138
    /**
138
    /**
139
     * A helper method to unregister the listener for a provider. 
139
     * A helper method to unregister the listener for a provider. 
140
     * @param provider the provider
140
     * @param provider the provider
141
     */
141
     */
142
    private void internalRemoveSupport(IBugProvider provider) {
142
    private void internalRemoveSupport(IBugProvider provider) {
143
        final ListenerInfo info= (ListenerInfo)fListenerInfos.remove(provider);
143
        final ListenerInfo info= (ListenerInfo)fListenerInfos.remove(provider);
144
        if (info == null)
144
        if (info == null)
145
            return;
145
            return;
146
        final Transfer [] transfers= info.getTransferTypes();
146
        final Transfer [] transfers= info.getTransferTypes();
147
        for (int i = 0; i < transfers.length; i++) {
147
        for (int i = 0; i < transfers.length; i++) {
148
            fTransfers.remove(transfers[i]);
148
            fTransfers.remove(transfers[i]);
149
        }
149
        }
150
    }
150
    }
151
151
152
    /* (non-Javadoc)
152
    /* (non-Javadoc)
153
     * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
153
     * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
154
     */
154
     */
155
    public void dragEnter(DropTargetEvent event) {
155
    public void dragEnter(DropTargetEvent event) {
156
        final ListenerInfo info= getCurrentInfo(event);
156
        final ListenerInfo info= getCurrentInfo(event);
157
        if (info != null && info.supports(event.dataTypes, event.operations)) {
157
        if (info != null && info.supports(event.dataTypes, event.operations)) {
158
            info.getListener().dragEnter(event);
158
            info.getListener().dragEnter(event);
159
            return;
159
            return;
160
        }
160
        }
161
        event.detail= DND.DROP_NONE;
161
        event.detail= DND.DROP_NONE;
162
        event.currentDataType= null;
162
        event.currentDataType= null;
163
    }
163
    }
164
164
165
    /* (non-Javadoc)
165
    /* (non-Javadoc)
166
     * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(org.eclipse.swt.dnd.DropTargetEvent)
166
     * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(org.eclipse.swt.dnd.DropTargetEvent)
167
     */
167
     */
168
    public void dragLeave(DropTargetEvent event) {
168
    public void dragLeave(DropTargetEvent event) {
169
        final ListenerInfo info= getCurrentInfo(event);
169
        final ListenerInfo info= getCurrentInfo(event);
170
        if (info != null && info.supports(event.dataTypes, event.operations)) {
170
        if (info != null && info.supports(event.dataTypes, event.operations)) {
171
            info.getListener().dragLeave(event);
171
            info.getListener().dragLeave(event);
172
            return;
172
            return;
173
        }
173
        }
174
        event.detail= DND.DROP_NONE;
174
        event.detail= DND.DROP_NONE;
175
        event.currentDataType= null;
175
        event.currentDataType= null;
176
    }
176
    }
177
177
178
    /* (non-Javadoc)
178
    /* (non-Javadoc)
179
     * @see org.eclipse.swt.dnd.DropTargetListener#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
179
     * @see org.eclipse.swt.dnd.DropTargetListener#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
180
     */
180
     */
181
    public void dragOperationChanged(DropTargetEvent event) {
181
    public void dragOperationChanged(DropTargetEvent event) {
182
        final ListenerInfo info= getCurrentInfo(event);
182
        final ListenerInfo info= getCurrentInfo(event);
183
        if (info != null && info.supports(event.dataTypes, event.operations)) {
183
        if (info != null && info.supports(event.dataTypes, event.operations)) {
184
            info.getListener().dragOperationChanged(event);
184
            info.getListener().dragOperationChanged(event);
185
            return;
185
            return;
186
        }
186
        }
187
        event.detail= DND.DROP_NONE;
187
        event.detail= DND.DROP_NONE;
188
        event.currentDataType= null;
188
        event.currentDataType= null;
189
    }
189
    }
190
190
191
    /* (non-Javadoc)
191
    /* (non-Javadoc)
192
     * @see org.eclipse.swt.dnd.DropTargetListener#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
192
     * @see org.eclipse.swt.dnd.DropTargetListener#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
193
     */
193
     */
194
    public void dragOver(DropTargetEvent event) {
194
    public void dragOver(DropTargetEvent event) {
195
        final ListenerInfo info= getCurrentInfo(event);
195
        final ListenerInfo info= getCurrentInfo(event);
196
        if (info != null && info.supports(event.dataTypes, event.operations)) {
196
        if (info != null && info.supports(event.dataTypes, event.operations)) {
197
            info.getListener().dragOver(event);
197
            info.getListener().dragOver(event);
198
            return;
198
            return;
199
        } 
199
        } 
200
        event.detail= DND.DROP_NONE;
200
        event.detail= DND.DROP_NONE;
201
        event.currentDataType= null;
201
        event.currentDataType= null;
202
    }
202
    }
203
203
204
204
205
    /* (non-Javadoc)
205
    /* (non-Javadoc)
206
     * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
206
     * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
207
     */
207
     */
208
    public void drop(DropTargetEvent event) {
208
    public void drop(DropTargetEvent event) {
209
        final ListenerInfo info= getCurrentInfo(event);
209
        final ListenerInfo info= getCurrentInfo(event);
210
        if (info.supports(event.dataTypes, event.operations)) {
210
        if (info.supports(event.dataTypes, event.operations)) {
211
            info.getListener().drop(event);
211
            info.getListener().drop(event);
212
        } else {
212
        } else {
213
            event.detail= DND.DROP_NONE;
213
            event.detail= DND.DROP_NONE;
214
            event.currentDataType= null;
214
            event.currentDataType= null;
215
        }
215
        }
216
    }
216
    }
217
217
218
218
219
    /* (non-Javadoc)
219
    /* (non-Javadoc)
220
     * @see org.eclipse.swt.dnd.DropTargetListener#dropAccept(org.eclipse.swt.dnd.DropTargetEvent)
220
     * @see org.eclipse.swt.dnd.DropTargetListener#dropAccept(org.eclipse.swt.dnd.DropTargetEvent)
221
     */
221
     */
222
    public void dropAccept(DropTargetEvent event) {
222
    public void dropAccept(DropTargetEvent event) {
223
        final ListenerInfo info= getCurrentInfo(event);
223
        final ListenerInfo info= getCurrentInfo(event);
224
        if (info.supports(event.dataTypes, event.operations)) {
224
        if (info.supports(event.dataTypes, event.operations)) {
225
            info.getListener().dropAccept(event);
225
            info.getListener().dropAccept(event);
226
        } else {
226
        } else {
227
            event.detail= DND.DROP_NONE;
227
            event.detail= DND.DROP_NONE;
228
            event.currentDataType= null;
228
            event.currentDataType= null;
229
        }
229
        }
230
    }
230
    }
231
    
231
    
232
    protected ListenerInfo getCurrentInfo(DropTargetEvent event) {
232
    protected ListenerInfo getCurrentInfo(DropTargetEvent event) {
233
        if (event.item == null)
233
        if (event.item == null)
234
            return null;
234
            return null;
235
        final IGenericModel element= (IGenericModel)event.item.getData();
235
        final IGenericModel element= (IGenericModel)event.item.getData();
236
        if (element == null)
236
        if (element == null)
237
            return null;
237
            return null;
238
        final IBugProvider provider= element.getProvider();
238
        final IBugProvider provider= element.getProvider();
239
        return (ListenerInfo)fListenerInfos.get(provider);
239
        return (ListenerInfo)fListenerInfos.get(provider);
240
    }
240
    }
241
}
241
}

Return to bug 81795