本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor类的典型用法代码示例。如果您正苦于以下问题:Java ChangeSignatureProcessor类的具体用法?Java ChangeSignatureProcessor怎么用?Java ChangeSignatureProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeSignatureProcessor类属于org.eclipse.jdt.internal.corext.refactoring.structure包,在下文中一共展示了ChangeSignatureProcessor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: helper1
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
private void helper1(String[] newNames, String[] signature) throws Exception {
ICompilationUnit cu = createCUfromTestFile(getPackageP(), true, true);
IType classA = getType(cu, "A");
IMethod method = classA.getMethod("m", signature);
Assert.assertTrue(
"refactoring not available",
RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
Refactoring ref = new ProcessorBasedRefactoring(processor);
// ref.setUpdateReferences(updateReferences);
// ref.setNewParameterNames(newNames);
// ref.setNewNames(createRenamings(method, newNames));
modifyInfos(processor.getParameterInfos(), newNames);
RefactoringStatus result = performRefactoring(ref);
Assert.assertEquals("precondition was supposed to pass", null, result);
IPackageFragment pack = (IPackageFragment) cu.getParent();
String newCuName = getSimpleTestFileName(true, true);
ICompilationUnit newcu = pack.getCompilationUnit(newCuName);
Assert.assertTrue(newCuName + " does not exist", newcu.exists());
Assert.assertEquals(
"invalid renaming",
getFileContents(getTestFileName(true, false)).length(),
newcu.getSource().length());
assertEqualLines(
"invalid renaming", getFileContents(getTestFileName(true, false)), newcu.getSource());
}
示例2: helper2
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
private void helper2(String[] newNames, String[] signature) throws Exception {
IType classA = getType(createCUfromTestFile(getPackageP(), false, false), "A");
// DebugUtils.dump("classA" + classA);
IMethod method = classA.getMethod("m", signature);
Assert.assertTrue(
"refactoring not available",
RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
Refactoring ref = new ProcessorBasedRefactoring(processor);
modifyInfos(processor.getParameterInfos(), newNames);
RefactoringStatus result = performRefactoring(ref);
Assert.assertNotNull("precondition was supposed to fail", result);
}
示例3: createRefactoring
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException {
JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
ChangeSignatureProcessor processor= new ChangeSignatureProcessor(arguments, status);
return new ProcessorBasedRefactoring(processor);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ChangeMethodSignatureRefactoringContribution.java
示例4: startChangeSignatureRefactoring
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
public static void startChangeSignatureRefactoring(final IMethod method, final SelectionDispatchAction action, final Shell shell) throws JavaModelException {
if (!RefactoringAvailabilityTester.isChangeSignatureAvailable(method))
return;
try {
ChangeSignatureProcessor processor= new ChangeSignatureProcessor(method);
RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
Object element= entry.getData();
if (element != null) {
String message= Messages.format(RefactoringMessages.RefactoringErrorDialogUtil_okToPerformQuestion, entry.getMessage());
if (MessageDialog.openQuestion(shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, message)) {
IStructuredSelection selection= new StructuredSelection(element);
// TODO: should not hijack this
// ModifiyParametersAction.
// The action is set up on an editor, but we use it
// as if it were set up on a ViewPart.
boolean wasEnabled= action.isEnabled();
action.selectionChanged(selection);
if (action.isEnabled()) {
action.run(selection);
} else {
MessageDialog.openInformation(shell, ActionMessages.ModifyParameterAction_problem_title, ActionMessages.ModifyParameterAction_problem_message);
}
action.setEnabled(wasEnabled);
}
}
return;
}
}
Refactoring refactoring= new ProcessorBasedRefactoring(processor);
ChangeSignatureWizard wizard= new ChangeSignatureWizard(processor, refactoring);
new RefactoringStarter().activate(wizard, shell, wizard.getDefaultPageTitle(), RefactoringSaveHelper.SAVE_REFACTORING);
} catch (CoreException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.RefactoringStarter_unexpected_exception);
}
}
示例5: validateDefaultValue
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
private IStatus validateDefaultValue() {
if (fDefaultValue == null)
return null;
String defaultValue= fDefaultValue.getText();
if (defaultValue.length() == 0)
return createErrorStatus(RefactoringMessages.ParameterEditDialog_defaultValue_error);
if (ChangeSignatureProcessor.isValidExpression(defaultValue))
return Status.OK_STATUS;
String msg= Messages.format(RefactoringMessages.ParameterEditDialog_defaultValue_invalid, new String[]{defaultValue});
return createErrorStatus(msg);
}
示例6: ChangeSignatureWizard
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
public ChangeSignatureWizard(ChangeSignatureProcessor processor, Refactoring refactoring) {
super(refactoring, DIALOG_BASED_USER_INTERFACE);
fProcessor= processor;
setDefaultPageTitle(RefactoringMessages.ChangeSignatureRefactoring_modify_Parameters);
}
示例7: ChangeSignatureInputPage
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
public ChangeSignatureInputPage(ChangeSignatureProcessor processor) {
super(PAGE_NAME);
fProcessor= processor;
setMessage(RefactoringMessages.ChangeSignatureInputPage_change);
}
示例8: getChangeMethodSignatureProcessor
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
private ChangeSignatureProcessor getChangeMethodSignatureProcessor() {
return fProcessor;
}
示例9: ChangeSignatureInputPage
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; //导入依赖的package包/类
public ChangeSignatureInputPage(ChangeSignatureProcessor processor) {
super(PAGE_NAME);
fProcessor= processor;
setMessage(RefactoringMessages.ChangeSignatureInputPage_change);
fSignaturePreviewDocument= new Document();
}