KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > actions > AddPackageStepFilterAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.jdt.internal.debug.ui.actions;
12
13
14 import org.eclipse.debug.core.DebugException;
15 import org.eclipse.jdt.debug.core.IJavaStackFrame;
16
17 /**
18  * Adds a Java package to the set of active step filters.
19  */

20 public class AddPackageStepFilterAction extends AbstractAddStepFilterAction {
21
22     /**
23      * @see org.eclipse.jdt.internal.debug.ui.actions.AbstractAddStepFilterAction#generateStepFilterPattern(org.eclipse.jdt.debug.core.IJavaStackFrame)
24      */

25     protected String JavaDoc generateStepFilterPattern(IJavaStackFrame frame) {
26         String JavaDoc typeName;
27         try {
28             typeName = frame.getDeclaringTypeName();
29         } catch (DebugException de) {
30             return null;
31         }
32         
33         // Check for default package, which is not supported by JDI
34
int lastDot = typeName.lastIndexOf('.');
35         if (lastDot < 0) {
36             return null;
37         }
38                 
39         // Append ".*" to the pattern to form a package name
40
String JavaDoc packageName = typeName.substring(0, lastDot + 1);
41         packageName += '*';
42         return packageName;
43     }
44
45 }
46
Popular Tags