1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.eclipse.adt.internal.refactorings.extractstring; 18 19 import org.eclipse.ltk.core.refactoring.RefactoringContribution; 20 import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; 21 22 import java.util.Map; 23 24 /** 25 * @see ExtractStringDescriptor 26 */ 27 public class ExtractStringContribution extends RefactoringContribution { 28 29 /* (non-Javadoc) 30 * @see org.eclipse.ltk.core.refactoring.RefactoringContribution#createDescriptor(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Map, int) 31 */ 32 @SuppressWarnings({"unchecked", "rawtypes"}) 33 @Override createDescriptor( String id, String project, String description, String comment, Map arguments, int flags)34 public RefactoringDescriptor createDescriptor( 35 String id, 36 String project, 37 String description, 38 String comment, 39 Map arguments, 40 int flags) 41 throws IllegalArgumentException { 42 return new ExtractStringDescriptor(project, description, comment, arguments); 43 } 44 45 @SuppressWarnings("rawtypes") 46 @Override retrieveArgumentMap(RefactoringDescriptor descriptor)47 public Map retrieveArgumentMap(RefactoringDescriptor descriptor) { 48 if (descriptor instanceof ExtractStringDescriptor) { 49 return ((ExtractStringDescriptor) descriptor).getArguments(); 50 } 51 return super.retrieveArgumentMap(descriptor); 52 } 53 } 54