From 45a626cce9687dfb10c76119ade0924a65b1e81e Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 24 Feb 2024 06:27:41 -0500 Subject: [PATCH] Split up cell services into subpackages, create adapter system for context menus --- .../cell/CellConfigurationService.java | 4 + .../cell/ContextMenuProviderService.java | 615 --------------- .../AbstractContextMenuProviderFactory.java | 7 +- .../context/AnnotationContextMenuAdapter.java | 41 + .../AnnotationContextMenuProviderFactory.java | 5 +- .../context/AssemblerContextMenuAdapter.java | 41 + .../AssemblerContextMenuProviderFactory.java | 17 +- ...cAnnotationContextMenuProviderFactory.java | 7 +- ...icAssemblerContextMenuProviderFactory.java | 21 +- .../BasicBlacklistingContextSource.java | 2 +- ...BasicBundleContextMenuProviderFactory.java | 7 +- .../BasicClassContextMenuProviderFactory.java | 7 +- .../{ => context}/BasicContextSource.java | 5 +- ...icDirectoryContextMenuProviderFactory.java | 7 +- .../BasicFieldContextMenuProviderFactory.java | 7 +- .../BasicFileContextMenuProviderFactory.java | 7 +- ...cInnerClassContextMenuProviderFactory.java | 10 +- ...BasicMethodContextMenuProviderFactory.java | 7 +- ...asicPackageContextMenuProviderFactory.java | 13 +- ...sicResourceContextMenuProviderFactory.java | 6 +- .../BasicWhitelistingContextSource.java | 2 +- .../context/BundleContextMenuAdapter.java | 33 + .../BundleContextMenuProviderFactory.java | 5 +- .../cell/context/ClassContextMenuAdapter.java | 60 ++ .../ClassContextMenuProviderFactory.java | 5 +- .../cell/context/ContextMenuAdapter.java | 10 + .../{ => context}/ContextMenuProvider.java | 2 +- .../ContextMenuProviderFactory.java | 5 +- .../context/ContextMenuProviderService.java | 744 ++++++++++++++++++ .../ContextMenuProviderServiceConfig.java | 2 +- .../cell/{ => context}/ContextSource.java | 2 +- .../context/DirectoryContextMenuAdapter.java | 35 + .../DirectoryContextMenuProviderFactory.java | 5 +- .../cell/context/FieldContextMenuAdapter.java | 40 + .../FieldContextMenuProviderFactory.java | 5 +- .../cell/context/FileContextMenuAdapter.java | 36 + .../FileContextMenuProviderFactory.java | 5 +- .../context/InnerClassContextMenuAdapter.java | 40 + .../InnerClassContextMenuProviderFactory.java | 5 +- .../context/MethodContextMenuAdapter.java | 40 + .../MethodContextMenuProviderFactory.java | 5 +- .../context/PackageContextMenuAdapter.java | 38 + .../PackageContextMenuProviderFactory.java | 5 +- .../context/ResourceContextMenuAdapter.java | 28 + .../ResourceContextMenuProviderFactory.java | 5 +- .../AnnotationIconProviderFactory.java | 2 +- .../BasicAnnotationIconProviderFactory.java | 6 +- .../BasicBundleIconProviderFactory.java | 6 +- .../BasicClassIconProviderFactory.java | 6 +- .../BasicDirectoryIconProviderFactory.java | 6 +- .../BasicFieldIconProviderFactory.java | 6 +- .../BasicFileIconProviderFactory.java | 6 +- .../BasicInnerClassIconProviderFactory.java | 6 +- .../BasicMethodIconProviderFactory.java | 6 +- .../BasicPackageIconProviderFactory.java | 7 +- .../BasicResourceIconProviderFactory.java | 8 +- .../{ => icon}/BundleIconProviderFactory.java | 2 +- .../{ => icon}/ClassIconProviderFactory.java | 2 +- .../DirectoryIconProviderFactory.java | 2 +- .../{ => icon}/FieldIconProviderFactory.java | 2 +- .../{ => icon}/FileIconProviderFactory.java | 2 +- .../cell/{ => icon}/IconProvider.java | 2 +- .../cell/{ => icon}/IconProviderFactory.java | 2 +- .../cell/{ => icon}/IconProviderService.java | 4 +- .../{ => icon}/IconProviderServiceConfig.java | 2 +- .../InnerClassIconProviderFactory.java | 2 +- .../{ => icon}/MethodIconProviderFactory.java | 2 +- .../PackageIconProviderFactory.java | 3 +- .../ResourceIconProviderFactory.java | 2 +- .../cell/{ => text}/TextProvider.java | 2 +- .../cell/{ => text}/TextProviderFactory.java | 2 +- .../cell/{ => text}/TextProviderService.java | 2 +- .../{ => text}/TextProviderServiceConfig.java | 2 +- .../summary/builtin/EntryPointSummarizer.java | 4 +- .../recaf/services/navigation/Actions.java | 4 +- .../ui/contextmenu/ContextMenuBuilder.java | 2 +- .../coley/recaf/ui/contextmenu/ItemSink.java | 2 +- .../contextmenu/actions/AnnotationAction.java | 2 +- .../ui/contextmenu/actions/BundleAction.java | 2 +- .../contextmenu/actions/DirectoryAction.java | 2 +- .../ui/contextmenu/actions/InfoAction.java | 2 +- .../ui/contextmenu/actions/MemberAction.java | 2 +- .../contextmenu/actions/ResourceAction.java | 2 +- .../contextmenu/actions/WorkspaceAction.java | 2 +- .../source/JavaContextActionSupport.java | 4 +- .../recaf/ui/control/tree/WorkspaceTree.java | 2 +- .../ui/control/tree/WorkspaceTreeCell.java | 2 +- .../recaf/ui/pane/MappingProgressPane.java | 2 +- .../ui/pane/WorkspaceInformationPane.java | 4 +- .../AssemblerContextActionSupport.java | 4 +- .../ContextualAssemblerComponent.java | 4 +- .../pane/editing/assembler/TypeTableCell.java | 2 +- .../editing/tabs/FieldsAndMethodsPane.java | 2 +- .../ui/pane/editing/tabs/InheritancePane.java | 2 +- .../java/software/coley/recaf/util/Icons.java | 2 +- 95 files changed, 1371 insertions(+), 785 deletions(-) delete mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderService.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/AbstractContextMenuProviderFactory.java (73%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/AnnotationContextMenuProviderFactory.java (86%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/AssemblerContextMenuProviderFactory.java (68%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicAnnotationContextMenuProviderFactory.java (93%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicAssemblerContextMenuProviderFactory.java (91%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/BasicBlacklistingContextSource.java (92%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicBundleContextMenuProviderFactory.java (90%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicClassContextMenuProviderFactory.java (96%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/BasicContextSource.java (83%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicDirectoryContextMenuProviderFactory.java (88%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicFieldContextMenuProviderFactory.java (93%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicFileContextMenuProviderFactory.java (90%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicInnerClassContextMenuProviderFactory.java (86%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicMethodContextMenuProviderFactory.java (93%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicPackageContextMenuProviderFactory.java (88%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => context}/BasicResourceContextMenuProviderFactory.java (86%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/BasicWhitelistingContextSource.java (93%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/BundleContextMenuProviderFactory.java (82%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/ClassContextMenuProviderFactory.java (90%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/ContextMenuProvider.java (87%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/ContextMenuProviderFactory.java (86%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderService.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/ContextMenuProviderServiceConfig.java (91%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/ContextSource.java (95%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/DirectoryContextMenuProviderFactory.java (86%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/FieldContextMenuProviderFactory.java (85%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/FileContextMenuProviderFactory.java (83%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/InnerClassContextMenuProviderFactory.java (85%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/MethodContextMenuProviderFactory.java (85%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/PackageContextMenuProviderFactory.java (86%) create mode 100644 recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuAdapter.java rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => context}/ResourceContextMenuProviderFactory.java (78%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/AnnotationIconProviderFactory.java (96%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicAnnotationIconProviderFactory.java (85%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicBundleIconProviderFactory.java (85%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicClassIconProviderFactory.java (93%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicDirectoryIconProviderFactory.java (81%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicFieldIconProviderFactory.java (91%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicFileIconProviderFactory.java (94%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicInnerClassIconProviderFactory.java (94%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicMethodIconProviderFactory.java (91%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicPackageIconProviderFactory.java (79%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{builtin => icon}/BasicResourceIconProviderFactory.java (90%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/BundleIconProviderFactory.java (95%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/ClassIconProviderFactory.java (97%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/DirectoryIconProviderFactory.java (95%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/FieldIconProviderFactory.java (96%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/FileIconProviderFactory.java (95%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/IconProvider.java (88%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/IconProviderFactory.java (97%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/IconProviderService.java (98%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/IconProviderServiceConfig.java (92%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/InnerClassIconProviderFactory.java (96%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/MethodIconProviderFactory.java (96%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/PackageIconProviderFactory.java (92%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => icon}/ResourceIconProviderFactory.java (93%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => text}/TextProvider.java (85%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => text}/TextProviderFactory.java (89%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => text}/TextProviderService.java (99%) rename recaf-ui/src/main/java/software/coley/recaf/services/cell/{ => text}/TextProviderServiceConfig.java (92%) diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/CellConfigurationService.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/CellConfigurationService.java index f1052e85d..a43d1ee1b 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/CellConfigurationService.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/CellConfigurationService.java @@ -23,6 +23,10 @@ import software.coley.recaf.info.member.MethodMember; import software.coley.recaf.path.*; import software.coley.recaf.services.Service; +import software.coley.recaf.services.cell.context.ContextMenuProviderService; +import software.coley.recaf.services.cell.context.ContextSource; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.services.navigation.ClassNavigable; import software.coley.recaf.services.navigation.Navigable; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderService.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderService.java deleted file mode 100644 index 97272147d..000000000 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderService.java +++ /dev/null @@ -1,615 +0,0 @@ -package software.coley.recaf.services.cell; - -import jakarta.annotation.Nonnull; -import jakarta.annotation.Nullable; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import software.coley.recaf.info.*; -import software.coley.recaf.info.annotation.Annotated; -import software.coley.recaf.info.annotation.AnnotationInfo; -import software.coley.recaf.info.member.ClassMember; -import software.coley.recaf.info.member.FieldMember; -import software.coley.recaf.info.member.MethodMember; -import software.coley.recaf.path.AssemblerPathData; -import software.coley.recaf.services.Service; -import software.coley.recaf.ui.control.tree.WorkspaceTreeCell; -import software.coley.recaf.workspace.model.Workspace; -import software.coley.recaf.workspace.model.bundle.*; -import software.coley.recaf.workspace.model.resource.WorkspaceResource; - -/** - * Provides support for providing context menus for a variety of item types. - * For instance, the menus of {@link WorkspaceTreeCell} instances. - *
- * The menus displayed in the UI can be swapped out by supplying your own - * {@link ContextMenuProviderFactory} instances to the overrides: - * - * - * @author Matt Coley - */ -@ApplicationScoped -public class ContextMenuProviderService implements Service { - public static final String SERVICE_ID = "cell-menus"; - private final ContextMenuProviderServiceConfig config; - // Defaults - private final ClassContextMenuProviderFactory classContextMenuDefault; - private final FileContextMenuProviderFactory fileContextMenuDefault; - private final InnerClassContextMenuProviderFactory innerClassContextMenuDefault; - private final FieldContextMenuProviderFactory fieldContextMenuDefault; - private final MethodContextMenuProviderFactory methodContextMenuDefault; - private final AnnotationContextMenuProviderFactory annotationContextMenuDefault; - private final PackageContextMenuProviderFactory packageContextMenuDefault; - private final DirectoryContextMenuProviderFactory directoryContextMenuDefault; - private final BundleContextMenuProviderFactory bundleContextMenuDefault; - private final ResourceContextMenuProviderFactory resourceContextMenuDefault; - private final AssemblerContextMenuProviderFactory assemblerContextMenuDefault; - // Overrides - private ClassContextMenuProviderFactory classContextMenuOverride; - private FileContextMenuProviderFactory fileContextMenuOverride; - private InnerClassContextMenuProviderFactory innerClassContextMenuOverride; - private FieldContextMenuProviderFactory fieldContextMenuOverride; - private MethodContextMenuProviderFactory methodContextMenuOverride; - private AnnotationContextMenuProviderFactory annotationContextMenuOverride; - private PackageContextMenuProviderFactory packageContextMenuOverride; - private DirectoryContextMenuProviderFactory directoryContextMenuOverride; - private BundleContextMenuProviderFactory bundleContextMenuOverride; - private ResourceContextMenuProviderFactory resourceContextMenuOverride; - private AssemblerContextMenuProviderFactory assemblerContextMenuOverride; - - @Inject - public ContextMenuProviderService(@Nonnull ContextMenuProviderServiceConfig config, - @Nonnull ClassContextMenuProviderFactory classContextMenuDefault, - @Nonnull FileContextMenuProviderFactory fileContextMenuDefault, - @Nonnull InnerClassContextMenuProviderFactory innerClassContextMenuDefault, - @Nonnull FieldContextMenuProviderFactory fieldContextMenuDefault, - @Nonnull MethodContextMenuProviderFactory methodContextMenuDefault, - @Nonnull AnnotationContextMenuProviderFactory annotationContextMenuDefault, - @Nonnull PackageContextMenuProviderFactory packageContextMenuDefault, - @Nonnull DirectoryContextMenuProviderFactory directoryContextMenuDefault, - @Nonnull BundleContextMenuProviderFactory bundleContextMenuDefault, - @Nonnull ResourceContextMenuProviderFactory resourceContextMenuDefault, - @Nonnull AssemblerContextMenuProviderFactory assemblerContextMenuDefault) { - this.config = config; - - // Default factories - this.classContextMenuDefault = classContextMenuDefault; - this.fileContextMenuDefault = fileContextMenuDefault; - this.innerClassContextMenuDefault = innerClassContextMenuDefault; - this.fieldContextMenuDefault = fieldContextMenuDefault; - this.methodContextMenuDefault = methodContextMenuDefault; - this.annotationContextMenuDefault = annotationContextMenuDefault; - this.packageContextMenuDefault = packageContextMenuDefault; - this.directoryContextMenuDefault = directoryContextMenuDefault; - this.bundleContextMenuDefault = bundleContextMenuDefault; - this.resourceContextMenuDefault = resourceContextMenuDefault; - this.assemblerContextMenuDefault = assemblerContextMenuDefault; - } - - /** - * Delegates to {@link ClassContextMenuProviderFactory}. - * - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param info - * The class to create a menu for. - * - * @return Menu provider for the class. - */ - @Nonnull - public ContextMenuProvider getJvmClassInfoContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull JvmClassBundle bundle, - @Nonnull JvmClassInfo info) { - ClassContextMenuProviderFactory factory = classContextMenuOverride != null ? classContextMenuOverride : classContextMenuDefault; - return factory.getJvmClassInfoContextMenuProvider(source, workspace, resource, bundle, info); - } - - /** - * Delegates to {@link ClassContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param info - * The class to create a menu for. - * - * @return Menu provider for the class. - */ - @Nonnull - public ContextMenuProvider getAndroidClassInfoContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull AndroidClassBundle bundle, - @Nonnull AndroidClassInfo info) { - ClassContextMenuProviderFactory factory = classContextMenuOverride != null ? classContextMenuOverride : classContextMenuDefault; - return factory.getAndroidClassInfoContextMenuProvider(source, workspace, resource, bundle, info); - } - - /** - * Delegates to {@link InnerClassContextMenuProviderFactory}. - * - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param outerClass - * Outer class. - * @param inner - * The inner class to create a menu for. - * - * @return Menu provider for the class. - */ - @Nonnull - public ContextMenuProvider getInnerClassInfoContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull ClassInfo outerClass, - @Nonnull InnerClassInfo inner) { - InnerClassContextMenuProviderFactory factory = innerClassContextMenuOverride != null ? innerClassContextMenuOverride : innerClassContextMenuDefault; - return factory.getInnerClassInfoContextMenuProvider(source, workspace, resource, bundle, outerClass, inner); - } - - /** - * Delegates to {@link FieldContextMenuProviderFactory} and {@link MethodContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param declaringClass - * Containing class. - * @param member - * The member to create a menu for. - * - * @return Menu provider for the class member. - */ - @Nonnull - public ContextMenuProvider getClassMemberContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull ClassInfo declaringClass, - @Nonnull ClassMember member) { - if (member.isField()) { - FieldContextMenuProviderFactory factory = fieldContextMenuOverride != null ? fieldContextMenuOverride : fieldContextMenuDefault; - return factory.getFieldContextMenuProvider(source, workspace, resource, bundle, declaringClass, (FieldMember) member); - } else if (member.isMethod()) { - MethodContextMenuProviderFactory factory = methodContextMenuOverride != null ? methodContextMenuOverride : methodContextMenuDefault; - return factory.getMethodContextMenuProvider(source, workspace, resource, bundle, declaringClass, (MethodMember) member); - } else { - throw new IllegalStateException("Unsupported member: " + member.getClass().getName()); - } - } - - /** - * Delegates to {@link AnnotationContextMenuProviderFactory}. - * - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param annotated - * The annotated item. - * @param annotation - * The annotation to create an icon for. - * - * @return Text provider for the annotation. - */ - @Nonnull - public ContextMenuProvider getAnnotationContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull Annotated annotated, - @Nonnull AnnotationInfo annotation) { - AnnotationContextMenuProviderFactory factory = annotationContextMenuOverride != null ? annotationContextMenuOverride : annotationContextMenuDefault; - return factory.getAnnotationContextMenuProvider(source, workspace, resource, bundle, annotated, annotation); - } - - /** - * Delegates to {@link FileContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param info - * The file to create a menu for. - * - * @return Menu provider for the file. - */ - @Nonnull - public ContextMenuProvider getFileInfoContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull FileBundle bundle, - @Nonnull FileInfo info) { - FileContextMenuProviderFactory factory = fileContextMenuOverride != null ? fileContextMenuOverride : fileContextMenuDefault; - return factory.getFileInfoContextMenuProvider(source, workspace, resource, bundle, info); - } - - /** - * Delegates to {@link PackageContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param packageName - * The full package name, separated by {@code /}. - * - * @return Menu provider for the package. - */ - @Nonnull - public ContextMenuProvider getPackageContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull String packageName) { - PackageContextMenuProviderFactory factory = packageContextMenuOverride != null ? packageContextMenuOverride : packageContextMenuDefault; - return factory.getPackageContextMenuProvider(source, workspace, resource, bundle, packageName); - } - - /** - * Delegates to {@link DirectoryContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param directoryName - * The full path of the directory. - * - * @return Menu provider for the directory. - */ - @Nonnull - public ContextMenuProvider getDirectoryContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull FileBundle bundle, - @Nonnull String directoryName) { - DirectoryContextMenuProviderFactory factory = directoryContextMenuOverride != null ? directoryContextMenuOverride : directoryContextMenuDefault; - return factory.getDirectoryContextMenuProvider(source, workspace, resource, bundle, directoryName); - } - - /** - * Delegates to {@link BundleContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * The bundle to create a menu for. - * - * @return Menu provider for the bundle. - */ - @Nonnull - public ContextMenuProvider getBundleContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull Bundle bundle) { - BundleContextMenuProviderFactory factory = bundleContextMenuOverride != null ? bundleContextMenuOverride : bundleContextMenuDefault; - return factory.getBundleContextMenuProvider(source, workspace, resource, bundle); - } - - /** - * Delegates to {@link ResourceContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * The resource to create a menu for. - * - * @return Menu provider for the resource. - */ - @Nonnull - public ContextMenuProvider getResourceContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource) { - ResourceContextMenuProviderFactory factory = resourceContextMenuOverride != null ? resourceContextMenuOverride : resourceContextMenuDefault; - return factory.getResourceContextMenuProvider(source, workspace, resource); - } - - /** - * Delegates to {@link AssemblerContextMenuProviderFactory}. - * - * @param source - * Context request origin. - * @param workspace - * Containing workspace. - * @param resource - * Containing resource. - * @param bundle - * Containing bundle. - * @param declaringClass - * Containing class. - * @param assemblerData - * The assembler data to create a menu for. - * - * @return Menu provider for the resource. - */ - @Nonnull - public ContextMenuProvider getAssemblerContextMenuProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull ClassInfo declaringClass, - @Nonnull AssemblerPathData assemblerData) { - AssemblerContextMenuProviderFactory factory = assemblerContextMenuOverride != null ? assemblerContextMenuOverride : assemblerContextMenuDefault; - return factory.getProvider(source, workspace, resource, bundle, declaringClass, assemblerData); - } - - /** - * @return Default menu provider for classes. - */ - @Nonnull - public ClassContextMenuProviderFactory getClassContextMenuDefault() { - return classContextMenuDefault; - } - - /** - * @return Default menu provider for files. - */ - @Nonnull - public FileContextMenuProviderFactory getFileContextMenuDefault() { - return fileContextMenuDefault; - } - - /** - * @return Default menu provider for packages. - */ - @Nonnull - public PackageContextMenuProviderFactory getPackageContextMenuDefault() { - return packageContextMenuDefault; - } - - /** - * @return Default menu provider for directories. - */ - @Nonnull - public DirectoryContextMenuProviderFactory getDirectoryContextMenuDefault() { - return directoryContextMenuDefault; - } - - /** - * @return Default menu provider for bundles. - */ - @Nonnull - public BundleContextMenuProviderFactory getBundleContextMenuDefault() { - return bundleContextMenuDefault; - } - - /** - * @return Default menu provider for resources. - */ - @Nonnull - public ResourceContextMenuProviderFactory getResourceContextMenuDefault() { - return resourceContextMenuDefault; - } - - /** - * @return Override factory for supplying class menu providers. - */ - @Nullable - public ClassContextMenuProviderFactory getClassContextMenuProviderOverride() { - return classContextMenuOverride; - } - - /** - * @param classContextMenuOverride - * Override factory for supplying class menu providers. - */ - public void setClassContextMenuProviderOverride(@Nullable ClassContextMenuProviderFactory classContextMenuOverride) { - this.classContextMenuOverride = classContextMenuOverride; - } - - /** - * @return Override factory for supplying file menu providers. - */ - @Nullable - public FileContextMenuProviderFactory getFileContextMenuProviderOverride() { - return fileContextMenuOverride; - } - - /** - * @param fileContextMenuOverride - * Override factory for supplying file menu providers. - */ - public void setFileContextMenuProviderOverride(@Nullable FileContextMenuProviderFactory fileContextMenuOverride) { - this.fileContextMenuOverride = fileContextMenuOverride; - } - - /** - * @return Override factory for supplying inner class menu providers. - */ - @Nullable - public InnerClassContextMenuProviderFactory getInnerClassContextMenuProviderOverride() { - return innerClassContextMenuOverride; - } - - /** - * @param innerClassContextMenuOverride - * Override factory for supplying inner class menu providers. - */ - public void setInnerClassContextMenuProviderOverride(@Nullable InnerClassContextMenuProviderFactory innerClassContextMenuOverride) { - this.innerClassContextMenuOverride = innerClassContextMenuOverride; - } - - /** - * @return Override factory for supplying field menu providers. - */ - @Nullable - public FieldContextMenuProviderFactory getFieldContextMenuProviderOverride() { - return fieldContextMenuOverride; - } - - /** - * @param fieldContextMenuOverride - * Override factory for supplying field menu providers. - */ - public void setFieldContextMenuProviderOverride(@Nullable FieldContextMenuProviderFactory fieldContextMenuOverride) { - this.fieldContextMenuOverride = fieldContextMenuOverride; - } - - /** - * @return Override factory for supplying method menu providers. - */ - @Nullable - public MethodContextMenuProviderFactory getMethodContextMenuProviderOverride() { - return methodContextMenuOverride; - } - - /** - * @param methodContextMenuOverride - * Override factory for supplying method menu providers. - */ - public void setMethodContextMenuProviderOverride(@Nullable MethodContextMenuProviderFactory methodContextMenuOverride) { - this.methodContextMenuOverride = methodContextMenuOverride; - } - - /** - * @return Override factory for supplying annotation menu providers. - */ - @Nullable - public AnnotationContextMenuProviderFactory getAnnotationContextMenuProviderOverride() { - return annotationContextMenuOverride; - } - - /** - * @param annotationContextMenuOverride - * Override factory for supplying annotation menu providers. - */ - public void setAnnotationContextMenuProviderOverride(@Nullable AnnotationContextMenuProviderFactory annotationContextMenuOverride) { - this.annotationContextMenuOverride = annotationContextMenuOverride; - } - - /** - * @return Override factory for supplying package menu providers. - */ - @Nullable - public PackageContextMenuProviderFactory getPackageContextMenuProviderOverride() { - return packageContextMenuOverride; - } - - /** - * @param packageContextMenuOverride - * Override factory for supplying package menu providers. - */ - public void setPackageContextMenuProviderOverride(@Nullable PackageContextMenuProviderFactory packageContextMenuOverride) { - this.packageContextMenuOverride = packageContextMenuOverride; - } - - /** - * @return Override factory for supplying directory menu providers. - */ - @Nullable - public DirectoryContextMenuProviderFactory getDirectoryContextMenuProviderOverride() { - return directoryContextMenuOverride; - } - - /** - * @param directoryContextMenuOverride - * Override factory for supplying directory menu providers. - */ - public void setDirectoryContextMenuProviderOverride(@Nullable DirectoryContextMenuProviderFactory directoryContextMenuOverride) { - this.directoryContextMenuOverride = directoryContextMenuOverride; - } - - /** - * @return Override factory for supplying bundle menu providers. - */ - @Nullable - public BundleContextMenuProviderFactory getBundleContextMenuProviderOverride() { - return bundleContextMenuOverride; - } - - /** - * @param bundleContextMenuOverride - * Override factory for supplying bundle menu providers. - */ - public void setBundleContextMenuProviderOverride(@Nullable BundleContextMenuProviderFactory bundleContextMenuOverride) { - this.bundleContextMenuOverride = bundleContextMenuOverride; - } - - /** - * @return Override factory for supplying resource menu providers. - */ - @Nullable - public ResourceContextMenuProviderFactory getResourceContextMenuProviderOverride() { - return resourceContextMenuOverride; - } - - /** - * @param resourceContextMenuOverride - * Override factory for supplying resource menu providers. - */ - public void setResourceContextMenuProviderOverride(@Nullable ResourceContextMenuProviderFactory resourceContextMenuOverride) { - this.resourceContextMenuOverride = resourceContextMenuOverride; - } - - /** - * @param assemblerContextMenuOverride - * Override factory for supplying assembler menu providers. - */ - public void setAssemblerContextMenuOverride(@Nullable AssemblerContextMenuProviderFactory assemblerContextMenuOverride) { - this.assemblerContextMenuOverride = assemblerContextMenuOverride; - } - - @Nonnull - @Override - public String getServiceId() { - return SERVICE_ID; - } - - @Nonnull - @Override - public ContextMenuProviderServiceConfig getServiceConfig() { - return config; - } -} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/AbstractContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AbstractContextMenuProviderFactory.java similarity index 73% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/AbstractContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AbstractContextMenuProviderFactory.java index f72eb1a54..10441178a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/AbstractContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AbstractContextMenuProviderFactory.java @@ -1,9 +1,8 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; -import software.coley.recaf.services.cell.IconProviderService; -import software.coley.recaf.services.cell.TextProviderService; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; /** diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuAdapter.java new file mode 100644 index 000000000..864bbcb77 --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuAdapter.java @@ -0,0 +1,41 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.info.annotation.Annotated; +import software.coley.recaf.info.annotation.AnnotationInfo; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.ClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link AnnotationInfo} types. + * + * @author Matt Coley + */ +public interface AnnotationContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param annotated + * The annotated item. + * @param annotation + * The annotation the menu is for. + */ + default void adaptAnnotationContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull Annotated annotated, + @Nonnull AnnotationInfo annotation) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/AnnotationContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuProviderFactory.java similarity index 86% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/AnnotationContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuProviderFactory.java index c7711d75d..f91328bd3 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/AnnotationContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AnnotationContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; @@ -9,8 +9,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link AnnotationInfo types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link AnnotationInfo} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuAdapter.java new file mode 100644 index 000000000..28168561b --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuAdapter.java @@ -0,0 +1,41 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.path.AssemblerPathData; +import software.coley.recaf.ui.pane.editing.assembler.AssemblerPane; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.ClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for contents within an {@link AssemblerPane}. + * + * @author Matt Coley + */ +public interface AssemblerContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param declaringClass + * Containing class. + * @param assemblerData + * The assembler data the menu is for. + */ + default void adaptAssemblerMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull AssemblerPathData assemblerData) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/AssemblerContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuProviderFactory.java similarity index 68% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/AssemblerContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuProviderFactory.java index b34a010c7..da667e049 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/AssemblerContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/AssemblerContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; @@ -9,8 +9,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for contents within an {@link AssemblerPane}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for contents within an {@link AssemblerPane}. * * @author Matt Coley */ @@ -32,12 +31,12 @@ public interface AssemblerContextMenuProviderFactory extends ContextMenuProvider * @return Menu provider for the selected contents in the assembler. */ @Nonnull - default ContextMenuProvider getProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull ClassInfo declaringClass, - @Nonnull AssemblerPathData assemblerData) { + default ContextMenuProvider getAssemblerMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull AssemblerPathData assemblerData) { return emptyProvider(); } } diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAnnotationContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicAnnotationContextMenuProviderFactory.java similarity index 93% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAnnotationContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicAnnotationContextMenuProviderFactory.java index 46f51f3b3..e24cdc9f3 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAnnotationContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicAnnotationContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -17,7 +17,10 @@ import software.coley.recaf.info.member.FieldMember; import software.coley.recaf.info.member.MethodMember; import software.coley.recaf.path.ClassPathNode; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.util.visitors.ClassAnnotationRemovingVisitor; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAssemblerContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicAssemblerContextMenuProviderFactory.java similarity index 91% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAssemblerContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicAssemblerContextMenuProviderFactory.java index cf651a989..f82f36286 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAssemblerContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicAssemblerContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -15,11 +15,8 @@ import software.coley.recaf.path.AssemblerPathData; import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.path.IncompletePathException; -import software.coley.recaf.services.cell.AssemblerContextMenuProviderFactory; -import software.coley.recaf.services.cell.ContextMenuProvider; -import software.coley.recaf.services.cell.ContextSource; -import software.coley.recaf.services.cell.IconProviderService; -import software.coley.recaf.services.cell.TextProviderService; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.control.ActionMenuItem; import software.coley.recaf.ui.control.richtext.Editor; @@ -56,12 +53,12 @@ public BasicAssemblerContextMenuProviderFactory(@Nonnull TextProviderService tex @Nonnull @Override - public ContextMenuProvider getProvider(@Nonnull ContextSource source, - @Nonnull Workspace workspace, - @Nonnull WorkspaceResource resource, - @Nonnull ClassBundle bundle, - @Nonnull ClassInfo declaringClass, - @Nonnull AssemblerPathData assemblerData) { + public ContextMenuProvider getAssemblerMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull AssemblerPathData assemblerData) { return () -> { ContextMenu menu = new ContextMenu(); AssemblyResolution resolution = assemblerData.resolution(); diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicBlacklistingContextSource.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicBlacklistingContextSource.java similarity index 92% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicBlacklistingContextSource.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicBlacklistingContextSource.java index ac265d40f..265290ca2 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicBlacklistingContextSource.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicBlacklistingContextSource.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicBundleContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicBundleContextMenuProviderFactory.java similarity index 90% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicBundleContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicBundleContextMenuProviderFactory.java index 76adcf667..02bbb64a9 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicBundleContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicBundleContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -6,7 +6,10 @@ import jakarta.inject.Inject; import javafx.scene.control.ContextMenu; import software.coley.recaf.info.Info; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.ui.control.popup.ChangeClassVersionForAllPopup; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicClassContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicClassContextMenuProviderFactory.java similarity index 96% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicClassContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicClassContextMenuProviderFactory.java index 37b1fae61..07b6ced89 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicClassContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicClassContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -13,7 +13,10 @@ import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.JvmClassInfo; import software.coley.recaf.path.PathNodes; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.ui.contextmenu.MenuHandler; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicContextSource.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicContextSource.java similarity index 83% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicContextSource.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicContextSource.java index 3b5522b1c..d205ee471 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicContextSource.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicContextSource.java @@ -1,8 +1,11 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; /** * Basic context source. Either a declaration or a reference. * + * @see BasicBlacklistingContextSource Simple blacklist filtering source. + * @see BasicWhitelistingContextSource Simple whitelist filtering source. + * * @author Matt Coley */ public class BasicContextSource implements ContextSource { diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicDirectoryContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicDirectoryContextMenuProviderFactory.java similarity index 88% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicDirectoryContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicDirectoryContextMenuProviderFactory.java index 545b74aba..ac73dfb73 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicDirectoryContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicDirectoryContextMenuProviderFactory.java @@ -1,10 +1,13 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import javafx.scene.control.ContextMenu; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.util.ClipboardUtil; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFieldContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicFieldContextMenuProviderFactory.java similarity index 93% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFieldContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicFieldContextMenuProviderFactory.java index 0afa24e83..a7e7be0c1 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFieldContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicFieldContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -12,7 +12,10 @@ import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.path.IncompletePathException; import software.coley.recaf.path.PathNodes; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.util.ClipboardUtil; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFileContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicFileContextMenuProviderFactory.java similarity index 90% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFileContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicFileContextMenuProviderFactory.java index ea1638344..802cee98a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFileContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicFileContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -7,7 +7,10 @@ import software.coley.recaf.info.FileInfo; import software.coley.recaf.path.FilePathNode; import software.coley.recaf.path.PathNodes; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.util.ClipboardUtil; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicInnerClassContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicInnerClassContextMenuProviderFactory.java similarity index 86% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicInnerClassContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicInnerClassContextMenuProviderFactory.java index ee90bc0fd..fc2e08146 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicInnerClassContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicInnerClassContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -6,10 +6,10 @@ import javafx.scene.control.ContextMenu; import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.InnerClassInfo; -import software.coley.recaf.services.cell.ClassContextMenuProviderFactory; -import software.coley.recaf.services.cell.ContextMenuProvider; -import software.coley.recaf.services.cell.ContextSource; -import software.coley.recaf.services.cell.InnerClassContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ClassContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProvider; +import software.coley.recaf.services.cell.context.ContextSource; +import software.coley.recaf.services.cell.context.InnerClassContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.AndroidClassBundle; import software.coley.recaf.workspace.model.bundle.ClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicMethodContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicMethodContextMenuProviderFactory.java similarity index 93% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicMethodContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicMethodContextMenuProviderFactory.java index 2ff832500..2435683be 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicMethodContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicMethodContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -15,7 +15,10 @@ import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.path.IncompletePathException; import software.coley.recaf.path.PathNodes; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; import software.coley.recaf.util.ClipboardUtil; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicPackageContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicPackageContextMenuProviderFactory.java similarity index 88% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicPackageContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicPackageContextMenuProviderFactory.java index 52d5c1421..f21673841 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicPackageContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicPackageContextMenuProviderFactory.java @@ -1,20 +1,17 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import javafx.collections.ObservableList; import javafx.scene.control.ContextMenu; -import javafx.scene.control.Menu; -import javafx.scene.control.MenuItem; -import org.kordamp.ikonli.carbonicons.CarbonIcons; import software.coley.recaf.info.ClassInfo; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProvider; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.ui.contextmenu.ContextMenuBuilder; -import software.coley.recaf.ui.contextmenu.DirectoryMenuBuilder; import software.coley.recaf.util.ClipboardUtil; -import software.coley.recaf.util.Lang; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.ClassBundle; import software.coley.recaf.workspace.model.bundle.JvmClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicResourceContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicResourceContextMenuProviderFactory.java similarity index 86% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicResourceContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicResourceContextMenuProviderFactory.java index a484ba9b1..6edc28c2a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicResourceContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicResourceContextMenuProviderFactory.java @@ -1,10 +1,12 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import javafx.scene.control.ContextMenu; -import software.coley.recaf.services.cell.*; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicWhitelistingContextSource.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicWhitelistingContextSource.java similarity index 93% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicWhitelistingContextSource.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicWhitelistingContextSource.java index 7af9480b5..e13e959fd 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BasicWhitelistingContextSource.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BasicWhitelistingContextSource.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuAdapter.java new file mode 100644 index 000000000..1d93bcf68 --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuAdapter.java @@ -0,0 +1,33 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.Info; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.Bundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link Bundle} types. + * + * @author Matt Coley + */ +public interface BundleContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * The bundle the menu is for. + */ + default void adaptBundleContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull Bundle bundle) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BundleContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuProviderFactory.java similarity index 82% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/BundleContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuProviderFactory.java index fd26567f1..7d87a969f 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BundleContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/BundleContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.Info; @@ -7,8 +7,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link Bundle types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link Bundle} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuAdapter.java new file mode 100644 index 000000000..3032fa27b --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuAdapter.java @@ -0,0 +1,60 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.AndroidClassInfo; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.info.JvmClassInfo; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.AndroidClassBundle; +import software.coley.recaf.workspace.model.bundle.JvmClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link ClassInfo} types. + * + * @author Matt Coley + */ +public interface ClassContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param info + * The class the menu is for. + */ + default void adaptJvmClassMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull JvmClassBundle bundle, + @Nonnull JvmClassInfo info) {} + + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param info + * The class the menu is for. + */ + default void adaptAndroidClassMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull AndroidClassBundle bundle, + @Nonnull AndroidClassInfo info) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ClassContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuProviderFactory.java similarity index 90% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ClassContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuProviderFactory.java index e422bd318..4389d5d7c 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ClassContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ClassContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.AndroidClassInfo; @@ -10,8 +10,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link ClassInfo types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link ClassInfo} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuAdapter.java new file mode 100644 index 000000000..bea0b658e --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuAdapter.java @@ -0,0 +1,10 @@ +package software.coley.recaf.services.cell.context; + +import javafx.scene.control.ContextMenu; + +/** + * Adapts an existing {@link ContextMenu}. Used to customize content provided by {@link ContextMenuProvider} instances. + * + * @author Matt Coley + */ +public interface ContextMenuAdapter {} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProvider.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProvider.java similarity index 87% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProvider.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProvider.java index 847322ba1..e3ef09119 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProvider.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProvider.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nullable; import javafx.scene.control.ContextMenu; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderFactory.java similarity index 86% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderFactory.java index 7436f7432..9f72e09b4 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; @@ -11,6 +11,7 @@ import software.coley.recaf.info.JvmClassInfo; import software.coley.recaf.info.member.FieldMember; import software.coley.recaf.info.member.MethodMember; +import software.coley.recaf.ui.pane.editing.assembler.resolve.AssemblyResolution; import software.coley.recaf.workspace.model.bundle.AndroidClassBundle; import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; @@ -19,6 +20,8 @@ * Base context menu provider factory. * * @author Matt Coley + * @see AnnotationContextMenuProviderFactory For annotations on classes and their members. + * @see AssemblerContextMenuProviderFactory For {@link AssemblyResolution} data in an assembler UI. * @see ClassContextMenuProviderFactory For {@link JvmClassInfo} and {@link AndroidClassBundle} entries. * @see InnerClassContextMenuProviderFactory For {@link InnerClassInfo} entries. * @see FieldContextMenuProviderFactory For {@link FieldMember} entries. diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderService.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderService.java new file mode 100644 index 000000000..90ee3698e --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderService.java @@ -0,0 +1,744 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.*; +import software.coley.recaf.info.annotation.Annotated; +import software.coley.recaf.info.annotation.AnnotationInfo; +import software.coley.recaf.info.member.ClassMember; +import software.coley.recaf.info.member.FieldMember; +import software.coley.recaf.info.member.MethodMember; +import software.coley.recaf.path.AssemblerPathData; +import software.coley.recaf.services.Service; +import software.coley.recaf.ui.control.tree.WorkspaceTreeCell; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.*; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; +import java.util.function.BiConsumer; + +/** + * Provides support for providing context menus for a variety of item types. + * For instance, the menus of {@link WorkspaceTreeCell} instances. + *
+ * The menus displayed in the UI can be adapted out by supplying your own + * {@link ContextMenuAdapter} instances via: + * + * + * @author Matt Coley + */ +@ApplicationScoped +public class ContextMenuProviderService implements Service { + public static final String SERVICE_ID = "cell-menus"; + private final ContextMenuProviderServiceConfig config; + // Adapters + private final Set classContextMenuAdapters = new HashSet<>(); + private final Set fileContextMenuAdapters = new HashSet<>(); + private final Set innerClassContextMenuAdapters = new HashSet<>(); + private final Set fieldContextMenuAdapters = new HashSet<>(); + private final Set methodContextMenuAdapters = new HashSet<>(); + private final Set annotationContextMenuAdapters = new HashSet<>(); + private final Set packageContextMenuAdapters = new HashSet<>(); + private final Set directoryContextMenuAdapters = new HashSet<>(); + private final Set bundleContextMenuAdapters = new HashSet<>(); + private final Set resourceContextMenuAdapters = new HashSet<>(); + private final Set assemblerContextMenuAdapters = new HashSet<>(); + // Defaults + private final ClassContextMenuProviderFactory classContextMenuDefault; + private final FileContextMenuProviderFactory fileContextMenuDefault; + private final InnerClassContextMenuProviderFactory innerClassContextMenuDefault; + private final FieldContextMenuProviderFactory fieldContextMenuDefault; + private final MethodContextMenuProviderFactory methodContextMenuDefault; + private final AnnotationContextMenuProviderFactory annotationContextMenuDefault; + private final PackageContextMenuProviderFactory packageContextMenuDefault; + private final DirectoryContextMenuProviderFactory directoryContextMenuDefault; + private final BundleContextMenuProviderFactory bundleContextMenuDefault; + private final ResourceContextMenuProviderFactory resourceContextMenuDefault; + private final AssemblerContextMenuProviderFactory assemblerContextMenuDefault; + + @Inject + public ContextMenuProviderService(@Nonnull ContextMenuProviderServiceConfig config, + @Nonnull ClassContextMenuProviderFactory classContextMenuDefault, + @Nonnull FileContextMenuProviderFactory fileContextMenuDefault, + @Nonnull InnerClassContextMenuProviderFactory innerClassContextMenuDefault, + @Nonnull FieldContextMenuProviderFactory fieldContextMenuDefault, + @Nonnull MethodContextMenuProviderFactory methodContextMenuDefault, + @Nonnull AnnotationContextMenuProviderFactory annotationContextMenuDefault, + @Nonnull PackageContextMenuProviderFactory packageContextMenuDefault, + @Nonnull DirectoryContextMenuProviderFactory directoryContextMenuDefault, + @Nonnull BundleContextMenuProviderFactory bundleContextMenuDefault, + @Nonnull ResourceContextMenuProviderFactory resourceContextMenuDefault, + @Nonnull AssemblerContextMenuProviderFactory assemblerContextMenuDefault) { + this.config = config; + + // Default factories + this.classContextMenuDefault = classContextMenuDefault; + this.fileContextMenuDefault = fileContextMenuDefault; + this.innerClassContextMenuDefault = innerClassContextMenuDefault; + this.fieldContextMenuDefault = fieldContextMenuDefault; + this.methodContextMenuDefault = methodContextMenuDefault; + this.annotationContextMenuDefault = annotationContextMenuDefault; + this.packageContextMenuDefault = packageContextMenuDefault; + this.directoryContextMenuDefault = directoryContextMenuDefault; + this.bundleContextMenuDefault = bundleContextMenuDefault; + this.resourceContextMenuDefault = resourceContextMenuDefault; + this.assemblerContextMenuDefault = assemblerContextMenuDefault; + } + + /** + * Delegates to {@link ClassContextMenuProviderFactory}. + * + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param info + * The class to create a menu for. + * + * @return Menu provider for the class. + */ + @Nonnull + public ContextMenuProvider getJvmClassInfoContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull JvmClassBundle bundle, + @Nonnull JvmClassInfo info) { + ContextMenuProvider provider = classContextMenuDefault.getJvmClassInfoContextMenuProvider(source, workspace, resource, bundle, info); + provider = adapt(provider, classContextMenuAdapters, (adapter, menu) -> adapter.adaptJvmClassMenu(menu, source, workspace, resource, bundle, info)); + return provider; + } + + /** + * Delegates to {@link ClassContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param info + * The class to create a menu for. + * + * @return Menu provider for the class. + */ + @Nonnull + public ContextMenuProvider getAndroidClassInfoContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull AndroidClassBundle bundle, + @Nonnull AndroidClassInfo info) { + ContextMenuProvider provider = classContextMenuDefault.getAndroidClassInfoContextMenuProvider(source, workspace, resource, bundle, info); + provider = adapt(provider, classContextMenuAdapters, (adapter, menu) -> adapter.adaptAndroidClassMenu(menu, source, workspace, resource, bundle, info)); + return provider; + } + + /** + * Delegates to {@link InnerClassContextMenuProviderFactory}. + * + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param outerClass + * Outer class. + * @param inner + * The inner class to create a menu for. + * + * @return Menu provider for the class. + */ + @Nonnull + public ContextMenuProvider getInnerClassInfoContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo outerClass, + @Nonnull InnerClassInfo inner) { + ContextMenuProvider provider = innerClassContextMenuDefault.getInnerClassInfoContextMenuProvider(source, workspace, resource, bundle, outerClass, inner); + provider = adapt(provider, innerClassContextMenuAdapters, (adapter, menu) -> adapter.adaptInnerClassInfoContextMenu(menu, source, workspace, resource, bundle, outerClass, inner)); + return provider; + } + + /** + * Delegates to {@link FieldContextMenuProviderFactory} and {@link MethodContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param declaringClass + * Containing class. + * @param member + * The member to create a menu for. + * + * @return Menu provider for the class member. + */ + @Nonnull + public ContextMenuProvider getClassMemberContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull ClassMember member) { + if (member.isField()) { + FieldMember field = (FieldMember) member; + ContextMenuProvider provider = fieldContextMenuDefault.getFieldContextMenuProvider(source, workspace, resource, bundle, declaringClass, field); + provider = adapt(provider, fieldContextMenuAdapters, (adapter, menu) -> adapter.adaptFieldContextMenu(menu, source, workspace, resource, bundle, declaringClass, field)); + return provider; + } else if (member.isMethod()) { + MethodMember method = (MethodMember) member; + ContextMenuProvider provider = methodContextMenuDefault.getMethodContextMenuProvider(source, workspace, resource, bundle, declaringClass, method); + provider = adapt(provider, methodContextMenuAdapters, (adapter, menu) -> adapter.adaptMethodContextMenu(menu, source, workspace, resource, bundle, declaringClass, method)); + return provider; + } else { + throw new IllegalStateException("Unsupported member: " + member.getClass().getName()); + } + } + + /** + * Delegates to {@link AnnotationContextMenuProviderFactory}. + * + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param annotated + * The annotated item. + * @param annotation + * The annotation to create an icon for. + * + * @return Text provider for the annotation. + */ + @Nonnull + public ContextMenuProvider getAnnotationContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull Annotated annotated, + @Nonnull AnnotationInfo annotation) { + ContextMenuProvider provider = annotationContextMenuDefault.getAnnotationContextMenuProvider(source, workspace, resource, bundle, annotated, annotation); + provider = adapt(provider, annotationContextMenuAdapters, (adapter, menu) -> adapter.adaptAnnotationContextMenu(menu, source, workspace, resource, bundle, annotated, annotation)); + return provider; + } + + /** + * Delegates to {@link FileContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param info + * The file to create a menu for. + * + * @return Menu provider for the file. + */ + @Nonnull + public ContextMenuProvider getFileInfoContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull FileBundle bundle, + @Nonnull FileInfo info) { + ContextMenuProvider provider = fileContextMenuDefault.getFileInfoContextMenuProvider(source, workspace, resource, bundle, info); + provider = adapt(provider, fileContextMenuAdapters, (adapter, menu) -> adapter.adaptFileInfoContextMenu(menu, source, workspace, resource, bundle, info)); + return provider; + } + + /** + * Delegates to {@link PackageContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param packageName + * The full package name, separated by {@code /}. + * + * @return Menu provider for the package. + */ + @Nonnull + public ContextMenuProvider getPackageContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull String packageName) { + ContextMenuProvider provider = packageContextMenuDefault.getPackageContextMenuProvider(source, workspace, resource, bundle, packageName); + provider = adapt(provider, packageContextMenuAdapters, (adapter, menu) -> adapter.adaptPackageContextMenu(menu, source, workspace, resource, bundle, packageName)); + return provider; + } + + /** + * Delegates to {@link DirectoryContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param directoryName + * The full path of the directory. + * + * @return Menu provider for the directory. + */ + @Nonnull + public ContextMenuProvider getDirectoryContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull FileBundle bundle, + @Nonnull String directoryName) { + ContextMenuProvider provider = directoryContextMenuDefault.getDirectoryContextMenuProvider(source, workspace, resource, bundle, directoryName); + provider = adapt(provider, directoryContextMenuAdapters, (adapter, menu) -> adapter.adaptDirectoryContextMenu(menu, source, workspace, resource, bundle, directoryName)); + return provider; + } + + /** + * Delegates to {@link BundleContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * The bundle to create a menu for. + * + * @return Menu provider for the bundle. + */ + @Nonnull + public ContextMenuProvider getBundleContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull Bundle bundle) { + ContextMenuProvider provider = bundleContextMenuDefault.getBundleContextMenuProvider(source, workspace, resource, bundle); + provider = adapt(provider, bundleContextMenuAdapters, (adapter, menu) -> adapter.adaptBundleContextMenu(menu, source, workspace, resource, bundle)); + return provider; + } + + /** + * Delegates to {@link ResourceContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * The resource to create a menu for. + * + * @return Menu provider for the resource. + */ + @Nonnull + public ContextMenuProvider getResourceContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource) { + ContextMenuProvider provider = resourceContextMenuDefault.getResourceContextMenuProvider(source, workspace, resource); + provider = adapt(provider, resourceContextMenuAdapters, (adapter, menu) -> adapter.adaptResourceContextMenu(menu, source, workspace, resource)); + return provider; + } + + /** + * Delegates to {@link AssemblerContextMenuProviderFactory}. + * + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param declaringClass + * Containing class. + * @param assemblerData + * The assembler data to create a menu for. + * + * @return Menu provider for the resource. + */ + @Nonnull + public ContextMenuProvider getAssemblerContextMenuProvider(@Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull AssemblerPathData assemblerData) { + ContextMenuProvider provider = assemblerContextMenuDefault.getAssemblerMenuProvider(source, workspace, resource, bundle, declaringClass, assemblerData); + provider = adapt(provider, assemblerContextMenuAdapters, (adapter, menu) -> adapter.adaptAssemblerMenu(menu, source, workspace, resource, bundle, declaringClass, assemblerData)); + return provider; + } + + /** + * @param adapter + * Adapter to register for modifying class context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addClassContextMenuAdapter(@Nonnull ClassContextMenuAdapter adapter) { + return classContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeClassContextMenuAdapter(@Nonnull ClassContextMenuAdapter adapter) { + return classContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying file context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addFileContextMenuAdapter(@Nonnull FileContextMenuAdapter adapter) { + return fileContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeFileContextMenuAdapter(@Nonnull FileContextMenuAdapter adapter) { + return fileContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying inner-class context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addInnerClassContextMenuAdapter(@Nonnull InnerClassContextMenuAdapter adapter) { + return innerClassContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeInnerClassContextMenuAdapter(@Nonnull InnerClassContextMenuAdapter adapter) { + return innerClassContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying field context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addFieldContextMenuAdapter(@Nonnull FieldContextMenuAdapter adapter) { + return fieldContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeFieldContextMenuAdapter(@Nonnull FieldContextMenuAdapter adapter) { + return fieldContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying method context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addMethodContextMenuAdapter(@Nonnull MethodContextMenuAdapter adapter) { + return methodContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeMethodContextMenuAdapter(@Nonnull MethodContextMenuAdapter adapter) { + return methodContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying annotation context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addAnnotationContextMenuAdapter(@Nonnull AnnotationContextMenuAdapter adapter) { + return annotationContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeAnnotationContextMenuAdapter(@Nonnull AnnotationContextMenuAdapter adapter) { + return annotationContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying package context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addPackageContextMenuAdapter(@Nonnull PackageContextMenuAdapter adapter) { + return packageContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removePackageContextMenuAdapter(@Nonnull PackageContextMenuAdapter adapter) { + return packageContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying directory context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addDirectoryContextMenuAdapter(@Nonnull DirectoryContextMenuAdapter adapter) { + return directoryContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeDirectoryContextMenuAdapter(@Nonnull DirectoryContextMenuAdapter adapter) { + return directoryContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying bundle context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addBundleContextMenuAdapter(@Nonnull BundleContextMenuAdapter adapter) { + return bundleContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeBundleContextMenuAdapter(@Nonnull BundleContextMenuAdapter adapter) { + return bundleContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying resource context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addResourceContextMenuAdapter(@Nonnull ResourceContextMenuAdapter adapter) { + return resourceContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeResourceContextMenuAdapter(@Nonnull ResourceContextMenuAdapter adapter) { + return resourceContextMenuAdapters.remove(adapter); + } + + /** + * @param adapter + * Adapter to register for modifying assembler context menus. + * + * @return {@code true} when the adapter was added. {@link false} when the adapter has already been added. + */ + public boolean addAssemblerContextMenuAdapter(@Nonnull AssemblerContextMenuAdapter adapter) { + return assemblerContextMenuAdapters.add(adapter); + } + + /** + * @param adapter + * Adapter to remove. + * + * @return {@code true} when the adapter was removed. {@link false} when the adapter was not previously registered. + */ + public boolean removeAssemblerContextMenuAdapter(@Nonnull AssemblerContextMenuAdapter adapter) { + return assemblerContextMenuAdapters.remove(adapter); + } + + /** + * @return Default menu provider for classes. + */ + @Nonnull + public ClassContextMenuProviderFactory getClassContextMenuDefault() { + return classContextMenuDefault; + } + + /** + * @return Default menu provider for files. + */ + @Nonnull + public FileContextMenuProviderFactory getFileContextMenuDefault() { + return fileContextMenuDefault; + } + + /** + * @return Default menu provider for packages. + */ + @Nonnull + public PackageContextMenuProviderFactory getPackageContextMenuDefault() { + return packageContextMenuDefault; + } + + /** + * @return Default menu provider for directories. + */ + @Nonnull + public DirectoryContextMenuProviderFactory getDirectoryContextMenuDefault() { + return directoryContextMenuDefault; + } + + /** + * @return Default menu provider for bundles. + */ + @Nonnull + public BundleContextMenuProviderFactory getBundleContextMenuDefault() { + return bundleContextMenuDefault; + } + + /** + * @return Default menu provider for resources. + */ + @Nonnull + public ResourceContextMenuProviderFactory getResourceContextMenuDefault() { + return resourceContextMenuDefault; + } + + /** + * @return Default menu provider for inner classes. + */ + @Nonnull + public InnerClassContextMenuProviderFactory getInnerClassContextMenuDefault() { + return innerClassContextMenuDefault; + } + + /** + * @return Default menu provider for fields. + */ + @Nonnull + public FieldContextMenuProviderFactory getFieldContextMenuDefault() { + return fieldContextMenuDefault; + } + + /** + * @return Default menu provider for methods. + */ + @Nonnull + public MethodContextMenuProviderFactory getMethodContextMenuDefault() { + return methodContextMenuDefault; + } + + /** + * @return Default menu provider for annotations. + */ + @Nonnull + public AnnotationContextMenuProviderFactory getAnnotationContextMenuDefault() { + return annotationContextMenuDefault; + } + + /** + * @return Default menu provider for assembler data. + */ + @Nonnull + public AssemblerContextMenuProviderFactory getAssemblerContextMenuDefault() { + return assemblerContextMenuDefault; + } + + @Nonnull + @Override + public String getServiceId() { + return SERVICE_ID; + } + + @Nonnull + @Override + public ContextMenuProviderServiceConfig getServiceConfig() { + return config; + } + + @Nonnull + private static ContextMenuProvider adapt(@Nonnull ContextMenuProvider provider, + @Nonnull Collection adapters, + @Nonnull BiConsumer adapterConsumer) { + for (T adapter : adapters) { + ContextMenuProvider currentProvider = provider; + provider = () -> { + ContextMenu menu = currentProvider.makeMenu(); + if (menu != null) + adapterConsumer.accept(adapter, menu); + return menu; + }; + } + return provider; + } +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderServiceConfig.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderServiceConfig.java similarity index 91% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderServiceConfig.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderServiceConfig.java index d860460c4..5a954c046 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextMenuProviderServiceConfig.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextMenuProviderServiceConfig.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextSource.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextSource.java similarity index 95% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextSource.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextSource.java index c3c02e9e5..6b995997a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ContextSource.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ContextSource.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuAdapter.java new file mode 100644 index 000000000..983c5b3ef --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuAdapter.java @@ -0,0 +1,35 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.FileBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for directories (paths in {@link FileBundle}). + * + * @author Matt Coley + */ +public interface DirectoryContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param directoryName + * The full path of the directory the menu is for. + */ + default void adaptDirectoryContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull FileBundle bundle, + @Nonnull String directoryName) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/DirectoryContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuProviderFactory.java similarity index 86% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/DirectoryContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuProviderFactory.java index 1fcdb5293..57a77311f 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/DirectoryContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/DirectoryContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.workspace.model.Workspace; @@ -6,8 +6,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for directories (paths in {@link FileBundle}), - * to be plugged into {@link ContextMenuProviderService} to allow for third party menu customization. + * Context menu provider for directories (paths in {@link FileBundle}). * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuAdapter.java new file mode 100644 index 000000000..8607e1878 --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuAdapter.java @@ -0,0 +1,40 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.info.member.FieldMember; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.ClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link FieldMember} types. + * + * @author Matt Coley + */ +public interface FieldContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param declaringClass + * Containing class. + * @param field + * The field the menu is for. + */ + default void adaptFieldContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull FieldMember field) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FieldContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuProviderFactory.java similarity index 85% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/FieldContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuProviderFactory.java index fb36d3eb3..4d24a7671 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FieldContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FieldContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; @@ -8,8 +8,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link FieldMember types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link FieldMember} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuAdapter.java new file mode 100644 index 000000000..50e398887 --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuAdapter.java @@ -0,0 +1,36 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.FileInfo; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.FileBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link FileInfo} types. + * + * @author Matt Coley + */ +public interface FileContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param info + * The file the menu is for. + */ + default void adaptFileInfoContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull FileBundle bundle, + @Nonnull FileInfo info) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FileContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuProviderFactory.java similarity index 83% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/FileContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuProviderFactory.java index 6da31b181..b5f7bff79 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FileContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/FileContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.FileInfo; @@ -7,8 +7,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link FileInfo types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link FileInfo} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuAdapter.java new file mode 100644 index 000000000..4d2991803 --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuAdapter.java @@ -0,0 +1,40 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.info.InnerClassInfo; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.ClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link InnerClassInfo} types. + * + * @author Matt Coley + */ +public interface InnerClassContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param outerClass + * Outer class. + * @param inner + * The inner class the menu is for. + */ + default void adaptInnerClassInfoContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo outerClass, + @Nonnull InnerClassInfo inner) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/InnerClassContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuProviderFactory.java similarity index 85% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/InnerClassContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuProviderFactory.java index 734916e3b..7d4acf4a3 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/InnerClassContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/InnerClassContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; @@ -8,8 +8,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link ClassInfo types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link InnerClassInfo} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuAdapter.java new file mode 100644 index 000000000..d42efd7df --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuAdapter.java @@ -0,0 +1,40 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.info.member.MethodMember; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.ClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link MethodMember} types. + * + * @author Matt Coley + */ +public interface MethodContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param declaringClass + * Containing class. + * @param method + * The method the menu is for. + */ + default void adaptMethodContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull ClassInfo declaringClass, + @Nonnull MethodMember method) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/MethodContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuProviderFactory.java similarity index 85% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/MethodContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuProviderFactory.java index 52997b8e2..22f93b0b7 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/MethodContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/MethodContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; @@ -8,8 +8,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link MethodMember types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link MethodMember} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuAdapter.java new file mode 100644 index 000000000..8d68cebbe --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuAdapter.java @@ -0,0 +1,38 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.info.ClassInfo; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.bundle.AndroidClassBundle; +import software.coley.recaf.workspace.model.bundle.ClassBundle; +import software.coley.recaf.workspace.model.bundle.JvmClassBundle; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for packages (paths in {@link JvmClassBundle} and {@link AndroidClassBundle}). + * + * @author Matt Coley + */ +public interface PackageContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request source. + * @param workspace + * Containing workspace. + * @param resource + * Containing resource. + * @param bundle + * Containing bundle. + * @param packageName + * The full package name, separated by {@code /}. + */ + default void adaptPackageContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource, + @Nonnull ClassBundle bundle, + @Nonnull String packageName) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/PackageContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuProviderFactory.java similarity index 86% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/PackageContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuProviderFactory.java index 8b141e8c1..b6bd8bb48 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/PackageContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/PackageContextMenuProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; @@ -9,8 +9,7 @@ import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for packages (paths in {@link JvmClassBundle} and {@link AndroidClassBundle}), - * to be plugged into {@link ContextMenuProviderService} to allow for third party menu customization. + * Context menu provider for packages (paths in {@link JvmClassBundle} and {@link AndroidClassBundle}). * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuAdapter.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuAdapter.java new file mode 100644 index 000000000..2487521a6 --- /dev/null +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuAdapter.java @@ -0,0 +1,28 @@ +package software.coley.recaf.services.cell.context; + +import jakarta.annotation.Nonnull; +import javafx.scene.control.ContextMenu; +import software.coley.recaf.workspace.model.Workspace; +import software.coley.recaf.workspace.model.resource.WorkspaceResource; + +/** + * Context menu adapter for {@link WorkspaceResource} types. + * + * @author Matt Coley + */ +public interface ResourceContextMenuAdapter extends ContextMenuAdapter { + /** + * @param menu + * The menu to adapt. + * @param source + * Context request origin. + * @param workspace + * Containing workspace. + * @param resource + * The resource the menu is for. + */ + default void adaptResourceContextMenu(@Nonnull ContextMenu menu, + @Nonnull ContextSource source, + @Nonnull Workspace workspace, + @Nonnull WorkspaceResource resource) {} +} diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ResourceContextMenuProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuProviderFactory.java similarity index 78% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ResourceContextMenuProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuProviderFactory.java index 0307ddde8..da3a5c949 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ResourceContextMenuProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/context/ResourceContextMenuProviderFactory.java @@ -1,12 +1,11 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.context; import jakarta.annotation.Nonnull; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.resource.WorkspaceResource; /** - * Context menu provider for {@link WorkspaceResource types}, to be plugged into {@link ContextMenuProviderService} - * to allow for third party menu customization. + * Context menu provider for {@link WorkspaceResource} types. * * @author Matt Coley */ diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/AnnotationIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/AnnotationIconProviderFactory.java similarity index 96% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/AnnotationIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/AnnotationIconProviderFactory.java index 0431a5a49..a3f62f264 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/AnnotationIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/AnnotationIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAnnotationIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicAnnotationIconProviderFactory.java similarity index 85% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAnnotationIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicAnnotationIconProviderFactory.java index df9e0c5bc..53b620185 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicAnnotationIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicAnnotationIconProviderFactory.java @@ -1,12 +1,12 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.annotation.Annotated; import software.coley.recaf.info.annotation.AnnotationInfo; -import software.coley.recaf.services.cell.AnnotationIconProviderFactory; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.AnnotationIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.ClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicBundleIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicBundleIconProviderFactory.java similarity index 85% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicBundleIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicBundleIconProviderFactory.java index 1ecc809be..1bba9c08a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicBundleIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicBundleIconProviderFactory.java @@ -1,10 +1,10 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import software.coley.recaf.info.Info; -import software.coley.recaf.services.cell.BundleIconProviderFactory; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.BundleIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.Bundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicClassIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicClassIconProviderFactory.java similarity index 93% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicClassIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicClassIconProviderFactory.java index 3f5445a96..570062f25 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicClassIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicClassIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -6,8 +6,8 @@ import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.JvmClassInfo; import software.coley.recaf.info.properties.builtin.ThrowableProperty; -import software.coley.recaf.services.cell.ClassIconProviderFactory; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.ClassIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.AndroidClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicDirectoryIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicDirectoryIconProviderFactory.java similarity index 81% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicDirectoryIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicDirectoryIconProviderFactory.java index d11a48d46..2375a34b8 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicDirectoryIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicDirectoryIconProviderFactory.java @@ -1,9 +1,9 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; -import software.coley.recaf.services.cell.DirectoryIconProviderFactory; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.DirectoryIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.FileBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFieldIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicFieldIconProviderFactory.java similarity index 91% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFieldIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicFieldIconProviderFactory.java index ab4912a3f..45e0496eb 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFieldIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicFieldIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -8,8 +8,8 @@ import javafx.scene.layout.StackPane; import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.member.FieldMember; -import software.coley.recaf.services.cell.FieldIconProviderFactory; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.FieldIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.ClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFileIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicFileIconProviderFactory.java similarity index 94% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFileIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicFileIconProviderFactory.java index 9507884c5..b2e947208 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicFileIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicFileIconProviderFactory.java @@ -1,10 +1,10 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import software.coley.recaf.info.FileInfo; -import software.coley.recaf.services.cell.FileIconProviderFactory; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.FileIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.util.ByteHeaderUtil; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicInnerClassIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicInnerClassIconProviderFactory.java similarity index 94% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicInnerClassIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicInnerClassIconProviderFactory.java index 51e9af523..afe1c4f99 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicInnerClassIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicInnerClassIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -7,8 +7,8 @@ import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.InnerClassInfo; import software.coley.recaf.info.properties.builtin.ThrowableProperty; -import software.coley.recaf.services.cell.IconProvider; -import software.coley.recaf.services.cell.InnerClassIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.InnerClassIconProviderFactory; import software.coley.recaf.ui.control.FontIconView; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicMethodIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicMethodIconProviderFactory.java similarity index 91% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicMethodIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicMethodIconProviderFactory.java index 0c8f1d7c9..74236dcfa 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicMethodIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicMethodIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; @@ -8,8 +8,8 @@ import javafx.scene.layout.StackPane; import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.member.MethodMember; -import software.coley.recaf.services.cell.IconProvider; -import software.coley.recaf.services.cell.MethodIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.MethodIconProviderFactory; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.ClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicPackageIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicPackageIconProviderFactory.java similarity index 79% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicPackageIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicPackageIconProviderFactory.java index 0b0ad068f..da09481ca 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicPackageIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicPackageIconProviderFactory.java @@ -1,13 +1,12 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import software.coley.recaf.info.ClassInfo; -import software.coley.recaf.services.cell.IconProvider; -import software.coley.recaf.services.cell.PackageIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.PackageIconProviderFactory; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; -import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.bundle.ClassBundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicResourceIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicResourceIconProviderFactory.java similarity index 90% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicResourceIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicResourceIconProviderFactory.java index 8badd5935..73b3d8536 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/builtin/BasicResourceIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BasicResourceIconProviderFactory.java @@ -1,11 +1,11 @@ -package software.coley.recaf.services.cell.builtin; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; import software.coley.recaf.info.*; -import software.coley.recaf.services.cell.IconProvider; -import software.coley.recaf.services.cell.PackageIconProviderFactory; -import software.coley.recaf.services.cell.ResourceIconProviderFactory; +import software.coley.recaf.services.cell.icon.IconProvider; +import software.coley.recaf.services.cell.icon.PackageIconProviderFactory; +import software.coley.recaf.services.cell.icon.ResourceIconProviderFactory; import software.coley.recaf.util.ByteHeaderUtil; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BundleIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BundleIconProviderFactory.java similarity index 95% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/BundleIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BundleIconProviderFactory.java index 399dfa374..114a6e636 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/BundleIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/BundleIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.Info; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ClassIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/ClassIconProviderFactory.java similarity index 97% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ClassIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/ClassIconProviderFactory.java index c56574b17..347890c19 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ClassIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/ClassIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.AndroidClassInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/DirectoryIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/DirectoryIconProviderFactory.java similarity index 95% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/DirectoryIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/DirectoryIconProviderFactory.java index 25b61679e..5205ca0bf 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/DirectoryIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/DirectoryIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.workspace.model.Workspace; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FieldIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/FieldIconProviderFactory.java similarity index 96% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/FieldIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/FieldIconProviderFactory.java index 5c2cb74df..8daa3cf39 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FieldIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/FieldIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FileIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/FileIconProviderFactory.java similarity index 95% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/FileIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/FileIconProviderFactory.java index a6980f248..152fad384 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/FileIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/FileIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.FileInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProvider.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProvider.java similarity index 88% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProvider.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProvider.java index 31751118e..cede3771d 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProvider.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProvider.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nullable; import javafx.scene.Node; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderFactory.java similarity index 97% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderFactory.java index 9340225b3..b9946e20a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderService.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderService.java similarity index 98% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderService.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderService.java index b48ba0845..b60cb454a 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderService.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderService.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; @@ -11,6 +11,8 @@ import software.coley.recaf.info.member.FieldMember; import software.coley.recaf.info.member.MethodMember; import software.coley.recaf.services.Service; +import software.coley.recaf.services.cell.context.FieldContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.MethodContextMenuProviderFactory; import software.coley.recaf.ui.control.tree.WorkspaceTreeCell; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.*; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderServiceConfig.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderServiceConfig.java similarity index 92% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderServiceConfig.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderServiceConfig.java index ab8884f92..929c2a72c 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/IconProviderServiceConfig.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/IconProviderServiceConfig.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/InnerClassIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/InnerClassIconProviderFactory.java similarity index 96% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/InnerClassIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/InnerClassIconProviderFactory.java index fe8a74e95..4104b85f0 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/InnerClassIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/InnerClassIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/MethodIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/MethodIconProviderFactory.java similarity index 96% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/MethodIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/MethodIconProviderFactory.java index 6c4a83923..8d3e3b2e7 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/MethodIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/MethodIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/PackageIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/PackageIconProviderFactory.java similarity index 92% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/PackageIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/PackageIconProviderFactory.java index 4accff7f8..ef7deb0c2 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/PackageIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/PackageIconProviderFactory.java @@ -1,10 +1,9 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.AndroidClassBundle; -import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.bundle.ClassBundle; import software.coley.recaf.workspace.model.bundle.JvmClassBundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ResourceIconProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/ResourceIconProviderFactory.java similarity index 93% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/ResourceIconProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/ResourceIconProviderFactory.java index 6fc72c26c..d633fc9b2 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/ResourceIconProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/icon/ResourceIconProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.icon; import jakarta.annotation.Nonnull; import software.coley.recaf.workspace.model.Workspace; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProvider.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProvider.java similarity index 85% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProvider.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProvider.java index df28a117f..f7f514270 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProvider.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProvider.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.text; import jakarta.annotation.Nullable; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderFactory.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderFactory.java similarity index 89% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderFactory.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderFactory.java index 6a91eede4..283e04aeb 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderFactory.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderFactory.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.text; import jakarta.annotation.Nonnull; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderService.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderService.java similarity index 99% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderService.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderService.java index 0c437c295..12a8f0812 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderService.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderService.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.text; import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ApplicationScoped; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderServiceConfig.java b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderServiceConfig.java similarity index 92% rename from recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderServiceConfig.java rename to recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderServiceConfig.java index bc94ba96e..46199b818 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/cell/TextProviderServiceConfig.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/cell/text/TextProviderServiceConfig.java @@ -1,4 +1,4 @@ -package software.coley.recaf.services.cell; +package software.coley.recaf.services.cell.text; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/info/summary/builtin/EntryPointSummarizer.java b/recaf-ui/src/main/java/software/coley/recaf/services/info/summary/builtin/EntryPointSummarizer.java index c050010e3..bf4581720 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/info/summary/builtin/EntryPointSummarizer.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/info/summary/builtin/EntryPointSummarizer.java @@ -8,8 +8,8 @@ import javafx.scene.Node; import javafx.scene.control.Label; import software.coley.recaf.info.member.MethodMember; -import software.coley.recaf.services.cell.IconProviderService; -import software.coley.recaf.services.cell.TextProviderService; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.info.summary.ResourceSummarizer; import software.coley.recaf.services.info.summary.SummaryConsumer; import software.coley.recaf.services.navigation.Actions; diff --git a/recaf-ui/src/main/java/software/coley/recaf/services/navigation/Actions.java b/recaf-ui/src/main/java/software/coley/recaf/services/navigation/Actions.java index e16532826..b8b6ed9a2 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/services/navigation/Actions.java +++ b/recaf-ui/src/main/java/software/coley/recaf/services/navigation/Actions.java @@ -25,8 +25,8 @@ import software.coley.recaf.info.member.MethodMember; import software.coley.recaf.path.*; import software.coley.recaf.services.Service; -import software.coley.recaf.services.cell.IconProviderService; -import software.coley.recaf.services.cell.TextProviderService; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.mapping.IntermediateMappings; import software.coley.recaf.services.mapping.MappingApplier; import software.coley.recaf.services.mapping.MappingResults; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ContextMenuBuilder.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ContextMenuBuilder.java index 0a23eb3b4..c357787ac 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ContextMenuBuilder.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ContextMenuBuilder.java @@ -7,7 +7,7 @@ import software.coley.recaf.info.annotation.Annotated; import software.coley.recaf.info.annotation.AnnotationInfo; import software.coley.recaf.info.member.ClassMember; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.bundle.ClassBundle; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ItemSink.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ItemSink.java index 9b9c180ab..0a2bcdcec 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ItemSink.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/ItemSink.java @@ -4,7 +4,7 @@ import javafx.scene.control.Menu; import javafx.scene.control.MenuItem; import org.kordamp.ikonli.Ikon; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.util.CollectionUtil; import software.coley.recaf.util.Lang; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/AnnotationAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/AnnotationAction.java index 489067068..ff44d1623 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/AnnotationAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/AnnotationAction.java @@ -4,7 +4,7 @@ import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.annotation.Annotated; import software.coley.recaf.info.annotation.AnnotationInfo; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.ClassBundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/BundleAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/BundleAction.java index 44467d536..7a08cf7e7 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/BundleAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/BundleAction.java @@ -1,7 +1,7 @@ package software.coley.recaf.ui.contextmenu.actions; import jakarta.annotation.Nonnull; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/DirectoryAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/DirectoryAction.java index 02a7dc470..fd3d3bb30 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/DirectoryAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/DirectoryAction.java @@ -1,7 +1,7 @@ package software.coley.recaf.ui.contextmenu.actions; import jakarta.annotation.Nonnull; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/InfoAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/InfoAction.java index 01e565f22..16069d90f 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/InfoAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/InfoAction.java @@ -2,7 +2,7 @@ import jakarta.annotation.Nonnull; import software.coley.recaf.info.Info; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/MemberAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/MemberAction.java index 69ba60beb..bc6804efa 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/MemberAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/MemberAction.java @@ -3,7 +3,7 @@ import jakarta.annotation.Nonnull; import software.coley.recaf.info.ClassInfo; import software.coley.recaf.info.member.ClassMember; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.bundle.Bundle; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/ResourceAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/ResourceAction.java index fe52dbc65..14cbb1f46 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/ResourceAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/ResourceAction.java @@ -1,7 +1,7 @@ package software.coley.recaf.ui.contextmenu.actions; import jakarta.annotation.Nonnull; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; import software.coley.recaf.workspace.model.resource.WorkspaceResource; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/WorkspaceAction.java b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/WorkspaceAction.java index 2760f1544..94688bd00 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/WorkspaceAction.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/contextmenu/actions/WorkspaceAction.java @@ -1,7 +1,7 @@ package software.coley.recaf.ui.contextmenu.actions; import jakarta.annotation.Nonnull; -import software.coley.recaf.services.cell.ContextMenuProviderFactory; +import software.coley.recaf.services.cell.context.ContextMenuProviderFactory; import software.coley.recaf.workspace.model.Workspace; /** diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/source/JavaContextActionSupport.java b/recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/source/JavaContextActionSupport.java index 8f9f32975..590a6d5ed 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/source/JavaContextActionSupport.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/source/JavaContextActionSupport.java @@ -32,8 +32,8 @@ import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.path.PathNode; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextMenuProviderService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextMenuProviderService; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.services.navigation.ClassNavigable; import software.coley.recaf.services.navigation.Navigable; import software.coley.recaf.services.navigation.UpdatableNavigable; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTree.java b/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTree.java index fc4e79436..bfc36ee1f 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTree.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTree.java @@ -12,7 +12,7 @@ import software.coley.recaf.info.*; import software.coley.recaf.path.*; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.ui.config.WorkspaceExplorerConfig; import software.coley.recaf.util.FxThreadUtil; import software.coley.recaf.util.StringUtil; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTreeCell.java b/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTreeCell.java index 5f26db14f..dbceb3ebc 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTreeCell.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/WorkspaceTreeCell.java @@ -3,7 +3,7 @@ import jakarta.annotation.Nonnull; import javafx.scene.control.TreeCell; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.path.PathNode; import java.util.function.Function; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/MappingProgressPane.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/MappingProgressPane.java index 21615fa8d..129ea9dd1 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/MappingProgressPane.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/MappingProgressPane.java @@ -34,7 +34,7 @@ import software.coley.recaf.info.properties.builtin.OriginalClassNameProperty; import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.services.mapping.IntermediateMappings; import software.coley.recaf.services.mapping.Mappings; import software.coley.recaf.services.mapping.aggregate.AggregateMappingManager; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/WorkspaceInformationPane.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/WorkspaceInformationPane.java index e99a79a97..dbbf71e60 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/WorkspaceInformationPane.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/WorkspaceInformationPane.java @@ -16,8 +16,8 @@ import software.coley.recaf.path.PathNode; import software.coley.recaf.path.PathNodes; import software.coley.recaf.path.WorkspacePathNode; -import software.coley.recaf.services.cell.IconProviderService; -import software.coley.recaf.services.cell.TextProviderService; +import software.coley.recaf.services.cell.icon.IconProviderService; +import software.coley.recaf.services.cell.text.TextProviderService; import software.coley.recaf.services.info.summary.ResourceSummarizer; import software.coley.recaf.services.info.summary.ResourceSummaryService; import software.coley.recaf.services.info.summary.SummaryConsumer; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/AssemblerContextActionSupport.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/AssemblerContextActionSupport.java index c332ef811..93996ed0e 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/AssemblerContextActionSupport.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/AssemblerContextActionSupport.java @@ -11,8 +11,8 @@ import software.coley.recaf.path.AssemblerPathData; import software.coley.recaf.path.AssemblerPathNode; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextMenuProviderService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextMenuProviderService; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.ui.control.richtext.Editor; import software.coley.recaf.ui.control.richtext.source.JavaContextActionSupport; import software.coley.recaf.ui.pane.editing.assembler.resolve.AssemblyResolution; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/ContextualAssemblerComponent.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/ContextualAssemblerComponent.java index ba2a0af95..a339867f9 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/ContextualAssemblerComponent.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/ContextualAssemblerComponent.java @@ -9,8 +9,8 @@ import software.coley.recaf.path.ClassMemberPathNode; import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.path.PathNode; -import software.coley.recaf.services.cell.BasicBlacklistingContextSource; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.BasicBlacklistingContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.services.navigation.Navigable; import software.coley.recaf.services.navigation.UpdatableNavigable; import software.coley.recaf.ui.control.richtext.Editor; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/TypeTableCell.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/TypeTableCell.java index d3c48c6bc..552392044 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/TypeTableCell.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/assembler/TypeTableCell.java @@ -8,7 +8,7 @@ import me.darknet.assembler.compile.analysis.AnalysisUtils; import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextMenuProvider; +import software.coley.recaf.services.cell.context.ContextMenuProvider; import software.coley.recaf.ui.config.TextFormatConfig; import software.coley.recaf.util.Icons; import software.coley.recaf.workspace.model.Workspace; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/FieldsAndMethodsPane.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/FieldsAndMethodsPane.java index 84815655a..7bdd21932 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/FieldsAndMethodsPane.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/FieldsAndMethodsPane.java @@ -30,7 +30,7 @@ import software.coley.recaf.path.InnerClassPathNode; import software.coley.recaf.path.PathNode; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.services.navigation.Actions; import software.coley.recaf.services.navigation.ClassNavigable; import software.coley.recaf.services.navigation.Navigable; diff --git a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/InheritancePane.java b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/InheritancePane.java index b51a33907..1ddc26451 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/InheritancePane.java +++ b/recaf-ui/src/main/java/software/coley/recaf/ui/pane/editing/tabs/InheritancePane.java @@ -17,7 +17,7 @@ import software.coley.recaf.path.ClassPathNode; import software.coley.recaf.path.PathNode; import software.coley.recaf.services.cell.CellConfigurationService; -import software.coley.recaf.services.cell.ContextSource; +import software.coley.recaf.services.cell.context.ContextSource; import software.coley.recaf.services.inheritance.InheritanceGraph; import software.coley.recaf.services.inheritance.InheritanceVertex; import software.coley.recaf.services.navigation.Navigable; diff --git a/recaf-ui/src/main/java/software/coley/recaf/util/Icons.java b/recaf-ui/src/main/java/software/coley/recaf/util/Icons.java index 766d7eff9..807fb9c8b 100644 --- a/recaf-ui/src/main/java/software/coley/recaf/util/Icons.java +++ b/recaf-ui/src/main/java/software/coley/recaf/util/Icons.java @@ -4,7 +4,7 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; -import software.coley.recaf.services.cell.IconProvider; +import software.coley.recaf.services.cell.icon.IconProvider; import software.coley.recaf.ui.control.IconView; import java.io.InputStream;