Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
subhra74 committed Oct 4, 2019
1 parent 451804a commit fea61ae
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/snowflake/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public static void main(String[] args) throws UnsupportedLookAndFeelException {

UIManager.setLookAndFeel(nimbusLookAndFeel);
UIManager.put("control", Color.WHITE);
UIManager.put("nimbusSelectionBackground", new Color(3, 155, 229));

//UIManager.put("nimbusBase", new Color(200, 200, 200));
// UIManager.put("text", new Color(208, 208, 208));

Expand Down
13 changes: 9 additions & 4 deletions src/main/java/snowflake/common/ssh/files/SshFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException;
import com.jcraft.jsch.SftpStatVFS;
import snowflake.common.*;
import snowflake.common.FileSystem;
import snowflake.common.ssh.AbstractUserInteraction;
Expand All @@ -12,10 +13,7 @@

import java.io.*;
import java.nio.file.AccessDeniedException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;

public class SshFileSystem implements FileSystem {
Expand Down Expand Up @@ -149,6 +147,7 @@ private List<FileInfo> listFiles(String path) throws Exception {
continue;
}
SftpATTRS attrs = ent.getAttrs();

if (attrs.isLink()) {
childs.add(resolveSymlink(ent.getFilename(),
PathUtils.combineUnix(path,
Expand Down Expand Up @@ -509,4 +508,10 @@ public String getSeparator() {
public String getSeparator() {
return "/";
}

public void statFs() throws Exception {
ensureConnected();
SftpStatVFS statVFS = this.sftp.statVFS("/");
System.out.println(statVFS.getSize() + " " + statVFS.getUsed());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public SshFileBrowserView(FileBrowser fileBrowser,
this.addressPopup = menuHandler.createAddressPopup();
if (initialPath == null) {
this.path = holder.getInfo().getRemoteFolder();
if (this.path != null && this.path.trim().length() < 1) {
this.path = null;
}
System.out.println("Path: " + path);
} else {
this.path = initialPath;
Expand Down Expand Up @@ -146,6 +149,7 @@ public void render(String path, boolean useCache) {
try {
if (path == null) {
this.path = holder.getSshFileSystem().getHome();
//holder.getSshFileSystem().statFs();
}
renderDirectory(this.path, useCache);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

public class TerminalComponent extends JPanel implements ConnectedResource {
private JRootPane rootPane;
Expand Down Expand Up @@ -63,6 +65,13 @@ public TerminalComponent(SessionInfo info, String name, String command) {
term.setTtyConnector(tty);
term.start();
contentPane.add(term);

addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
requestFocusInWindow();
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

Expand Down Expand Up @@ -107,6 +109,13 @@ public TerminalHolder(SessionInfo info) {
snippetPopupMenu.add(snippetPanel);

createNewTerminal();

addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
requestFocusInWindow();
}
});
}

private void showSnippets() {
Expand Down

0 comments on commit fea61ae

Please sign in to comment.