forked from JetBrains/intellij-community
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a new custom Module Type for Sherlock
- Loading branch information
1 parent
6fcefcf
commit f3fe7ac
Showing
4 changed files
with
126 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 15 additions & 11 deletions
26
sherlock-platform/customization/resources/META-INF/SherlockPlatformCustomization.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
40 changes: 40 additions & 0 deletions
40
sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|
69 changes: 69 additions & 0 deletions
69
sherlock-platform/customization/src/com/google/sherlock/module/SherlockModuleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |