From b04aac7a5a0e71bd33debbd1c68dd52409b207f2 Mon Sep 17 00:00:00 2001 From: Benedikt Zoennchen Date: Wed, 11 Oct 2017 13:57:03 +0200 Subject: [PATCH] solved issue #36 and find a quick solution for issue #37 which requires further improvements. --- VadereGui/resources/icons/Error.gif | Bin 0 -> 386 bytes VadereGui/resources/icons/Inform.gif | Bin 0 -> 764 bytes VadereGui/resources/icons/floppy.gif | Bin 0 -> 137 bytes .../components/view/ScenarioElementView.java | 2 +- .../model/PostvisualizationModel.java | 4 +- .../utils/ImageGenerator.java | 2 +- .../gui/projectview/VadereApplication.java | 3 +- .../control/ActionAbstractSaveProject.java | 2 +- .../control/ActionLoadProject.java | 8 +-- .../gui/projectview/utils/ClassFinder.java | 52 ++++++++++++++---- .../vadere/gui/projectview/view/JSONView.java | 9 ++- .../projectview/view/JsonValidIndicator.java | 7 +-- .../gui/projectview/view/ProjectView.java | 3 +- .../gui/projectview/view/ScenarioPanel.java | 5 +- .../vadere/gui/projectview/view/TextView.java | 26 ++++----- .../simulator/projects/io/IOVadere.java | 5 +- 16 files changed, 81 insertions(+), 47 deletions(-) create mode 100644 VadereGui/resources/icons/Error.gif create mode 100644 VadereGui/resources/icons/Inform.gif create mode 100644 VadereGui/resources/icons/floppy.gif diff --git a/VadereGui/resources/icons/Error.gif b/VadereGui/resources/icons/Error.gif new file mode 100644 index 0000000000000000000000000000000000000000..28645eb903f04e7f5598d69c86dfe1ef1deb4de2 GIT binary patch literal 386 zcmV-|0e${QNk%w1VIKe>0K^^u?wFUZX=j-L0H0o5dwYBQ!olg3lk=vf_OY=0zrM_3 zV&|5XpbZVbN=ey!d-t@n?WCjitgFUWRk=Pr^{%a-3=Hs|o$;Wb`nqbD=9v^N;1oVC@VR3m(-j>iNN(qhnPSmOuDary4g>ZPo5r+@F>u5049UOvqC#;DJ z9BAHvur7iXb`A@65(RlWdwoR_1sQP_6>%8_6h(<515g+cc6JaLOP3y*OBMxyb_xX+ zp?sKC37mEd2~eV>MF<59oeTvCt%^h!1r42X4FwmLuA@r{gK-naakR|BI=Z}ZVRpU` zM7M1@2-E_Fr*;$Idd*(CW)zHO>_$G#K~Gv+1o-*m`*IxVhecmNdjSYeF{ovrKNDV< g+pIkfMryAVY@CNV23!5+MKpJDUic>i_@% literal 0 HcmV?d00001 diff --git a/VadereGui/resources/icons/Inform.gif b/VadereGui/resources/icons/Inform.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f59de825f0acb1c6f9aeb35630661c44f880fc1 GIT binary patch literal 764 zcmZ?wbhEHbRA5kGcoxNQ=FI=Jw3*+&{Xcf>=ZY2Qi;I_S-u!IxynUgcW zu(0sKga0pH{O|4ET~=0BTwJ_=|EHp&qMn}p`8hLIOq}xc>HqSA$>oL9v(qPLrcbFU znch-4ts%cSKeMO2yu7ruv^al8Nl8g=Mt^;M{p9A!Ss7Cn_fF_&Ybz)yC@CtM-#xXW zXhu<1dqK{$#**f$+}fFK6Q;FIo7X)hCv$ph)%41o+T!evX-%zjyQVajPpQkVtj(*) z&z@M6GohlQqBMV6b#?XB)~U_S&AD0An@egd@_Q;PD;IY6&1&szEGVujnpRd)Qd?b} zpFO1{r=z!~t-GctFKf!QX@~mi`{#G{=4SLwZfNf6>MG2c#z1$V_>+Z^fgy@P2V^rS zP8it#H$*ixx3spkceHAo>M-^(O2}AtPKh!SVP$7yW?&FxV`mjno!TlY&BZZy^%@2a zE^qavQKE{RbJp%;=8W{1x>a~B)8WIsYlZbfr$}?|Wa{TTww6;oqQi-6$C~qf7k6<5 zc8IJx$M=lo(pnA^jW%P}opX;I7W>G+8qg-g{_PH9@YhGO21ZK+*qHyy33ALh?Z7Y8 z%H-nlqJx3Cnwg2EGlRduzFU@A=AnlngGV)^oy!$9pNB^)1et6!SXdJG^y^Fa&G7VK z-#=ULt?Z72#Q{7O4%*LhLKECCI=Ya4g~#iZ+9AcKVRtuh8kJ1=@a2N2{K{ARK3zy`?1)r}n{gr~ zVUcU(Yf$@<^_HM0TrDYdmWfwU)xdq`rg^yPoooZIA5EMR-HKj@r&0xuByhQyH?&90iiujYkad33sW_Ks?3-g59CXCY4+&;^ lI$d)!pRqYr^Dk3y_!pPOPU~;Jns(V%;=Eh?tceT^)&TT9HI4uP literal 0 HcmV?d00001 diff --git a/VadereGui/src/org/vadere/gui/components/view/ScenarioElementView.java b/VadereGui/src/org/vadere/gui/components/view/ScenarioElementView.java index df983125a..fada8c5fc 100644 --- a/VadereGui/src/org/vadere/gui/components/view/ScenarioElementView.java +++ b/VadereGui/src/org/vadere/gui/components/view/ScenarioElementView.java @@ -89,7 +89,7 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen Theme syntaxTheme = Theme.load(in); syntaxTheme.apply(textAreaLocal); } catch (IOException e) { - logger.error(e); + logger.error("could not load theme" + e.getMessage()); } txtrTextfiletextarea = textAreaLocal; diff --git a/VadereGui/src/org/vadere/gui/postvisualization/model/PostvisualizationModel.java b/VadereGui/src/org/vadere/gui/postvisualization/model/PostvisualizationModel.java index 71f87a106..42f2819de 100644 --- a/VadereGui/src/org/vadere/gui/postvisualization/model/PostvisualizationModel.java +++ b/VadereGui/src/org/vadere/gui/postvisualization/model/PostvisualizationModel.java @@ -174,7 +174,7 @@ public class PostvisualizationModel extends SimulationModel { bi = renderer.renderImage(ImageGenerator.calculateOptimalWidth(model), ImageGenerator.calculateOptimalHeight(model)); } catch (Exception e) { - logger.error(e); + logger.error("could not render image " + e.getMessage()); } finally { model.setScale(oldScale); } diff --git a/VadereGui/src/org/vadere/gui/projectview/VadereApplication.java b/VadereGui/src/org/vadere/gui/projectview/VadereApplication.java index e90e79c23..51221a1b4 100644 --- a/VadereGui/src/org/vadere/gui/projectview/VadereApplication.java +++ b/VadereGui/src/org/vadere/gui/projectview/VadereApplication.java @@ -3,6 +3,7 @@ package org.vadere.gui.projectview; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.vadere.gui.projectview.view.ProjectView; +import org.vadere.state.attributes.models.AttributesBHM; import org.vadere.util.io.IOUtils; import java.io.IOException; @@ -21,7 +22,7 @@ public class VadereApplication { public static void main(String[] args) { logger.info("starting Vadere GUI..."); - // load settings + // load settings loadPreferences(); // start main gui diff --git a/VadereGui/src/org/vadere/gui/projectview/control/ActionAbstractSaveProject.java b/VadereGui/src/org/vadere/gui/projectview/control/ActionAbstractSaveProject.java index caf00c05f..db655e2ed 100644 --- a/VadereGui/src/org/vadere/gui/projectview/control/ActionAbstractSaveProject.java +++ b/VadereGui/src/org/vadere/gui/projectview/control/ActionAbstractSaveProject.java @@ -103,7 +103,7 @@ public abstract class ActionAbstractSaveProject extends AbstractAction { Messages.getString("SaveFileErrorMessage.text") + System.lineSeparator() + e.getLocalizedMessage(), Messages.getString("SaveFileErrorMessage.title")); - logger.error(e); + logger.error("could not save project: " + e.getMessage()); throw new IOException(e); } } else { diff --git a/VadereGui/src/org/vadere/gui/projectview/control/ActionLoadProject.java b/VadereGui/src/org/vadere/gui/projectview/control/ActionLoadProject.java index ae7729444..f03e6c99e 100644 --- a/VadereGui/src/org/vadere/gui/projectview/control/ActionLoadProject.java +++ b/VadereGui/src/org/vadere/gui/projectview/control/ActionLoadProject.java @@ -99,22 +99,22 @@ public class ActionLoadProject extends AbstractAction { public static void loadProjectByPath(ProjectViewModel projectViewModel, String projectFilePath) { try { - VadereProject project = IOVadere. readProjectJson(projectFilePath); + VadereProject project = IOVadere.readProjectJson(projectFilePath); projectViewModel.setCurrentProjectPath(projectFilePath); projectViewModel.setProject(project); projectViewModel.refreshOutputTable(); + logger.info("refreshed output table"); // select and load first scenario from list projectViewModel.setSelectedRowIndexInScenarioTable(0); + logger.info("selected the first scenario"); // change the default directory for searching files Preferences.userNodeForPackage(VadereApplication.class).put("default_directory", projectViewModel.getCurrentProjectPath()); - addToRecentProjects(projectFilePath); ProjectView.getMainWindow().setProjectSpecificActionsEnabled(true); - logger.info(String.format("project '%s' loaded.", projectViewModel.getProject().getName())); // results from migration assistant if he was active @@ -159,7 +159,7 @@ public class ActionLoadProject extends AbstractAction { } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Migration assistant", JOptionPane.ERROR_MESSAGE); - logger.error(e); + logger.error("could not load project: " + e.getMessage()); e.printStackTrace(); } } diff --git a/VadereGui/src/org/vadere/gui/projectview/utils/ClassFinder.java b/VadereGui/src/org/vadere/gui/projectview/utils/ClassFinder.java index 23f99642d..d2b8e08d1 100644 --- a/VadereGui/src/org/vadere/gui/projectview/utils/ClassFinder.java +++ b/VadereGui/src/org/vadere/gui/projectview/utils/ClassFinder.java @@ -1,24 +1,32 @@ package org.vadere.gui.projectview.utils; import org.apache.commons.lang3.tuple.Pair; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; import org.vadere.simulator.models.MainModel; import org.vadere.simulator.models.Model; import org.vadere.simulator.projects.dataprocessing.datakey.DataKey; import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile; import org.vadere.simulator.projects.dataprocessing.processor.DataProcessor; import org.vadere.state.attributes.Attributes; +import org.vadere.state.attributes.models.AttributesBHM; import org.vadere.state.attributes.models.AttributesOSM; import java.io.*; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; +import java.net.JarURLConnection; import java.net.URL; import java.util.*; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; import java.util.stream.Collectors; public class ClassFinder { + private static Logger log = LogManager.getLogger(ClassFinder.class); + public static List getAttributesNames() { // OSM ok for determining package name? use Object.class as tag instead? return getClassNamesWithTagInPackage(AttributesOSM.class.getPackage().getName(), Attributes.class); @@ -45,14 +53,14 @@ public class ClassFinder { public static Map getDataKeysOutputFileRelation() { try { - return getClassesStream(DataKey.class.getPackage().getName()) + return getClasses(DataKey.class.getPackage().getName()) .stream() .filter(c -> !Modifier.isInterface(c.getModifiers())) .filter(c -> DataKey.class.isAssignableFrom(c)) .map(c -> { // Find corresponding outputfile class try { - List> opClasses = getClassesStream(OutputFile.class.getPackage().getName()); + List> opClasses = getClasses(OutputFile.class.getPackage().getName()); Optional> corrOpClass = opClasses .stream() @@ -106,7 +114,7 @@ public class ClassFinder { private static List> findSubclassesInPackage(String packageName, Class baseClassOrInterface) { try { - return getClassesStream(packageName).stream() + return getClasses(packageName).stream() .filter(c -> !c.isInterface() && baseClassOrInterface.isAssignableFrom(c) && isNotAnInnerClass(c)) @@ -139,19 +147,41 @@ public class ClassFinder { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String path = packageName.replace('.', '/'); List dirs = new ArrayList<>(); + ArrayList> classes = new ArrayList<>(); assert classLoader != null; - //String path = packageName.replace('.', '/'); Enumeration resources = classLoader.getResources(path); while (resources.hasMoreElements()) { - URL resource = resources.nextElement(); - dirs.add(new File(resource.getFile())); - } - ArrayList> classes = new ArrayList<>(); - for (File directory : dirs) { - classes.addAll(findClasses(directory, packageName)); + URL url = resources.nextElement(); + + /* + * TODO[Issue #37, Bug]: Find a better solution! The problem is that one can not easily access class-files inside a packed jar! + * this code runs if the project is started via a executable jar + * it is slow, since the whole .jar will be unpacked. + */ + if(url.getProtocol() == "jar") { + JarURLConnection urlcon = (JarURLConnection) (url.openConnection()); + try (JarFile jar = urlcon.getJarFile();) { + Enumeration entries = jar.entries(); + while (entries.hasMoreElements()) { + String entry = entries.nextElement().getName(); + if(entry.startsWith(path) && entry.endsWith(".class")) { + String classPath = entry.substring(0, entry.length() - 6).replace('/', '.'); + classes.add(ClassFinder.class.forName(classPath)); + log.info(classPath); + } + } + } + } // this code is fine but will only be used if the project is started from an IDE! + else { + dirs.add(new File(url.getFile())); + for (File directory : dirs) { + classes.addAll(findClasses(directory, packageName)); + } + } } + return classes; } @@ -175,6 +205,8 @@ public class ClassFinder { dirs.add(path); + log.info(ClassFinder.class.forName(AttributesBHM.class.getName())); + while(!dirs.isEmpty()) { String currentDir = dirs.removeFirst(); String currentPackage = currentDir.replace('/', '.'); diff --git a/VadereGui/src/org/vadere/gui/projectview/view/JSONView.java b/VadereGui/src/org/vadere/gui/projectview/view/JSONView.java index d543dcd60..5d1123ef0 100644 --- a/VadereGui/src/org/vadere/gui/projectview/view/JSONView.java +++ b/VadereGui/src/org/vadere/gui/projectview/view/JSONView.java @@ -6,6 +6,7 @@ import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import org.fife.ui.rsyntaxtextarea.Theme; import org.vadere.gui.components.utils.Messages; +import org.vadere.gui.components.utils.Resources; import javax.swing.*; import javax.swing.event.DocumentListener; @@ -34,7 +35,7 @@ public class JSONView extends JPanel { Theme syntaxTheme = Theme.load(in); syntaxTheme.apply(textAreaLocal); } catch (IOException e) { - logger.error(e); + logger.error("could not apply theme: " + e.getMessage()); } JPanel panelTop = new JPanel(); @@ -46,11 +47,9 @@ public class JSONView extends JPanel { add(scrollPane, BorderLayout.CENTER); lbljsoninvalid = new JLabel(Messages.getString("TextView.lbljsoninvalid.text")); - lbljsoninvalid - .setIcon(new ImageIcon(TextView.class.getResource("/com/sun/java/swing/plaf/windows/icons/Error.gif"))); + lbljsoninvalid.setIcon(new ImageIcon(Resources.class.getResource("/icons/Error.gif"))); lbljsonvalid = new JLabel(Messages.getString("TextView.lbljsonvalid.text")); - lbljsonvalid.setIcon( - new ImageIcon(TextView.class.getResource("/com/sun/java/swing/plaf/windows/icons/Inform.gif"))); + lbljsonvalid.setIcon(new ImageIcon(Resources.class.getResource("/icons/Inform.gif"))); panelTop.add(lbljsoninvalid); panelTop.add(lbljsonvalid); diff --git a/VadereGui/src/org/vadere/gui/projectview/view/JsonValidIndicator.java b/VadereGui/src/org/vadere/gui/projectview/view/JsonValidIndicator.java index 3401c31f2..667dd2d0f 100644 --- a/VadereGui/src/org/vadere/gui/projectview/view/JsonValidIndicator.java +++ b/VadereGui/src/org/vadere/gui/projectview/view/JsonValidIndicator.java @@ -3,6 +3,7 @@ package org.vadere.gui.projectview.view; import javax.swing.*; import org.vadere.gui.components.utils.Messages; +import org.vadere.gui.components.utils.Resources; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -21,8 +22,7 @@ public class JsonValidIndicator extends JPanel { labelJsonValid = new JLabel(Messages.getString("TextView.lbljsonvalid.text")); add(labelJsonValid); - labelJsonValid.setIcon(new ImageIcon( - TextView.class.getResource("/com/sun/java/swing/plaf/windows/icons/Inform.gif"))); + labelJsonValid.setIcon(new ImageIcon(Resources.class.getResource("/icons/Inform.gif"))); // INVALID @@ -30,8 +30,7 @@ public class JsonValidIndicator extends JPanel { " " + Messages.getString("TextView.lbljsoninvalid.showErrorText") + ""); add(labelJsonInvalid); - labelJsonInvalid.setIcon(new ImageIcon(TextView.class - .getResource("/com/sun/java/swing/plaf/windows/icons/Error.gif"))); + labelJsonInvalid.setIcon(new ImageIcon(Resources.class.getResource("/icons/Error.gif"))); labelJsonInvalid.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { diff --git a/VadereGui/src/org/vadere/gui/projectview/view/ProjectView.java b/VadereGui/src/org/vadere/gui/projectview/view/ProjectView.java index 129471209..22d5d2fc0 100644 --- a/VadereGui/src/org/vadere/gui/projectview/view/ProjectView.java +++ b/VadereGui/src/org/vadere/gui/projectview/view/ProjectView.java @@ -489,13 +489,14 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing Player.kill(); ScenarioBundle bundle = model.getSelectedScenarioBundle(); - logger.info(String.format("selected scenario '%s'", bundle.getScenario().getName())); model.setCurrentScenario(bundle.getScenario()); + logger.info(String.format("selected scenario '%s'", bundle.getScenario().getName())); scenarioJPanel.setScenario(bundle.getScenario(), true); outputTableRenderer.setMarkedOutputFiles(bundle.getOutputDirectories()); outputTable.repaint(); // make cell renderer mark associated outputs + logger.info("repainted output table"); } }); scenarioTable.setDefaultRenderer(Object.class, new ScenarioTableRenderer(model)); diff --git a/VadereGui/src/org/vadere/gui/projectview/view/ScenarioPanel.java b/VadereGui/src/org/vadere/gui/projectview/view/ScenarioPanel.java index f2dc92a48..09ede3f6f 100644 --- a/VadereGui/src/org/vadere/gui/projectview/view/ScenarioPanel.java +++ b/VadereGui/src/org/vadere/gui/projectview/view/ScenarioPanel.java @@ -91,9 +91,9 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro setTopography(scenario.getTopography()); } }); - attributesSimulationView = new TextView("/attributes", "default_directory_attributes", AttributeType.SIMULATION); + tabbedPane.addTab(Messages.getString("Tab.Simulation.title"), attributesSimulationView); attributesModelView = new TextView("/attributes", "default_directory_attributes", AttributeType.MODEL); @@ -103,6 +103,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro JMenu mnPresetMenu = new JMenu(Messages.getString("Tab.Model.loadTemplateMenu.title")); presetMenuBar.add(mnPresetMenu); menusInTabs.add(mnPresetMenu); + ModelPresets.getPresets().forEach( modelDefinition -> mnPresetMenu.add(new JMenuItem(new AbstractAction(modelDefinition.getMainModel()) { private static final long serialVersionUID = 1L; @@ -150,6 +151,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro attributesModelView.insertAtCursor("\"" + className + "\""); } }))); + logger.info("3"); ClassFinder.getModelNames().stream() .sorted() .forEach(className -> mnModelNameMenu.add(new JMenuItem(new AbstractAction(className) { @@ -202,6 +204,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro public void setScenario(Scenario scenario, boolean isEditable) { this.scenario = scenario; this.scenarioName.setText(scenario.getDisplayName()); + if (!initialized) { initialize(); } diff --git a/VadereGui/src/org/vadere/gui/projectview/view/TextView.java b/VadereGui/src/org/vadere/gui/projectview/view/TextView.java index 62e186bb1..653484b25 100644 --- a/VadereGui/src/org/vadere/gui/projectview/view/TextView.java +++ b/VadereGui/src/org/vadere/gui/projectview/view/TextView.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.prefs.Preferences; +import javax.imageio.ImageIO; import javax.swing.AbstractButton; import javax.swing.ImageIcon; import javax.swing.JButton; @@ -26,6 +27,7 @@ import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; import org.fife.ui.rsyntaxtextarea.SyntaxConstants; import org.fife.ui.rsyntaxtextarea.Theme; import org.vadere.gui.components.utils.Messages; +import org.vadere.gui.components.utils.Resources; import org.vadere.gui.projectview.VadereApplication; import org.vadere.simulator.projects.Scenario; import org.vadere.simulator.projects.dataprocessing.DataProcessingJsonManager; @@ -98,7 +100,7 @@ public class TextView extends JPanel implements IJsonView { String content = IOUtils.readTextFile(path); txtrTextfiletextarea.setText(content); } catch (IOException e) { - logger.error(e); + logger.error("could not load from file: " + e.getMessage()); } } }; @@ -107,43 +109,37 @@ public class TextView extends JPanel implements IJsonView { * Create the panel. */ public TextView(String default_folder, String default_resource, final AttributeType attributeType) { - this.default_folder = default_folder; + this.default_folder = default_folder; this.default_resource = default_resource; this.attributeType = attributeType; setLayout(new BorderLayout(0, 0)); - + logger.info("04"); panelTop = new JPanel(); add(panelTop, BorderLayout.NORTH); panelTop.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JButton btnSaveToFile = new JButton(Messages.getString("TextFileView.btnSaveToFile.text")); btnSaveToFile.addActionListener(saveToFileActionListener); - btnSaveToFile.setIcon(new ImageIcon(TextView.class - .getResource("/javax/swing/plaf/metal/icons/ocean/floppy.gif"))); + btnSaveToFile.setIcon(new ImageIcon(Resources.class.getResource("/icons/floppy.gif"))); panelTop.add(btnSaveToFile); - btnLoadFromFile = new JButton(Messages.getString("TextView.btnLoadFromFile.text")); - btnLoadFromFile.addActionListener(loadFromFileActionListener); - btnLoadFromFile.setIcon(new ImageIcon( - TextView.class.getResource("/javax/swing/plaf/metal/icons/ocean/floppy.gif"))); - panelTop.add(btnLoadFromFile); + btnLoadFromFile.setIcon(new ImageIcon(Resources.class.getResource("/icons/floppy.gif"))); + panelTop.add(btnLoadFromFile); - jsonValidIndicator = new JsonValidIndicator(); + jsonValidIndicator = new JsonValidIndicator(); panelTop.add(jsonValidIndicator); - JScrollPane scrollPane = new JScrollPane(); add(scrollPane, BorderLayout.CENTER); RSyntaxTextArea textAreaLocal = new RSyntaxTextArea(); textAreaLocal.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JSON); - // set other color theme for text area... InputStream in = getClass().getResourceAsStream("/syntaxthemes/idea.xml"); try { Theme syntaxTheme = Theme.load(in); syntaxTheme.apply(textAreaLocal); - } catch (IOException e) { - logger.error(e); + } catch (Exception e) { + logger.error("could not loead theme " + e.getMessage()); } txtrTextfiletextarea = textAreaLocal; diff --git a/VadereSimulator/src/org/vadere/simulator/projects/io/IOVadere.java b/VadereSimulator/src/org/vadere/simulator/projects/io/IOVadere.java index 6b9d02c29..266e43e3a 100644 --- a/VadereSimulator/src/org/vadere/simulator/projects/io/IOVadere.java +++ b/VadereSimulator/src/org/vadere/simulator/projects/io/IOVadere.java @@ -42,6 +42,8 @@ public class IOVadere { public static VadereProject readProject(final String folderpath) throws IOException { String name = IOUtils.readTextFile(Paths.get(folderpath, IOUtils.VADERE_PROJECT_FILENAME).toString()); + logger.info("read .project file"); + List scenarios = new ArrayList<>(); Set scenarioNames = new HashSet<>(); Path p = Paths.get(folderpath, IOUtils.SCENARIO_DIR); @@ -49,7 +51,7 @@ public class IOVadere { if (Files.isDirectory(p)) { migrationStats = MigrationAssistant.analyzeProject(folderpath); - + logger.info("analysed .scenario files"); for (File file : IOUtils.getFilesInScenarioDirectory(p)) { try { Scenario scenario = @@ -70,6 +72,7 @@ public class IOVadere { VadereProject project = new VadereProject(name, scenarios); project.setMigrationStats(migrationStats); // TODO [priority=low] [task=refactoring] better way to tunnel those results to the GUI? project.setOutputDir(Paths.get(folderpath, IOUtils.OUTPUT_DIR)); + logger.info("project loaded: " + project.getName()); return project; } -- GitLab