Commit 280cdc18 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck

add open in explorer menu item to outputfiles.

parent ca5c2d18
Pipeline #88068 passed with stages
in 102 minutes and 36 seconds
......@@ -28,6 +28,9 @@ LoadProjectFileErrorMessage.title=Error loading project file
RenameFileErrorMessage.text=Could not rename the file, maybe the filename is already used.
RenameFileErrorMessage.title=Error
OpenInExplorerErrorMessage.text=Could not open output directory in explorer.
OpenInExplorerErrorMessage.title=Error
LoadProjectText=Open Project
LoadOutputText=Choose output...
......@@ -200,6 +203,7 @@ AdjustPanel.lblStep.text=Timestep
ProjectView.mntmOutputToSceneario.text=Generate scenario
ProjectView.mntmRunOutput.text=Run offline again
ProjectView.OpenInExplorer.text=Open in Explorer
ProjectView.mntmCopyOutputDir.text=Copy output path to clipboard
SettingsDialog.chbShowPedestrianIds.text=Show PedestrianIds
......
......@@ -169,6 +169,10 @@ listMenuRenameOutputButtonAction.title=Dateiname
renameErrorDialog.title=Fehler
renameErrorDialog.text=Der Name wird eventuell bereits verwendet.
OpenInExplorerErrorMessage.text=Output Ordner konnte nicht ge\u00F6ffnet werden.
OpenInExplorerErrorMessage.title=Fehler
DeleteOutputQuestionOne.text=Wollen Sie wirklich dieses Output-Verzeichnis l\u00F6schen?
DeleteOutputQuestionMultiple.text=Wollen Sie wirklich diese Output-Verzeichnisse l\u00F6schen?
DeleteOutputQuestion.title=Ouput l\u00F6schen
......@@ -201,6 +205,7 @@ AdjustPanel.lblStep.text=Zeitschritt
ProjectView.mntmOutputToSceneario.text=Generiere Szenario
ProjectView.mntmRunOutput.text=Offline erneut starten
ProjectView.OpenInExplorer.text=In Explorer \u00F6ffnen
ProjectView.mntmCopyOutputDir.text=Kopiere Output Pfad in Zwischenablage
SettingsDialog.chbShowPedestrianIds.text=Fu\u00dfg\u00E4nger-Ids anzeigen
......
package org.vadere.gui.projectview.control;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.utils.SwingUtils;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.util.io.IOUtils;
import org.vadere.util.logging.Logger;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import javax.swing.*;
public class ActionOpenInExplorer extends AbstractAction {
private static Logger logger = Logger.getLogger(ActionRunOutput.class);
private ProjectViewModel model;
public ActionOpenInExplorer(final String name, final ProjectViewModel model) {
super(name);
this.model = model;
}
@Override
public void actionPerformed(ActionEvent event) {
try {
ProjectViewModel.OutputBundle outputBundle = model.getSelectedOutputBundle();
File file = outputBundle.getDirectory();
if (file.isDirectory()){
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
public Void doInBackground() throws Exception {
Desktop.getDesktop().open(file);
return null;
}
};
worker.execute();
} else {
IOUtils.errorBox(Messages.getString("OpenInExplorerErrorMessage.text"),
Messages.getString("OpenInExplorerErrorMessage.title"));
logger.errorf("Cannot access outputBundle directory for project: %s", outputBundle.getProject().getName());
}
} catch (IOException e) {
logger.errorf("Cannot get output bundle. %s",e.getMessage());
}
}
}
......@@ -15,6 +15,7 @@ import org.vadere.gui.projectview.control.ActionGenerateScenarioFromOutputFile;
import org.vadere.gui.projectview.control.ActionInterruptScenarios;
import org.vadere.gui.projectview.control.ActionLoadProject;
import org.vadere.gui.projectview.control.ActionLoadRecentProject;
import org.vadere.gui.projectview.control.ActionOpenInExplorer;
import org.vadere.gui.projectview.control.ActionOutputToScenario;
import org.vadere.gui.projectview.control.ActionPauseScenario;
import org.vadere.gui.projectview.control.ActionRenameOutputFile;
......@@ -587,6 +588,8 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
new ActionOutputToScenario(Messages.getString("ProjectView.mntmOutputToSceneario.text"), model)));
outputListPopupMenu
.add(new JMenuItem(new ActionRunOutput(Messages.getString("ProjectView.mntmRunOutput.text"), model)));
outputListPopupMenu
.add(new JMenuItem(new ActionOpenInExplorer(Messages.getString("ProjectView.OpenInExplorer.text"), model)));
JMenu copyPath = new JMenu(Messages.getString("ProjectView.mntmCopyOutputDir.text"));
outputTable.getSelectionModel().addListSelectionListener(new TableSelectionListener(outputTable) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment