mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
introduce com.intellij.xml.tools plugin (part 1)
GitOrigin-RevId: a6f8667d764581c81d8162f7282c1aacb7a39860
This commit is contained in:
committed by
intellij-monorepo-bot
parent
de7af54d1c
commit
745d96d05e
@@ -1,27 +1,8 @@
|
||||
<idea-plugin>
|
||||
<actions>
|
||||
<group id="ToolsXmlGroup" popup="true" class="com.intellij.xml.actions.XmlActionsGroup">
|
||||
<action id="ValidateXml" class="com.intellij.xml.actions.validate.ValidateXmlAction"/>
|
||||
<action id="GenerateDTD" class="com.intellij.codeInsight.actions.GenerateDTDAction"/>
|
||||
<separator/>
|
||||
|
||||
<add-to-group group-id="ToolsMenu" anchor="before" relative-to-action="ExternalToolsGroup"/>
|
||||
</group>
|
||||
|
||||
<group id="XmlGenerateToolsGroup">
|
||||
<separator/>
|
||||
<reference ref="GenerateDTD" />
|
||||
<separator/>
|
||||
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
|
||||
<add-to-group group-id="ProjectViewPopupMenu" anchor="last"/>
|
||||
</group>
|
||||
|
||||
<reference ref="ValidateXml">
|
||||
<add-to-group group-id="EditorPopupMenu.Run" anchor="last"/>
|
||||
<add-to-group group-id="ProjectViewPopupMenuRefactoringGroup" anchor="last"/>
|
||||
<add-to-group group-id="EditorTabPopupMenuEx" anchor="last"/>
|
||||
</reference>
|
||||
|
||||
<group id="DomCollectionControl">
|
||||
<action id="DomCollectionControl.Add" class="com.intellij.util.xml.ui.DomCollectionControl$AddAction">
|
||||
<keyboard-shortcut first-keystroke="INSERT" keymap="$default"/>
|
||||
|
||||
@@ -546,7 +546,7 @@ public abstract class KeymapsTestCase extends KeymapsTestCaseBase {
|
||||
"IDEtalk.SearchUserHistory", "IDEtalk.Rename", "CIDR.Lang.Cpp.GenerateDefinitions", "ActivateErrorsInSolutionToolWindow",
|
||||
"ActivateUnitTestsToolWindow", "ActivateDatabaseToolWindow", "ActivateBuildToolWindow", "ActivateNuGetToolWindow",
|
||||
"RiderBackendAction-EncapsulateField", "SwitchHeaderSource", "BuildProject", "RebuildProject", "BuildSolutionAction", "RebuildSolutionAction",
|
||||
"ActivateInspectionResultsToolWindow", ""
|
||||
"ActivateInspectionResultsToolWindow", "", "ValidateXml"
|
||||
);
|
||||
|
||||
private static final Set<String> DEFAULT_BOUND_ACTIONS = Set.of(
|
||||
|
||||
@@ -98,11 +98,11 @@ To use the <b>Ant</b> tool window, select <b>View > Tool Windows > Ant</b>.
|
||||
<add-to-group group-id="BuildMenu" relative-to-action="BuildJar" anchor="before"/>
|
||||
</group>
|
||||
<action id="AddAntBuildFile" class="com.intellij.lang.ant.config.actions.AddAntBuildFile" icon="AntIcons.Build">
|
||||
<add-to-group group-id="ToolsXmlGroup" relative-to-action="GenerateDTD" anchor="before"/>
|
||||
<add-to-group group-id="ToolsXmlGroup"/>
|
||||
<add-to-group group-id="EditorPopupMenu" relative-to-action="PackageFile" anchor="after"/>
|
||||
<add-to-group group-id="ProjectViewPopupMenu" relative-to-action="ValidateXml" anchor="after"/>
|
||||
<add-to-group group-id="ScopeViewPopupMenu" relative-to-action="ValidateXml" anchor="after"/>
|
||||
<add-to-group group-id="CommanderPopupMenu" relative-to-action="ValidateXml" anchor="after"/>
|
||||
<add-to-group group-id="ProjectViewPopupMenu"/>
|
||||
<add-to-group group-id="ScopeViewPopupMenu"/>
|
||||
<add-to-group group-id="CommanderPopupMenu"/>
|
||||
</action>
|
||||
<action id="RunTargetAction" class="com.intellij.lang.ant.config.actions.RunTargetAction">
|
||||
<add-to-group group-id="BuildMenu" relative-to-action="BuildJar" anchor="before"/>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
<actions resource-bundle="messages.RelaxngBundle">
|
||||
<action id="ConvertSchemaAction" class="org.intellij.plugins.relaxNG.convert.ConvertSchemaAction">
|
||||
<add-to-group group-id="ToolsXmlGroup" anchor="after" relative-to-action="GenerateDTD" />
|
||||
<add-to-group group-id="ToolsXmlGroup"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -48,5 +48,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.actions;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightActionHandler;
|
||||
import com.intellij.codeInsight.actions.BaseCodeInsightAction;
|
||||
import com.intellij.lang.xml.XMLLanguage;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -38,18 +25,17 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class GenerateDTDAction extends BaseCodeInsightAction{
|
||||
final class GenerateDTDAction extends BaseCodeInsightAction {
|
||||
private static final Logger LOG = Logger.getInstance(GenerateDTDAction.class);
|
||||
@Override
|
||||
@NotNull
|
||||
protected CodeInsightActionHandler getHandler(){
|
||||
protected @NotNull 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 StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("<!DOCTYPE " + document.getRootTag().getName() + " [\n");
|
||||
buffer.append("<!DOCTYPE ").append(document.getRootTag().getName()).append(" [\n");
|
||||
buffer.append(XmlUtil.generateDocumentDTD(document, true));
|
||||
buffer.append("]>\n");
|
||||
XmlFile tempFile;
|
||||
@@ -75,8 +61,7 @@ public class GenerateDTDAction extends BaseCodeInsightAction{
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static XmlDocument findSuitableXmlDocument(@Nullable PsiFile psiFile) {
|
||||
private static @Nullable XmlDocument findSuitableXmlDocument(@Nullable PsiFile psiFile) {
|
||||
if (psiFile instanceof XmlFile) {
|
||||
final XmlDocument document = ((XmlFile)psiFile).getDocument();
|
||||
if (document != null && document.getRootTag() != null) {
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xml.actions.xmlbeans.GenerateInstanceDocumentFromSchemaDialog">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xml.tools.GenerateInstanceDocumentFromSchemaDialog">
|
||||
<grid id="fece0" binding="panel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="1" left="1" bottom="1" right="1"/>
|
||||
<constraints>
|
||||
<xy x="282" y="178" width="526" height="157"/>
|
||||
<xy x="282" y="178" width="526" height="185"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
|
||||
import com.intellij.codeInspection.util.InspectionMessage;
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xml.actions.xmlbeans.GenerateSchemaFromInstanceDocumentDialog">
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xml.tools.GenerateSchemaFromInstanceDocumentDialog">
|
||||
<grid id="fece0" binding="panel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="1" left="1" bottom="1" right="1"/>
|
||||
<constraints>
|
||||
<xy x="282" y="178" width="645" height="153"/>
|
||||
<xy x="282" y="178" width="645" height="201"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.codeInspection.util.InspectionMessage;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.xml.actions.validate;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.ide.highlighter.XHtmlFileType;
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
@@ -12,9 +12,12 @@ import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.xml.actions.validate.StdErrorReporter;
|
||||
import com.intellij.xml.actions.validate.ValidateXmlActionHandler;
|
||||
import com.intellij.xml.actions.validate.ValidateXmlHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ValidateXmlAction extends AnAction {
|
||||
final class ValidateXmlAction extends AnAction {
|
||||
private static final Key<String> runningValidationKey = Key.create("xml.running.validation.indicator");
|
||||
|
||||
public ValidateXmlAction() {
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans;
|
||||
package com.intellij.xml.tools;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -1,16 +1,29 @@
|
||||
<idea-plugin package="com.intellij.xml.actions.xmlbeans">
|
||||
<idea-plugin package="com.intellij.xml.tools">
|
||||
<dependencies>
|
||||
<plugin id="com.intellij.modules.xml"/>
|
||||
</dependencies>
|
||||
|
||||
<actions>
|
||||
<action id="XSD2Document" class="com.intellij.xml.actions.xmlbeans.GenerateSchemaFromInstanceDocumentAction">
|
||||
<add-to-group group-id="ToolsXmlGroup" anchor="after" relative-to-action="GenerateDTD"/>
|
||||
<add-to-group group-id="XmlGenerateToolsGroup" anchor="after" relative-to-action="GenerateDTD"/>
|
||||
</action>
|
||||
<action id="Document2XSD" class="com.intellij.xml.actions.xmlbeans.GenerateInstanceDocumentFromSchemaAction">
|
||||
<add-to-group group-id="ToolsXmlGroup" anchor="after" relative-to-action="XSD2Document"/>
|
||||
<add-to-group group-id="XmlGenerateToolsGroup" anchor="after" relative-to-action="XSD2Document"/>
|
||||
</action>
|
||||
<group id="ToolsXmlGroupEx">
|
||||
<action id="ValidateXml" class="com.intellij.xml.tools.ValidateXmlAction"/>
|
||||
<action id="GenerateDTD" class="com.intellij.xml.tools.GenerateDTDAction"/>
|
||||
<action id="XSD2Document" class="com.intellij.xml.tools.GenerateSchemaFromInstanceDocumentAction"/>
|
||||
<action id="Document2XSD" class="com.intellij.xml.tools.GenerateInstanceDocumentFromSchemaAction"/>
|
||||
<separator/>
|
||||
|
||||
<add-to-group group-id="ToolsXmlGroup"/>
|
||||
</group>
|
||||
<group id="XmlGenerateToolsGroup">
|
||||
<separator/>
|
||||
<reference ref="GenerateDTD" />
|
||||
<separator/>
|
||||
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
|
||||
<add-to-group group-id="ProjectViewPopupMenu" anchor="last"/>
|
||||
</group>
|
||||
<reference ref="ValidateXml">
|
||||
<add-to-group group-id="EditorPopupMenu.Run" anchor="last"/>
|
||||
<add-to-group group-id="ProjectViewPopupMenuRefactoringGroup" anchor="last"/>
|
||||
<add-to-group group-id="EditorTabPopupMenuEx" anchor="last"/>
|
||||
</reference>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml.actions.xmlbeans
|
||||
package com.intellij.xml.tools
|
||||
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
Reference in New Issue
Block a user