Skip to content

Commit

Permalink
- Plugin availability for IDEA 2019.3.*
Browse files Browse the repository at this point in the history
- Revised codebase because of upcoming breaking changes in IDEA 2019.3.* and above
  • Loading branch information
Grav-IntelliJ-Plugin committed Mar 7, 2020
1 parent 0f47d42 commit e38d972
Show file tree
Hide file tree
Showing 27 changed files with 228 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions GravSupport.iml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/testresources" type="java-test-resource" />
</content>
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-191.6183.87" jdkType="IDEA JDK" />
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-193.6494.35 (2)" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="yaml" level="project" />
<orderEntry type="library" scope="PROVIDED" name="php-openapi" level="project" />
<orderEntry type="library" scope="PROVIDED" name="twig" level="project" />
<orderEntry type="module-library" scope="PROVIDED">
<library>
Expand All @@ -23,6 +22,7 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="php-openapi-src" level="project" />
<orderEntry type="library" name="gson-2.8.5" level="project" />
<orderEntry type="library" name="org.eclipse.egit.github.core-2.1.5" level="project" />
<orderEntry type="library" scope="TEST" name="proxy-vole-1.0.5" level="project" />
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ within for IntelliJ Community / Ultimate Edition and PhpStorm
[Grav](https://getgrav.org/) is a flat-file CMS and it's open source.

Tested with:
* PhpStorm 2018.3.*, 2019.1.1
* IntelliJ IDEA Ultimate 2018.2.4, 2019.1.1
* PhpStorm 2018.3.*, 2019.1.1, 2019.3.3
* IntelliJ IDEA Ultimate 2018.2.4, 2019.1.1, 2019.3.3
* IntelliJ IDEA Community 2017.2.*

The plugin is also available in the [JetBrains Plugins Repository](https://plugins.jetbrains.com/plugin/9971-grav-support).

## Version

This plugin supports the following Grav versions: 1.4.*, 1.5.*, 1.6.*, ...
The latest plugin supports the following Grav versions: 1.6.*, ...

Furthermore, I only provide support for PHP 7.*. If you have a lower version than the plugin may not work correctly.

## Install

Expand Down
58 changes: 41 additions & 17 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
<idea-plugin>
<id>net.offbeatpioneer.intellij.plugins.gravsupport</id>
<name>Grav Support</name>
<version>0.4.2</version>
<version>0.5.0</version>
<vendor email="[email protected]" url="http://www.offbeat-pioneer.net/">Dominik Grzelak</vendor>

<description><![CDATA[
Grav Support for IntelliJ PhpStorm, Community Edition and Ultimate<br>
]]></description>

<change-notes><![CDATA[
<p>
<span>0.5.0</span>
<ul>
<li>Internal Changes</li>
<ul>
<li>Plugin availability for IDEA 2019.3.*</li>
<li>Revised codebase because of upcoming breaking changes in IDEA 2019.3.* and above</li>
</ul>
</ul>
</p>
<p>
<span>0.4.2</span>
<ul>
Expand Down Expand Up @@ -164,7 +174,7 @@
</change-notes>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="182" until-build="191.*"/>
<idea-version since-build="193" until-build="193.*"/>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
Expand All @@ -176,27 +186,34 @@
<!--<depends>com.intellij.modules.json</depends>-->
<depends>org.jetbrains.plugins.yaml</depends>
<depends optional="true" config-file="grav-php-features.xml">com.jetbrains.php</depends>
<depends optional="true">com.jetbrains.twig</depends>
<depends optional="true" config-file="">com.jetbrains.twig</depends>
<depends optional="true">org.intellij.plugins.markdown</depends>
<!--config-file="grav-php-features.xml"-->
<!--<depends>com.intellij.modules.all</depends>-->


<!-- Dependency on PHP functionality -->

<application-components>
</application-components>
<!-- <application-components>-->
<!-- </application-components>-->

<!-- <project-components>-->
<!-- <component>-->
<!-- <implementation-class>net.offbeatpioneer.intellij.plugins.grav.project.GravProjectComponent-->
<!-- </implementation-class>-->
<!-- </component>-->
<!-- </project-components>-->

<project-components>
<component>
<implementation-class>net.offbeatpioneer.intellij.plugins.grav.project.GravProjectComponent
</implementation-class>
</component>
</project-components>
<!-- replaces the former project-component class -->
<projectListeners>
<listener class="net.offbeatpioneer.intellij.plugins.grav.project.GravProjectListener"
topic="com.intellij.openapi.project.impl.ProjectLifecycleListener"/>
</projectListeners>


<extensions defaultExtensionNs="com.intellij">
<sdkType implementation="net.offbeatpioneer.intellij.plugins.grav.module.GravSdkType"/>

<moduleType id="GRAV_TYPE"
implementationClass="net.offbeatpioneer.intellij.plugins.grav.module.GravModuleType"/>
<!--<framework.type implementation="net.offbeatpioneer.module.GravFrameworkType"/>-->
Expand Down Expand Up @@ -239,9 +256,16 @@
<treeStructureProvider
implementation="net.offbeatpioneer.intellij.plugins.grav.treestructure.LanguageTreeStructureProvider"/>

<!-- file types are now specified individually instead of using the file type factory-->
<fileType name="Theme blueprints"
implementationClass="net.offbeatpioneer.intellij.plugins.grav.files.ThemeBlueprintsFileType"
fieldName="INSTANCE" language="yaml" extensions="yaml"/>
<fileType name="Theme configuration"
implementationClass="net.offbeatpioneer.intellij.plugins.grav.files.ThemeConfigurationFileType"
fieldName="INSTANCE" language="yaml" extensions="yaml"/>

<fileTypeFactory
implementation="net.offbeatpioneer.intellij.plugins.grav.files.GravConfigurationFileTypeFactory"/>
<!-- <fileTypeFactory-->
<!-- implementation="net.offbeatpioneer.intellij.plugins.grav.files.GravConfigurationFileTypeFactory"/>-->
<!--File type support-->
<internalFileTemplate name="Grav Theme Blueprints"/>
<internalFileTemplate name="Grav Theme Configuration"/>
Expand All @@ -265,10 +289,10 @@

<actions>
<!-- Add your actions here -->
<action id="Grav.CreateTheme" class="net.offbeatpioneer.intellij.plugins.grav.action.CreateNewThemeAction">
<add-to-group group-id="ToolsMenu" anchor="first"/>
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFromTemplate"/>
</action>
<action id="Grav.CreateTheme" class="net.offbeatpioneer.intellij.plugins.grav.action.CreateNewThemeAction">
<add-to-group group-id="ToolsMenu" anchor="first"/>
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFromTemplate"/>
</action>

<!-- <action id="Grav.ThrowException" class="net.offbeatpioneer.intellij.plugins.grav.errorreporting.TriggerExceptionAction">-->
<!-- <add-to-group group-id="ToolsMenu" anchor="first"/>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ private void createTheme(@NotNull Project project, Module module) {
"--name", themeData.getName(),
"--description", themeData.getDescription(),
"--developer", themeData.getDeveloper(),
"--email", themeData.getEmail()};
"--email", themeData.getEmail(),
"--githubid", themeData.getGitHubId()
};

String srcPath = module.getProject().getBasePath();
if (Objects.isNull(srcPath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="e3588" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
Expand Down Expand Up @@ -80,6 +80,22 @@
</constraints>
<properties/>
</component>
<component id="b021a" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="GitHub-ID"/>
</properties>
</component>
<component id="e1cc1" class="javax.swing.JTextField" binding="textField5" default-binding="true">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</children>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class CreateThemeDialog extends JDialog implements CaretListener {
public JTextField textField2;
public JTextField textField3;
public JTextField textField4;
private JTextField textField5;

private NewThemeData themeData = new NewThemeData();

Expand All @@ -22,6 +23,7 @@ public CreateThemeDialog() {
textField2.addCaretListener(this);
textField3.addCaretListener(this);
textField4.addCaretListener(this);
textField5.addCaretListener(this);
}

public static void main(String[] args) {
Expand All @@ -45,6 +47,9 @@ public void caretUpdate(CaretEvent e) {
if (e.getSource() == textField4) {
themeData.setEmail(textField4.getText());
}
if (e.getSource() == textField4) {
themeData.setGitHubId(textField5.getText());
}
}

public NewThemeData getThemeData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.intellij.psi.PsiElement;
import com.intellij.util.PlatformIcons;
import com.intellij.util.ui.JBUI;
import net.offbeatpioneer.intellij.plugins.grav.files.GravConfigurationFileType;
import net.offbeatpioneer.intellij.plugins.grav.files.AbstractGravFileType;
import net.offbeatpioneer.intellij.plugins.grav.files.GravFileTypes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected CustomCreateFileFromTemplateDialog(@NotNull Project project) {
myKindCombo.getComboBox().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (GravConfigurationFileType each : GravFileTypes.CONFIGURATION_FILE_TYPES) {
for (AbstractGravFileType each : GravFileTypes.CONFIGURATION_FILE_TYPES) {
if (getKindCombo().getSelectedName().equalsIgnoreCase(each.getCorrespondingTemplateFile())) {
disableEnableFields(each.needsFilename());
if (!each.needsFilename()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ public class NewThemeData {
private String developer;
private String description;
private String email;
private String githubId;

public NewThemeData() {
this(null, "", "", "");
this(null, "", "", "", "");
}

public NewThemeData(String name, String developer, String description, String email) {
public NewThemeData(String name, String developer, String description, String email, String githubId) {
this.name = name;
this.developer = developer;
this.description = description;
this.email = email;
this.githubId = githubId;
}

public String getName() {
Expand Down Expand Up @@ -51,4 +53,12 @@ public String getEmail() {
public void setEmail(String email) {
this.email = email;
}

public String getGitHubId() {
return githubId;
}

public void setGitHubId(String text) {
this.githubId = text;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import javax.swing.*;

/**
* Icons for various files in Grav or other purposes.
*
* @author Dominik Grzelak
*/
public class GravIcons {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.offbeatpioneer.intellij.plugins.grav.editor;

import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.FileEditorPolicy;
import com.intellij.openapi.fileEditor.FileEditorProvider;
import com.intellij.openapi.project.DumbAware;
Expand All @@ -12,11 +11,6 @@
import net.offbeatpioneer.intellij.plugins.grav.project.GravProjectComponent;
import org.jetbrains.annotations.NotNull;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

import static net.offbeatpioneer.intellij.plugins.grav.helper.GravYamlFiles.LangFileEditorType.LANGUAGE_FOLDER;
import static net.offbeatpioneer.intellij.plugins.grav.helper.GravYamlFiles.LangFileEditorType.NONE;

//TODO listen for file deletion and updates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
package net.offbeatpioneer.intellij.plugins.grav.files;

import com.intellij.lang.Language;
import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.yaml.YAMLLanguage;

/**
* Base class for Gravs configuration files
* Configuration files are in the yaml format.
* Base abstarct class for all Grav-specific files (i.e., mainly configuration files).
* Configuration files come mostly in the YAML format:
* <ul>
* <li>Blueprints for theme (yaml)</li>
* <li>THEME.yaml</li>
* </ul>
* Created by Dome on 16.07.2017.
*
* @author Dominik Grzelak
* @since 16.07.2017.
*/
public abstract class GravConfigurationFileType extends LanguageFileType {

protected GravConfigurationFileType(@NotNull Language language) {
super(language);
}
public abstract class AbstractGravFileType extends LanguageFileType {

public static final String DEFAULT_EXTENSION = "yaml";

protected AbstractGravFileType() {
super(YAMLLanguage.INSTANCE);
}

@NotNull
@Override
public String getDefaultExtension() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package net.offbeatpioneer.intellij.plugins.grav.files;

/**
* Created by Dome on 16.07.2017.
* Enum-like class that provides all available file types if necessary.
*
* @author Dominik Grzelak
* @since 16.07.2017.
*/
public class GravFileTypes {

public static GravConfigurationFileType[] CONFIGURATION_FILE_TYPES = new GravConfigurationFileType[]{
public static AbstractGravFileType[] CONFIGURATION_FILE_TYPES = new AbstractGravFileType[]{
new ThemeBlueprintsFileType(),
new ThemeConfigurationFileType()
};

public static void setModuleName(String moduleName) {
((ThemeConfigurationFileType)CONFIGURATION_FILE_TYPES[1]).setDefaultFileName(moduleName);
((ThemeConfigurationFileType) CONFIGURATION_FILE_TYPES[1]).setDefaultFileName(moduleName);
}
}
Loading

0 comments on commit e38d972

Please sign in to comment.