Skip to content

Commit

Permalink
Merge pull request #846 from fesch/bugfix
Browse files Browse the repository at this point in the history
Merge defects mended for 3.30-07
  • Loading branch information
fesch authored Apr 11, 2020
2 parents 4068610 + 7198c1e commit 00a8882
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 30 deletions.
Binary file modified samples/arrz/TextWriter.arrz
Binary file not shown.
30 changes: 26 additions & 4 deletions src/Structorizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
******************************************************************************************************
*
Expand Down Expand Up @@ -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<String> fileNames = new Vector<String>();
String generator = null;
Expand Down Expand Up @@ -769,21 +774,38 @@ private static boolean addExportPool(HashMap<ArchivePool, Vector<Root>> pools, A
}
}
else {
// START KGU#815/KGU#824 2020-03-23: Enh. #828, issue #836 - Collect all Roots from the archive as fallback
Vector<Root> allRoots = new Vector<Root>();
// END KGU#815/KGU#824 2020-03-23
// Identify and collect all main diagrams of the pool
for (Iterator<ArchiveIndexEntry> 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);
Expand Down Expand Up @@ -1052,7 +1074,7 @@ private static void writeRootsToFiles(List<Root> 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();
Expand Down
2 changes: 1 addition & 1 deletion src/lu/fisch/structorizer/archivar/Archivar.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lu/fisch/structorizer/archivar/ArchivePool.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/lu/fisch/structorizer/arranger/Surface.java
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ private LinkedList<Root> 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);
Expand Down Expand Up @@ -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();
Expand Down
52 changes: 37 additions & 15 deletions src/lu/fisch/structorizer/gui/ExportOptionDialoge.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
******************************************************************************************************
*
Expand Down Expand Up @@ -164,6 +165,9 @@ private void initComponents() {
btnPluginOptions = new javax.swing.JButton();
cbOptionPlugins = new javax.swing.JComboBox<String>(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 ...");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())*/))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -709,7 +730,6 @@ private Vector<String> 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;
Expand Down Expand Up @@ -739,5 +759,7 @@ private Vector<String> 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
}
14 changes: 7 additions & 7 deletions src/lu/fisch/structorizer/io/Ini.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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).<br/>
* 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
Expand Down

0 comments on commit 00a8882

Please sign in to comment.