Skip to content

Commit

Permalink
Added a new custom Module Type for Sherlock
Browse files Browse the repository at this point in the history
  • Loading branch information
sonakshisaxena1 committed Dec 9, 2024
1 parent 6fcefcf commit f3fe7ac
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
<orderEntry type="module" module-name="intellij.platform.lang.core" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
</component>
</module>
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<idea-plugin>

<depends>com.intellij.modules.platform</depends>
<actions resource-bundle="messages.ActionsBundle">
<group id="WelcomeScreen.Platform.NewProject">
<action id="NewProjectStep"
class="com.google.sherlock.onboarding.NewProjectStep"
text="New Project"/>
<reference ref="WelcomeScreen.OpenDirectoryProject"/>
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
</group>
</actions>
<depends>com.intellij.modules.platform</depends>
<extensions defaultExtensionNs="com.intellij">
<moduleType
id="SHERLOCK_MODULE_TYPE"
implementationClass="com.google.sherlock.module.SherlockModuleType"/>
</extensions>
<actions resource-bundle="messages.ActionsBundle">
<group id="WelcomeScreen.Platform.NewProject">
<action id="NewProjectStep"
class="com.google.sherlock.onboarding.NewProjectStep"
text="New Project"/>
<reference ref="WelcomeScreen.OpenDirectoryProject"/>
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
</group>
</actions>
</idea-plugin>
Original file line number Diff line number Diff line change
@@ -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<SherlockModuleBuilder> getModuleType() {
return SherlockModuleType.getInstance();
}
@Nullable
@Override
public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) {
return null;
}
}

Original file line number Diff line number Diff line change
@@ -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<SherlockModuleBuilder> {
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);
}
}

0 comments on commit f3fe7ac

Please sign in to comment.