Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Improved properties files readability. Fixed issue with obtaining the correct YAML definition while typing.

Authordjarvis <email>
Date2016-11-06 18:28:53 GMT-0800
Commitd2d3825706f7b5226155f0b045aeed9c809cf640
Parentd7b93d6
Delta153 lines added, 29 lines removed, 124-line increase
src/main/resources/com/scrivendor/messages.properties
#
-# Copyright (c) 2016 Karl Tauber <karl at jformdesigner dot com>
+# Copyright 2016 Karl Tauber and White Magic Software, Ltd.
+#
# All rights reserved.
#
#
-#---- Main Application Window ----
+# ########################################################################
+#
+# Main Application Window
+#
+# ########################################################################
# The application title should exist only once in the entire code base.
Main.menu.help.about=About ${Main.title}
-#---- About ----
+# ########################################################################
+#
+# About Dialog
+#
+# ########################################################################
Dialog.about.title=About
Dialog.about.header=${Main.title}
Dialog.about.content=Copyright 2016 White Magic Software, Ltd.\n\nBased on Markdown Writer FX by Karl Tauber
-#---- FileEditor ----
+# ########################################################################
+#
+# File Editor
+#
+# ########################################################################
FileEditor.untitled=Untitled
FileEditor.loadFailed.message=Failed to load ''{0}''.\n\nReason: {1}
FileEditor.loadFailed.title=Load
FileEditor.saveFailed.message=Failed to save ''{0}''.\n\nReason: {1}
FileEditor.saveFailed.title=Save
-
-#---- FileEditorTabPane ----
+# ########################################################################
+#
+# File Open
+#
+# ########################################################################
Dialog.file.choose.open.title=Open File
Dialog.file.choose.save.title=Save File
-
-Alert.file.close.title=Close
-Alert.file.close.text=''{0}'' has been modified. Save changes?
Dialog.file.choose.filter.title.markdown=Markdown Files
Dialog.file.choose.filter.title.definition=Definition Files
Dialog.file.choose.filter.title.all=All Files
-#---- DefinitionPane ----
+# ########################################################################
+#
+# Alert Dialog
+#
+# ########################################################################
+
+Alert.file.close.title=Close
+Alert.file.close.text=''{0}'' has been modified. Save changes?
+
+# ########################################################################
+#
+# Definition Pane
+#
+# ########################################################################
Pane.defintion.node.root.title=Definitions
-#==== Controls ================================================================
+# Controls ###############################################################
-#---- BrowseDirectoryButton ----
+# ########################################################################
+#
+# Browse Directory
+#
+# ########################################################################
BrowseDirectoryButton.chooser.title=Browse for local folder
BrowseDirectoryButton.tooltip=${BrowseDirectoryButton.chooser.title}
-
-#---- BrowseFileButton ----
+# ########################################################################
+#
+# Browse File
+#
+# ########################################################################
BrowseFileButton.chooser.title=Browse for local file
BrowseFileButton.chooser.allFilesFilter=All Files
BrowseFileButton.tooltip=${BrowseFileButton.chooser.title}
-
-#==== Dialogs =================================================================
+# Dialogs ################################################################
-#---- ImageDialog ----
+# ########################################################################
+#
+# Image
+#
+# ########################################################################
ImageDialog.title=Image
ImageDialog.chooser.imagesFilter=Images
ImageDialog.previewLabel.text=Markdown Preview\:
ImageDialog.textLabel.text=Alternate Text\:
ImageDialog.titleLabel.text=Title (tooltip)\:
ImageDialog.urlLabel.text=Image URL\:
-
-#---- LinkDialog ----
+# ########################################################################
+#
+# Hyperlink
+#
+# ########################################################################
LinkDialog.title=Link
LinkDialog.previewLabel.text=Markdown Preview\:
LinkDialog.textLabel.text=Link Text\:
LinkDialog.titleLabel.text=Title (tooltip)\:
LinkDialog.urlLabel.text=Link URL\:
-
-#==== Options =================================================================
+# Options ################################################################
-#---- OptionsDialog ----
+# ########################################################################
+#
+# Options Dialog
+#
+# ########################################################################
OptionsDialog.title=Options
OptionsDialog.generalTab.text=General
OptionsDialog.markdownTab.text=Markdown
-
-#---- GeneralOptionsPane ----
+# ########################################################################
+#
+# General Options Pane
+#
+# ########################################################################
GeneralOptionsPane.encodingLabel.text=En_coding\:
GeneralOptionsPane.lineSeparatorLabel.text=_Line separator\:
GeneralOptionsPane.lineSeparatorLabel2.text=(applies to new files only)
GeneralOptionsPane.platformDefault=Platform Default ({0})
GeneralOptionsPane.sepWindows=Windows (CRLF)
GeneralOptionsPane.sepUnix=Unix (LF)
-
-#---- MarkdownOptionsPane ----
+# ########################################################################
+#
+# Markdown Options Pane
+#
+# ########################################################################
MarkdownOptionsPane.abbreviationsExtCheckBox.text=A_bbreviations in the way of
src/main/resources/com/scrivendor/settings.properties
+# ########################################################################
+#
+# Filename Extensions
+#
+# ########################################################################
+
# Comma-separated list of filename extensions.
Dialog.file.choose.filter.ext.markdown=*.Rmd,*.md,*.txt,*.markdown
Dialog.file.choose.filter.ext.definition=*.yml,*.yaml,*.properties,*.props
Dialog.file.choose.filter.ext.all=*.*
+
+# ########################################################################
+#
+# Variable Name Editor
+#
+# ########################################################################
+
+# Maximum number of characters for a variable name. A variable is defined
+# as one or more non-whitespace characters up to this maximum length.
+editor.variable.maxLength=512
src/main/java/com/scrivendor/service/Pipeline.java
/*
- * Copyright 2016 White Magic Software, Inc.
+ * Copyright 2016 White Magic Software, Ltd.
*
* All rights reserved.
src/main/java/com/scrivendor/service/Service.java
/*
- * Copyright (c) 2016 White Magic Software, Inc.
+ * Copyright 2016 White Magic Software, Ltd.
*
* All rights reserved.
src/main/java/com/scrivendor/service/Settings.java
/*
- * Copyright (c) 2016 White Magic Software, Inc.
+ * Copyright 2016 White Magic Software, Ltd.
*
* All rights reserved.
*/
public String getSetting( String property, String defaultValue );
+
+ /**
+ * Returns a setting property or its default value.
+ *
+ * @param property The property key name to obtain its value.
+ * @param defaultValue The default value to return iff the property cannot
+ * be found.
+ *
+ * @return The property value for the given property key.
+ */
+ public int getSetting( String property, int defaultValue );
/**
src/main/java/com/scrivendor/definition/StartsPredicate.java
+/*
+ * Copyright 2016 White Magic Software, Ltd.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.scrivendor.definition;
+
+/**
+ * Determines if one string starts with another.
+ *
+ * @author White Magic Software, Ltd.
+ */
+public class StartsPredicate implements Predicate {
+
+ /**
+ * Compares two strings taking into consideration options for case.
+ *
+ * @param s1 A non-null string, possibly empty.
+ * @param s2 A non-null string, possibly empty.
+ *
+ * @return true The strings are equal.
+ */
+ @Override
+ public boolean pass( final String s1, final String s2 ) {
+ return s1.toLowerCase().startsWith( s2.toLowerCase() );
+ }
+}