Skip to content

Commit

Permalink
Integrate BundleHelper with SystemHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
trixon committed Apr 9, 2017
1 parent d6d9c48 commit ea11a0f
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import se.trixon.almond.util.AlmondUI;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Xlog;
Expand All @@ -60,7 +60,7 @@
*/
public final class Client extends UnicastRemoteObject implements ClientCallbacks {

private final ResourceBundle mBundle = BundleHelper.getBundle(Jota.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(Jota.class, "Bundle");
private VMID mClientVmid;
private Job mCurrentJob;
private boolean mExitOnException;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/client/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.PomInfo;
import se.trixon.almond.util.SystemHelper;
Expand All @@ -37,7 +37,7 @@
*/
public class Main {

private static final ResourceBundle sBundle = BundleHelper.getBundle(Jota.class, "Bundle");
private static final ResourceBundle sBundle = SystemHelper.getBundle(Jota.class, "Bundle");

static final String OPT_CLIENT_PORT = "client-port";
static final String OPT_CRON = "cron";
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/se/trixon/jota/client/ui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import se.trixon.almond.util.AlmondOptions;
import se.trixon.almond.util.AlmondOptionsPanel;
import se.trixon.almond.util.AlmondUI;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.PomInfo;
import se.trixon.almond.util.SystemHelper;
Expand Down Expand Up @@ -90,7 +90,7 @@ public class MainFrame extends JFrame implements ConnectionListener, ServerEvent
private boolean mServerShutdownRequested;
private final ClientOptions mOptions = ClientOptions.INSTANCE;
private final Client mClient;
private final ResourceBundle mBundle = BundleHelper.getBundle(MainFrame.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(MainFrame.class, "Bundle");
private final LinkedList<AlmondAction> mServerActions = new LinkedList<>();
private final LinkedList<AlmondAction> mAllActions = new LinkedList<>();
private final Manager mManager = Manager.getInstance();
Expand Down Expand Up @@ -691,7 +691,7 @@ public void actionPerformed(ActionEvent e) {
//about
keyStroke = null;
PomInfo pomInfo = new PomInfo(MainFrame.class, "se.trixon", "jotasync");
AboutModel aboutModel = new AboutModel(BundleHelper.getBundle(MainFrame.class, "about"), SystemHelper.getResourceAsImageIcon(MainFrame.class, "sync-256px.png"));
AboutModel aboutModel = new AboutModel(SystemHelper.getBundle(MainFrame.class, "about"), SystemHelper.getResourceAsImageIcon(MainFrame.class, "sync-256px.png"));
aboutModel.setAppVersion(pomInfo.getVersion());
AboutPanel aboutPanel = new AboutPanel(aboutModel);
action = AboutPanel.getAction(MainFrame.this, aboutPanel);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/client/ui/OptionsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JSpinner;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.jota.client.ClientOptions;
import se.trixon.jota.client.Manager;
Expand All @@ -36,7 +36,7 @@ public class OptionsPanel extends javax.swing.JPanel {
private final Manager mManager = Manager.getInstance();
private final ServerCommander mServerCommander;
private final ClientOptions mOptions = ClientOptions.INSTANCE;
private final ResourceBundle mBundle = BundleHelper.getBundle(MainFrame.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(MainFrame.class, "Bundle");

/**
* Creates new form OptionsPanel
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/client/ui/SpeedDialPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import javax.swing.UnsupportedLookAndFeelException;
import se.trixon.almond.util.AlmondOptions;
import se.trixon.almond.util.AlmondUI;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.icons.material.MaterialIcon;
import se.trixon.almond.util.swing.SwingHelper;
Expand Down Expand Up @@ -68,7 +68,7 @@ public final class SpeedDialPanel extends JPanel implements ConnectionListener,
private final HashSet<SpeedDialListener> mSpeedDialListeners = new HashSet<>();
private final ClientOptions mOptions = ClientOptions.INSTANCE;
private final Manager mManager = Manager.getInstance();
private final ResourceBundle mBundle = BundleHelper.getBundle(MainFrame.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(MainFrame.class, "Bundle");
private final AlmondOptions mAlmondOptions = AlmondOptions.getInstance();

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/client/ui/editor/JobsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.commons.lang3.SerializationUtils;
import se.trixon.jota.client.Manager;
import se.trixon.jota.shared.job.Job;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.swing.SwingHelper;
import se.trixon.almond.util.swing.dialogs.Message;
Expand All @@ -42,7 +42,7 @@
*/
public final class JobsPanel extends EditPanel {

private final ResourceBundle mBundle = BundleHelper.getBundle(JobsPanel.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(JobsPanel.class, "Bundle");
private final HashSet<JobsListener> mJobsListeners = new HashSet<>();
private final Manager mManager = Manager.getInstance();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/client/ui/editor/TasksPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.commons.lang3.SerializationUtils;
import se.trixon.jota.client.Manager;
import se.trixon.jota.shared.task.Task;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.swing.SwingHelper;
import se.trixon.almond.util.swing.dialogs.Message;
Expand All @@ -40,7 +40,7 @@
*/
public class TasksPanel extends EditPanel {

private final ResourceBundle mBundle = BundleHelper.getBundle(TasksPanel.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(TasksPanel.class, "Bundle");
private final Manager mManager = Manager.getInstance();
private final HashSet<TasksListener> mTaskListeners = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import javax.swing.ListSelectionModel;
import org.apache.commons.lang3.StringUtils;
import se.trixon.jota.client.ui.editor.EditPanel;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.swing.SwingHelper;
import se.trixon.almond.util.swing.dialogs.Message;
Expand All @@ -36,7 +36,7 @@
public class CronEditorPanel extends EditPanel {

private static final String CRON_ITEM_SEPARATOR = "|";
private final ResourceBundle mBundle = BundleHelper.getBundle(CronEditorPanel.class, "Bundle");
private final ResourceBundle mBundle = SystemHelper.getBundle(CronEditorPanel.class, "Bundle");

/**
* Creates new form CronPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.ResourceBundle;
import org.apache.commons.lang3.SystemUtils;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import static se.trixon.jota.shared.task.TaskSection.OPT_SEPARATOR;

/**
Expand All @@ -36,7 +36,7 @@ public enum ExcludeOption implements OptionHandler {
GVFS("--exclude=**/.gvfs/", SystemUtils.IS_OS_LINUX);
private final boolean mActive;
private final String mArg;
private final ResourceBundle mBundle = BundleHelper.getBundle(ExcludeOption.class, "ExcludeOption");
private final ResourceBundle mBundle = SystemHelper.getBundle(ExcludeOption.class, "ExcludeOption");
private final String mTitle;

private ExcludeOption(String arg, boolean active) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.ResourceBundle;
import org.apache.commons.lang3.StringUtils;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;

/**
*
Expand Down Expand Up @@ -143,7 +143,7 @@ public enum RsyncOption implements OptionHandler {
WRITE_BATCH(null, "write-batch=FILE"),
_8_BIT_OUTPUT("8", "8-bit-output");

private final ResourceBundle mBundle = BundleHelper.getBundle(RsyncOption.class, "RsyncOption");
private final ResourceBundle mBundle = SystemHelper.getBundle(RsyncOption.class, "RsyncOption");
private final String mLongArg;
private final String mShortArg;
private final String mTitle;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/se/trixon/jota/server/JobExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Xlog;
Expand Down Expand Up @@ -70,8 +70,8 @@ class JobExecutor extends Thread {
mErrBuffer = new StringBuffer();
mOutBuffer = new StringBuffer();

mJobExecBundle = BundleHelper.getBundle(JobExecutePanel.class, "Bundle");
mTaskExecBundle = BundleHelper.getBundle(TaskExecutePanel.class, "Bundle");
mJobExecBundle = SystemHelper.getBundle(JobExecutePanel.class, "Bundle");
mTaskExecBundle = SystemHelper.getBundle(TaskExecutePanel.class, "Bundle");
}

@Override
Expand Down Expand Up @@ -165,7 +165,7 @@ public void stopJob() {
}

private String getRsyncErrorCode(int exitValue) {
ResourceBundle bundle = BundleHelper.getBundle(getClass(), "ExitValues");
ResourceBundle bundle = SystemHelper.getBundle(getClass(), "ExitValues");
String key = String.valueOf(exitValue);

return bundle.containsKey(key) ? bundle.getString(key) : String.format((Dict.SYSTEM_CODE.toString()), key);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/server/JobValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.IOException;
import java.io.Serializable;
import java.util.ResourceBundle;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.jota.client.ui.editor.module.job.JobExecutePanel;
import se.trixon.jota.shared.job.Job;
Expand Down Expand Up @@ -73,7 +73,7 @@ private void addSummary(String header, String message) {
}

private void validateExecutor(boolean active, String command, String key) {
ResourceBundle bundle = BundleHelper.getBundle(JobExecutePanel.class, "Bundle");
ResourceBundle bundle = SystemHelper.getBundle(JobExecutePanel.class, "Bundle");
File file = new File(command);
if (active && !file.exists()) {
mInvalid = true;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/server/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.almond.util.PomInfo;
import se.trixon.almond.util.SystemHelper;
Expand All @@ -38,7 +38,7 @@
*/
public class Main {

private static final ResourceBundle sBundle = BundleHelper.getBundle(Jota.class, "Bundle");
private static final ResourceBundle sBundle = SystemHelper.getBundle(Jota.class, "Bundle");

/**
* @param args the command line arguments
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/shared/Jota.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;

/**
*
Expand All @@ -29,7 +29,7 @@ public class Jota {
public static final int DEFAULT_PORT_CLIENT = 1199;
public static final int DEFAULT_PORT_HOST = 1099;
public static final String TASK_SEPARATOR = ",";
private static final ResourceBundle sBundle = BundleHelper.getBundle(Jota.class, "Bundle");
private static final ResourceBundle sBundle = SystemHelper.getBundle(Jota.class, "Bundle");

public static void exit() {
exit(0);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/shared/job/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import se.trixon.jota.client.ui.editor.module.job.JobExecutePanel;
import se.trixon.jota.shared.Jota;
import se.trixon.jota.shared.task.Task;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;

/**
Expand Down Expand Up @@ -174,7 +174,7 @@ public String getName() {
public String getSummaryAsHtml() {
mSummaryBuilder = new StringBuilder("<html><body>");
mSummaryBuilder.append("<h1>").append(getName()).append("</h1>");
ResourceBundle bundle = BundleHelper.getBundle(JobExecutePanel.class, "Bundle");
ResourceBundle bundle = SystemHelper.getBundle(JobExecutePanel.class, "Bundle");

addOptionalToSummary(mExecuteSection.isBefore(), mExecuteSection.getBeforeCommand(), bundle.getString("JobPanel.beforePanel.header"));
if (mExecuteSection.isBefore() && mExecuteSection.isBeforeHaltOnError()) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/se/trixon/jota/shared/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import se.trixon.jota.client.ui.editor.module.task.TaskExecutePanel;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;

/**
Expand Down Expand Up @@ -143,7 +143,7 @@ public String getSummaryAsHtml() {
addOptionalToSummary(true, getSource(), Dict.SOURCE.toString());
addOptionalToSummary(true, getDestination(), Dict.DESTINATION.toString());

ResourceBundle bundle = BundleHelper.getBundle(TaskExecutePanel.class, "Bundle");
ResourceBundle bundle = SystemHelper.getBundle(TaskExecutePanel.class, "Bundle");

addOptionalToSummary(mExecuteSection.isBefore(), mExecuteSection.getBeforeCommand(), bundle.getString("TaskExecutePanel.beforePanel.header"));
if (mExecuteSection.isBefore() && mExecuteSection.isBeforeHaltOnError()) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/se/trixon/jota/shared/task/TaskValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.File;
import java.io.Serializable;
import java.util.ResourceBundle;
import se.trixon.almond.util.BundleHelper;
import se.trixon.almond.util.SystemHelper;
import se.trixon.almond.util.Dict;
import se.trixon.jota.client.ui.editor.module.task.TaskExcludePanel;
import se.trixon.jota.client.ui.editor.module.task.TaskExecutePanel;
Expand Down Expand Up @@ -76,14 +76,14 @@ private void validateDirs() {

private void validateExclusion() {
ExcludeSection excludeSection = mTask.getExcludeSection();
ResourceBundle bundle = BundleHelper.getBundle(TaskExcludePanel.class, "Bundle");
ResourceBundle bundle = SystemHelper.getBundle(TaskExcludePanel.class, "Bundle");

validateFile(excludeSection.isManualFileUsed(), excludeSection.getManualFilePath(), bundle.getString("TaskExcludePanel.externalFilePanel.header"));
}

private void validateExecutors() {
TaskExecuteSection executeSection = mTask.getExecuteSection();
ResourceBundle bundle = BundleHelper.getBundle(TaskExecutePanel.class, "Bundle");
ResourceBundle bundle = SystemHelper.getBundle(TaskExecutePanel.class, "Bundle");

validateFile(executeSection.isBefore(), executeSection.getBeforeCommand(), bundle.getString("TaskExecutePanel.beforePanel.header"));
validateFile(executeSection.isAfterFailure(), executeSection.getAfterFailureCommand(), bundle.getString("TaskExecutePanel.afterFailurePanel.header"));
Expand Down

0 comments on commit ea11a0f

Please sign in to comment.