KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > breakpoints > BreakpointTypeOrganizer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.views.breakpoints;
12
13 import java.util.HashMap JavaDoc;
14 import java.util.Map JavaDoc;
15
16 import org.eclipse.core.runtime.IAdaptable;
17 import org.eclipse.debug.core.DebugPlugin;
18 import org.eclipse.debug.core.model.IBreakpoint;
19 import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
20 import org.eclipse.debug.ui.BreakpointTypeCategory;
21 import org.eclipse.debug.ui.IBreakpointTypeCategory;
22
23 /**
24  * Breakpoint organizers for breakpoint types.
25  *
26  * @since 3.1
27  */

28 public class BreakpointTypeOrganizer extends AbstractBreakpointOrganizerDelegate {
29     
30     private Map JavaDoc fTypes = new HashMap JavaDoc();
31
32     /* (non-Javadoc)
33      * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
34      */

35     public IAdaptable[] getCategories(IBreakpoint breakpoint) {
36         IBreakpointTypeCategory category = (IBreakpointTypeCategory) breakpoint.getAdapter(IBreakpointTypeCategory.class);
37         if (category != null) {
38             return new IAdaptable[]{category};
39         }
40         String JavaDoc name = DebugPlugin.getDefault().getBreakpointManager().getTypeName(breakpoint);
41         if (name != null) {
42             IAdaptable[] categories = (IAdaptable[]) fTypes.get(name);
43             if (categories == null) {
44                 categories = new IAdaptable[]{new BreakpointTypeCategory(name)};
45                 fTypes.put(name, categories);
46             }
47             return categories;
48         }
49         return null;
50     }
51     
52     /* (non-Javadoc)
53      * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#dispose()
54      */

55     public void dispose() {
56         fTypes.clear();
57     }
58
59 }
60
Popular Tags