Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New features #12

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions djns-swt-cocoa-macosx-aarch64/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=8cec4aaa
build.xml.data.CRC32=b73d1e95
build.xml.script.CRC32=a26f62a4
[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=8cec4aaa
nbproject/build-impl.xml.data.CRC32=b73d1e95
nbproject/build-impl.xml.script.CRC32=c8510446
nbproject/[email protected]
4 changes: 3 additions & 1 deletion djns-swt-cocoa-macosx-aarch64/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
<public-packages>
<package>chrriis.dj.nativeswing.swtimpl.components.core</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/DJNativeSwing-SWTCore.jar</runtime-relative-path>
<binary-origin>release/modules/ext/DJNativeSwing-SWTCore.jar</binary-origin>
Expand Down
8 changes: 4 additions & 4 deletions djns-swt-cocoa-macosx-x86_64/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=60a660c4
build.xml.data.CRC32=80ae4190
build.xml.script.CRC32=862c6b80
build.xml.stylesheet.CRC32=15ca8a54@2.80
build.xml.stylesheet.CRC32=15ca8a54@2.92
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=60a660c4
nbproject/build-impl.xml.data.CRC32=80ae4190
nbproject/build-impl.xml.script.CRC32=425cae01
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.80
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.92
4 changes: 3 additions & 1 deletion djns-swt-cocoa-macosx-x86_64/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
<public-packages>
<package>chrriis.dj.nativeswing.swtimpl.components.core</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/swt-cocoa-macosx-x86_64.jar</runtime-relative-path>
<binary-origin>release/modules/ext/swt-cocoa-macosx-x86_64.jar</binary-origin>
Expand Down
4 changes: 2 additions & 2 deletions djns-swt-gtk-linux-aarch64/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=77c0b219
build.xml.data.CRC32=de29771e
build.xml.script.CRC32=30a1f23c
[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=77c0b219
nbproject/build-impl.xml.data.CRC32=de29771e
nbproject/build-impl.xml.script.CRC32=be0ec097
nbproject/[email protected]
4 changes: 3 additions & 1 deletion djns-swt-gtk-linux-aarch64/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
<public-packages>
<package>chrriis.dj.nativeswing.swtimpl.components.core</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/swt-4.25-gtk-linux-aarch64.jar</runtime-relative-path>
<binary-origin>release/modules/ext/swt-4.25-gtk-linux-aarch64.jar</binary-origin>
Expand Down
4 changes: 2 additions & 2 deletions djns-swt-gtk-linux-ppc64/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=283374d5
build.xml.data.CRC32=0b689509
build.xml.script.CRC32=4ed57078
[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=283374d5
nbproject/build-impl.xml.data.CRC32=0b689509
nbproject/build-impl.xml.script.CRC32=e3c014c2
nbproject/[email protected]
4 changes: 3 additions & 1 deletion djns-swt-gtk-linux-ppc64/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
<public-packages>
<package>chrriis.dj.nativeswing.swtimpl.components.core</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/swt-4.25-gtk-linux-ppc64le.jar</runtime-relative-path>
<binary-origin>release/modules/ext/swt-4.25-gtk-linux-ppc64le.jar</binary-origin>
Expand Down
8 changes: 4 additions & 4 deletions djns-swt-gtk-linux-x86_64/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=238326f1
build.xml.data.CRC32=7e9f711f
build.xml.script.CRC32=12845596
build.xml.stylesheet.CRC32=15ca8a54@2.80
build.xml.stylesheet.CRC32=15ca8a54@2.92
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=238326f1
nbproject/build-impl.xml.data.CRC32=7e9f711f
nbproject/build-impl.xml.script.CRC32=c1d9ef41
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.80
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.92
4 changes: 3 additions & 1 deletion djns-swt-gtk-linux-x86_64/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
<public-packages>
<package>chrriis.dj.nativeswing.swtimpl.components.core</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/swt-4.25-gtk-linux-x86_64.jar</runtime-relative-path>
<binary-origin>release/modules/ext/swt-4.25-gtk-linux-x86_64.jar</binary-origin>
Expand Down
8 changes: 4 additions & 4 deletions djns-swt-win32-win32-x86_64/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=88305667
build.xml.data.CRC32=d1e1da1d
build.xml.script.CRC32=7d38c2ab
build.xml.stylesheet.CRC32=15ca8a54@2.80
build.xml.stylesheet.CRC32=15ca8a54@2.92
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=88305667
nbproject/build-impl.xml.data.CRC32=d1e1da1d
nbproject/build-impl.xml.script.CRC32=c16237f3
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.80
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.92
5 changes: 4 additions & 1 deletion djns-swt-win32-win32-x86_64/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
</run-dependency>
</dependency>
</module-dependencies>
<public-packages/>
<public-packages>
<package>chrriis.dj.nativeswing.swtimpl.components.core</package>
<package>chrriis.dj.nativeswing.swtimpl.components.win32.core</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/swt-win32-win32-x86_64.jar</runtime-relative-path>
<binary-origin>release/modules/ext/swt-win32-win32-x86_64.jar</binary-origin>
Expand Down
2 changes: 2 additions & 0 deletions djns/manifest.mf
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
OpenIDE-Module: pt.cjmach.netbeans.djns
OpenIDE-Module-Install: pt/cjmach/netbeans/djns/Installer.class
OpenIDE-Module-Layer: pt/cjmach/netbeans/djns/layer.xml
OpenIDE-Module-Localizing-Bundle: pt/cjmach/netbeans/djns/Bundle.properties
OpenIDE-Module-Requires: org.openide.windows.WindowManager
OpenIDE-Module-Specification-Version: 1.1

2 changes: 1 addition & 1 deletion djns/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ build.xml.script.CRC32=7652be79
[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=375f4386
nbproject/build-impl.xml.data.CRC32=2e0bc9fb
nbproject/build-impl.xml.script.CRC32=9797c51f
nbproject/[email protected]
83 changes: 83 additions & 0 deletions djns/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
<specification-version>1.55</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.core.multiview</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.64</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.modules.settings</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.69</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.awt</code-name-base>
<build-prerequisite/>
Expand All @@ -31,6 +49,54 @@
<specification-version>7.76</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.dialogs</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.66</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.filesystems</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.33</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.loaders</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.90</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.modules</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.68</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.nodes</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.65</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.text</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.88</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
Expand All @@ -47,9 +113,26 @@
<specification-version>8.41</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.ui</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.29</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.windows</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.97</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages>
<package>pt.cjmach.netbeans.djns.browser</package>
<package>pt.cjmach.netbeans.djns.dialog</package>
</public-packages>
</data>
</configuration>
Expand Down
19 changes: 19 additions & 0 deletions djns/src/pt/cjmach/netbeans/djns/Installer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/NetBeansModuleDevelopment-files/moduleInstall.java to edit this template
*/
package pt.cjmach.netbeans.djns;

import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.netbeans.NativeInterfaceNetBeansHandler;
import org.openide.modules.ModuleInstall;

public class Installer extends ModuleInstall {

@Override
public void restored() {
NativeInterfaceNetBeansHandler.initialize();
NativeInterface.open();
}

}
7 changes: 0 additions & 7 deletions djns/src/pt/cjmach/netbeans/djns/browser/DjnsBrowserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
package pt.cjmach.netbeans.djns.browser;

import chrriis.dj.nativeswing.NSComponentOptions;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserAdapter;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserListener;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserNavigationEvent;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserWindowWillOpenEvent;
import chrriis.dj.nativeswing.swtimpl.netbeans.NativeInterfaceNetBeansHandler;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -58,11 +56,6 @@ class DjnsBrowserImpl extends HtmlBrowser.Impl {
private int progress;
private final WebBrowserListener browserListener;

static {
NativeInterfaceNetBeansHandler.initialize();
NativeInterface.open();
}

public DjnsBrowserImpl() {
browserListener = new BrowserListener();
propChangeSupport = new PropertyChangeSupport(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package pt.cjmach.netbeans.djns.browser;

import chrriis.dj.nativeswing.NSComponentOptions;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.StyledDocument;
import org.netbeans.core.spi.multiview.MultiViewElement;
import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
import org.openide.cookies.EditorCookie;
import org.openide.loaders.DataObject;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;

/**
*
* @author cmachado
*/
@MultiViewElement.Registration(displayName = "#LBL_HTMLPREVIEW_ELEM",
// iconBase = "org/myorg/abcfiletype/Datasource.gif",
mimeType = "text/html",
persistenceType = TopComponent.PERSISTENCE_NEVER,
preferredID = "HtmlPreviewMultiViewElement",
position = 3000)
@NbBundle.Messages({
"LBL_HTMLPREVIEW_ELEM=Preview"
})
public class HtmlPreviewMultiViewElement extends MultiViewEditorElement {

private JWebBrowser browser;
private boolean needsUpdate = true;

public HtmlPreviewMultiViewElement(Lookup lookup) {
super(lookup);
DataObject htmlObject = getLookup().lookup(DataObject.class);
htmlObject.addPropertyChangeListener(new PropertyChangeListener() {

@Override
public void propertyChange(PropertyChangeEvent pce) {
if (DataObject.PROP_MODIFIED.equals(pce.getPropertyName())) {
updateName();
}
}
});
}

@Override
public void componentShowing() {
// TODO: Update content only when there's actually a change.
// It's currently updating the content everytime we select the view.
getVisualRepresentation().setHTMLContent(getHTMLContent());
}

private String getHTMLContent() {
DataObject htmlObject = getLookup().lookup(DataObject.class);
EditorCookie cookie = htmlObject.getCookie(EditorCookie.class);
StyledDocument document = cookie.getDocument();
if (document == null) {
return null;
}
try {
return document.getText(0, document.getLength());
} catch (BadLocationException ex) {
return "";
}

}

@Override
public JWebBrowser getVisualRepresentation() {
if (browser == null) {
browser = new JWebBrowser(NSComponentOptions.destroyOnFinalization());
browser.setJavascriptEnabled(true);
browser.setDefaultPopupMenuRegistered(false);
browser.setBarsVisible(false);
}
return browser;
}
}
Loading