public class JavaPushDownDelegate extends PushDownDelegate<MemberInfo,PsiMember>
Modifier and Type | Field and Description |
---|---|
static Key<java.lang.Boolean> |
REMOVE_QUALIFIER_KEY |
static Key<PsiClass> |
REPLACE_QUALIFIER_KEY |
EP_NAME
Constructor and Description |
---|
JavaPushDownDelegate() |
Modifier and Type | Method and Description |
---|---|
void |
checkSourceClassConflicts(PushDownData<MemberInfo,PsiMember> pushDownData,
MultiMap<PsiElement,java.lang.String> conflicts)
Collect conflicts inside sourceClass assuming members would be removed,
e.g.
|
void |
checkTargetClassConflicts(PsiElement targetClass,
PushDownData<MemberInfo,PsiMember> pushDownData,
MultiMap<PsiElement,java.lang.String> conflicts,
NewSubClassData subClassData)
Collect conflicts inside targetClass assuming methods would be pushed,
e.g.
|
PsiElement |
createSubClass(PsiElement aClass,
NewSubClassData subClassData)
Create sub class with
subClassData.getNewClassName() in the specified context if no inheritors were found |
java.util.List<PsiElement> |
findInheritors(PushDownData<MemberInfo,PsiMember> pushDownData)
Find classes to push members down.
|
void |
inlineSuperCall(MemberInfoBase<? extends PsiElement> memberInfo,
PsiMethod methodBySignature) |
boolean |
isApplicableForSource(PsiElement sourceClass)
Check if delegate can process pushed members from the sourceClass.
|
void |
prepareToPush(PushDownData<MemberInfo,PsiMember> pushDownData)
Could be used e.g.
|
NewSubClassData |
preprocessNoInheritorsFound(PsiElement sourceClass,
java.lang.String conflictDialogTitle)
Called if no inheritors were found in
PushDownDelegate.findInheritors(PushDownData) . |
void |
pushDownToClass(PsiElement targetElement,
PushDownData<MemberInfo,PsiMember> pushDownData)
Push members to the target class adjusting visibility, comments according to the policy, etc
|
void |
removeFromSourceClass(PushDownData<MemberInfo,PsiMember> pushDownData)
Remove members from the source class according to the abstract flag.
|
createUsageInfo, findDelegate, findDelegateForTarget
public static final Key<java.lang.Boolean> REMOVE_QUALIFIER_KEY
public boolean isApplicableForSource(PsiElement sourceClass)
PushDownDelegate
PushDownDelegate.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):
PushDownDelegate.checkTargetClassConflicts(PsiElement, PushDownData, MultiMap, NewSubClassData)
,
PushDownDelegate.pushDownToClass(PsiElement, PushDownData)
isApplicableForSource
in class PushDownDelegate<MemberInfo,PsiMember>
public java.util.List<PsiElement> findInheritors(PushDownData<MemberInfo,PsiMember> pushDownData)
PushDownDelegate
findInheritors
in class PushDownDelegate<MemberInfo,PsiMember>
public void checkSourceClassConflicts(PushDownData<MemberInfo,PsiMember> pushDownData, MultiMap<PsiElement,java.lang.String> conflicts)
PushDownDelegate
checkSourceClassConflicts
in class PushDownDelegate<MemberInfo,PsiMember>
public void checkTargetClassConflicts(PsiElement targetClass, PushDownData<MemberInfo,PsiMember> pushDownData, MultiMap<PsiElement,java.lang.String> conflicts, NewSubClassData subClassData)
PushDownDelegate
targetClass == null
(target class should be created), then subClassData would be not nullcheckTargetClassConflicts
in class PushDownDelegate<MemberInfo,PsiMember>
public NewSubClassData preprocessNoInheritorsFound(PsiElement sourceClass, java.lang.String conflictDialogTitle)
PushDownDelegate
PushDownDelegate.findInheritors(PushDownData)
. Should warn that members would be deleted and
suggest to create new target class if applicablepreprocessNoInheritorsFound
in class PushDownDelegate<MemberInfo,PsiMember>
PushDownDelegate.createSubClass(PsiElement, NewSubClassData)
public void prepareToPush(PushDownData<MemberInfo,PsiMember> pushDownData)
PushDownDelegate
prepareToPush
in class PushDownDelegate<MemberInfo,PsiMember>
public void pushDownToClass(PsiElement targetElement, PushDownData<MemberInfo,PsiMember> pushDownData)
PushDownDelegate
pushDownToClass
in class PushDownDelegate<MemberInfo,PsiMember>
public void inlineSuperCall(MemberInfoBase<? extends PsiElement> memberInfo, PsiMethod methodBySignature)
public void removeFromSourceClass(PushDownData<MemberInfo,PsiMember> pushDownData)
PushDownDelegate
removeFromSourceClass
in class PushDownDelegate<MemberInfo,PsiMember>
public PsiElement createSubClass(PsiElement aClass, NewSubClassData subClassData)
PushDownDelegate
subClassData.getNewClassName()
in the specified context if no inheritors were foundcreateSubClass
in class PushDownDelegate<MemberInfo,PsiMember>