branch develop updated (8ea45d4 -> 9cc764a)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git from 8ea45d4 Improve index page new 5f9877e fixes #1341: Double click on a running should stop it new a06bbaf fixes #1338: Can't start with webstart new a804120 fixes #1337: When creating a new task, focus is not ok fixes #1340: I cancel the creation of a new task, but it is still created new 9cc764a fixes #1339: Check the template directory exists (or create it at launch time ?) The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 9cc764aa5002bfc68a5b0acef579a557b192f859 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 16:07:05 2016 +0100 fixes #1339: Check the template directory exists (or create it at launch time ?) commit a8041207c6b4321eb5edc0dab98e5ce93f6aa418 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 16:03:40 2016 +0100 fixes #1337: When creating a new task, focus is not ok fixes #1340: I cancel the creation of a new task, but it is still created commit a06bbaf74e2cdc003190cd47ec70d9f5db48505a Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 10:55:21 2016 +0100 fixes #1338: Can't start with webstart commit 5f9877eef8cad482eff5ec9cf30076701416a1e5 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 10:54:19 2016 +0100 fixes #1341: Double click on a running should stop it Summary of changes: src/main/java/org/chorem/jtimer/JTimer.java | 38 +---- src/main/java/org/chorem/jtimer/JTimerConfig.java | 29 ++-- .../java/org/chorem/jtimer/ui/NewTaskPanel.java | 105 -------------- .../java/org/chorem/jtimer/ui/NewTaskView.java | 159 +++++++++++++++++++++ .../org/chorem/jtimer/resources/JTimer.properties | 3 - .../chorem/jtimer/resources/JTimer_fr.properties | 3 - .../jtimer/ui/resources/NewTaskView.properties} | 13 +- .../jtimer/ui/resources/NewTaskView_fr.properties} | 12 +- src/site/rst/index.rst.vm | 2 +- 9 files changed, 203 insertions(+), 161 deletions(-) delete mode 100644 src/main/java/org/chorem/jtimer/ui/NewTaskPanel.java create mode 100644 src/main/java/org/chorem/jtimer/ui/NewTaskView.java copy src/main/resources/{jtimer.properties => org/chorem/jtimer/ui/resources/NewTaskView.properties} (67%) copy src/main/resources/{jtimer.properties => org/chorem/jtimer/ui/resources/NewTaskView_fr.properties} (67%) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit 5f9877eef8cad482eff5ec9cf30076701416a1e5 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 10:54:19 2016 +0100 fixes #1341: Double click on a running should stop it --- src/main/java/org/chorem/jtimer/JTimer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimer.java b/src/main/java/org/chorem/jtimer/JTimer.java index a48f2b2..a8db87c 100644 --- a/src/main/java/org/chorem/jtimer/JTimer.java +++ b/src/main/java/org/chorem/jtimer/JTimer.java @@ -1395,11 +1395,9 @@ public class JTimer extends SingleFrameApplication implements if (appTask != null) { getContext().getTaskService().execute(appTask); } - /* TODO EC-20100416 temp disable, called twice, can display - -1 task running :( - } else if (isSelectedSingleRunningTask()) { + } else if (isSelectedSingleTask()) { TimerTask task = projectsAndTasksTable.getSelectedTasks().get(0); - stopTask(task); */ + stopTask(task); } else { if (log.isDebugEnabled()) { log.debug("Non selected non running task to launch"); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit a06bbaf74e2cdc003190cd47ec70d9f5db48505a Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 10:55:21 2016 +0100 fixes #1338: Can't start with webstart --- src/site/rst/index.rst.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/rst/index.rst.vm b/src/site/rst/index.rst.vm index 363e3b7..4a6b6f3 100644 --- a/src/site/rst/index.rst.vm +++ b/src/site/rst/index.rst.vm @@ -58,5 +58,5 @@ For more information, go to page `jnlp documentation`_. .. _Download jTimer ${project.version}: https://forge.chorem.org/projects/jtimer/files .. _Java: http://java.sun.com/javase/downloads/index.jsp .. _gTimer: http://www.k5n.us/gtimer.php -.. _Start jTimer via webstart: ../jnlp/${jnlpFileName} +.. _Start jTimer via webstart: jnlp/${jnlpFileName} .. _jnlp documentation: jnlp-report.html \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit a8041207c6b4321eb5edc0dab98e5ce93f6aa418 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 16:03:40 2016 +0100 fixes #1337: When creating a new task, focus is not ok fixes #1340: I cancel the creation of a new task, but it is still created --- src/main/java/org/chorem/jtimer/JTimer.java | 32 +---- .../java/org/chorem/jtimer/ui/NewTaskPanel.java | 105 -------------- .../java/org/chorem/jtimer/ui/NewTaskView.java | 159 +++++++++++++++++++++ .../org/chorem/jtimer/resources/JTimer.properties | 3 - .../chorem/jtimer/resources/JTimer_fr.properties | 3 - .../jtimer/ui/resources/NewTaskView.properties | 31 ++++ .../jtimer/ui/resources/NewTaskView_fr.properties | 30 ++++ 7 files changed, 225 insertions(+), 138 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimer.java b/src/main/java/org/chorem/jtimer/JTimer.java index a8db87c..228a8be 100644 --- a/src/main/java/org/chorem/jtimer/JTimer.java +++ b/src/main/java/org/chorem/jtimer/JTimer.java @@ -67,7 +67,7 @@ import org.chorem.jtimer.data.TimerCore; import org.chorem.jtimer.entities.TimerProject; import org.chorem.jtimer.entities.TimerTask; import org.chorem.jtimer.ui.HelpFrame; -import org.chorem.jtimer.ui.NewTaskPanel; +import org.chorem.jtimer.ui.NewTaskView; import org.chorem.jtimer.ui.StatusBar; import org.chorem.jtimer.ui.TimerTaskEditor; import org.chorem.jtimer.ui.alert.AlertEditor; @@ -550,7 +550,7 @@ public class JTimer extends SingleFrameApplication implements * * @param errorMessageKey saf error message key */ - protected void displayErrorMessage(String errorMessageKey) { + public void displayErrorMessage(String errorMessageKey) { String title = resourceMap.getString("action.invalidActionTitle"); String message = resourceMap.getString(errorMessageKey); @@ -632,32 +632,10 @@ public class JTimer extends SingleFrameApplication implements public void newTask() { // select task to add new task - TimerTask selectedTask = projectsAndTasksTable.getSelectedElements() - .get(0); - - NewTaskPanel newTaskPanel = new NewTaskPanel(this, selectedTask); - JOptionPane.showMessageDialog(getMainFrame(), newTaskPanel, resourceMap - .getString("input.newTaskTitle"), JOptionPane.QUESTION_MESSAGE); - String taskName = newTaskPanel.getTaskName(); - String taskTemplate = newTaskPanel.getTaskTemplate(); - - if (taskName != null) { - - // remove unneeded spaces - taskName = taskName.trim(); - - TimerTask t = new TimerTask(taskName); - - // Fix creation date - t.setCreationDate(new Date()); - - try { - core.getData().addTask(selectedTask, t, taskTemplate); - } catch (DataViolationException e) { - displayErrorMessage(e.getExceptionKey()); - } - } + TimerTask selectedTask = projectsAndTasksTable.getSelectedElements().get(0); + NewTaskView newTaskPanel = new NewTaskView(this, core, selectedTask); + show(newTaskPanel); } /** diff --git a/src/main/java/org/chorem/jtimer/ui/NewTaskPanel.java b/src/main/java/org/chorem/jtimer/ui/NewTaskPanel.java deleted file mode 100644 index 4d4e3bd..0000000 --- a/src/main/java/org/chorem/jtimer/ui/NewTaskPanel.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * #%L - * jTimer - * %% - * Copyright (C) 2016 CodeLutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ -package org.chorem.jtimer.ui; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.util.Map; -import java.util.Set; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import org.chorem.jtimer.JTimer; -import org.chorem.jtimer.entities.TimerTask; -import org.jdesktop.application.Application; -import org.jdesktop.application.ResourceMap; - -/** - * New task panel used to ask for: - * <ul> - * <li>Task name</li> - * <li>Task template (if available)</li> - * </ul> - * - * @author Eric Chatellier - */ -public class NewTaskPanel extends JPanel { - - /** serialVersionUID. */ - private static final long serialVersionUID = -6725150779251233404L; - - protected JTextField newTaskField; - protected JComboBox<String> newTaskTemplateBox; - - public NewTaskPanel(Application app, TimerTask selectedTask) { - super(new GridBagLayout()); - - ResourceMap resourceMap = app.getContext().getResourceMap(); - - // task name - JLabel newTaskLabel = new JLabel(resourceMap.getString("input.newTaskMessage", selectedTask.getName())); - this.add(newTaskLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - newTaskField = new JTextField(); - this.add(newTaskField, new GridBagConstraints(0, 1, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - - // Task template - Map<String, Object> templates = JTimer.config.getTaskTemplates(); - - - newTaskTemplateBox = new JComboBox<>(); - if (templates != null && !templates.isEmpty()) { - - // model - Set<String> templateNames = templates.keySet(); - DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(templateNames.toArray(new String[templateNames.size()])); - model.insertElementAt(null, 0); // empty option - newTaskTemplateBox.setModel(model); - newTaskTemplateBox.setSelectedItem(null); // empty option - - JLabel newTaskTemplateLabel = new JLabel(resourceMap.getString("input.newTaskTemplate")); - this.add(newTaskTemplateLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - - this.add(newTaskTemplateBox, new GridBagConstraints(0, 3, 1, 1, 0, 0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(1, 1, 1, 1), 0, 0)); - } - } - - public String getTaskName() { - return newTaskField.getText(); - } - - public String getTaskTemplate() { - return (String)newTaskTemplateBox.getSelectedItem(); - } -} diff --git a/src/main/java/org/chorem/jtimer/ui/NewTaskView.java b/src/main/java/org/chorem/jtimer/ui/NewTaskView.java new file mode 100644 index 0000000..a571c21 --- /dev/null +++ b/src/main/java/org/chorem/jtimer/ui/NewTaskView.java @@ -0,0 +1,159 @@ +/* + * #%L + * jTimer + * %% + * Copyright (C) 2016 CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +package org.chorem.jtimer.ui; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.util.Date; +import java.util.Map; +import java.util.Set; + +import javax.swing.ActionMap; +import javax.swing.DefaultComboBoxModel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import org.chorem.jtimer.JTimer; +import org.chorem.jtimer.data.DataViolationException; +import org.chorem.jtimer.data.TimerCore; +import org.chorem.jtimer.entities.TimerTask; +import org.jdesktop.application.Action; +import org.jdesktop.application.FrameView; + +/** + * New task panel used to ask for: + * <ul> + * <li>Task name</li> + * <li>Task template (if available)</li> + * </ul> + * + * @author Eric Chatellier + */ +public class NewTaskView extends FrameView { + + protected JTimer parent; + protected TimerCore core; + protected ActionMap actionMap; + protected TimerTask selectedTask; + + protected JTextField newTaskField; + protected JComboBox<String> newTaskTemplateBox; + + public NewTaskView(JTimer parent, TimerCore core, TimerTask selectedTask) { + super(parent); + this.parent = parent; + this.core = core; + this.selectedTask = selectedTask; + actionMap = parent.getContext().getActionMap(this); + + // modify frame name + // otherwise, get parent frame dimention + getFrame().setName("newTask"); + getFrame().setTitle(getResourceMap().getString("newTaskTitle")); + getFrame().setResizable(false); + + setComponent(getMainComponent(selectedTask)); + } + + protected JPanel getMainComponent(TimerTask selectedTask) { + JPanel panel = new JPanel(new GridBagLayout()); + + // icon + JLabel newTaskIcon = new JLabel(new ImageIcon(getClass().getResource("../resources/document-new.png"))); + panel.add(newTaskIcon, new GridBagConstraints(0, 0, 1, 4, 0, 0, + GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + + // task name + JLabel newTaskLabel = new JLabel(getResourceMap().getString("input.newTaskMessage", selectedTask.getName())); + panel.add(newTaskLabel, new GridBagConstraints(1, 0, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); + newTaskField = new JTextField(); + panel.add(newTaskField, new GridBagConstraints(1, 1, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 0, 5), 0, 0)); + + // Task template + Map<String, Object> templates = JTimer.config.getTaskTemplates(); + + newTaskTemplateBox = new JComboBox<>(); + if (templates != null && !templates.isEmpty()) { + + // model + Set<String> templateNames = templates.keySet(); + DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(templateNames.toArray(new String[templateNames.size()])); + model.insertElementAt(null, 0); // empty option + newTaskTemplateBox.setModel(model); + newTaskTemplateBox.setSelectedItem(null); // empty option + + JLabel newTaskTemplateLabel = new JLabel(getResourceMap().getString("input.newTaskTemplate")); + panel.add(newTaskTemplateLabel, new GridBagConstraints(1, 2, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); + + panel.add(newTaskTemplateBox, new GridBagConstraints(1, 3, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 0, 5), 0, 0)); + } + + // ok cancel buttons + JButton okButton = new JButton(); + okButton.setAction(actionMap.get("valid")); + panel.add(okButton, new GridBagConstraints(1, 4, 1, 1, 1, 0, + GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 1), 0, 0)); + + JButton cancelButton = new JButton(); + cancelButton.setAction(actionMap.get("cancel")); + panel.add(cancelButton, new GridBagConstraints(2, 4, 1, 1, 1, 0, + GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 1, 5, 5), 0, 0)); + + return panel; + } + + @Action + public void valid() { + String taskName = newTaskField.getText(); + String taskTemplate = (String)newTaskTemplateBox.getSelectedItem(); + + getApplication().hide(this); + + // remove unneeded spaces + taskName = taskName.trim(); + + TimerTask t = new TimerTask(taskName); + + // Fix creation date + t.setCreationDate(new Date()); + + try { + core.getData().addTask(selectedTask, t, taskTemplate); + } catch (DataViolationException e) { + parent.displayErrorMessage(e.getExceptionKey()); + } + } + + @Action + public void cancel() { + getApplication().hide(this); + } +} diff --git a/src/main/resources/org/chorem/jtimer/resources/JTimer.properties b/src/main/resources/org/chorem/jtimer/resources/JTimer.properties index 9c25f8f..7eaaa13 100644 --- a/src/main/resources/org/chorem/jtimer/resources/JTimer.properties +++ b/src/main/resources/org/chorem/jtimer/resources/JTimer.properties @@ -161,9 +161,6 @@ input.editProjectTitle=Edit project input.editProjectMessage=New project name : input.deleteProjectTitle=Confirm input.deleteProjectMessage=Do you want to delete project "%s" ? -input.newTaskTitle=New task -input.newTaskMessage=Task name to create for "%s" : -input.newTaskTemplate=Task template to use : input.editTaskTitle=Edit task input.editTaskMessage=New task name : input.deleteTaskTitle=Confirm diff --git a/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties b/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties index ea42975..192ac7a 100644 --- a/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties +++ b/src/main/resources/org/chorem/jtimer/resources/JTimer_fr.properties @@ -126,9 +126,6 @@ input.editProjectTitle=\u00C9dition du projet input.editProjectMessage=Nouveau nom du projet : input.deleteProjectTitle=Confirmation input.deleteProjectMessage=Voulez-vous supprimer le projet "%s" ? -input.newTaskTitle=Nouvelle t\u00E2che -input.newTaskMessage=Nom de la t\u00E2che \u00E0 cr\u00E9er pour "%s" : -input.newTaskTemplate=Template \u00E0 utiliser : input.editTaskTitle=\u00C9dition de la t\u00E2che input.editTaskMessage=Nouveau nom de la t\u00E2che : input.deleteTaskTitle=Confirmation diff --git a/src/main/resources/org/chorem/jtimer/ui/resources/NewTaskView.properties b/src/main/resources/org/chorem/jtimer/ui/resources/NewTaskView.properties new file mode 100644 index 0000000..1e5302e --- /dev/null +++ b/src/main/resources/org/chorem/jtimer/ui/resources/NewTaskView.properties @@ -0,0 +1,31 @@ +### +# #%L +# jTimer +# %% +# Copyright (C) 2016 CodeLutin, Chatellier Eric +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### +newTaskTitle=New task +newTaskIcon.icon = document-new.png +input.newTaskMessage=Task name to create for "%s" : +input.newTaskTemplate=Task template to use : + +valid.Action.text = OK +valid.Action.accelerator = control O + +cancel.Action.text = Cancel +cancel.Action.accelerator = control C diff --git a/src/main/resources/org/chorem/jtimer/ui/resources/NewTaskView_fr.properties b/src/main/resources/org/chorem/jtimer/ui/resources/NewTaskView_fr.properties new file mode 100644 index 0000000..40994da --- /dev/null +++ b/src/main/resources/org/chorem/jtimer/ui/resources/NewTaskView_fr.properties @@ -0,0 +1,30 @@ +### +# #%L +# jTimer +# %% +# Copyright (C) 2016 CodeLutin, Chatellier Eric +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### +newTaskTitle=Nouvelle t\u00E2che +input.newTaskMessage=Nom de la t\u00E2che \u00E0 cr\u00E9er pour "%s" : +input.newTaskTemplate=Template \u00E0 utiliser : + +valid.Action.text = OK +valid.Action.accelerator = control O + +cancel.Action.text = Annuler +cancel.Action.accelerator = control A -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit 9cc764aa5002bfc68a5b0acef579a557b192f859 Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Mar 9 16:07:05 2016 +0100 fixes #1339: Check the template directory exists (or create it at launch time ?) --- src/main/java/org/chorem/jtimer/JTimerConfig.java | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimerConfig.java b/src/main/java/org/chorem/jtimer/JTimerConfig.java index ac98d49..beb4fa5 100644 --- a/src/main/java/org/chorem/jtimer/JTimerConfig.java +++ b/src/main/java/org/chorem/jtimer/JTimerConfig.java @@ -160,22 +160,27 @@ public class JTimerConfig { */ public Map<String, Object> getTaskTemplates() { Map<String, Object> result = new TreeMap<>(); + String tplDirectory = appConfig.getOption(JTimerOption.UI_TEMPLATE_DIRECTORY.key); - Path backupDir = FileSystems.getDefault().getPath(tplDirectory); - try (DirectoryStream<Path> stream = Files.newDirectoryStream(backupDir)) { - Yaml yaml = new Yaml(); - for (Path file : stream) { - try (InputStream is = new FileInputStream(file.toFile())) { - Object r = yaml.load(is); - String name = FilenameUtils.removeExtension(file.getFileName().toString()); - result.put(name, r); + Path tplDir = FileSystems.getDefault().getPath(tplDirectory); + + if (Files.exists(tplDir)) { + try (DirectoryStream<Path> stream = Files.newDirectoryStream(tplDir)) { + Yaml yaml = new Yaml(); + for (Path file : stream) { + try (InputStream is = new FileInputStream(file.toFile())) { + Object r = yaml.load(is); + String name = FilenameUtils.removeExtension(file.getFileName().toString()); + result.put(name, r); + } + } + } catch (DirectoryIteratorException|IOException ex) { + if (log.isErrorEnabled()) { + log.error("Can't create backup", ex); } - } - } catch (DirectoryIteratorException|IOException ex) { - if (log.isErrorEnabled()) { - log.error("Can't create backup", ex); } } + return result; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm