本文整理汇总了Java中org.eclipse.ltk.core.refactoring.TextEditBasedChange类的典型用法代码示例。如果您正苦于以下问题:Java TextEditBasedChange类的具体用法?Java TextEditBasedChange怎么用?Java TextEditBasedChange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextEditBasedChange类属于org.eclipse.ltk.core.refactoring包,在下文中一共展示了TextEditBasedChange类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: feedInput
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public ChangePreview feedInput(IChangePreviewViewer viewer, List categories)
throws CoreException {
InternalTextEditChangeNode element = getTextEditChangeNode();
if (element != null) {
Change change = element.getChange();
if (change instanceof TextEditBasedChange) {
List groups = collectTextEditBasedChangeGroups(categories);
return viewer.setInput(
TextEditChangePreviewViewer.createInput(
change,
(TextEditBasedChangeGroup[])
groups.toArray(new TextEditBasedChangeGroup[groups.size()]),
getTextRange()));
}
} else {
return viewer.setInput(null);
}
return null;
}
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:InternalLanguageElementNode.java
示例2: feedInput
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public ChangePreview feedInput(IChangePreviewViewer viewer, List categories)
throws CoreException {
InternalTextEditChangeNode element = getTextEditChangeNode();
if (element != null) {
Change change = element.getChange();
if (change instanceof TextEditBasedChange) {
IRegion range = getTextRange(this);
ChangePreviewViewerInput input = null;
if (range != null) {
input =
TextEditChangePreviewViewer.createInput(
change, new TextEditBasedChangeGroup[] {fChangeGroup}, range);
} else {
input = TextEditChangePreviewViewer.createInput(change, fChangeGroup, 2);
}
return viewer.setInput(input);
}
} else {
return viewer.setInput(null);
}
return null;
}
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:TextEditGroupNode.java
示例3: getAllChanges
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
/**
* Returns all text changes managed by this instance.
*
* @return all text changes managed by this instance
*/
public TextEditBasedChange[] getAllChanges(){
Set<ICompilationUnit> cuSet= fMap.keySet();
ICompilationUnit[] cus= cuSet.toArray(new ICompilationUnit[cuSet.size()]);
// sort by cu name:
Arrays.sort(cus, new Comparator<ICompilationUnit>() {
public int compare(ICompilationUnit o1, ICompilationUnit o2) {
String name1= o1.getElementName();
String name2= o2.getElementName();
return name1.compareTo(name2);
}
});
TextEditBasedChange[] textChanges= new TextEditBasedChange[cus.length];
for (int i= 0; i < cus.length; i++) {
textChanges[i]= fMap.get(cus[i]);
}
return textChanges;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:TextEditBasedChangeManager.java
示例4: wrap
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public static Change wrap(Change delegate) {
if(delegate instanceof TextEditBasedChange) {
return new TextEditBased((TextEditBasedChange) delegate);
} else {
return new Generic(delegate);
}
}
开发者ID:cplutte,项目名称:bts,代码行数:8,代码来源:DisplayChangeWrapper.java
示例5: createChildNodes
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
protected ChildNode[] createChildNodes() {
TextEditBasedChange change = getTextEditBasedChange();
if (change instanceof MultiStateTextFileChange) {
return new ChildNode
[0]; // no edit preview & edit disabling possible in the MultiStateTextFileChange (edits
// must be applied in sequence)
}
TextEditBasedChangeGroup[] groups = getSortedChangeGroups(change);
ChildNode[] result = new ChildNode[groups.length];
for (int i = 0; i < groups.length; i++) {
result[i] = new TextEditGroupNode(this, groups[i]);
}
return result;
}
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:TextEditChangeNode.java
示例6: getSortedChangeGroups
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
private TextEditBasedChangeGroup[] getSortedChangeGroups(TextEditBasedChange change) {
TextEditBasedChangeGroup[] groups = change.getChangeGroups();
List result = new ArrayList(groups.length);
for (int i = 0; i < groups.length; i++) {
if (!groups[i].getTextEditGroup().isEmpty()) result.add(groups[i]);
}
Comparator comparator = new OffsetComparator();
Collections.sort(result, comparator);
return (TextEditBasedChangeGroup[]) result.toArray(new TextEditBasedChangeGroup[result.size()]);
}
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:TextEditChangeNode.java
示例7: createChildNodes
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
@Override
protected ChildNode[] createChildNodes() {
TextEditBasedChange change = getTextEditBasedChange();
if (change instanceof MultiStateTextFileChange) {
return new ChildNode
[0]; // no edit preview & edit disabling possible in the MultiStateTextFileChange (edits
// must be applied
// in sequence)
}
ICompilationUnit cunit = (ICompilationUnit) change.getAdapter(ICompilationUnit.class);
if (cunit != null) {
List<ChildNode> children = new ArrayList<ChildNode>(5);
Map<IJavaElement, JavaLanguageNode> map = new HashMap<IJavaElement, JavaLanguageNode>(20);
TextEditBasedChangeGroup[] changes = getSortedChangeGroups(change);
for (int i = 0; i < changes.length; i++) {
TextEditBasedChangeGroup tec = changes[i];
try {
IJavaElement element = getModifiedJavaElement(tec, cunit);
if (element.equals(cunit)) {
children.add(createTextEditGroupNode(this, tec));
} else {
JavaLanguageNode pjce = getChangeElement(map, element, children, this);
pjce.addChild(createTextEditGroupNode(pjce, tec));
}
} catch (JavaModelException e) {
children.add(createTextEditGroupNode(this, tec));
}
}
return children.toArray(new ChildNode[children.size()]);
} else {
return EMPTY_CHILDREN;
}
}
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:CompilationUnitChangeNode.java
示例8: getSortedChangeGroups
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
private TextEditBasedChangeGroup[] getSortedChangeGroups(TextEditBasedChange change) {
TextEditBasedChangeGroup[] edits = change.getChangeGroups();
List<TextEditBasedChangeGroup> result = new ArrayList<TextEditBasedChangeGroup>(edits.length);
for (int i = 0; i < edits.length; i++) {
if (!edits[i].getTextEditGroup().isEmpty()) result.add(edits[i]);
}
Comparator<TextEditBasedChangeGroup> comparator = new OffsetComparator();
Collections.sort(result, comparator);
return result.toArray(new TextEditBasedChangeGroup[result.size()]);
}
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:CompilationUnitChangeNode.java
示例9: get
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public static ChangePreviewViewerDescriptor get(Object element) throws CoreException {
if (element instanceof TextEditBasedChange) {
return changePreviewViewerDescriptor;
}
return null;
// return fgDescriptions.get(element.getClass());
}
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:ChangePreviewViewerDescriptor.java
示例10: mergeParticipantTextChanges
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
/**
* Attempts to merge all the text changes rooted at <code>rootChange</code>
* into the refactoring's shared text change for each file (via
* {@link RefactoringParticipant#getTextChange(Object)}). Any text changes
* that are merged will be removed from their parents.
*
*
* @param participant the participant which will be used to get the shared
* text change for each file
* @param rootChange the root of the change tree that will be searched for
* text changes to merge into the shared text changes
* @return true if the entire tree was merged and the root change is no longer
* valid
*/
public static boolean mergeParticipantTextChanges(
final RefactoringParticipant participant, Change rootChange) {
final List<Change> dupChanges = new ArrayList<Change>();
ChangeUtilities.acceptOnChange(rootChange, new ChangeVisitor() {
public void visit(Change change) {
if (change instanceof TextEditBasedChange) {
TextEditBasedChange textChange = (TextEditBasedChange) change;
TextChange existingTextChange = participant.getTextChange(textChange.getModifiedElement());
if (existingTextChange == null) {
return;
}
// Merge all changes from text change into the existing
TextEditUtilities.moveTextEditGroupsIntoChange(
textChange.getChangeGroups(), existingTextChange);
dupChanges.add(textChange);
}
}
});
for (Change dupChange : dupChanges) {
ChangeUtilities.removeChange(dupChange,
(CompositeChange) dupChange.getParent());
}
return dupChanges.contains(rootChange);
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:43,代码来源:ChangeUtilities.java
示例11: findTextEditGroup
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
/**
* Finds the text edit group which has the given text edit as a child.
*
* @param change the change that contains the groups
* @param edit the text edit to find
* @return the group that has the text edit as a child, or null
*/
public static TextEditGroup findTextEditGroup(TextEditBasedChange change, TextEdit edit) {
for (TextEditGroup group : getTextEditGroups(change.getChangeGroups())) {
for (TextEdit curEdit : group.getTextEdits()) {
if (edit == curEdit) {
return group;
}
}
}
return null;
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:TextEditUtilities.java
示例12: createChildNodes
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
@Override
protected ChildNode[] createChildNodes() {
TextEditBasedChange change= getTextEditBasedChange();
if (change instanceof MultiStateTextFileChange) {
return new ChildNode[0]; // no edit preview & edit disabling possible in the MultiStateTextFileChange (edits must be applied in sequence)
}
ICompilationUnit cunit= (ICompilationUnit) change.getAdapter(ICompilationUnit.class);
if (cunit != null) {
List<ChildNode> children= new ArrayList<ChildNode>(5);
Map<IJavaElement, JavaLanguageNode> map= new HashMap<IJavaElement, JavaLanguageNode>(20);
TextEditBasedChangeGroup[] changes= getSortedChangeGroups(change);
for (int i= 0; i < changes.length; i++) {
TextEditBasedChangeGroup tec= changes[i];
try {
IJavaElement element= getModifiedJavaElement(tec, cunit);
if (element.equals(cunit)) {
children.add(createTextEditGroupNode(this, tec));
} else {
JavaLanguageNode pjce= getChangeElement(map, element, children, this);
pjce.addChild(createTextEditGroupNode(pjce, tec));
}
} catch (JavaModelException e) {
children.add(createTextEditGroupNode(this, tec));
}
}
return children.toArray(new ChildNode[children.size()]);
} else {
return EMPTY_CHILDREN;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:CompilationUnitChangeNode.java
示例13: getSortedChangeGroups
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
private TextEditBasedChangeGroup[] getSortedChangeGroups(TextEditBasedChange change) {
TextEditBasedChangeGroup[] edits= change.getChangeGroups();
List<TextEditBasedChangeGroup> result= new ArrayList<TextEditBasedChangeGroup>(edits.length);
for (int i= 0; i < edits.length; i++) {
if (!edits[i].getTextEditGroup().isEmpty())
result.add(edits[i]);
}
Comparator<TextEditBasedChangeGroup> comparator= new OffsetComparator();
Collections.sort(result, comparator);
return result.toArray(new TextEditBasedChangeGroup[result.size()]);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:CompilationUnitChangeNode.java
示例14: getAdapter
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public Object getAdapter(Object object, Class key) {
if (!TextEditChangeNode.class.equals(key))
return null;
if (!(object instanceof CompilationUnitChange) && !(object instanceof MultiStateCompilationUnitChange))
return null;
return new CompilationUnitChangeNode((TextEditBasedChange)object);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:RefactoringAdapterFactory.java
示例15: TextEditBased
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
protected TextEditBased(TextEditBasedChange delegate) {
super(delegate.getName());
this.delegate = delegate;
}
开发者ID:cplutte,项目名称:bts,代码行数:5,代码来源:DisplayChangeWrapper.java
示例16: getDelegate
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public TextEditBasedChange getDelegate() {
return delegate;
}
开发者ID:cplutte,项目名称:bts,代码行数:4,代码来源:DisplayChangeWrapper.java
示例17: hasOneGroupCategory
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
boolean hasOneGroupCategory(List categories) {
return ((TextEditBasedChange) getChange()).hasOneGroupCategory(categories);
}
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:InternalTextEditChangeNode.java
示例18: getTextEditBasedChange
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
protected TextEditBasedChange getTextEditBasedChange() {
return (TextEditBasedChange) getChange();
}
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:InternalTextEditChangeNode.java
示例19: CompilationUnitChangeNode
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public CompilationUnitChangeNode(TextEditBasedChange change) {
super(change);
}
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:CompilationUnitChangeNode.java
示例20: createInput
import org.eclipse.ltk.core.refactoring.TextEditBasedChange; //导入依赖的package包/类
public static ChangePreviewViewerInput createInput(TextEditBasedChange change) {
return new ChangePreviewViewerInput(change);
}
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:TextEditChangePreviewViewer.java
注:本文中的org.eclipse.ltk.core.refactoring.TextEditBasedChange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论