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 @@ -132,6 +132,10 @@ private void setOrientation(TileTabLayout orientation) {
}

public MainFrame() {
this(null);
}

public MainFrame(String[] args) {
super(resources.getMessage("MainFrame.title"));
this.enableEvents(AWTEvent.WINDOW_EVENT_MASK);
this.getContentPane().setLayout(new BorderLayout());
Expand Down Expand Up @@ -270,6 +274,12 @@ public void drop(DropTargetDropEvent drop) {
DnDConstants.ACTION_REFERENCE,
tabDropTargetListener
);
for (int i = 0; i < args.length; i++) {
String path = args[i];
System.out.println("file: "+path);
File file = new File(path);
fileHistory.open(file);
}
setDragNotAccepting();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import java.util.Arrays;

public class Samurai {
private static final Logger logger = LogManager.getLogger();
Expand Down Expand Up @@ -65,6 +65,9 @@ public static void main(String[] args) {
}
command.add("one.cafebabe.samurai.swing.Samurai");
command.add("nested-launch");
for (int i = 0; i < args.length; i++) {
command.add(args[i]);
}

System.out.println("relaunching samurai with the following command:");
System.out.println(String.join(" ", command));
Expand Down Expand Up @@ -95,7 +98,10 @@ public static void main(String[] args) {
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
logger.warn("failed to setLookAndFeel", e);
}
javax.swing.JFrame frame = new MainFrame();
String[] finalArgs = new String[0];
if (args.length > 1)
finalArgs = Arrays.copyOfRange(args, 1, args.length);
javax.swing.JFrame frame = new MainFrame(finalArgs);
frame.validate();
frame.setVisible(true);
});
Expand Down