2 * Instantlauncher. Author: Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.instantlauncher;
7 import eu.svjatoslav.commons.gui.dialog.ExceptionDialog;
12 import java.io.IOException;
16 private static final String FILE_INDICATOR = "{file}";
18 public static void setComponentSize(JComponent component, Dimension size) {
19 component.setMinimumSize(size);
20 component.setMaximumSize(size);
21 component.setSize(size);
22 component.setPreferredSize(size);
25 public static void runOpeningApplication(String commands, final File file) {
27 String[] commandsArray = commands.split("\\s+");
28 for (int i=0; i< commandsArray.length; i++)
29 commandsArray[i] = commandsArray[i].replaceAll("\\{file\\}", file.getAbsolutePath());
31 Runtime.getRuntime().exec(commandsArray);
32 } catch (final IOException e) {
33 new ExceptionDialog(e);
37 public static void executeCommand(String... c) {
39 Runtime.getRuntime().exec(c);
40 } catch (final IOException e) {
41 new ExceptionDialog(e);