[devkit] DOM: move Anchor to AddToGroup

GitOrigin-RevId: 3d88aad127499035b276074b0949c01fde8de553
This commit is contained in:
Yann Cébron
2024-12-10 14:05:07 +00:00
committed by intellij-monorepo-bot
parent 09f1e8527d
commit e05b30b818
4 changed files with 10 additions and 27 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2019 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.
// Copyright 2000-2024 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 org.jetbrains.idea.devkit.dom;
import com.intellij.ide.presentation.Presentation;
@@ -26,4 +26,8 @@ public interface AddToGroup extends DomElement {
@Required
@Convert(ActionOrGroupResolveConverter.OnlyGroups.class)
GenericAttributeValue<ActionOrGroup> getGroupId();
enum Anchor {
first, last, before, after
}
}
@@ -1,21 +0,0 @@
/*
* Copyright 2000-2018 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 org.jetbrains.idea.devkit.dom;
public enum Anchor {
first, last, before, after
}
@@ -943,13 +943,13 @@ public final class PluginXmlDomInspection extends DevKitPluginXmlInspectionBase
return;
}
final Anchor value = addToGroup.getAnchor().getValue();
if (value == Anchor.after || value == Anchor.before) {
final AddToGroup.Anchor value = addToGroup.getAnchor().getValue();
if (value == AddToGroup.Anchor.after || value == AddToGroup.Anchor.before) {
return;
}
holder.createProblem(
addToGroup.getAnchor(),
DevKitBundle.message("inspections.plugin.xml.must.use.after.before.with.relative-to-action", Anchor.after, Anchor.before));
DevKitBundle.message("inspections.plugin.xml.must.use.after.before.with.relative-to-action", AddToGroup.Anchor.after, AddToGroup.Anchor.before));
}
private static void annotateGroup(Group group, DomElementAnnotationHolder holder) {
@@ -6,7 +6,7 @@ import com.intellij.openapi.project.IntelliJProjectUtil;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.devkit.dom.Anchor;
import org.jetbrains.idea.devkit.dom.AddToGroup;
import org.jetbrains.idea.devkit.inspections.quickfix.RegisterActionFix;
import org.jetbrains.idea.devkit.util.ActionData;
@@ -140,7 +140,7 @@ public abstract class ComponentNotRegisteredInspectionTestBase extends PluginMod
@Override
public String getSelectedAnchor() {
return Anchor.before.name();
return AddToGroup.Anchor.before.name();
}
@Nullable