Skip to content

Commit

Permalink
Associate Jenkins icon with files named 'Jenkinsfile'
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlockwood committed Jul 9, 2016
1 parent 159cbe7 commit 1e1b162
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
*.iml
out/
37 changes: 37 additions & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<idea-plugin version="2">
<id>com.oliverlockwood.plugins.jenkinsfile</id>
<name>Jenkinsfile IDEA plugin</name>
<version>1.0</version>
<vendor email="[email protected]" url="http://www.oliverlockwood.com">Oliver Lockwood</vendor>

<description><![CDATA[
Description for plugin.<br>
<em>most HTML tags may be used</em>
Jenkins icon under <a href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>. See <a href="https://jenkins.io/">https://jenkins.io/</a>
]]></description>

<change-notes><![CDATA[
Change notes for plugin.<br>
<em>most HTML tags may be used</em>
]]>
</change-notes>

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

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<!-- uncomment to enable plugin in all products
<depends>com.intellij.modules.lang</depends>
-->

<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<fileTypeFactory implementation="com.oliverlockwood.plugins.jenkinsfile.JenkinsFileTypeFactory" />
</extensions>

<actions>
<!-- Add your actions here -->
</actions>

</idea-plugin>
38 changes: 38 additions & 0 deletions src/com/oliverlockwood/plugins/jenkinsfile/JenkinsFileType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.oliverlockwood.plugins.jenkinsfile;

import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.*;

import javax.swing.*;

public class JenkinsFileType extends LanguageFileType {
public static final JenkinsFileType INSTANCE = new JenkinsFileType();

private JenkinsFileType() {
super(JenkinsLanguage.INSTANCE);
}

@NotNull
@Override
public String getName() {
return "Jenkins file";
}

@NotNull
@Override
public String getDescription() {
return "Jenkins language file";
}

@NotNull
@Override
public String getDefaultExtension() {
return "";
}

@Nullable
@Override
public Icon getIcon() {
return JenkinsIcons.FILE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.oliverlockwood.plugins.jenkinsfile;

import com.intellij.openapi.fileTypes.*;
import org.jetbrains.annotations.NotNull;

public class JenkinsFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(JenkinsFileType.INSTANCE, new ExactFileNameMatcher("Jenkinsfile"));
}
}
9 changes: 9 additions & 0 deletions src/com/oliverlockwood/plugins/jenkinsfile/JenkinsIcons.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.oliverlockwood.plugins.jenkinsfile;

import com.intellij.openapi.util.IconLoader;

import javax.swing.Icon;

public class JenkinsIcons {
public static final Icon FILE = IconLoader.getIcon("/com/oliverlockwood/plugins/jenkinsfile/icons/jenkins.png");
}
11 changes: 11 additions & 0 deletions src/com/oliverlockwood/plugins/jenkinsfile/JenkinsLanguage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.oliverlockwood.plugins.jenkinsfile;

import com.intellij.lang.Language;

public class JenkinsLanguage extends Language {
public static final JenkinsLanguage INSTANCE = new JenkinsLanguage();

private JenkinsLanguage() {
super("Jenkins");
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1e1b162

Please sign in to comment.