public boolean addMenu(final File directory) {
final int newMenuHorizontalIndex = menus.size();
- if (newMenuHorizontalIndex >= VERTICAL_MENUS_COUNT)
+ if (newMenuHorizontalIndex >= VERTICAL_MENUS_COUNT) {
return false;
+ }
final Menu menu = new Menu(directory);
menu.addMenuListener(this);
public int getMenuIndex(final Menu menu) {
int i = 0;
for (final Menu m : menus) {
- if (m == menu)
+ if (m == menu) {
return i;
+ }
i++;
}
return -1;
@Override
public void menuItemSelected(final Menu menu, final File chosenFile) {
- if (chosenFile.isFile())
- if (chosenFile.canExecute())
+ if (chosenFile.isFile()) {
+ if (chosenFile.canExecute()) {
executeCommand(chosenFile.getAbsolutePath());
- else {
+ } else {
final boolean fileOpened = FileAssociationManager.openFile(chosenFile);
- if (fileOpened)
+ if (fileOpened) {
InstantLauncher.exitProgram();
+ }
}
+ }
if (chosenFile.isDirectory()) {
- executeCommand("nautilus", "-n", chosenFile.getAbsolutePath());
+ executeCommand("nautilus", "-w", chosenFile.getAbsolutePath());
}
}
@Override
public void menuItemSelectedAlternative(final Menu menu, final File chosenFile) {
- if (chosenFile.isFile())
+ if (chosenFile.isFile()) {
chosenFile.setExecutable(!chosenFile.canExecute());
- else {
+ } else {
executeCommand("gnome-terminal", "--working-directory=" + chosenFile.getAbsolutePath());
}
}
jPanel.removeAll();
}
- while (menus.size() > fromIndex)
+ while (menus.size() > fromIndex) {
menus.remove(fromIndex);
+ }
}
@Override