2 * Instantlauncher. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
9 package eu.svjatoslav.instantlauncher;
11 import eu.svjatoslav.commons.gui.dialog.ExceptionDialog;
16 import java.io.IOException;
20 private static final String FILE_INDICATOR = "{file}";
22 public static void setComponentSize(JComponent component, Dimension size) {
23 component.setMinimumSize(size);
24 component.setMaximumSize(size);
25 component.setSize(size);
26 component.setPreferredSize(size);
29 public static void runOpeningApplication(String commands, final File file) {
31 String[] commandsArray = commands.split("\\s+");
32 for (int i=0; i< commandsArray.length; i++)
33 commandsArray[i] = commandsArray[i].replaceAll("\\{file\\}", file.getAbsolutePath());
35 Runtime.getRuntime().exec(commandsArray);
36 } catch (final IOException e) {
37 new ExceptionDialog(e);
41 public static void executeCommand(String... c) {
43 Runtime.getRuntime().exec(c);
44 } catch (final IOException e) {
45 new ExceptionDialog(e);