summaryrefslogtreecommitdiff
path: root/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
diff options
context:
space:
mode:
Diffstat (limited to 'xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java')
-rw-r--r--xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java b/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
index 0c9c6d70183d..c0930b4d9971 100644
--- a/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
+++ b/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,13 +46,15 @@ import org.jetbrains.annotations.Nullable;
*/
public class GenerateDTDAction extends BaseCodeInsightAction{
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.actions.GenerateDTDAction");
+ @Override
@NotNull
protected CodeInsightActionHandler getHandler(){
return new CodeInsightActionHandler(){
+ @Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
final XmlDocument document = findSuitableXmlDocument(file);
if (document != null) {
- final @NonNls StringBuffer buffer = new StringBuffer();
+ final @NonNls StringBuilder buffer = new StringBuilder();
buffer.append("<!DOCTYPE " + document.getRootTag().getName() + " [\n");
buffer.append(XmlUtil.generateDocumentDTD(document, true));
buffer.append("]>\n");
@@ -77,6 +79,7 @@ public class GenerateDTDAction extends BaseCodeInsightAction{
}
}
+ @Override
public boolean startInWriteAction(){
return true;
}
@@ -94,6 +97,7 @@ public class GenerateDTDAction extends BaseCodeInsightAction{
return null;
}
+ @Override
public void update(AnActionEvent event) {
super.update(event);
if (ActionPlaces.isPopupPlace(event.getPlace())) {
@@ -102,6 +106,7 @@ public class GenerateDTDAction extends BaseCodeInsightAction{
}
}
+ @Override
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file){
return file.getLanguage() == XMLLanguage.INSTANCE && findSuitableXmlDocument(file) != null;
}