01: /*******************************************************************************
02: * Copyright (c) 2007 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;
11:
12: import java.util.Map;
13:
14: import org.eclipse.core.runtime.CoreException;
15:
16: import org.eclipse.ltk.core.refactoring.Refactoring;
17: import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
18: import org.eclipse.ltk.core.refactoring.RefactoringStatus;
19:
20: import org.eclipse.jdt.core.refactoring.descriptors.ExtractClassDescriptor;
21: import org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringContribution;
22: import org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor;
23:
24: import org.eclipse.jdt.internal.corext.refactoring.structure.ExtractClassRefactoring;
25:
26: public class ExtractClassContribution extends
27: JavaRefactoringContribution {
28:
29: public ExtractClassContribution() {
30: }
31:
32: public RefactoringDescriptor createDescriptor(String id,
33: String project, String description, String comment,
34: Map arguments, int flags) throws IllegalArgumentException {
35: return new ExtractClassDescriptor(project, description,
36: comment, arguments, flags);
37: }
38:
39: public RefactoringDescriptor createDescriptor() {
40: return new ExtractClassDescriptor();
41: }
42:
43: public Refactoring createRefactoring(
44: JavaRefactoringDescriptor descriptor,
45: RefactoringStatus status) throws CoreException {
46: if (!(descriptor instanceof ExtractClassDescriptor)) {
47: status
48: .addFatalError(RefactoringCoreMessages.ExtractClassContribution_error_unknown_descriptor);
49: return null;
50: }
51: return new ExtractClassRefactoring(
52: (ExtractClassDescriptor) descriptor);
53: }
54:
55: }
|