Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ protected void componentClosed() {
removeProgressIndicator();
super.componentClosed();
pane = null;
if (cloneableEditorSupport().getOpenedPanes() == null && session != null) {
if (cloneableEditorSupport().getOpenedPanes() == null && env != null) {
try {
// terminate the JShell
session.getEnv().shutdown();
env.shutdown();
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@

import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import org.netbeans.api.editor.EditorActionRegistration;
import org.netbeans.api.editor.document.EditorDocumentUtils;
import org.netbeans.api.project.Project;
import org.netbeans.editor.BaseAction;
import org.netbeans.modules.jshell.support.ShellSession;
import org.openide.*;
import org.openide.awt.ActionID;
Expand Down Expand Up @@ -75,7 +72,7 @@ protected void doPerformAction(ActionEvent evt, JTextComponent target, ShellSess
"ERROR_NoClassTemplate=Class template not found; chech Templates in Tools menu."
})
private void doGenerateForSession(JTextComponent target, ShellSession s, FileObject anchor) {
Project p = s.getEnv().getProject();
Project p = s.getProject();
String n = (String)target.getClientProperty(CLASSNAME_PROPERTY);
if (anchor == null) {
anchor = (FileObject)target.getClientProperty(FOLDER_PROPERTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected void query(CompletionResultSet resultSet, Document doc, int caretOffse
} catch (BadLocationException ex) {
}
final String fPrefix = prefix;
ShellHistory h = session.getEnv().getLookup().lookup(ShellHistory.class);
ShellHistory h = session.getShellHistory();
resultSet.addAllItems(
session.historyItems().stream().
filter(i -> i.getContents().startsWith(fPrefix)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ public class JShellEnvironment {

private JavaPlatform platform;

private String displayName;
private ConfigurableClasspath userClassPathImpl = new ConfigurableClasspath();
private ClassPath userLibraryPath = ClassPathFactory.createClassPath(userClassPathImpl);
private final String displayName;

private final ConfigurableClasspath userClassPathImpl = new ConfigurableClasspath();

private final ClassPath userLibraryPath = ClassPathFactory.createClassPath(userClassPathImpl);

private ClassPath snippetClassPath;

Expand Down Expand Up @@ -393,7 +393,7 @@ public synchronized void start() throws IOException {
this.classpathInfo = cpi;
forceOpenDocument();
// createSession will get opened document, shutdown runs under lock
doStartAndFire(ShellSession.createSession(this));
doStartAndFire(ShellSessionImpl.createSession(this));
}

private void fireShellStatus(ShellEvent event) {
Expand Down Expand Up @@ -433,7 +433,7 @@ public boolean canReset() {

public void reset() {
assert workRoot != null;
doStartAndFire(ShellSession.createSession(this));
doStartAndFire(ShellSessionImpl.createSession(this));
}

private void fireExecuting(ShellSession session, boolean start) {
Expand All @@ -449,7 +449,7 @@ private void fireExecuting(ShellSession session, boolean start) {
ll.stream().forEach(l -> l.shellStatusChanged(e));
}

private void doStartAndFire(ShellSession nss) {
private void doStartAndFire(ShellSessionImpl nss) {
synchronized (this) {
this.shellSession = nss;
starting = true;
Expand All @@ -470,12 +470,11 @@ public void sectionUpdated(ConsoleEvent e) {}
@Override
public void closed(ConsoleEvent e) {}
});
ShellSession previous = res.first();
if (previous != null) {
if (res.first() instanceof ShellSessionImpl previous) {
previous.removePropertyChangeListener(shellL);
}
nss.addPropertyChangeListener(shellL);
ShellEvent event = new ShellEvent(this, nss, previous);
ShellEvent event = new ShellEvent(this, nss, res.first());
fireShellStatus(event);

res.second().addTaskListener(e -> {
Expand Down
Loading
Loading