本文整理汇总了Java中org.eclipse.ltk.core.refactoring.TextChange.setKeepPreviewEdits方法的典型用法代码示例。如果您正苦于以下问题:Java TextChange.setKeepPreviewEdits方法的具体用法?Java TextChange.setKeepPreviewEdits怎么用?Java TextChange.setKeepPreviewEdits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ltk.core.refactoring.TextChange
的用法示例。
在下文中一共展示了TextChange.setKeepPreviewEdits方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdditionalProposalInfo
import org.eclipse.ltk.core.refactoring.TextChange; //导入方法依赖的package包/类
@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
StringBuffer buf = new StringBuffer();
try {
TextChange change = getTextChange();
change.setKeepPreviewEdits(true);
IDocument previewDocument = change.getPreviewDocument(monitor);
TextEdit rootEdit = change.getPreviewEdit(change.getEdit());
EditAnnotator ea = new EditAnnotator(buf, previewDocument);
rootEdit.accept(ea);
ea.unchangedUntil(previewDocument.getLength()); // Final pre-existing region
} catch (CoreException e) {
JavaPlugin.log(e);
}
return buf.toString();
}
示例2: getAdditionalProposalInfo
import org.eclipse.ltk.core.refactoring.TextChange; //导入方法依赖的package包/类
@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
StringBuffer buf= new StringBuffer();
try {
TextChange change= getTextChange();
change.setKeepPreviewEdits(true);
IDocument previewDocument= change.getPreviewDocument(monitor);
TextEdit rootEdit= change.getPreviewEdit(change.getEdit());
EditAnnotator ea= new EditAnnotator(buf, previewDocument);
rootEdit.accept(ea);
ea.unchangedUntil(previewDocument.getLength()); // Final pre-existing region
} catch (CoreException e) {
JavaPlugin.log(e);
}
return buf.toString();
}
示例3: getAdditionalProposalInfo
import org.eclipse.ltk.core.refactoring.TextChange; //导入方法依赖的package包/类
@Override
public String getAdditionalProposalInfo(IProgressMonitor monitor) throws CoreException {
StringBuffer buf= new StringBuffer();
TextChange change = getTextChange();
change.setKeepPreviewEdits(true);
IDocument previewDocument = change.getPreviewDocument(monitor);
TextEdit rootEdit = change.getPreviewEdit(change.getEdit());
EditAnnotator ea = new EditAnnotator(buf, previewDocument);
rootEdit.accept(ea);
ea.unchangedUntil(previewDocument.getLength()); // Final pre-existing
// region
return buf.toString();
}
示例4: checkCUCompleteConditions
import org.eclipse.ltk.core.refactoring.TextChange; //导入方法依赖的package包/类
private void checkCUCompleteConditions(final RefactoringStatus status, CompilationUnit currentResolvedCU, ICompilationUnit currentCU, List<RefactoringProcessor> processors) throws CoreException {
// check local variable conditions
List<RefactoringProcessor> locals= getProcessorsOfType(processors, RenameLocalVariableProcessor.class);
if (!locals.isEmpty()) {
RenameAnalyzeUtil.LocalAnalyzePackage[] analyzePackages= new RenameAnalyzeUtil.LocalAnalyzePackage[locals.size()];
TextChangeManager manager= new TextChangeManager();
int current= 0;
TextChange textChange= manager.get(currentCU);
textChange.setKeepPreviewEdits(true);
for (Iterator<RefactoringProcessor> iterator= locals.iterator(); iterator.hasNext();) {
RenameLocalVariableProcessor localProcessor= (RenameLocalVariableProcessor) iterator.next();
RenameAnalyzeUtil.LocalAnalyzePackage analyzePackage= localProcessor.getLocalAnalyzePackage();
analyzePackages[current]= analyzePackage;
for (int i= 0; i < analyzePackage.fOccurenceEdits.length; i++) {
TextChangeCompatibility.addTextEdit(textChange, "", analyzePackage.fOccurenceEdits[i], GroupCategorySet.NONE); //$NON-NLS-1$
}
current++;
}
status.merge(RenameAnalyzeUtil.analyzeLocalRenames(analyzePackages, textChange, currentResolvedCU, false));
}
/*
* There is room for performance improvement here: One could move
* shadowing analyzes out of the field and method processors and perform
* it here, thus saving on working copy creation. Drawback is increased
* heap consumption.
*/
}
示例5: getAdditionalProposalInfo
import org.eclipse.ltk.core.refactoring.TextChange; //导入方法依赖的package包/类
@Override
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
final StringBuffer buf= new StringBuffer();
try {
for (int i= 0; i < fChanges.length; i++) {
if (fChanges[i] instanceof TextChange) {
TextChange change= (TextChange) fChanges[i];
String filename= getFileName(change);
if (filename != null) {
buf.append("<b>"); //$NON-NLS-1$
buf.append(filename);
buf.append("</b>"); //$NON-NLS-1$
buf.append("<br>"); //$NON-NLS-1$
}
change.setKeepPreviewEdits(true);
IDocument currentContent= change.getCurrentDocument(monitor);
TextEdit rootEdit= change.getEdit();
EditAnnotator ea= new EditAnnotator(buf, currentContent) {
@Override
protected boolean rangeRemoved(TextEdit edit) {
return annotateEdit(edit, "<del>", "</del>"); //$NON-NLS-1$ //$NON-NLS-2$
}
};
rootEdit.accept(ea);
ea.unchangedUntil(currentContent.getLength()); // Final pre-existing region
buf.append("<br><br>"); //$NON-NLS-1$
}
}
} catch (CoreException e) {
JavaPlugin.log(e);
}
return buf.toString();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:PropertiesQuickAssistProcessor.java
示例6: checkCUCompleteConditions
import org.eclipse.ltk.core.refactoring.TextChange; //导入方法依赖的package包/类
private void checkCUCompleteConditions(
final RefactoringStatus status,
CompilationUnit currentResolvedCU,
ICompilationUnit currentCU,
List<RefactoringProcessor> processors)
throws CoreException {
// check local variable conditions
List<RefactoringProcessor> locals =
getProcessorsOfType(processors, RenameLocalVariableProcessor.class);
if (!locals.isEmpty()) {
RenameAnalyzeUtil.LocalAnalyzePackage[] analyzePackages =
new RenameAnalyzeUtil.LocalAnalyzePackage[locals.size()];
TextChangeManager manager = new TextChangeManager();
int current = 0;
TextChange textChange = manager.get(currentCU);
textChange.setKeepPreviewEdits(true);
for (Iterator<RefactoringProcessor> iterator = locals.iterator(); iterator.hasNext(); ) {
RenameLocalVariableProcessor localProcessor =
(RenameLocalVariableProcessor) iterator.next();
RenameAnalyzeUtil.LocalAnalyzePackage analyzePackage =
localProcessor.getLocalAnalyzePackage();
analyzePackages[current] = analyzePackage;
for (int i = 0; i < analyzePackage.fOccurenceEdits.length; i++) {
TextChangeCompatibility.addTextEdit(
textChange,
"",
analyzePackage.fOccurenceEdits[i],
GroupCategorySet.NONE); // $NON-NLS-1$
}
current++;
}
status.merge(
RenameAnalyzeUtil.analyzeLocalRenames(
analyzePackages, textChange, currentResolvedCU, false));
}
/*
* There is room for performance improvement here: One could move
* shadowing analyzes out of the field and method processors and perform
* it here, thus saving on working copy creation. Drawback is increased
* heap consumption.
*/
}