public abstract class CreateFromTemplateAction<T extends PsiElement> extends AnAction implements WriteActionAware
AnAction.TransparentUpdate
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG |
ACTIONS_KEY, EMPTY_ARRAY
Constructor and Description |
---|
CreateFromTemplateAction(java.lang.String text,
java.lang.String description,
javax.swing.Icon icon) |
CreateFromTemplateAction(java.util.function.Supplier<java.lang.String> dynamicText,
java.util.function.Supplier<java.lang.String> dynamicDescription,
javax.swing.Icon icon) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(AnActionEvent e)
Implement this method to provide your action handler.
|
protected abstract void |
buildDialog(Project project,
PsiDirectory directory,
CreateFileFromTemplateDialog.Builder builder) |
protected abstract T |
createFile(java.lang.String name,
java.lang.String templateName,
PsiDirectory dir) |
protected abstract java.lang.String |
getActionName(PsiDirectory directory,
java.lang.String newName,
java.lang.String templateName) |
protected java.lang.String |
getDefaultTemplateName(PsiDirectory dir) |
protected java.lang.String |
getDefaultTemplateProperty() |
protected java.lang.String |
getErrorTitle() |
protected boolean |
isAvailable(DataContext dataContext) |
static void |
moveCaretAfterNameIdentifier(PsiNameIdentifierOwner createdElement) |
protected void |
postProcess(T createdElement,
java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.String> customProperties) |
void |
update(AnActionEvent e)
Updates the state of the action.
|
addTextOverride, applyTextOverride, beforeActionPerformedUpdate, copyFrom, copyShortcutFrom, displayTextInToolbar, getEventProject, getShortcutSet, getTemplatePresentation, getTemplateText, isDefaultIcon, isEnabledInModalContext, isInInjectedContext, isTransparentUpdate, registerCustomShortcutSet, registerCustomShortcutSet, registerCustomShortcutSet, registerCustomShortcutSet, setDefaultIcon, setEnabledInModalContext, setInjectedContext, setShortcutSet, startInTransaction, toString, unregisterCustomShortcutSet, useSmallerFontForTextInToolbar
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
startInWriteAction
isDumbAware
protected static final Logger LOG
public CreateFromTemplateAction(java.lang.String text, java.lang.String description, javax.swing.Icon icon)
public CreateFromTemplateAction(java.util.function.Supplier<java.lang.String> dynamicText, java.util.function.Supplier<java.lang.String> dynamicDescription, javax.swing.Icon icon)
public final void actionPerformed(AnActionEvent e)
AnAction
actionPerformed
in class AnAction
e
- Carries information on the invocation placeprotected void postProcess(T createdElement, java.lang.String templateName, java.util.Map<java.lang.String,java.lang.String> customProperties)
protected abstract T createFile(java.lang.String name, java.lang.String templateName, PsiDirectory dir)
protected abstract void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder)
protected java.lang.String getDefaultTemplateName(PsiDirectory dir)
protected java.lang.String getDefaultTemplateProperty()
public void update(AnActionEvent e)
AnAction
AnAction.actionPerformed(AnActionEvent)
method and notify
the user that action cannot be executed if it's the case.
If the action is added to a toolbar, its "update" can be called twice a second, but only if there was
any user activity or a focus transfer. If your action's availability is changed
in absence of any of these events, please call ActivityTracker.getInstance().inc()
to notify
action subsystem to update all toolbar actions when your subsystem's determines that its actions' visibility might be affected.protected boolean isAvailable(DataContext dataContext)
protected abstract java.lang.String getActionName(PsiDirectory directory, java.lang.String newName, java.lang.String templateName)
protected java.lang.String getErrorTitle()
public static void moveCaretAfterNameIdentifier(PsiNameIdentifierOwner createdElement)