Updating IGV documentation (#10193)

Updating IGV documentation. Putting Run and Debug actions into popup menus. Enabling breakpoints in Enso source files.
This commit is contained in:
Jaroslav Tulach 2024-06-06 18:36:27 +02:00 committed by GitHub
parent 4beded2438
commit 01d292af30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 101 additions and 12 deletions

View File

@ -5,9 +5,9 @@
[Enso language](http://enso.org) runtime engine is built on top of
[GraalVM](http://graalvm.org) and its _Truffle framework_. Enso, as a good
citizen of the GraalVM ecosystem, benefits from polyglot capabilities of GraalVM
as well as its rich tooling offering. One of such tools is _IGV_ - the _Ideal
Graph Visualizer_ - an excellent tool to get insights into behavior of Graal
compiler.
as well as its rich tooling offering. One of such tools is
[IGV - the _Ideal Graph Visualizer_](https://www.graalvm.org/jdk22/tools/igv/) -
an excellent tool to get insights into behavior of Graal compiler.
This document shows how to use _IGV_ with the _Enso language_. The command line
instructions format is Unix oriented. Use instructions appropriate for your
@ -17,13 +17,14 @@ major operating systems.
## Installation
Visit [GraalVM.org](http://graalvm.org) download page and continue towards
_enterprise edition_ option. There is an _Ideal Graph Visualizer_ option. After
clicking through the confirmation dialogs you should get a ZIP - I've just got
`idealgraphvisualizer-22.1.0.zip` and then:
Visit [GraalVM's IGV page](https://www.graalvm.org/jdk22/tools/igv/) to read and
download _IGV_. Or follow
[this link](https://lafo.ssw.uni-linz.ac.at/pub/idealgraphvisualizer/idealgraphvisualizer-0.31-cb98bbf5fef-all.zip)
to get ZIP with the most up to date version of _Ideal Graph Visualizer_ (as of
June 2024). Then:
```bash
$ unzip idealgraphvisualizer-22.1.0.zip
$ unzip idealgraphvisualizer-*.zip
$ ./idealgraphvisualizer/bin/idealgraphvisualizer --userdir /tmp/emptyuserdir
```

View File

@ -5,7 +5,7 @@
<artifactId>enso4igv</artifactId>
<packaging>nbm</packaging>
<name>Enso Language Support for NetBeans &amp; Ideal Graph Visualizer</name>
<version>1.35-SNAPSHOT</version>
<version>1.36-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -1,6 +1,9 @@
package org.enso.tools.enso4igv;
import java.io.IOException;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.core.spi.multiview.MultiViewElement;
import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
import org.netbeans.modules.textmate.lexer.api.GrammarRegistration;
@ -40,6 +43,17 @@ import org.openide.windows.TopComponent;
position = 100,
separatorAfter = 200
),
@ActionReference(
path = "Loaders/application/x-enso/Actions",
id = @ActionID(category = "Project", id = "org.netbeans.modules.project.ui.RunSingle"),
position = 230
),
@ActionReference(
path = "Loaders/application/x-enso/Actions",
id = @ActionID(category = "Debug", id = "org.netbeans.modules.debugger.ui.actions.DebugFileAction"),
position = 270,
separatorAfter = 290
),
@ActionReference(
path = "Loaders/application/x-enso/Actions",
id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
@ -83,13 +97,27 @@ import org.openide.windows.TopComponent;
path = "Loaders/application/x-enso/Actions",
id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
position = 1400
)
),
// editor popups
@ActionReference(
path = "Editors/application/x-enso/Popup",
id = @ActionID(category = "Project", id = "org.netbeans.modules.project.ui.RunSingle"),
position = 30
),
@ActionReference(
path = "Editors/application/x-enso/Popup",
id = @ActionID(category = "Debug", id = "org.netbeans.modules.debugger.ui.actions.DebugFileAction"),
position = 70,
separatorAfter = 90
),
})
public class EnsoDataObject extends MultiDataObject {
public EnsoDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
registerEditor("application/x-enso", true);
registerTruffleMimeType("application/x-enso");
}
@Override
@ -110,4 +138,20 @@ public class EnsoDataObject extends MultiDataObject {
return new MultiViewEditorElement(lkp);
}
private void registerTruffleMimeType(String mime) throws IOException {
ClassLoader all = Lookup.getDefault().lookup(ClassLoader.class);
if (all == null) {
all = EnsoDataObject.class.getClassLoader();
}
try {
var clazz = all.loadClass("org.netbeans.modules.debugger.jpda.truffle.MIMETypes");
var getDefault = clazz.getMethod("getDefault");
var mimeTypes = getDefault.invoke(null);
var get = clazz.getMethod("get");
var toSet = (Set<String>)get.invoke(mimeTypes);
toSet.add(mime);
} catch (ReflectiveOperationException ex) {
Installer.LOG.log(Level.WARNING, "Cannot register breakpoints for Enso", ex);
}
}
}

View File

@ -0,0 +1,26 @@
package org.enso.tools.enso4igv;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.modules.ModuleInstall;
import org.openide.util.Lookup;
import org.openide.util.NbPreferences;
public class Installer extends ModuleInstall {
static final Logger LOG = Logger.getLogger(EnsoDataObject.class.getName());
@Override
public void restored() {
try {
ClassLoader all = Lookup.getDefault().lookup(ClassLoader.class);
if (all == null) {
all = Installer.class.getClassLoader();
}
var clazz = all.loadClass("org.netbeans.modules.project.ui.api.ProjectActionUtils");
var pref = NbPreferences.forModule(clazz);
pref.putBoolean("openSubprojects", true);
} catch (ClassNotFoundException ex) {
LOG.log(Level.WARNING, "Cannot register breakpoints for Enso", ex);
}
}
}

View File

@ -1,5 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module-Install: org/enso/tools/enso4igv/Installer.class
OpenIDE-Module-Layer: org/enso/tools/enso4igv/layer.xml
OpenIDE-Module-Localizing-Bundle: org/enso/tools/enso4igv/Bundle.properties
Multi-Release: true
OpenIDE-Module-Recommends: cnb.org.netbeans.modules.java.kit
OpenIDE-Module-Recommends: cnb.org.netbeans.modules.java.kit, cnb.org.netbeans.modules.debugger.jpda.truffle, cnd.org.netbeans.modules.terminal, cnd.org.netbeans.modules.git

View File

@ -16,6 +16,23 @@
<attr name="originalFile" stringvalue="Actions/Debug/org-netbeans-modules-debugger-ui-actions-ConnectAction.instance"/>
<attr name="position" intvalue="9535"/>
</file>
<file name="Favorites.shadow">
<attr name="originalFile" stringvalue="Actions/Window/org-netbeans-modules-favorites-View.instance"/>
<attr name="position" intvalue="9707"/>
</file>
<file name="ShowTerminalTCAction.shadow">
<attr name="originalFile" stringvalue="Actions/Window/ShowTerminalTCAction.instance"/>
<attr name="position" intvalue="9737"/>
</file>
</folder>
</folder>
<folder name="Editors">
<folder name="application">
<folder name="x-enso">
<folder name="ToolTips">
<file name="org-netbeans-modules-debugger-jpda-truffle-vars-tooltip-ToolTipAnnotation.instance"/>
</folder>
</folder>
</folder>
</folder>
</filesystem>