KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > core > refactoring > DeleteBreakpointChange


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.core.refactoring;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15 import org.eclipse.jdt.debug.core.IJavaBreakpoint;
16 import org.eclipse.ltk.core.refactoring.Change;
17 import org.eclipse.ltk.core.refactoring.NullChange;
18
19 import com.ibm.icu.text.MessageFormat;
20
21 /**
22  * A change to delete a breakpoint. Currently used for undo.
23  * When undoing a refactoring, the "target/original" resource does
24  * not exist in time to create a marker on it, and thus the operation
25  * cannot be undone. Instead, we delete breakpoints on undo.
26  *
27  * @since 3.2
28  *
29  */

30 public class DeleteBreakpointChange extends BreakpointChange {
31     
32     public DeleteBreakpointChange(IJavaBreakpoint breakpoint) throws CoreException {
33         super(breakpoint);
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.ltk.core.refactoring.Change#getName()
38      */

39     public String JavaDoc getName() {
40         return MessageFormat.format(RefactoringMessages.DeleteBreakpointChange_0,
41                 new String JavaDoc[] {getBreakpointLabel(getOriginalBreakpoint())});
42     }
43
44     /* (non-Javadoc)
45      * @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor)
46      */

47     public Change perform(IProgressMonitor pm) throws CoreException {
48         getOriginalBreakpoint().delete();
49         return new NullChange();
50     }
51
52 }
53
Popular Tags