Skip to content

Commit

Permalink
Merge pull request #71 from moacirrf/start-version-3
Browse files Browse the repository at this point in the history
Start version 3
  • Loading branch information
moacirrf authored Apr 23, 2024
2 parents 97e1e55 + 45d67b0 commit 6f8b812
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 26 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Markdown for Netbeans ![master](https://github.com/moacirrf/netbeans-markdown/actions/workflows/maven-publish.yml/badge.svg)

***

## Description
This plugin adds some additional features to Apache Netbeans Markdown Editor.
- Preview
Expand All @@ -10,7 +10,8 @@ This plugin adds some additional features to Apache Netbeans Markdown Editor.
- Export to DOCX, PDF and HTML

## Requirements
- Apache Netbeans 14+
- Apache Netbeans 14-20(until version 2.0)
- Apache Netbeans 21+(version 3.0)
- JDK 11+

## Licenses
Expand Down
59 changes: 39 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.moacirrf</groupId>
<artifactId>netbeans-markdown</artifactId>
<version>2.0-SNAPSHOT</version>
<version>3.0</version>
<packaging>nbm</packaging>
<name>Netbeans Markdown</name>
<url>https://github.com/moacirrf/netbeans-markdown</url>
Expand All @@ -22,7 +22,7 @@
<connection>scm:git:https://github.com/moacirrf/netbeans-markdown</connection>
<developerConnection>scm:git:https://github.com/moacirrf/netbeans-markdown</developerConnection>
<url>https://github.com/moacirrf/netbeans-markdown/tree/${project.scm.tag}</url>
<tag>v2.0</tag>
<tag>v3.0</tag>
</scm>

<licenses>
Expand Down Expand Up @@ -101,7 +101,13 @@
<netbeansInstallation>${netbeansInstalationPath}</netbeansInstallation> -->
<keystore>${basedir}/keystore.jks</keystore>
<keystorepassword>${keypass}</keystorepassword>
<keystorealias>netbeans-markdown-key</keystorealias>
<keystorealias>netbeans-markdown-key</keystorealias>
<moduleDependencies>
<dependency>
<id>org.netbeans.modules:org-netbeans-bootstrap</id>
<type>impl</type>
</dependency>
</moduleDependencies>
</configuration>
</plugin>

Expand Down Expand Up @@ -244,112 +250,125 @@
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-api-annotations-common</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-modules</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-core-multiview</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-textmate-lexer</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-awt</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-filesystems</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-loaders</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-lookup</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-ui</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-editor-completion</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-editor-mimelookup</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-editor-settings</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-dialogs</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-filesystems-nb</artifactId>
<version>RELEASE140</version>
<version>RELEASE210</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>RELEASE160</version>
</dependency>
<version>RELEASE210</version>
</dependency>

<dependency>
<groupId>org.netbeans.modules</groupId>
<artifactId>org-netbeans-bootstrap</artifactId>
<version>RELEASE210</version>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-windows</artifactId>
<version>RELEASE210</version>
</dependency>

</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,46 @@
*/
package io.github.moacirrf.netbeans.markdown;

import javax.swing.JOptionPane;
import org.netbeans.InvalidException;
import org.netbeans.ModuleManager;
import org.openide.modules.ModuleInstall;
import org.openide.util.Exceptions;

/**
*
* @author Moacir da Roza Flores <moacirrf@gmail.com>
*/
public class Installer extends ModuleInstall {


private static final String MARKDOWN_SUPPORT = "org.netbeans.modules.markdown";

@Override
public void restored() {
ModuleManager mg = (ModuleManager) ModuleManager.getDefault();
if (mg != null) {
org.netbeans.Module module = mg.get(MARKDOWN_SUPPORT);
if (module != null && module.isEnabled()) {
mg.disable(module);
}
}
}

@Override
public void uninstalled() {
ModuleManager mg = (ModuleManager) ModuleManager.getDefault();
if (mg != null) {
org.netbeans.Module module = mg.get(MARKDOWN_SUPPORT);
if (module != null && !module.isEnabled()) {
try {
mg.enable(module);
} catch (IllegalArgumentException | InvalidException ex) {
Exceptions.printStackTrace(ex);
}
}
}
}

@Override
public boolean closing() {
TempDir.removeTempDir();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@
position = 1400
)
})
@GrammarRegistration(mimeType = "text/x-markdown-nb", grammar = "markdown.tmLanguage.json")
@GrammarRegistration(mimeType = MarkdownDataObject.MIME_TYPE, grammar = "markdown.tmLanguage.json")
public class MarkdownDataObject extends MultiDataObject {

public static final String MIME_TYPE = "text/x-markdown-nb";

public MarkdownDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
registerEditor(MarkdownDataObject.MIME_TYPE, true);
registerEditor("text/x-markdown", true);
}

@Override
Expand All @@ -116,7 +116,7 @@ protected int associateLookup() {
@MultiViewElement.Registration(
displayName = "#LBL_Markdown_EDITOR",
iconBase = "io/github/moacirrf/netbeans/markdown/markdown.png",
mimeType = "text/x-markdown-nb",
mimeType = "text/x-markdown",
persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
preferredID = "io.github.moacirrf.netbeans.markdown.ui.MultiViewSplitEditorElement",
position = 1000
Expand Down

0 comments on commit 6f8b812

Please sign in to comment.