public abstract class PushDownDelegate<MemberInfo extends MemberInfoBase<Member>,Member extends PsiElement>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static LanguageExtension<PushDownDelegate> |
EP_NAME |
Constructor and Description |
---|
PushDownDelegate() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
checkSourceClassConflicts(PushDownData<MemberInfo,Member> pushDownData,
MultiMap<PsiElement,java.lang.String> conflicts)
Collect conflicts inside sourceClass assuming members would be removed,
e.g.
|
protected abstract void |
checkTargetClassConflicts(PsiElement targetClass,
PushDownData<MemberInfo,Member> pushDownData,
MultiMap<PsiElement,java.lang.String> conflicts,
NewSubClassData subClassData)
Collect conflicts inside targetClass assuming methods would be pushed,
e.g.
|
protected PsiElement |
createSubClass(PsiElement aClass,
NewSubClassData subClassData)
Create sub class with
subClassData.getNewClassName() in the specified context if no inheritors were found |
protected UsageInfo |
createUsageInfo(PsiElement element) |
protected static <MemberInfo extends MemberInfoBase<Member>,Member extends PsiElement> |
findDelegate(PsiElement sourceClass) |
protected static PushDownDelegate |
findDelegateForTarget(PsiElement sourceClass,
PsiElement targetClass) |
protected abstract java.util.List<PsiElement> |
findInheritors(PushDownData<MemberInfo,Member> pushDownData)
Find classes to push members down.
|
protected abstract boolean |
isApplicableForSource(PsiElement sourceClass)
Check if delegate can process pushed members from the sourceClass.
|
protected void |
prepareToPush(PushDownData<MemberInfo,Member> pushDownData)
Could be used e.g.
|
protected NewSubClassData |
preprocessNoInheritorsFound(PsiElement sourceClass,
java.lang.String conflictDialogTitle)
Called if no inheritors were found in
findInheritors(PushDownData) . |
protected abstract void |
pushDownToClass(PsiElement targetClass,
PushDownData<MemberInfo,Member> pushDownData)
Push members to the target class adjusting visibility, comments according to the policy, etc
|
protected abstract void |
removeFromSourceClass(PushDownData<MemberInfo,Member> pushDownData)
Remove members from the source class according to the abstract flag.
|
public static final LanguageExtension<PushDownDelegate> EP_NAME
protected static <MemberInfo extends MemberInfoBase<Member>,Member extends PsiElement> PushDownDelegate<MemberInfo,Member> findDelegate(PsiElement sourceClass)
protected static PushDownDelegate findDelegateForTarget(PsiElement sourceClass, PsiElement targetClass)
protected abstract boolean isApplicableForSource(PsiElement sourceClass)
findDelegateForTarget(PsiElement, PsiElement)
.
Implementations are supposed to override this method when overriding default behaviour for the language,
e.g. pushing members from groovy class to java, groovy could provide additional delegate which inherits delegate for java and accepts groovy sources.
Methods to process target class should be updated to cope with source of another language (e.g. calling super on PushDownData translated to java):
checkTargetClassConflicts(PsiElement, PushDownData, MultiMap, NewSubClassData)
,
pushDownToClass(PsiElement, PushDownData)
protected abstract java.util.List<PsiElement> findInheritors(PushDownData<MemberInfo,Member> pushDownData)
protected UsageInfo createUsageInfo(PsiElement element)
protected abstract void checkSourceClassConflicts(PushDownData<MemberInfo,Member> pushDownData, MultiMap<PsiElement,java.lang.String> conflicts)
protected abstract void checkTargetClassConflicts(PsiElement targetClass, PushDownData<MemberInfo,Member> pushDownData, MultiMap<PsiElement,java.lang.String> conflicts, NewSubClassData subClassData)
targetClass == null
(target class should be created), then subClassData would be not nullprotected void prepareToPush(PushDownData<MemberInfo,Member> pushDownData)
protected abstract void pushDownToClass(PsiElement targetClass, PushDownData<MemberInfo,Member> pushDownData)
protected abstract void removeFromSourceClass(PushDownData<MemberInfo,Member> pushDownData)
protected NewSubClassData preprocessNoInheritorsFound(PsiElement sourceClass, java.lang.String conflictDialogTitle)
findInheritors(PushDownData)
. Should warn that members would be deleted and
suggest to create new target class if applicablecreateSubClass(PsiElement, NewSubClassData)
protected PsiElement createSubClass(PsiElement aClass, NewSubClassData subClassData)
subClassData.getNewClassName()
in the specified context if no inheritors were found