diff --git a/sherlock-platform/customization/com.google.sherlock.customization.iml b/sherlock-platform/customization/com.google.sherlock.customization.iml index 1d09648e1ee66..df8fc3f8cf644 100644 --- a/sherlock-platform/customization/com.google.sherlock.customization.iml +++ b/sherlock-platform/customization/com.google.sherlock.customization.iml @@ -9,5 +9,7 @@ + + \ No newline at end of file diff --git a/sherlock-platform/customization/resources/META-INF/SherlockPlatformCustomization.xml b/sherlock-platform/customization/resources/META-INF/SherlockPlatformCustomization.xml index e2e0aef4265ac..ea60f118dc845 100644 --- a/sherlock-platform/customization/resources/META-INF/SherlockPlatformCustomization.xml +++ b/sherlock-platform/customization/resources/META-INF/SherlockPlatformCustomization.xml @@ -1,14 +1,18 @@ - - com.intellij.modules.platform - - - - - - - + com.intellij.modules.platform + + + + + + + + + + \ No newline at end of file diff --git a/sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleBuilder.java b/sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleBuilder.java new file mode 100644 index 0000000000000..5aee4b65f00c0 --- /dev/null +++ b/sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleBuilder.java @@ -0,0 +1,40 @@ +/*** + * Copyright 2024 Google LLC + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***/ +package com.google.sherlock.module; + +import com.intellij.ide.util.projectWizard.ModuleBuilder; +import com.intellij.ide.util.projectWizard.ModuleWizardStep; +import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.openapi.Disposable; +import com.intellij.openapi.module.ModuleType; +import com.intellij.openapi.roots.ModifiableRootModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class SherlockModuleBuilder extends ModuleBuilder { + @Override + public void setupRootModel(@NotNull ModifiableRootModel model) { + } + @Override + public ModuleType getModuleType() { + return SherlockModuleType.getInstance(); + } + @Nullable + @Override + public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) { + return null; + } +} + diff --git a/sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleType.java b/sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleType.java new file mode 100644 index 0000000000000..40028befc6487 --- /dev/null +++ b/sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleType.java @@ -0,0 +1,69 @@ +/*** + * Copyright 2024 Google LLC + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***/ +package com.google.sherlock.module; + +import com.intellij.ide.util.projectWizard.ModuleWizardStep; +import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.openapi.module.ModuleType; +import com.intellij.openapi.module.ModuleTypeManager; +import com.intellij.openapi.roots.ui.configuration.ModulesProvider; +import com.intellij.util.PlatformIcons; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + + +public final class SherlockModuleType extends ModuleType { + public static final String ID = "SHERLOCK_MODULE_TYPE"; + + SherlockModuleType() { + super(ID); + } + + @NotNull + @Override + public SherlockModuleBuilder createModuleBuilder() { + return new SherlockModuleBuilder(); + } + + @NotNull + @Override + public String getName() { + return "SHERLOCK MODULE"; + } + + @NotNull + @Override + public String getDescription() { + return "Sherlock's custom module type"; + } + + @NotNull + @Override + public Icon getNodeIcon(@Deprecated boolean b) { + return PlatformIcons.ABSTRACT_METHOD_ICON; + } + + @Override + public ModuleWizardStep @NotNull [] createWizardSteps(@NotNull WizardContext wizardContext, + @NotNull SherlockModuleBuilder moduleBuilder, + @NotNull ModulesProvider modulesProvider) { + return super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider); + } + + public static SherlockModuleType getInstance() { + return (SherlockModuleType)ModuleTypeManager.getInstance().findByID(ID); + } +} \ No newline at end of file