@Override public final Map<String, String> retrieveArgumentMap(final RefactoringDescriptor descriptor) { Assert.isNotNull(descriptor); if (descriptor instanceof JavaRefactoringDescriptor) return ((JavaRefactoringDescriptor) descriptor).getArguments(); return super.retrieveArgumentMap(descriptor); }
/** * Returns the argument map of the specified descriptor. * * @param descriptor * the refactoring descriptor * @return the argument map, or <code>null</code> */ public static Map getArgumentMap(final RefactoringDescriptor descriptor) { Map arguments= null; final RefactoringContribution contribution= RefactoringContributionManager.getInstance().getRefactoringContribution(descriptor.getID()); if (contribution != null) arguments= contribution.retrieveArgumentMap(descriptor); else if (descriptor instanceof DefaultRefactoringDescriptor) arguments= ((DefaultRefactoringDescriptor) descriptor).getArguments(); return arguments; }
/** * Returns the argument map of the specified descriptor. * * @param descriptor * the refactoring descriptor * @return the argument map, or <code>null</code> */ public static Map<String, String> getArgumentMap(final RefactoringDescriptor descriptor) { Map<String, String> arguments= null; final RefactoringContribution contribution= RefactoringContributionManager.getInstance().getRefactoringContribution(descriptor.getID()); if (contribution != null) arguments= contribution.retrieveArgumentMap(descriptor); else if (descriptor instanceof DefaultRefactoringDescriptor) arguments= ((DefaultRefactoringDescriptor) descriptor).getArguments(); return arguments; }
/** * Returns the argument map of the specified descriptor. * * @param descriptor * the refactoring descriptor * @return the argument map, or <code>null</code> */ public static Map<String, String> getArgumentMap(final RefactoringDescriptor descriptor) { Map<String, String> arguments= null; final RefactoringContribution contribution= RefactoringContributionManager.getInstance().getRefactoringContribution(descriptor.getID()); if (contribution != null) arguments= contribution.retrieveArgumentMap(descriptor); else if (descriptor instanceof DefaultRefactoringDescriptor) arguments= ((DefaultRefactoringDescriptor) descriptor).getArguments(); return arguments; }
RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(javaDescriptor.getID()); Map<String, String> map= contribution.retrieveArgumentMap(descriptor); if (fJavaProject == null) { status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.InitializableRefactoring_inacceptable_arguments));
RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(javaDescriptor.getID()); Map<String, String> map= contribution.retrieveArgumentMap(descriptor); if (fJavaProject == null) { status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.InitializableRefactoring_inacceptable_arguments));
private IntroduceParameterDescriptor getRefactoringDescriptor() { ChangeMethodSignatureDescriptor extended= (ChangeMethodSignatureDescriptor) fChangeSignatureProcessor.createDescriptor(); RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(IJavaRefactorings.CHANGE_METHOD_SIGNATURE); Map<String, String> argumentsMap= contribution.retrieveArgumentMap(extended); final Map<String, String> arguments= new HashMap<>(); arguments.put(ATTRIBUTE_ARGUMENT, fParameter.getNewName()); arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, Integer.valueOf(fSelectionStart).toString() + " " + Integer.valueOf(fSelectionLength).toString()); //$NON-NLS-1$ arguments.putAll(argumentsMap); String signature= fChangeSignatureProcessor.getMethodName(); try { signature= fChangeSignatureProcessor.getOldMethodSignature(); } catch (JavaModelException exception) { JavaPlugin.log(exception); } final String description= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fChangeSignatureProcessor.getMethod().getElementName())); final String header= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fParameter.getNewName()), signature, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))}); final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(extended.getProject(), this, header); comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_original_pattern, JavaElementLabels.getTextLabel(fChangeSignatureProcessor.getMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED))); comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_pattern, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression)))); comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_parameter_pattern, BasicElementLabels.getJavaElementName(getAddedParameterInfo().getNewName()))); return RefactoringSignatureDescriptorFactory.createIntroduceParameterDescriptor(extended.getProject(), description, comment.asString(), arguments, extended.getFlags()); }
private IntroduceParameterDescriptor getRefactoringDescriptor() { ChangeMethodSignatureDescriptor extended= (ChangeMethodSignatureDescriptor) fChangeSignatureProcessor.createDescriptor(); RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(IJavaRefactorings.CHANGE_METHOD_SIGNATURE); Map<String, String> argumentsMap= contribution.retrieveArgumentMap(extended); final Map<String, String> arguments= new HashMap<>(); arguments.put(ATTRIBUTE_ARGUMENT, fParameter.getNewName()); arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$ arguments.putAll(argumentsMap); String signature= fChangeSignatureProcessor.getMethodName(); try { signature= fChangeSignatureProcessor.getOldMethodSignature(); } catch (JavaModelException exception) { JavaPlugin.log(exception); } final String description= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fChangeSignatureProcessor.getMethod().getElementName())); final String header= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fParameter.getNewName()), signature, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))}); final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(extended.getProject(), this, header); comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_original_pattern, JavaElementLabels.getTextLabel(fChangeSignatureProcessor.getMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED))); comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_pattern, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression)))); comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_parameter_pattern, BasicElementLabels.getJavaElementName(getAddedParameterInfo().getNewName()))); return RefactoringSignatureDescriptorFactory.createIntroduceParameterDescriptor(extended.getProject(), description, comment.asString(), arguments, extended.getFlags()); }