本文整理汇总了Java中org.eclipse.ltk.core.refactoring.Refactoring.getAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java Refactoring.getAdapter方法的具体用法?Java Refactoring.getAdapter怎么用?Java Refactoring.getAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ltk.core.refactoring.Refactoring
的用法示例。
在下文中一共展示了Refactoring.getAdapter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException {
RenameProcessor processor = (RenameProcessor) refactoring.getAdapter(RenameProcessor.class);
Object[] elements = processor.getElements();
RenameSelectionState state = null;//elements.length == 1 ? new RenameSelectionState(elements[0]) : null;
boolean executed = super.activate(refactoring, parent, saveMode);
TypeScriptRenameProcessor nameUpdating = (TypeScriptRenameProcessor) refactoring
.getAdapter(TypeScriptRenameProcessor.class);
if (executed && nameUpdating != null && state != null) {
// Object newElement = nameUpdating.getNewElement();
// if (newElement != null) {
// state.restore(newElement);
// }
}
return executed;
}
示例2: helperWithTextual
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
private String[] helperWithTextual(
String oldCuName,
String oldName,
String newName,
String newCUName,
boolean updateReferences,
boolean updateTextualMatches)
throws Exception {
ICompilationUnit cu = createCUfromTestFile(getPackageP(), oldCuName);
IType classA = getType(cu, oldName);
IJavaElement[] classAMembers = classA.getChildren();
IPackageFragment pack = (IPackageFragment) cu.getParent();
String[] renameHandles = null;
if (classA.getDeclaringType() == null
&& cu.getElementName().startsWith(classA.getElementName())) {
renameHandles = ParticipantTesting.createHandles(classA, cu, cu.getResource());
} else {
renameHandles = ParticipantTesting.createHandles(classA);
}
RenameJavaElementDescriptor descriptor = createRefactoringDescriptor(classA, newName);
descriptor.setUpdateReferences(updateReferences);
descriptor.setUpdateTextualOccurrences(updateTextualMatches);
Refactoring refactoring = createRefactoring(descriptor);
assertEquals("was supposed to pass", null, performRefactoring(refactoring));
ICompilationUnit newcu = pack.getCompilationUnit(newCUName + ".java");
TestCase.assertTrue("cu " + newcu.getElementName() + " does not exist", newcu.exists());
assertEqualLines(
"invalid renaming", getFileContents(getOutputTestFileName(newCUName)), newcu.getSource());
INameUpdating nameUpdating = ((INameUpdating) refactoring.getAdapter(INameUpdating.class));
IType newElement = (IType) nameUpdating.getNewElement();
TestCase.assertTrue(
"new element does not exist:\n" + newElement.toString(), newElement.exists());
checkMappers(refactoring, classA, newCUName + ".java", classAMembers);
return renameHandles;
}
示例3: generateDeprecateDelegateCheckbox
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
public static Button generateDeprecateDelegateCheckbox(Composite parent, Refactoring refactoring) {
final IDelegateUpdating updating= (IDelegateUpdating) refactoring.getAdapter(IDelegateUpdating.class);
if (updating == null || !updating.canEnableDelegateUpdating())
return null;
final Button button= createCheckbox(parent, getDeprecateDelegateCheckBoxTitle(), loadDeprecateDelegateSetting(updating));
updating.setDeprecateDelegates(button.getSelection());
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updating.setDeprecateDelegates(button.getSelection());
}
});
return button;
}
示例4: generateLeaveDelegateCheckbox
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
public static Button generateLeaveDelegateCheckbox(Composite parent, Refactoring refactoring, boolean plural) {
final IDelegateUpdating updating= (IDelegateUpdating) refactoring.getAdapter(IDelegateUpdating.class);
if (updating == null || !updating.canEnableDelegateUpdating())
return null;
final Button button= createCheckbox(parent, updating.getDelegateUpdatingTitle(plural), loadLeaveDelegateSetting(updating));
updating.setDelegateUpdating(button.getSelection());
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updating.setDelegateUpdating(button.getSelection());
}
});
return button;
}
示例5: activate
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
@Override
public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException {
RenameProcessor processor= (RenameProcessor)refactoring.getAdapter(RenameProcessor.class);
Object[] elements= processor.getElements();
RenameSelectionState state= elements.length == 1 ? new RenameSelectionState(elements[0]) : null;
boolean executed= super.activate(refactoring, parent, saveMode);
INameUpdating nameUpdating= (INameUpdating)refactoring.getAdapter(INameUpdating.class);
if (executed && nameUpdating != null && state != null) {
Object newElement= nameUpdating.getNewElement();
if (newElement != null) {
state.restore(newElement);
}
}
return executed;
}
示例6: activate
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
@Override
public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException {
RenameVirtualMethodProcessor processor= (RenameVirtualMethodProcessor)refactoring.getAdapter(RenameVirtualMethodProcessor.class);
if (processor != null) {
RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor());
if (!status.hasFatalError()) {
IMethod method= processor.getMethod();
if (!method.equals(processor.getOriginalMethod())) {
String message= null;
if (method.getDeclaringType().isInterface()) {
message= Messages.format(
RefactoringCoreMessages.MethodChecks_implements,
new String[]{
JavaElementUtil.createMethodSignature(method),
JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)});
} else {
message= Messages.format(
RefactoringCoreMessages.MethodChecks_overrides,
new String[]{
JavaElementUtil.createMethodSignature(method),
JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)});
}
message= Messages.format(
ReorgMessages.RenameMethodUserInterfaceStarter_message,
message);
if (!MessageDialog.openQuestion(parent,
ReorgMessages.RenameMethodUserInterfaceStarter_name,
message)) {
return false;
}
}
}
}
return super.activate(refactoring, parent, saveMode);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:RenameMethodUserInterfaceStarter.java
示例7: updateForcePreview
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
private void updateForcePreview() {
boolean forcePreview= false;
Refactoring refactoring= getRefactoring();
ITextUpdating tu= (ITextUpdating) refactoring.getAdapter(ITextUpdating.class);
IQualifiedNameUpdating qu= (IQualifiedNameUpdating)refactoring.getAdapter(IQualifiedNameUpdating.class);
if (tu != null) {
forcePreview= tu.getUpdateTextualMatches();
}
if (qu != null) {
forcePreview |= qu.getUpdateQualifiedNames();
}
getRefactoringWizard().setForcePreviewReview(forcePreview);
}
示例8: DeleteWizard
import org.eclipse.ltk.core.refactoring.Refactoring; //导入方法依赖的package包/类
public DeleteWizard(Refactoring refactoring) {
super(refactoring, DIALOG_BASED_USER_INTERFACE);
setDefaultPageTitle(RefactoringMessages.DeleteWizard_1);
fProcessor= (JavaDeleteProcessor) refactoring.getAdapter(JavaDeleteProcessor.class);
fProcessor.setQueries(new ReorgQueries(this));
}