Merge lp:~danilovesky/workcraft/trunk-log-color into lp:workcraft
- trunk-log-color
- Merge into trunk
Proposed by
Danil Sokolov
Status: | Merged |
---|---|
Merged at revision: | 715 |
Proposed branch: | lp:~danilovesky/workcraft/trunk-log-color |
Merge into: | lp:workcraft |
Diff against target: |
1111 lines (+406/-105) 19 files modified
CircuitPlugin/src/org/workcraft/plugins/circuit/genlib/GenlibUtils.java (+5/-4) CircuitPlugin/src/org/workcraft/plugins/circuit/interop/VerilogImporter.java (+17/-16) CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/VerilogSerialiser.java (+9/-8) MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisTask.java (+2/-1) WorkcraftCore/src/org/workcraft/CompatibilityManager.java (+9/-7) WorkcraftCore/src/org/workcraft/Console.java (+2/-2) WorkcraftCore/src/org/workcraft/gui/ErrorWindow.java (+4/-2) WorkcraftCore/src/org/workcraft/gui/OutputWindow.java (+71/-35) WorkcraftCore/src/org/workcraft/plugins/BuiltinTools.java (+2/-0) WorkcraftCore/src/org/workcraft/plugins/shared/CommonLogSettings.java (+225/-0) WorkcraftCore/src/org/workcraft/plugins/shared/tasks/ExternalProcessTask.java (+8/-7) WorkcraftCore/src/org/workcraft/util/LogUtils.java (+22/-0) XmasPlugin/src/org/workcraft/plugins/xmas/stg/StgGenerator.java (+2/-1) XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetExt.java (+2/-1) XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetGen.java (+7/-6) XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerAnalysis.java (+6/-5) XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerConfTool.java (+2/-1) XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerQuery.java (+6/-5) XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerTool.java (+5/-4) |
To merge this branch: | bzr merge lp:~danilovesky/workcraft/trunk-log-color |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danil Sokolov | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Danil Sokolov (danilovesky) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/genlib/GenlibUtils.java' |
2 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/genlib/GenlibUtils.java 2015-10-22 16:04:43 +0000 |
3 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/genlib/GenlibUtils.java 2016-01-17 22:48:15 +0000 |
4 | @@ -9,6 +9,7 @@ |
5 | import org.workcraft.plugins.circuit.expression.ExpressionUtils; |
6 | import org.workcraft.plugins.cpog.optimisation.BooleanFormula; |
7 | import org.workcraft.plugins.shared.CommonDebugSettings; |
8 | +import org.workcraft.util.LogUtils; |
9 | |
10 | public class GenlibUtils { |
11 | |
12 | @@ -20,7 +21,7 @@ |
13 | try { |
14 | circuit.setName(component, instanceName); |
15 | } catch (ArgumentException e) { |
16 | - System.out.println("Warning: cannot set name '" + instanceName +"' for component '" + circuit.getName(component) + "'."); |
17 | + LogUtils.logWarningLine("Cannot set name '" + instanceName +"' for component '" + circuit.getName(component) + "'."); |
18 | } |
19 | } |
20 | |
21 | @@ -30,9 +31,9 @@ |
22 | String setFunction = getSetFunction(gate); |
23 | String resetFunction = getResetFunction(gate); |
24 | if (CommonDebugSettings.getVerboseImport()) { |
25 | - System.out.println("Info: Instantiating gate " + gate.name + " " + gate.function.name + "=" + gate.function.formula); |
26 | - System.out.println(" Set function: " + setFunction); |
27 | - System.out.println(" Reset function: " + resetFunction); |
28 | + LogUtils.logInfoLine("Instantiating gate " + gate.name + " " + gate.function.name + "=" + gate.function.formula); |
29 | + LogUtils.logInfoLine(" Set function: " + setFunction); |
30 | + LogUtils.logInfoLine(" Reset function: " + resetFunction); |
31 | } |
32 | try { |
33 | BooleanFormula setFormula = CircuitUtils.parseContactFuncton(circuit, component, setFunction); |
34 | |
35 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/interop/VerilogImporter.java' |
36 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/interop/VerilogImporter.java 2015-11-12 09:54:10 +0000 |
37 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/interop/VerilogImporter.java 2016-01-17 22:48:15 +0000 |
38 | @@ -73,6 +73,7 @@ |
39 | import org.workcraft.plugins.cpog.optimisation.booleanvisitors.BooleanUtils; |
40 | import org.workcraft.plugins.cpog.optimisation.booleanvisitors.FormulaToString; |
41 | import org.workcraft.plugins.shared.CommonDebugSettings; |
42 | +import org.workcraft.util.LogUtils; |
43 | import org.workcraft.workspace.ModelEntry; |
44 | |
45 | |
46 | @@ -143,7 +144,7 @@ |
47 | throw new RuntimeException("More than one top module is found."); |
48 | } |
49 | if (CommonDebugSettings.getVerboseImport()) { |
50 | - System.out.print("Info: parsed Verilog modules\n"); |
51 | + LogUtils.logInfoLine("Parsed Verilog modules\n"); |
52 | for (Module module: modules.values()) { |
53 | if (topModules.contains(module)) { |
54 | System.out.print("// Top module\n"); |
55 | @@ -257,7 +258,7 @@ |
56 | try { |
57 | circuit.setName(component, ASSIGN_GATE_PREFIX + assign.name); |
58 | } catch (ArgumentException e) { |
59 | - System.out.println("Warning: cannot set name '" + assign.name +"' for component '" + circuit.getName(component) + "'."); |
60 | + LogUtils.logWarningLine("Cannot set name '" + assign.name +"' for component '" + circuit.getName(component) + "'."); |
61 | } |
62 | |
63 | AssignGate assignGate = null; |
64 | @@ -339,10 +340,10 @@ |
65 | String resetFunction = ExpressionUtils.extactResetExpression(function, assign.name); |
66 | Expression resetExpression = convertStringToExpression(resetFunction); |
67 | if (CommonDebugSettings.getVerboseImport()) { |
68 | - System.out.println("Info: Extracting SET and RESET from assign " + assign.name + " = " + assign.formula); |
69 | - System.out.println(" Function: " + function); |
70 | - System.out.println(" Set function: " + setFunction); |
71 | - System.out.println(" Reset function: " + resetFunction); |
72 | + LogUtils.logInfoLine("Extracting SET and RESET from assign " + assign.name + " = " + assign.formula); |
73 | + LogUtils.logInfoLine(" Function: " + function); |
74 | + LogUtils.logInfoLine(" Set function: " + setFunction); |
75 | + LogUtils.logInfoLine(" Reset function: " + resetFunction); |
76 | } |
77 | HashMap<String, String> connections = new HashMap<>(); |
78 | String outputName = getPrimitiveGatePinName(0); |
79 | @@ -379,7 +380,7 @@ |
80 | try { |
81 | expression = expressionParser.parseExpression(); |
82 | } catch (ParseException e1) { |
83 | - System.out.println("Warning: could not parse assign expression '" + formula + "'."); |
84 | + LogUtils.logWarningLine("Could not parse assign expression '" + formula + "'."); |
85 | } |
86 | return expression; |
87 | } |
88 | @@ -388,7 +389,7 @@ |
89 | Library library = new Library(); |
90 | String libraryFileName = CircuitSettings.getGateLibrary(); |
91 | if ((libraryFileName == null) || libraryFileName.isEmpty()) { |
92 | - System.out.println("Warning: gate library file is not specified."); |
93 | + LogUtils.logWarningLine("Gate library file is not specified."); |
94 | } else { |
95 | File libraryFile = new File(libraryFileName); |
96 | final Framework framework = Framework.getInstance(); |
97 | @@ -402,10 +403,10 @@ |
98 | genlibParser.disable_tracing(); |
99 | } |
100 | library = genlibParser.parseGenlib(); |
101 | - System.out.println("Info: mapping the imported Verilog into the gate library '" + libraryFileName + "'."); |
102 | + LogUtils.logInfoLine("Iapping the imported Verilog into the gate library '" + libraryFileName + "'."); |
103 | } catch (FileNotFoundException e) { |
104 | } catch (ParseException e) { |
105 | - System.out.println("Warning: could not parse the gate library '" + libraryFileName + "'."); |
106 | + LogUtils.logWarningLine("Could not parse the gate library '" + libraryFileName + "'."); |
107 | } |
108 | } |
109 | } |
110 | @@ -528,7 +529,7 @@ |
111 | try { |
112 | circuit.setName(component, verilogInstance.name); |
113 | } catch (ArgumentException e) { |
114 | - System.out.println("Warning: cannot set name '" + verilogInstance.name +"' for component '" + circuit.getName(component) + "'."); |
115 | + LogUtils.logWarningLine("Cannot set name '" + verilogInstance.name +"' for component '" + circuit.getName(component) + "'."); |
116 | } |
117 | Module module = modules.get(verilogInstance.moduleName); |
118 | HashMap<String, Port> instancePorts = getModulePortMap(module); |
119 | @@ -579,7 +580,7 @@ |
120 | try { |
121 | component.setIsZeroDelay(true); |
122 | } catch (ArgumentException e) { |
123 | - System.out.println("Warning for component '" + verilogInstance.name + "': " + e.getMessage()); |
124 | + LogUtils.logWarningLine("Component '" + verilogInstance.name + "': " + e.getMessage()); |
125 | } |
126 | } |
127 | } |
128 | @@ -728,16 +729,16 @@ |
129 | private BooleanFormula printFunctionSubstitution(BooleanFormula function, List<Contact> inputContacts, List<BooleanFormula> inputFunctions) { |
130 | final BooleanFormula setFunction = BooleanUtils.dumbReplace(function, inputContacts, inputFunctions); |
131 | if (CommonDebugSettings.getVerboseImport()) { |
132 | - System.out.println("Info: Expression substitution"); |
133 | - System.out.println(" Original: " + FormulaToString.toString(function)); |
134 | + LogUtils.logInfoLine("Expression substitution"); |
135 | + LogUtils.logInfoLine(" Original: " + FormulaToString.toString(function)); |
136 | Iterator<Contact> contactIterator = inputContacts.iterator(); |
137 | Iterator<BooleanFormula> formulaIterator = inputFunctions.iterator(); |
138 | while (contactIterator.hasNext() && formulaIterator.hasNext()) { |
139 | Contact contact = contactIterator.next(); |
140 | BooleanFormula formula = formulaIterator.next(); |
141 | - System.out.println(" Replacement: " + contact.getName() + " = " + FormulaToString.toString(formula)); |
142 | + LogUtils.logInfoLine(" Replacement: " + contact.getName() + " = " + FormulaToString.toString(formula)); |
143 | } |
144 | - System.out.println(" Result: " + FormulaToString.toString(setFunction)); |
145 | + LogUtils.logInfoLine(" Result: " + FormulaToString.toString(setFunction)); |
146 | } |
147 | return setFunction; |
148 | } |
149 | |
150 | === modified file 'CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/VerilogSerialiser.java' |
151 | --- CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/VerilogSerialiser.java 2015-11-09 13:07:13 +0000 |
152 | +++ CircuitPlugin/src/org/workcraft/plugins/circuit/serialisation/VerilogSerialiser.java 2016-01-17 22:48:15 +0000 |
153 | @@ -50,6 +50,7 @@ |
154 | import org.workcraft.serialisation.ReferenceProducer; |
155 | import org.workcraft.util.Func; |
156 | import org.workcraft.util.Hierarchy; |
157 | +import org.workcraft.util.LogUtils; |
158 | |
159 | public class VerilogSerialiser implements ModelSerialiser { |
160 | |
161 | @@ -113,7 +114,7 @@ |
162 | private void writeHeader(PrintWriter out, Circuit circuit) { |
163 | String topName = circuit.getTitle(); |
164 | if ((topName == null) || topName.isEmpty()) { |
165 | - System.out.println(" Warning: the top module does not have a name."); |
166 | + LogUtils.logWarningLine("The top module does not have a name."); |
167 | topName = ""; |
168 | } |
169 | out.print(KEYWORD_MODULE + " " + topName + " ("); |
170 | @@ -149,14 +150,14 @@ |
171 | String instanceRef = circuit.getNodeReference(component); |
172 | String instanceFlatName = NamespaceHelper.hierarchicalToFlatName(instanceRef); |
173 | if ((moduleName == null) || moduleName.isEmpty()) { |
174 | - System.out.println(" Warning: component '" + instanceFlatName + "' is not associated to a module."); |
175 | + LogUtils.logWarningLine("Component '" + instanceFlatName + "' is not associated to a module."); |
176 | moduleName = ""; |
177 | } |
178 | SubstitutionRule substitutionRule = substitutionRules.get(moduleName); |
179 | if (substitutionRule != null) { |
180 | String newModuleName = substitutionRule.newName; |
181 | if (newModuleName != null) { |
182 | - System.out.println("Info: in component '" + instanceFlatName + "' renaming module '" + moduleName + "' to '" + newModuleName + "'."); |
183 | + LogUtils.logInfoLine("In component '" + instanceFlatName + "' renaming module '" + moduleName + "' to '" + newModuleName + "'."); |
184 | moduleName = newModuleName; |
185 | } |
186 | } |
187 | @@ -174,13 +175,13 @@ |
188 | String contactName = contact.getName(); |
189 | String wireName = CircuitUtils.getWireName(circuit, contact); |
190 | if ((wireName == null) || wireName.isEmpty()) { |
191 | - System.out.println(" Warning: in component '" + instanceFlatName + "' contact '" + contactName + "' is disconnected."); |
192 | + LogUtils.logWarningLine("In component '" + instanceFlatName + "' contact '" + contactName + "' is disconnected."); |
193 | wireName = ""; |
194 | } |
195 | if (substitutionRule != null) { |
196 | String newContactName = substitutionRule.substitutions.get(contactName); |
197 | if (newContactName != null) { |
198 | - System.out.println("Info: in component '" + instanceFlatName + "' renaming contact '" + contactName + "' to '" + newContactName + "'."); |
199 | + LogUtils.logInfoLine("In component '" + instanceFlatName + "' renaming contact '" + contactName + "' to '" + newContactName + "'."); |
200 | contactName = newContactName; |
201 | } |
202 | } |
203 | @@ -194,7 +195,7 @@ |
204 | HashMap<String, SubstitutionRule> result = new HashMap<>(); |
205 | String substitutionsFileName = CircuitSettings.getSubstitutionLibrary(); |
206 | if ((substitutionsFileName == null) || substitutionsFileName.isEmpty()) { |
207 | - System.out.println("Warning: file of substitutions is not specified."); |
208 | + LogUtils.logWarningLine("File of substitutions is not specified."); |
209 | } else { |
210 | File libraryFile = new File(substitutionsFileName); |
211 | final Framework framework = Framework.getInstance(); |
212 | @@ -211,10 +212,10 @@ |
213 | for (SubstitutionRule rule: rules) { |
214 | result.put(rule.oldName, rule); |
215 | } |
216 | - System.out.println("Info: renaming gates and pins using the file of substitutions '" + substitutionsFileName + "'."); |
217 | + LogUtils.logInfoLine("Renaming gates and pins using the file of substitutions '" + substitutionsFileName + "'."); |
218 | } catch (FileNotFoundException e) { |
219 | } catch (ParseException e) { |
220 | - System.out.println("Warning: could not parse the file of substitutions '" + substitutionsFileName + "'."); |
221 | + LogUtils.logWarningLine("Could not parse the file of substitutions '" + substitutionsFileName + "'."); |
222 | } |
223 | } |
224 | } |
225 | |
226 | === modified file 'MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisTask.java' |
227 | --- MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisTask.java 2016-01-15 17:00:47 +0000 |
228 | +++ MpsatSynthesisPlugin/src/org/workcraft/plugins/mpsat/tasks/MpsatSynthesisTask.java 2016-01-17 22:48:15 +0000 |
229 | @@ -16,6 +16,7 @@ |
230 | import org.workcraft.tasks.Result.Outcome; |
231 | import org.workcraft.tasks.Task; |
232 | import org.workcraft.util.FileUtils; |
233 | +import org.workcraft.util.LogUtils; |
234 | import org.workcraft.util.ToolUtils; |
235 | |
236 | public class MpsatSynthesisTask implements Task<ExternalProcessResult> { |
237 | @@ -67,7 +68,7 @@ |
238 | command.add("-d"); |
239 | command.add(gateLibraryFile.getAbsolutePath()); |
240 | } else { |
241 | - System.out.println("Warning: cannot find gate library file '" + gateLibrary + "'. Using built-in gate library of MPSat."); |
242 | + LogUtils.logWarningLine("Cannot find gate library file '" + gateLibrary + "'. Using built-in gate library of MPSat."); |
243 | } |
244 | } |
245 | } |
246 | |
247 | === modified file 'WorkcraftCore/src/org/workcraft/CompatibilityManager.java' |
248 | --- WorkcraftCore/src/org/workcraft/CompatibilityManager.java 2015-07-30 15:45:39 +0000 |
249 | +++ WorkcraftCore/src/org/workcraft/CompatibilityManager.java 2016-01-17 22:48:15 +0000 |
250 | @@ -14,6 +14,8 @@ |
251 | import java.util.zip.ZipInputStream; |
252 | import java.util.zip.ZipOutputStream; |
253 | |
254 | +import org.workcraft.util.LogUtils; |
255 | + |
256 | public class CompatibilityManager { |
257 | private static final Pattern modelNamePattern = Pattern.compile("<model class=\"(.+?)\" ref=\"\">"); |
258 | private static final Pattern classNamePattern = Pattern.compile("<([A-Z]\\S*).*>"); |
259 | @@ -60,9 +62,9 @@ |
260 | private String replace(String line, Map.Entry<String, String> replacement, String message) { |
261 | String newline = line.replaceAll(replacement.getKey(), replacement.getValue()); |
262 | if ((message != null) && !line.equals(newline)) { |
263 | - System.out.println(message); |
264 | - System.out.println(" old: " + replacement.getKey()); |
265 | - System.out.println(" new: " + replacement.getValue()); |
266 | + LogUtils.logInfoLine("Compatibility management: " + message); |
267 | + LogUtils.logInfoLine(" old: " + replacement.getKey()); |
268 | + LogUtils.logInfoLine(" new: " + replacement.getValue()); |
269 | } |
270 | return newline; |
271 | } |
272 | @@ -70,7 +72,7 @@ |
273 | private String replaceMetaData(String line) { |
274 | for (Map.Entry<String, String> replacement: metaCompatibilityMap.entrySet()) { |
275 | if (line.contains(replacement.getKey())) { |
276 | - line = replace(line, replacement, "Compatibility management: legacy meta data"); |
277 | + line = replace(line, replacement, "legacy meta data"); |
278 | } |
279 | } |
280 | return line; |
281 | @@ -79,7 +81,7 @@ |
282 | private String replaceModelName(String line) { |
283 | for (Map.Entry<String, String> replacement: modelCompatibilityMap.entrySet()) { |
284 | if (line.contains(replacement.getKey())) { |
285 | - line = replace(line, replacement, "Compatibility management: legacy model class"); |
286 | + line = replace(line, replacement, "legacy model class"); |
287 | } |
288 | } |
289 | return line; |
290 | @@ -89,7 +91,7 @@ |
291 | CompatibilityMap replacementMap = globalReplacementMap.get(modelName); |
292 | if (replacementMap != null) { |
293 | for (Map.Entry<String, String> replacement: replacementMap.entrySet()) { |
294 | - line = replace(line, replacement, "Compatibility management: global replacement"); |
295 | + line = replace(line, replacement, "global replacement"); |
296 | } |
297 | } |
298 | return line; |
299 | @@ -101,7 +103,7 @@ |
300 | CompatibilityMap replacementMap = contextualMap.get(className); |
301 | if (replacementMap != null) { |
302 | for (Map.Entry<String, String> replacement: replacementMap.entrySet()) { |
303 | - line = replace(line, replacement, "Compatibility management: contextual replacement for " + className); |
304 | + line = replace(line, replacement, "contextual replacement for " + className); |
305 | } |
306 | } |
307 | } |
308 | |
309 | === modified file 'WorkcraftCore/src/org/workcraft/Console.java' |
310 | --- WorkcraftCore/src/org/workcraft/Console.java 2015-11-24 14:16:37 +0000 |
311 | +++ WorkcraftCore/src/org/workcraft/Console.java 2016-01-17 22:48:15 +0000 |
312 | @@ -91,9 +91,9 @@ |
313 | framework.execJavaScript(FileUtils.readAllTextFromSystemResource("scripts/functions.js")); |
314 | framework.execJavaScript(FileUtils.readAllTextFromSystemResource("scripts/startup.js")); |
315 | } catch (FileNotFoundException e2) { |
316 | - System.err.println ("! Warning: System script file not found: "+e2.getMessage()); |
317 | + System.err.println ("! Warning: System script file not found: " + e2.getMessage()); |
318 | } catch (IOException e) { |
319 | - System.err.println ("! Warning: Error reading system script file: "+e.getMessage()); |
320 | + System.err.println ("! Warning: Error reading system script file: " + e.getMessage()); |
321 | } catch (WrappedException e) { |
322 | System.err.println ("! Startup script failed: " + e.getMessage()); |
323 | } catch (org.mozilla.javascript.EcmaError e) { |
324 | |
325 | === modified file 'WorkcraftCore/src/org/workcraft/gui/ErrorWindow.java' |
326 | --- WorkcraftCore/src/org/workcraft/gui/ErrorWindow.java 2014-12-12 18:43:40 +0000 |
327 | +++ WorkcraftCore/src/org/workcraft/gui/ErrorWindow.java 2016-01-17 22:48:15 +0000 |
328 | @@ -41,6 +41,8 @@ |
329 | import javax.swing.SwingUtilities; |
330 | import javax.swing.event.ChangeEvent; |
331 | import javax.swing.event.ChangeListener; |
332 | + |
333 | +import org.workcraft.plugins.shared.CommonLogSettings; |
334 | |
335 | @SuppressWarnings("serial") |
336 | public class ErrorWindow extends JPanel implements ComponentListener { |
337 | @@ -56,7 +58,6 @@ |
338 | txtStdErr.setEditable(false); |
339 | txtStdErr.setWrapStyleWord(true); |
340 | txtStdErr.setForeground(Color.RED); |
341 | - txtStdErr.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); |
342 | txtStdErr.addMouseListener(new LogAreaMouseListener()); |
343 | |
344 | scrollStdErr = new JScrollPane(); |
345 | @@ -96,7 +97,8 @@ |
346 | } |
347 | } |
348 | }); |
349 | - target.append(s); |
350 | + target.append(s); |
351 | + target.setFont(new Font(Font.MONOSPACED, Font.PLAIN, CommonLogSettings.getTextSize())); |
352 | } |
353 | |
354 | @Override |
355 | |
356 | === modified file 'WorkcraftCore/src/org/workcraft/gui/OutputWindow.java' |
357 | --- WorkcraftCore/src/org/workcraft/gui/OutputWindow.java 2014-12-12 18:43:40 +0000 |
358 | +++ WorkcraftCore/src/org/workcraft/gui/OutputWindow.java 2016-01-17 22:48:15 +0000 |
359 | @@ -32,6 +32,12 @@ |
360 | import javax.swing.JPanel; |
361 | import javax.swing.JScrollPane; |
362 | import javax.swing.JTextArea; |
363 | +import javax.swing.text.BadLocationException; |
364 | +import javax.swing.text.DefaultHighlighter; |
365 | +import javax.swing.text.Highlighter; |
366 | + |
367 | +import org.workcraft.plugins.shared.CommonLogSettings; |
368 | +import org.workcraft.util.LogUtils; |
369 | |
370 | @SuppressWarnings("serial") |
371 | public class OutputWindow extends JPanel { |
372 | @@ -45,51 +51,20 @@ |
373 | txtStdOut.setLineWrap(true); |
374 | txtStdOut.setEditable(false); |
375 | txtStdOut.setWrapStyleWord(true); |
376 | - txtStdOut.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); |
377 | txtStdOut.addMouseListener(new LogAreaMouseListener()); |
378 | |
379 | scrollStdOut = new JScrollPane(); |
380 | scrollStdOut.setViewportView(txtStdOut); |
381 | - |
382 | setLayout(new BorderLayout(0,0)); |
383 | this.add(scrollStdOut, BorderLayout.CENTER); |
384 | } |
385 | - |
386 | - class OutputStreamView extends FilterOutputStream { |
387 | - JTextArea target; |
388 | - |
389 | - public OutputStreamView(OutputStream aStream, JTextArea target) { |
390 | - super(aStream); |
391 | - this.target = target; |
392 | - } |
393 | - |
394 | - @Override |
395 | - public void write(byte b[]) throws IOException { |
396 | - if (systemOut != null) { |
397 | - systemOut.write(b); |
398 | - } |
399 | - String s = new String(b); |
400 | - txtStdOut.append(s); |
401 | - txtStdOut.setCaretPosition(txtStdOut.getDocument().getLength()); |
402 | - } |
403 | - |
404 | - @Override |
405 | - public void write(byte b[], int off, int len) throws IOException { |
406 | - if (systemOut != null) { |
407 | - systemOut.write(b, off, len); |
408 | - } |
409 | - String s = new String(b , off , len); |
410 | - txtStdOut.append(s); |
411 | - } |
412 | - } |
413 | |
414 | public void captureStream() { |
415 | - if (!streamCaptured) { |
416 | - PrintStream outPrintStream = new PrintStream(new OutputStreamView( |
417 | - new ByteArrayOutputStream(), txtStdOut)); |
418 | - |
419 | + if ( !streamCaptured ) { |
420 | + OutputStreamView outView = new OutputStreamView(new ByteArrayOutputStream(), txtStdOut); |
421 | + PrintStream outStream = new PrintStream(outView); |
422 | systemOut = System.out; |
423 | - System.setOut(outPrintStream); |
424 | + System.setOut(outStream); |
425 | streamCaptured = true; |
426 | } |
427 | } |
428 | @@ -102,4 +77,65 @@ |
429 | } |
430 | } |
431 | |
432 | + class OutputStreamView extends FilterOutputStream { |
433 | + private JTextArea target; |
434 | + |
435 | + public OutputStreamView(OutputStream aStream, JTextArea target) { |
436 | + super(aStream); |
437 | + this.target = target; |
438 | + } |
439 | + |
440 | + @Override |
441 | + public void write(byte b[]) throws IOException { |
442 | + if (systemOut != null) { |
443 | + systemOut.write(b); |
444 | + } |
445 | + print(new String(b)); |
446 | + } |
447 | + |
448 | + @Override |
449 | + public void write(byte b[], int off, int len) throws IOException { |
450 | + if (systemOut != null) { |
451 | + systemOut.write(b, off, len); |
452 | + } |
453 | + print(new String(b , off , len)); |
454 | + } |
455 | + |
456 | + private void print(String text) { |
457 | + Highlighter.HighlightPainter highlighter = null; |
458 | + if (text.startsWith(LogUtils.PREFIX_INFO)) { |
459 | + highlighter = new DefaultHighlighter.DefaultHighlightPainter(CommonLogSettings.getInfoBackground()); |
460 | + } else if (text.startsWith(LogUtils.PREFIX_WARNING)) { |
461 | + highlighter = new DefaultHighlighter.DefaultHighlightPainter(CommonLogSettings.getWarningBackground()); |
462 | + } else if (text.startsWith(LogUtils.PREFIX_ERROR)) { |
463 | + highlighter = new DefaultHighlighter.DefaultHighlightPainter(CommonLogSettings.getErrorBackground()); |
464 | + } else if (text.startsWith(LogUtils.PREFIX_STDOUT)) { |
465 | + text = text.substring(LogUtils.PREFIX_STDOUT.length()); |
466 | + highlighter = new DefaultHighlighter.DefaultHighlightPainter(CommonLogSettings.getStdoutBackground()); |
467 | + } else if (text.startsWith(LogUtils.PREFIX_STDERR)) { |
468 | + text = text.substring(LogUtils.PREFIX_STDERR.length()); |
469 | + highlighter = new DefaultHighlighter.DefaultHighlightPainter(CommonLogSettings.getStderrBackground()); |
470 | + } |
471 | + String suffix = ""; |
472 | + if (highlighter != null) { |
473 | + // A text suffix to separate highlighted portions |
474 | + suffix = " "; |
475 | + } |
476 | + int fromPos = target.getDocument().getLength(); |
477 | + target.append(text + suffix); |
478 | + int toPos = target.getDocument().getLength(); |
479 | + target.setCaretPosition(toPos); |
480 | + |
481 | + target.setForeground(CommonLogSettings.getTextColor()); |
482 | + target.setFont(new Font(Font.MONOSPACED, Font.PLAIN, CommonLogSettings.getTextSize())); |
483 | + |
484 | + if ((highlighter != null) && (toPos > fromPos)) { |
485 | + try { |
486 | + target.getHighlighter().addHighlight(fromPos, toPos-suffix.length(), highlighter); |
487 | + } catch (BadLocationException e) { |
488 | + } |
489 | + } |
490 | + } |
491 | + } |
492 | + |
493 | } |
494 | |
495 | === modified file 'WorkcraftCore/src/org/workcraft/plugins/BuiltinTools.java' |
496 | --- WorkcraftCore/src/org/workcraft/plugins/BuiltinTools.java 2016-01-14 10:45:46 +0000 |
497 | +++ WorkcraftCore/src/org/workcraft/plugins/BuiltinTools.java 2016-01-17 22:48:15 +0000 |
498 | @@ -13,6 +13,7 @@ |
499 | import org.workcraft.plugins.shared.CommonCommentSettings; |
500 | import org.workcraft.plugins.shared.CommonDebugSettings; |
501 | import org.workcraft.plugins.shared.CommonEditorSettings; |
502 | +import org.workcraft.plugins.shared.CommonLogSettings; |
503 | import org.workcraft.plugins.shared.CommonSimulationSettings; |
504 | import org.workcraft.plugins.shared.CommonVisualSettings; |
505 | import org.workcraft.plugins.transform.CopyLablesTool; |
506 | @@ -29,6 +30,7 @@ |
507 | pm.registerClass(Settings.class, CommonSimulationSettings.class); |
508 | pm.registerClass(Settings.class, CommonCommentSettings.class); |
509 | pm.registerClass(Settings.class, CommonDebugSettings.class); |
510 | + pm.registerClass(Settings.class, CommonLogSettings.class); |
511 | |
512 | pm.registerClass(Settings.class, DotLayoutSettings.class); |
513 | pm.registerClass(Settings.class, RandomLayoutSettings.class); |
514 | |
515 | === added file 'WorkcraftCore/src/org/workcraft/plugins/shared/CommonLogSettings.java' |
516 | --- WorkcraftCore/src/org/workcraft/plugins/shared/CommonLogSettings.java 1970-01-01 00:00:00 +0000 |
517 | +++ WorkcraftCore/src/org/workcraft/plugins/shared/CommonLogSettings.java 2016-01-17 22:48:15 +0000 |
518 | @@ -0,0 +1,225 @@ |
519 | +/* |
520 | +* |
521 | +* Copyright 2008,2009 Newcastle University |
522 | +* |
523 | +* This file is part of Workcraft. |
524 | +* |
525 | +* Workcraft is free software: you can redistribute it and/or modify |
526 | +* it under the terms of the GNU General Public License as published by |
527 | +* the Free Software Foundation, either version 3 of the License, or |
528 | +* (at your option) any later version. |
529 | +* |
530 | +* Workcraft is distributed in the hope that it will be useful, |
531 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of |
532 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
533 | +* GNU General Public License for more details. |
534 | +* |
535 | +* You should have received a copy of the GNU General Public License |
536 | +* along with Workcraft. If not, see <http://www.gnu.org/licenses/>. |
537 | +* |
538 | +*/ |
539 | + |
540 | +package org.workcraft.plugins.shared; |
541 | +import java.awt.Color; |
542 | +import java.util.LinkedList; |
543 | +import java.util.List; |
544 | + |
545 | +import org.workcraft.Config; |
546 | +import org.workcraft.gui.propertyeditor.PropertyDeclaration; |
547 | +import org.workcraft.gui.propertyeditor.PropertyDescriptor; |
548 | +import org.workcraft.gui.propertyeditor.Settings; |
549 | + |
550 | +public class CommonLogSettings implements Settings { |
551 | + private static final LinkedList<PropertyDescriptor> properties = new LinkedList<PropertyDescriptor>(); |
552 | + private static final String prefix = "CommonLogSettings"; |
553 | + |
554 | + private static final String keyTextSize = prefix + ".textSize"; |
555 | + private static final String keyTextColor = prefix + ".textColor"; |
556 | + private static final String keyInfoBackground = prefix + ".infoBackground"; |
557 | + private static final String keyWarningBackground = prefix + ".warningBackground"; |
558 | + private static final String keyErrorBackground = prefix + ".warningBackground"; |
559 | + private static final String keyStdoutBackground = prefix + ".stdoutBackground"; |
560 | + private static final String keyStderrBackground = prefix + ".stderrBackground"; |
561 | + |
562 | + private static final int defaultTextSize = 12; |
563 | + private static final Color defaultTextColor = Color.BLACK; |
564 | + private static final Color defaultInfoBackground = new Color(0.8f, 1.0f, 0.8f); |
565 | + private static final Color defaultWarningBackground = new Color(1.0f, 0.8f, 0.0f); |
566 | + private static final Color defaultErrorBackground = new Color(1.0f, 0.7f, 0.7f); |
567 | + private static final Color defaultStdoutBackground = new Color(0.9f, 0.9f, 0.9f); |
568 | + private static final Color defaultStderrBackground = new Color(1.0f, 0.9f, 0.9f); |
569 | + |
570 | + private static int textSize = defaultTextSize; |
571 | + private static Color textColor = defaultTextColor; |
572 | + private static Color infoBackground = defaultInfoBackground; |
573 | + private static Color warningBackground = defaultWarningBackground; |
574 | + private static Color errorBackground = defaultErrorBackground; |
575 | + private static Color stdoutBackground = defaultStdoutBackground; |
576 | + private static Color stderrBackground = defaultStderrBackground; |
577 | + |
578 | + public CommonLogSettings() { |
579 | + properties.add(new PropertyDeclaration<CommonLogSettings, Integer>( |
580 | + this, "Text size", Integer.class, true, false, false) { |
581 | + protected void setter(CommonLogSettings object, Integer value) { |
582 | + setTextSize(value); |
583 | + } |
584 | + protected Integer getter(CommonLogSettings object) { |
585 | + return getTextSize(); |
586 | + } |
587 | + }); |
588 | + |
589 | + properties.add(new PropertyDeclaration<CommonLogSettings, Color>( |
590 | + this, "Text color", Color.class, true, false, false) { |
591 | + protected void setter(CommonLogSettings object, Color value) { |
592 | + setTextColor(value); |
593 | + } |
594 | + protected Color getter(CommonLogSettings object) { |
595 | + return getTextColor(); |
596 | + } |
597 | + }); |
598 | + |
599 | + properties.add(new PropertyDeclaration<CommonLogSettings, Color>( |
600 | + this, "Important info background", Color.class, true, false, false) { |
601 | + protected void setter(CommonLogSettings object, Color value) { |
602 | + setInfoBackground(value); |
603 | + } |
604 | + protected Color getter(CommonLogSettings object) { |
605 | + return getInfoBackground(); |
606 | + } |
607 | + }); |
608 | + |
609 | + properties.add(new PropertyDeclaration<CommonLogSettings, Color>( |
610 | + this, "Warning background", Color.class, true, false, false) { |
611 | + protected void setter(CommonLogSettings object, Color value) { |
612 | + setWarningBackground(value); |
613 | + } |
614 | + protected Color getter(CommonLogSettings object) { |
615 | + return getWarningBackground(); |
616 | + } |
617 | + }); |
618 | + |
619 | + properties.add(new PropertyDeclaration<CommonLogSettings, Color>( |
620 | + this, "Error background", Color.class, true, false, false) { |
621 | + protected void setter(CommonLogSettings object, Color value) { |
622 | + setErrorBackground(value); |
623 | + } |
624 | + protected Color getter(CommonLogSettings object) { |
625 | + return getErrorBackground(); |
626 | + } |
627 | + }); |
628 | + |
629 | + properties.add(new PropertyDeclaration<CommonLogSettings, Color>( |
630 | + this, "Backend stdout background", Color.class, true, false, false) { |
631 | + protected void setter(CommonLogSettings object, Color value) { |
632 | + setStdoutBackground(value); |
633 | + } |
634 | + protected Color getter(CommonLogSettings object) { |
635 | + return getStdoutBackground(); |
636 | + } |
637 | + }); |
638 | + |
639 | + properties.add(new PropertyDeclaration<CommonLogSettings, Color>( |
640 | + this, "Backend stderr background", Color.class, true, false, false) { |
641 | + protected void setter(CommonLogSettings object, Color value) { |
642 | + setStderrBackground(value); |
643 | + } |
644 | + protected Color getter(CommonLogSettings object) { |
645 | + return getStderrBackground(); |
646 | + } |
647 | + }); |
648 | + } |
649 | + |
650 | + @Override |
651 | + public List<PropertyDescriptor> getDescriptors() { |
652 | + return properties; |
653 | + } |
654 | + |
655 | + @Override |
656 | + public void load(Config config) { |
657 | + setTextSize(config.getInt(keyTextSize, defaultTextSize)); |
658 | + setTextColor(config.getColor(keyTextColor, defaultTextColor)); |
659 | + setInfoBackground(config.getColor(keyInfoBackground, defaultInfoBackground)); |
660 | + setWarningBackground(config.getColor(keyWarningBackground, defaultWarningBackground)); |
661 | + setErrorBackground(config.getColor(keyErrorBackground, defaultErrorBackground)); |
662 | + setStdoutBackground(config.getColor(keyStdoutBackground, defaultStdoutBackground)); |
663 | + setStderrBackground(config.getColor(keyStderrBackground, defaultStderrBackground)); |
664 | + } |
665 | + |
666 | + @Override |
667 | + public void save(Config config) { |
668 | + config.setDouble(keyTextSize, getTextSize()); |
669 | + config.setColor(keyTextColor, getTextColor()); |
670 | + config.setColor(keyInfoBackground, getInfoBackground()); |
671 | + config.setColor(keyWarningBackground, getWarningBackground()); |
672 | + config.setColor(keyErrorBackground, getErrorBackground()); |
673 | + config.setColor(keyStdoutBackground, getStdoutBackground()); |
674 | + config.setColor(keyStderrBackground, getStderrBackground()); |
675 | + } |
676 | + |
677 | + @Override |
678 | + public String getSection() { |
679 | + return "Common"; |
680 | + } |
681 | + |
682 | + @Override |
683 | + public String getName() { |
684 | + return "Log"; |
685 | + } |
686 | + |
687 | + public static int getTextSize() { |
688 | + return textSize; |
689 | + } |
690 | + |
691 | + public static void setTextSize(int value) { |
692 | + textSize = value; |
693 | + } |
694 | + |
695 | + public static Color getTextColor() { |
696 | + return textColor; |
697 | + } |
698 | + |
699 | + public static void setTextColor(Color value) { |
700 | + textColor = value; |
701 | + } |
702 | + |
703 | + public static Color getInfoBackground() { |
704 | + return infoBackground; |
705 | + } |
706 | + |
707 | + public static void setInfoBackground(Color value) { |
708 | + infoBackground = value; |
709 | + } |
710 | + |
711 | + public static Color getWarningBackground() { |
712 | + return warningBackground; |
713 | + } |
714 | + |
715 | + public static void setWarningBackground(Color value) { |
716 | + warningBackground = value; |
717 | + } |
718 | + |
719 | + public static Color getErrorBackground() { |
720 | + return errorBackground; |
721 | + } |
722 | + |
723 | + public static void setErrorBackground(Color value) { |
724 | + errorBackground = value; |
725 | + } |
726 | + |
727 | + public static Color getStdoutBackground() { |
728 | + return stdoutBackground; |
729 | + } |
730 | + |
731 | + public static void setStdoutBackground(Color value) { |
732 | + stdoutBackground = value; |
733 | + } |
734 | + |
735 | + public static Color getStderrBackground() { |
736 | + return stderrBackground; |
737 | + } |
738 | + |
739 | + public static void setStderrBackground(Color value) { |
740 | + stderrBackground = value; |
741 | + } |
742 | + |
743 | +} |
744 | |
745 | === modified file 'WorkcraftCore/src/org/workcraft/plugins/shared/tasks/ExternalProcessTask.java' |
746 | --- WorkcraftCore/src/org/workcraft/plugins/shared/tasks/ExternalProcessTask.java 2016-01-15 17:53:49 +0000 |
747 | +++ WorkcraftCore/src/org/workcraft/plugins/shared/tasks/ExternalProcessTask.java 2016-01-17 22:48:15 +0000 |
748 | @@ -11,6 +11,7 @@ |
749 | import org.workcraft.tasks.Result; |
750 | import org.workcraft.tasks.Task; |
751 | import org.workcraft.util.DataAccumulator; |
752 | +import org.workcraft.util.LogUtils; |
753 | |
754 | public class ExternalProcessTask implements Task<ExternalProcessResult>, ExternalProcessListener { |
755 | private List<String> args; |
756 | @@ -89,7 +90,7 @@ |
757 | } |
758 | |
759 | public static void printCommandLine(List<String> args) { |
760 | - System.out.println("Running external command: " + getCommandLine(args)); |
761 | + LogUtils.logInfoLine("Running external command: " + getCommandLine(args)); |
762 | } |
763 | |
764 | @Override |
765 | @@ -101,7 +102,7 @@ |
766 | } |
767 | monitor.stdout(data); |
768 | if (printStdout) { |
769 | - printData(data); |
770 | + printData(data, LogUtils.PREFIX_STDOUT); |
771 | } |
772 | } |
773 | |
774 | @@ -114,7 +115,7 @@ |
775 | } |
776 | monitor.stderr(data); |
777 | if (printStderr) { |
778 | - printData(data); |
779 | + printData(data, LogUtils.PREFIX_STDERR); |
780 | } |
781 | |
782 | } |
783 | @@ -130,10 +131,10 @@ |
784 | } |
785 | } |
786 | |
787 | - private void printData(byte[] data) { |
788 | - String s = new String(data); |
789 | - System.out.print(s); |
790 | - needsExtraNewLine = !s.endsWith("\n"); |
791 | + private void printData(byte[] data, String prefix) { |
792 | + String text = new String(data); |
793 | + System.out.println(prefix+text); |
794 | + needsExtraNewLine = !text.endsWith("\n"); |
795 | } |
796 | |
797 | } |
798 | |
799 | === added file 'WorkcraftCore/src/org/workcraft/util/LogUtils.java' |
800 | --- WorkcraftCore/src/org/workcraft/util/LogUtils.java 1970-01-01 00:00:00 +0000 |
801 | +++ WorkcraftCore/src/org/workcraft/util/LogUtils.java 2016-01-17 22:48:15 +0000 |
802 | @@ -0,0 +1,22 @@ |
803 | +package org.workcraft.util; |
804 | + |
805 | +public class LogUtils { |
806 | + public static final String PREFIX_INFO = "[INFO] "; |
807 | + public static final String PREFIX_WARNING = "[WARNING] "; |
808 | + public static final String PREFIX_ERROR = "[ERROR] "; |
809 | + public static final String PREFIX_STDOUT = "[STDOUT] "; |
810 | + public static final String PREFIX_STDERR = "[STDERR] "; |
811 | + |
812 | + public static void logInfoLine(String msg) { |
813 | + System.out.println(PREFIX_INFO + msg); |
814 | + } |
815 | + |
816 | + public static void logWarningLine(String msg) { |
817 | + System.out.println(PREFIX_WARNING + msg); |
818 | + } |
819 | + |
820 | + public static void logErrorLine(String msg) { |
821 | + System.out.println(PREFIX_ERROR + msg); |
822 | + } |
823 | + |
824 | +} |
825 | |
826 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/stg/StgGenerator.java' |
827 | --- XmasPlugin/src/org/workcraft/plugins/xmas/stg/StgGenerator.java 2015-09-28 09:12:46 +0000 |
828 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/stg/StgGenerator.java 2016-01-17 22:48:15 +0000 |
829 | @@ -30,6 +30,7 @@ |
830 | import org.workcraft.plugins.xmas.components.VisualXmasComponent; |
831 | import org.workcraft.plugins.xmas.components.VisualXmasContact; |
832 | import org.workcraft.util.Hierarchy; |
833 | +import org.workcraft.util.LogUtils; |
834 | |
835 | public class StgGenerator extends org.workcraft.plugins.stg.generator.StgGenerator { |
836 | |
837 | @@ -173,7 +174,7 @@ |
838 | } |
839 | for (VisualComponent component: remainingComponents) { |
840 | String name = getXmasModel().getNodeMathReference(component); |
841 | - System.out.println("ERROR: Cannot derive an STG for xMAS component '" + name +"' of type " + component.getClass().getName()); |
842 | + LogUtils.logErrorLine("Cannot derive an STG for xMAS component '" + name +"' of type " + component.getClass().getName()); |
843 | } |
844 | getXmasModel().selectNone(); |
845 | } |
846 | |
847 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetExt.java' |
848 | --- XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetExt.java 2016-01-01 00:01:42 +0000 |
849 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetExt.java 2016-01-17 22:48:15 +0000 |
850 | @@ -12,6 +12,7 @@ |
851 | import org.workcraft.plugins.xmas.components.FunctionComponent; |
852 | import org.workcraft.plugins.xmas.components.SourceComponent; |
853 | import org.workcraft.plugins.xmas.components.SwitchComponent; |
854 | +import org.workcraft.util.LogUtils; |
855 | |
856 | |
857 | public class PNetExt { |
858 | @@ -90,7 +91,7 @@ |
859 | try{ |
860 | sc=new Scanner(new File(file)); |
861 | }catch (FileNotFoundException e) { //Catch exception if any |
862 | - System.err.println("Error: " + e.getMessage()); |
863 | + LogUtils.logErrorLine(e.getMessage()); |
864 | } |
865 | String name; |
866 | int num; |
867 | |
868 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetGen.java' |
869 | --- XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetGen.java 2016-01-05 20:25:07 +0000 |
870 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/tools/PNetGen.java 2016-01-17 22:48:15 +0000 |
871 | @@ -22,6 +22,7 @@ |
872 | import org.workcraft.plugins.xmas.components.VisualSourceComponent; |
873 | import org.workcraft.plugins.xmas.components.VisualFunctionComponent; |
874 | import org.workcraft.util.Hierarchy; |
875 | +import org.workcraft.util.LogUtils; |
876 | import org.workcraft.util.WorkspaceUtils; |
877 | import org.workcraft.workspace.WorkspaceEntry; |
878 | import org.workcraft.plugins.xmas.XmasSettings; |
879 | @@ -99,7 +100,7 @@ |
880 | try { |
881 | sc=new Scanner(new File(file)); |
882 | } catch (FileNotFoundException e) { |
883 | - System.err.println("Error: " + e.getMessage()); |
884 | + LogUtils.logErrorLine(e.getMessage()); |
885 | } |
886 | String qs=""; |
887 | String cn=""; |
888 | @@ -873,7 +874,7 @@ |
889 | |
890 | current = jp.nextToken(); |
891 | if (current != JsonToken.START_OBJECT) { |
892 | - System.out.println("Error: root should be object: quiting."); |
893 | + LogUtils.logErrorLine("Root should be object: quiting."); |
894 | return; |
895 | } |
896 | |
897 | @@ -939,7 +940,7 @@ |
898 | } |
899 | } |
900 | } else { |
901 | - System.out.println("Error: records should be an array: skipping."); |
902 | + LogUtils.logErrorLine("Records should be an array: skipping."); |
903 | jp.skipChildren(); |
904 | } |
905 | } else { |
906 | @@ -985,7 +986,7 @@ |
907 | |
908 | current = jp.nextToken(); |
909 | if (current != JsonToken.START_OBJECT) { |
910 | - System.out.println("Error: root should be object: quiting."); |
911 | + LogUtils.logErrorLine("Root should be object: quiting."); |
912 | return; |
913 | } |
914 | |
915 | @@ -1115,11 +1116,11 @@ |
916 | //if(typeName.equals("sync")) sync_inf(idName,idName1,idName2,fieldgpf,fieldgpf1,styp,writer_s); |
917 | } |
918 | } else { |
919 | - System.out.println("Error: records should be an array: skipping."); |
920 | + LogUtils.logErrorLine("Records should be an array: skipping."); |
921 | jp.skipChildren(); |
922 | } |
923 | } else { |
924 | - System.out.println("Unprocessed property: " + fieldName); |
925 | + LogUtils.logWarningLine("Unprocessed property: " + fieldName); |
926 | jp.skipChildren(); |
927 | } |
928 | } |
929 | |
930 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerAnalysis.java' |
931 | --- XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerAnalysis.java 2016-01-05 20:25:07 +0000 |
932 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerAnalysis.java 2016-01-17 22:48:15 +0000 |
933 | @@ -44,6 +44,7 @@ |
934 | import org.workcraft.plugins.xmas.gui.SolutionsDialog1; |
935 | import org.workcraft.plugins.xmas.gui.SolutionsDialog2; |
936 | import org.workcraft.util.FileUtils; |
937 | +import org.workcraft.util.LogUtils; |
938 | import org.workcraft.util.WorkspaceUtils; |
939 | import org.workcraft.workspace.WorkspaceEntry; |
940 | |
941 | @@ -91,7 +92,7 @@ |
942 | try { |
943 | sc=new Scanner(new File(file)); |
944 | } catch (FileNotFoundException e) { |
945 | - System.err.println("Error: " + e.getMessage()); |
946 | + LogUtils.logErrorLine(e.getMessage()); |
947 | } |
948 | String targ=""; |
949 | String larg=""; |
950 | @@ -160,7 +161,7 @@ |
951 | try { |
952 | sc=new Scanner(new File(file)); |
953 | } catch (FileNotFoundException e) { |
954 | - System.err.println("Error: " + e.getMessage()); |
955 | + LogUtils.logErrorLine(e.getMessage()); |
956 | } |
957 | String str=""; |
958 | while(sc.hasNextLine()) { |
959 | @@ -178,7 +179,7 @@ |
960 | try { |
961 | sc=new Scanner(new File(file)); |
962 | } catch (FileNotFoundException e) { |
963 | - System.err.println("Error: " + e.getMessage()); |
964 | + LogUtils.logErrorLine(e.getMessage()); |
965 | } |
966 | while(sc.hasNextLine()) { |
967 | Scanner line_=new Scanner(sc.nextLine()); |
968 | @@ -198,7 +199,7 @@ |
969 | try { |
970 | sc=new Scanner(new File(file)); |
971 | } catch (FileNotFoundException e) { |
972 | - System.err.println("Error: " + e.getMessage()); |
973 | + LogUtils.logErrorLine(e.getMessage()); |
974 | } |
975 | String str=""; |
976 | while(sc.hasNextLine()) { |
977 | @@ -405,7 +406,7 @@ |
978 | try { |
979 | sc=new Scanner(new File(file)); |
980 | } catch (FileNotFoundException e) { |
981 | - System.err.println("Error: " + e.getMessage()); |
982 | + LogUtils.logErrorLine(e.getMessage()); |
983 | } |
984 | while(sc.hasNextLine()) { |
985 | String line = sc.nextLine(); |
986 | |
987 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerConfTool.java' |
988 | --- XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerConfTool.java 2016-01-01 00:01:42 +0000 |
989 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerConfTool.java 2016-01-17 22:48:15 +0000 |
990 | @@ -25,6 +25,7 @@ |
991 | import org.workcraft.plugins.xmas.Xmas; |
992 | import org.workcraft.plugins.xmas.XmasSettings; |
993 | import org.workcraft.util.Hierarchy; |
994 | +import org.workcraft.util.LogUtils; |
995 | import org.workcraft.util.WorkspaceUtils; |
996 | import org.workcraft.workspace.WorkspaceEntry; |
997 | import org.workcraft.Framework; |
998 | @@ -119,7 +120,7 @@ |
999 | File vsettingsFile = XmasSettings.getTempVxmVsettingsFile(); |
1000 | sc=new Scanner(vsettingsFile); |
1001 | } catch (FileNotFoundException e) { |
1002 | - System.err.println("Error: " + e.getMessage()); |
1003 | + LogUtils.logErrorLine(e.getMessage()); |
1004 | } |
1005 | while(sc.hasNextLine()) { |
1006 | Scanner line_=new Scanner(sc.nextLine()); |
1007 | |
1008 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerQuery.java' |
1009 | --- XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerQuery.java 2016-01-05 20:25:07 +0000 |
1010 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerQuery.java 2016-01-17 22:48:15 +0000 |
1011 | @@ -47,6 +47,7 @@ |
1012 | import org.workcraft.plugins.xmas.gui.SolutionsDialog2; |
1013 | import org.workcraft.util.FileUtils; |
1014 | import org.workcraft.util.Hierarchy; |
1015 | +import org.workcraft.util.LogUtils; |
1016 | import org.workcraft.util.WorkspaceUtils; |
1017 | import org.workcraft.workspace.WorkspaceEntry; |
1018 | |
1019 | @@ -96,7 +97,7 @@ |
1020 | try { |
1021 | sc=new Scanner(new File(file)); |
1022 | } catch (FileNotFoundException e) { |
1023 | - System.err.println("Error: " + e.getMessage()); |
1024 | + LogUtils.logErrorLine(e.getMessage()); |
1025 | } |
1026 | String targ=""; |
1027 | String larg=""; |
1028 | @@ -182,7 +183,7 @@ |
1029 | try { |
1030 | sc=new Scanner(new File(file)); |
1031 | } catch (FileNotFoundException e) { |
1032 | - System.err.println("Error: " + e.getMessage()); |
1033 | + LogUtils.logErrorLine(e.getMessage()); |
1034 | } |
1035 | String str=""; |
1036 | while(sc.hasNextLine()) { |
1037 | @@ -200,7 +201,7 @@ |
1038 | try { |
1039 | sc=new Scanner(new File(file)); |
1040 | } catch (FileNotFoundException e) { |
1041 | - System.err.println("Error: " + e.getMessage()); |
1042 | + LogUtils.logErrorLine(e.getMessage()); |
1043 | } |
1044 | while(sc.hasNextLine()) { |
1045 | Scanner line_=new Scanner(sc.nextLine()); |
1046 | @@ -220,7 +221,7 @@ |
1047 | try { |
1048 | sc=new Scanner(new File(file)); |
1049 | } catch (FileNotFoundException e) { |
1050 | - System.err.println("Error: " + e.getMessage()); |
1051 | + LogUtils.logErrorLine(e.getMessage()); |
1052 | } |
1053 | String str=""; |
1054 | while(sc.hasNextLine()) { |
1055 | @@ -237,7 +238,7 @@ |
1056 | try { |
1057 | sc=new Scanner(new File(file)); |
1058 | } catch (FileNotFoundException e) { |
1059 | - System.err.println("Error: " + e.getMessage()); |
1060 | + LogUtils.logErrorLine(e.getMessage()); |
1061 | } |
1062 | String str=""; |
1063 | while(sc.hasNextLine()) { |
1064 | |
1065 | === modified file 'XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerTool.java' |
1066 | --- XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerTool.java 2016-01-05 20:25:07 +0000 |
1067 | +++ XmasPlugin/src/org/workcraft/plugins/xmas/tools/VerTool.java 2016-01-17 22:48:15 +0000 |
1068 | @@ -31,6 +31,7 @@ |
1069 | import org.workcraft.plugins.xmas.gui.SolutionsDialog1; |
1070 | import org.workcraft.plugins.xmas.gui.SolutionsDialog2; |
1071 | import org.workcraft.util.FileUtils; |
1072 | +import org.workcraft.util.LogUtils; |
1073 | import org.workcraft.util.WorkspaceUtils; |
1074 | import org.workcraft.workspace.WorkspaceEntry; |
1075 | |
1076 | @@ -75,7 +76,7 @@ |
1077 | try { |
1078 | sc=new Scanner(new File(file)); |
1079 | } catch (FileNotFoundException e) { |
1080 | - System.err.println("Error: " + e.getMessage()); |
1081 | + LogUtils.logErrorLine(e.getMessage()); |
1082 | } |
1083 | String targ=""; |
1084 | String larg=""; |
1085 | @@ -139,7 +140,7 @@ |
1086 | try { |
1087 | sc=new Scanner(new File(file)); |
1088 | } catch (FileNotFoundException e) { |
1089 | - System.err.println("Error: " + e.getMessage()); |
1090 | + LogUtils.logErrorLine(e.getMessage()); |
1091 | } |
1092 | String str=""; |
1093 | while(sc.hasNextLine()) { |
1094 | @@ -157,7 +158,7 @@ |
1095 | try { |
1096 | sc=new Scanner(new File(file)); |
1097 | } catch (FileNotFoundException e) { |
1098 | - System.err.println("Error: " + e.getMessage()); |
1099 | + LogUtils.logErrorLine(e.getMessage()); |
1100 | } |
1101 | while(sc.hasNextLine()) { |
1102 | Scanner line_=new Scanner(sc.nextLine()); |
1103 | @@ -177,7 +178,7 @@ |
1104 | try { |
1105 | sc=new Scanner(new File(file)); |
1106 | } catch (FileNotFoundException e) { |
1107 | - System.err.println("Error: " + e.getMessage()); |
1108 | + LogUtils.logErrorLine(e.getMessage()); |
1109 | } |
1110 | String str=""; |
1111 | while(sc.hasNextLine()) { |