01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.corext.refactoring.reorg;
11:
12: import org.eclipse.core.runtime.Assert;
13:
14: import org.eclipse.ltk.core.refactoring.RefactoringStatus;
15: import org.eclipse.ltk.core.refactoring.participants.DeleteProcessor;
16: import org.eclipse.ltk.core.refactoring.participants.DeleteRefactoring;
17: import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
18: import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
19:
20: import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
21: import org.eclipse.jdt.internal.corext.refactoring.tagging.IScriptableRefactoring;
22: import org.eclipse.jdt.internal.corext.util.Messages;
23:
24: /**
25: * A delete refactoring which can be initialized with refactoring arguments.
26: *
27: * @since 3.3
28: */
29: public final class JavaDeleteRefactoring extends DeleteRefactoring
30: implements IScriptableRefactoring {
31:
32: /**
33: * Creates a new java delete refactoring.
34: *
35: * @param processor
36: * the delete processor to use
37: */
38: public JavaDeleteRefactoring(DeleteProcessor processor) {
39: super (processor);
40: }
41:
42: /**
43: * {@inheritDoc}
44: */
45: public RefactoringStatus initialize(
46: final RefactoringArguments arguments) {
47: Assert.isNotNull(arguments);
48: final RefactoringProcessor processor = getProcessor();
49: if (processor instanceof IScriptableRefactoring) {
50: return ((IScriptableRefactoring) processor)
51: .initialize(arguments);
52: }
53: return RefactoringStatus
54: .createFatalErrorStatus(Messages
55: .format(
56: RefactoringCoreMessages.ProcessorBasedRefactoring_error_unsupported_initialization,
57: getProcessor().getIdentifier()));
58: }
59: }
|