diff --git a/samples/arrz/TextWriter.arrz b/samples/arrz/TextWriter.arrz index c6b5cd4b..17ce2064 100644 Binary files a/samples/arrz/TextWriter.arrz and b/samples/arrz/TextWriter.arrz differ diff --git a/src/Structorizer.java b/src/Structorizer.java index 23aea5a3..4147111b 100644 --- a/src/Structorizer.java +++ b/src/Structorizer.java @@ -71,6 +71,10 @@ * Kay Gürtzig 2019-08-07 Enh. #741: Option -s now also respected for interactive mode, * Bugfix #742 * Kay Gürtzig 2019-09-16 #744 workaround: file open queue on startup for OS X + * Kay Gürtzig 2020-03-23 Issues #828, #836: Slight unification of arrangement exports with + * group export: Without specified entry points all contained diagrams + * will be qualified for export. Remaining difference: We still first + * check for contained main diagrams as potential tree roots. * ****************************************************************************************************** * @@ -139,6 +143,7 @@ public static void main(String args[]) // START KGU#484 2018-03-21: Issue #463 - Configurability of the logging system ensured setupLogging(); // END KGU#484 2018-03-21 + Logger.getLogger(Structorizer.class.getName()).log(Level.INFO, "Command line: " + new StringList(args).getLongString()); // START KGU#187 2016-04-28: Enh. #179 Vector fileNames = new Vector(); String generator = null; @@ -769,21 +774,38 @@ private static boolean addExportPool(HashMap> pools, A } } else { + // START KGU#815/KGU#824 2020-03-23: Enh. #828, issue #836 - Collect all Roots from the archive as fallback + Vector allRoots = new Vector(); + // END KGU#815/KGU#824 2020-03-23 // Identify and collect all main diagrams of the pool for (Iterator iter = index.iterator(); iter.hasNext();) { ArchiveIndexEntry entry = iter.next(); Root root = null; if (entry.name == null) { - entry.getRoot(archivar); + entry.getRoot(archivar); // This may set entry.name! } if (entry.name != null && entry.minArgs == -1) { root = entry.getRoot(archivar); - if (root != null && root.isProgram()) { - poolRoots.add(root); + // START KGU#815/KGU#824 2020-03-23: Enh. #828, issue #836 - Collect all Roots from the archive as fallback + //if (root != null && root.isProgram()) { + // poolRoots.add(root); + //} + if (root != null) { + allRoots.add(root); + if (root.isProgram()) { + poolRoots.add(root); + } } + // END KGU#815/KGU#824 2020-03-23 } } + // START KGU#815/KGU#824 2020-03-23: Enh. #828, issue #836 cautious unification with group export: + // If no suitable program Root is found then we will simply add all diagrams + if (poolRoots.isEmpty()) { + poolRoots = allRoots; + } + // END KGU#815/KGU#824 2020-03-23 } if (!poolRoots.isEmpty()) { pools.put(pool, poolRoots); @@ -1052,7 +1074,7 @@ private static void writeRootsToFiles(List newRoots, String filename, Stri out = new OutputStreamWriter(fos, "UTF8"); try { XmlGenerator xmlgen = new XmlGenerator(); - out.write(xmlgen.generateCode(rootNew,"\t")); + out.write(xmlgen.generateCode(rootNew,"\t", false)); } finally { out.close(); diff --git a/src/lu/fisch/structorizer/archivar/Archivar.java b/src/lu/fisch/structorizer/archivar/Archivar.java index 6762754b..be3c5424 100644 --- a/src/lu/fisch/structorizer/archivar/Archivar.java +++ b/src/lu/fisch/structorizer/archivar/Archivar.java @@ -765,7 +765,7 @@ private boolean saveVirginNSD(Root _root, File _targetDir) throws IOException FileOutputStream fos = new FileOutputStream(filename); out = new OutputStreamWriter(fos, "UTF-8"); XmlGenerator xmlgen = new XmlGenerator(); - out.write(xmlgen.generateCode(_root, "\t")); + out.write(xmlgen.generateCode(_root, "\t", true)); _root.filename = filename; _root.rememberSaved(); done = true; diff --git a/src/lu/fisch/structorizer/archivar/ArchivePool.java b/src/lu/fisch/structorizer/archivar/ArchivePool.java index 2b06c0dd..067620ac 100644 --- a/src/lu/fisch/structorizer/archivar/ArchivePool.java +++ b/src/lu/fisch/structorizer/archivar/ArchivePool.java @@ -84,7 +84,7 @@ public ArchivePool(String name) { /** * Creates an ArchivePool from a given {@link ArchiveIndex}. - * The archive name will be derived from the arrangemenet file in + * The archive name will be derived from the arrangement file in * {@code archiveIndex}. */ public ArchivePool(Archivar.ArchiveIndex archiveIndex) { diff --git a/src/lu/fisch/structorizer/arranger/Surface.java b/src/lu/fisch/structorizer/arranger/Surface.java index 62bba8d1..82ee3e35 100644 --- a/src/lu/fisch/structorizer/arranger/Surface.java +++ b/src/lu/fisch/structorizer/arranger/Surface.java @@ -1326,7 +1326,7 @@ private LinkedList saveVirginRootsToTempDir(Group group, File tempDir) { FileOutputStream fos = new FileOutputStream(filename); out = new OutputStreamWriter(fos, "UTF-8"); XmlGenerator xmlgen = new XmlGenerator(); - out.write(xmlgen.generateCode(diagr.root,"\t")); + out.write(xmlgen.generateCode(diagr.root,"\t", true)); diagr.root.filename = filename; diagr.root.rememberSaved(); savedRoots.add(diagr.root); @@ -2859,7 +2859,7 @@ public boolean copyDiagram() // START KGU#642 2018-12-21: Enh. #655 //StringSelection toClip = new StringSelection(xmlgen.generateCode(this.mouseSelected.root,"\t")); StringSelection toClip = new StringSelection( - xmlgen.generateCode(this.diagramsSelected.iterator().next().root,"\t") + xmlgen.generateCode(this.diagramsSelected.iterator().next().root,"\t", true) ); // END KGU#624 2018-12-21 Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); diff --git a/src/lu/fisch/structorizer/gui/ExportOptionDialoge.java b/src/lu/fisch/structorizer/gui/ExportOptionDialoge.java index a82db0b0..5331d277 100644 --- a/src/lu/fisch/structorizer/gui/ExportOptionDialoge.java +++ b/src/lu/fisch/structorizer/gui/ExportOptionDialoge.java @@ -47,6 +47,7 @@ * Kay Gürtzig 2017.06.20 Enh. #354/#357: generator-specific option mechanism implemented * Kay Gürtzig 2018.01.22 Issue #484: Layout of the "Includes" tab fixed (text fields now expand). * Kay Gürtzig 2019-02-15 Enh. #681: New spinner for triggering a change proposal for preferred generator + * Kay Gürtzig 2020-03-17 Enh. #837: New option for the proposed export directory * ****************************************************************************************************** * @@ -164,6 +165,9 @@ private void initComponents() { btnPluginOptions = new javax.swing.JButton(); cbOptionPlugins = new javax.swing.JComboBox(this.getCodeGeneratorNames(true)); // END KGU#416 2017-06-20 + // START KGU#816 2020-03-17: Enh. #837 + chkDirectoryFromNsd = new javax.swing.JCheckBox(); + // END KGI#816 2020-043-17 setTitle("Export options ..."); @@ -272,7 +276,13 @@ public void actionPerformed(ActionEvent evt) { } }); // END KGU#363 2017-05-11 - + + // START KGU#816 2020-03-17: Enh. #837 + chkDirectoryFromNsd.setText("Propose export directory from NSD location if available"); + chkDirectoryFromNsd.setToolTipText("Otherwise the most recent export directory will always be proposed."); + // No action listener required + // END KGI#816 2020-043-17 + jButton1.setText("OK"); jButton1.addActionListener(new ActionListener() { @Override @@ -362,6 +372,9 @@ public void actionPerformed(ActionEvent evt) { // START KGU#363 2017-05-11: Enh. #372 .add(chkExportLicenseInfo) // END KGU#363 2017-05-11: Enh. #372 + // START KGU#816 2020-03-17: Enh. #837 + .add(chkDirectoryFromNsd) + // END KGU#816 2020-03-17 /*.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(jButton1) .addContainerGap())*/)) @@ -410,6 +423,10 @@ public void actionPerformed(ActionEvent evt) { .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(chkExportLicenseInfo) // END KGU#363 2017-05-11: Enh. #372 + // START KGU#816 2020-03-17: Enh. #837 + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(chkDirectoryFromNsd) + // END KGU#816 2020-03-17 // START KGU#416 2017-06-20: Enh. #353,#357 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER) @@ -469,15 +486,15 @@ public void actionPerformed(ActionEvent evt) { //======== buttonBar ======== { - buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); - buttonBar.setLayout(new GridBagLayout()); - ((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 80}; - ((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0}; - - //---- btnOK ---- - buttonBar.add(jButton1, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(0, 0, 0, 0), 0, 0)); + buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); + buttonBar.setLayout(new GridBagLayout()); + ((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 80}; + ((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0}; + + //---- btnOK ---- + buttonBar.add(jButton1, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(0, 0, 0, 0), 0, 0)); } Container contentPane = getContentPane(); @@ -515,6 +532,10 @@ public void keyTyped(KeyEvent kevt) {} bracesCheckBox.addKeyListener(keyListener); lineNumbersCheckBox.addKeyListener(keyListener); chkExportSubroutines.addKeyListener(keyListener); + // START KGU#816 2020-03-17: Enh. #837 + this.chkDirectoryFromNsd.addKeyListener(keyListener); + this.chkExportLicenseInfo.addKeyListener(keyListener); + // END KGU#816 2020-03-17 for (int i = 0; i < this.includeLists.length; i++) { this.includeLists[i].addKeyListener(keyListener); } @@ -543,10 +564,10 @@ protected void openSpecificOptionDialog(String TitleFormat, GENPlugin plugin, Ha } // END KGU#416 2017-06-20 -// private void commentsCheckBoxActionPerformed(ActionEvent evt)//GEN-FIRST:event_commentsCheckBoxActionPerformed -// {//GEN-HEADEREND:event_commentsCheckBoxActionPerformed +// private void licenseInfoCheckBoxActionPerformed(ActionEvent evt)//GEN-FIRST:event_licenseInfoCheckBoxActionPerformed +// {//GEN-HEADEREND:event_licenseInfoCheckBoxActionPerformed // // TODO add your handling code here: -// }//GEN-LAST:event_commentsCheckBoxActionPerformed +// }//GEN-LAST:event_licenseInfoCheckBoxActionPerformed protected void licenseInfoCheckBoxActionPerformed(ActionEvent evt) { // TODO Auto-generated method stub @@ -709,7 +730,6 @@ private Vector getCodeGeneratorNames(boolean withOptionsOnly) public final LangTextHolder msgOptionsForPlugin = new LangTextHolder("Options for % Generator"); // END KGU#416 2017-06-20 // END KGU#351 2017-02-26 - // Variables declaration - do not modify//GEN-BEGIN:variables public javax.swing.JCheckBox bracesCheckBox; public javax.swing.JCheckBox commentsCheckBox; public javax.swing.JButton jButton1; @@ -739,5 +759,7 @@ private Vector getCodeGeneratorNames(boolean withOptionsOnly) // START KGU#363 2017-05-11: Enh. #372 public javax.swing.JCheckBox chkExportLicenseInfo; // END KGU#363 2017-05-11 - // End of variables declaration//GEN-END:variables + // START KGU#816 2020-03-17: Enh. #837 + public javax.swing.JCheckBox chkDirectoryFromNsd; + // END KGU#816 2020-03-17 } diff --git a/src/lu/fisch/structorizer/io/Ini.java b/src/lu/fisch/structorizer/io/Ini.java index 03677129..99242cc7 100644 --- a/src/lu/fisch/structorizer/io/Ini.java +++ b/src/lu/fisch/structorizer/io/Ini.java @@ -206,9 +206,9 @@ public static boolean setIniPath(String filePath) { // as well /** * Returns the path where the ini file is supposed to reside. In case of a specified - * predominant oder redirected ini file, it will be directory of this file rather than - * the standard ini folder (except in early initialization phase). - * @return the path of the directory for the ini file as string + * predominant oder redirected ini file, it will be the directory of this file rather + * than the standard ini folder (except in early initialization phase). + * @return the path of the default directory for the ini file as string * @see #getIniDirectory(boolean) */ public static File getIniDirectory() @@ -221,12 +221,12 @@ public static File getIniDirectory() * Returns the path where the ini file is supposed to reside. It depends on paramater * {@code alwaysStandard} whether in case of a specified predominant oder redirected * ini file still the user-specific standard folder is returned (true) or the directory - * of the configured non-standard ini file (predominant / redirected). - * the standard ini folder (except in early initialization phase). Method {@link #getIniDirectory()} - * is equivalent to {@code getIniDirectory(false)}. - * @param alwaysStandard + * of the configured non-standard (predominant / redirected) ini file (false).
+ * Method {@link #getIniDirectory()} is equivalent to {@code getIniDirectory(false)}. + * @param alwaysStandard - if true then the default ini path is yielded * @return the directory path of the effective ini file as string * @see #getIniDirectory() + * @see #setIniPath(String) */ public static File getIniDirectory(boolean alwaysStandard) // END KGU#789 2020-01-20