diff --git a/commons/advanced/Commons_Advanced/pom.xml b/commons/advanced/Commons_Advanced/pom.xml index c67a471d..87179405 100644 --- a/commons/advanced/Commons_Advanced/pom.xml +++ b/commons/advanced/Commons_Advanced/pom.xml @@ -10,7 +10,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_Image/pom.xml b/commons/advanced/Commons_Image/pom.xml index adfa7f9b..8d180d76 100644 --- a/commons/advanced/Commons_Image/pom.xml +++ b/commons/advanced/Commons_Image/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_Json/pom.xml b/commons/advanced/Commons_Json/pom.xml index 2083380e..1ec6d279 100644 --- a/commons/advanced/Commons_Json/pom.xml +++ b/commons/advanced/Commons_Json/pom.xml @@ -10,7 +10,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 @@ -89,7 +89,7 @@ net.anwiba.commons.tools anwiba-tools-definition-schema-json - 1.0.24 + 1.0.25 generate diff --git a/commons/advanced/Commons_Message/pom.xml b/commons/advanced/Commons_Message/pom.xml index 5e826f98..167701eb 100644 --- a/commons/advanced/Commons_Message/pom.xml +++ b/commons/advanced/Commons_Message/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_Model/pom.xml b/commons/advanced/Commons_Model/pom.xml index c1454948..18c3b7cb 100644 --- a/commons/advanced/Commons_Model/pom.xml +++ b/commons/advanced/Commons_Model/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_NLS/pom.xml b/commons/advanced/Commons_NLS/pom.xml index 4ed51708..d13add9e 100644 --- a/commons/advanced/Commons_NLS/pom.xml +++ b/commons/advanced/Commons_NLS/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_Preferences/pom.xml b/commons/advanced/Commons_Preferences/pom.xml index f20a0dbb..26b75f01 100644 --- a/commons/advanced/Commons_Preferences/pom.xml +++ b/commons/advanced/Commons_Preferences/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_Process/pom.xml b/commons/advanced/Commons_Process/pom.xml index caec1934..0cdb898f 100644 --- a/commons/advanced/Commons_Process/pom.xml +++ b/commons/advanced/Commons_Process/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/Commons_Workflow/pom.xml b/commons/advanced/Commons_Workflow/pom.xml index 4b0e07d5..74a8689f 100644 --- a/commons/advanced/Commons_Workflow/pom.xml +++ b/commons/advanced/Commons_Workflow/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-advanced - 1.0.24 + 1.0.25 diff --git a/commons/advanced/pom.xml b/commons/advanced/pom.xml index 0e5865d8..68d7726b 100644 --- a/commons/advanced/pom.xml +++ b/commons/advanced/pom.xml @@ -12,7 +12,7 @@ net.anwiba.commons anwiba-commons-maven-default - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Core/pom.xml b/commons/core/Commons_Core/pom.xml index e55f0579..9fbcc38e 100644 --- a/commons/core/Commons_Core/pom.xml +++ b/commons/core/Commons_Core/pom.xml @@ -10,7 +10,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Ensure/pom.xml b/commons/core/Commons_Ensure/pom.xml index 6c1ba50a..e95f742c 100644 --- a/commons/core/Commons_Ensure/pom.xml +++ b/commons/core/Commons_Ensure/pom.xml @@ -10,7 +10,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Lang/pom.xml b/commons/core/Commons_Lang/pom.xml index 4f29a730..618d1347 100644 --- a/commons/core/Commons_Lang/pom.xml +++ b/commons/core/Commons_Lang/pom.xml @@ -10,7 +10,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/IStream.java b/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/IStream.java index ee94e7ea..ed793835 100644 --- a/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/IStream.java +++ b/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/IStream.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.List; +import java.util.function.IntFunction; import net.anwiba.commons.lang.collection.IObjectList; import net.anwiba.commons.lang.functional.IAcceptor; @@ -56,4 +57,6 @@ public interface IStream { public void foreach(IConsumer consumer) throws E; + public O[] asArray(IntFunction factory) throws E; + } diff --git a/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/SequencedStream.java b/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/SequencedStream.java index 4a1050f2..faeab315 100644 --- a/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/SequencedStream.java +++ b/commons/core/Commons_Lang/src/main/java/net/anwiba/commons/lang/stream/SequencedStream.java @@ -28,6 +28,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; +import java.util.function.IntFunction; import net.anwiba.commons.lang.collection.IObjectList; import net.anwiba.commons.lang.collection.ObjectList; @@ -109,4 +110,10 @@ public IOptional foreach(final O identity, final IAccumulator return Optional.create(this.iterable.foreach(identity, adder)); } + @Override + public O[] asArray(final IntFunction factory) throws E { + final List list = asList(); + return list.toArray(factory.apply(list.size())); + } + } diff --git a/commons/core/Commons_Logging/pom.xml b/commons/core/Commons_Logging/pom.xml index a04b2142..176652a7 100644 --- a/commons/core/Commons_Logging/pom.xml +++ b/commons/core/Commons_Logging/pom.xml @@ -11,7 +11,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Reflaction/pom.xml b/commons/core/Commons_Reflaction/pom.xml index 0840d844..9dc6e282 100644 --- a/commons/core/Commons_Reflaction/pom.xml +++ b/commons/core/Commons_Reflaction/pom.xml @@ -11,7 +11,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Resource/pom.xml b/commons/core/Commons_Resource/pom.xml index 552c7e49..6bc96005 100644 --- a/commons/core/Commons_Resource/pom.xml +++ b/commons/core/Commons_Resource/pom.xml @@ -11,7 +11,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/reference/IResourceReferenceHandler.java b/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/reference/IResourceReferenceHandler.java index 7533f1dc..1f8bf83d 100644 --- a/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/reference/IResourceReferenceHandler.java +++ b/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/reference/IResourceReferenceHandler.java @@ -8,12 +8,12 @@ * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * + * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * . @@ -64,4 +64,6 @@ public interface IResourceReferenceHandler { public abstract String toString(IResourceReference resourceReference); + // public abstract IResourceReference getParent(IResourceReference resourceReference); + } \ No newline at end of file diff --git a/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/FileUtilities.java b/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/FileUtilities.java index c1e67e1f..fdb8e3fe 100755 --- a/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/FileUtilities.java +++ b/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/FileUtilities.java @@ -8,12 +8,12 @@ * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * + * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * . @@ -32,13 +32,12 @@ public class FileUtilities { * Get the extension of a file. */ public static String getExtension(final File file) { - final String s = file.getName(); - String ext = null; - final int i = s.lastIndexOf('.'); - if (i > 0 && i < s.length() - 1) { - ext = s.substring(i + 1).toLowerCase(); - } - return ext; + return getExtension(file.getName()); + } + + public static String getExtension(final String name) { + final int i = name.lastIndexOf('.'); + return (i > 0 && i < name.length() - 1) ? name.substring(i + 1).toLowerCase() : null; } public static File addExtension(final File file, final String extension) { diff --git a/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/IFileExtensions.java b/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/IFileExtensions.java index beea53d0..7836bdf0 100755 --- a/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/IFileExtensions.java +++ b/commons/core/Commons_Resource/src/main/java/net/anwiba/commons/resource/utilities/IFileExtensions.java @@ -8,12 +8,12 @@ * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * + * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * . @@ -26,9 +26,7 @@ public interface IFileExtensions { public static final String ASC = "asc"; //$NON-NLS-1$ public static final String BMP = "bmp"; //$NON-NLS-1$ public static final String BPW = "bpw"; //$NON-NLS-1$ - public static final String CPG = "cpg"; //$NON-NLS-1$ public static final String DAT = "dat"; //$NON-NLS-1$ - public static final String DBF = "dbf"; //$NON-NLS-1$ public static final String DGM = "dgm"; //$NON-NLS-1$ public static final String GFW = "gfw"; //$NON-NLS-1$ public static final String GIF = "gif"; //$NON-NLS-1$ @@ -43,11 +41,20 @@ public interface IFileExtensions { public static final String MDB = "mdb"; //$NON-NLS-1$ public static final String PGW = "pgw"; //$NON-NLS-1$ public static final String PNG = "png"; //$NON-NLS-1$ + + public static final String DEF = "def"; //$NON-NLS-1$ + public static final String CPG = "cpg"; //$NON-NLS-1$ public static final String PRJ = "prj"; //$NON-NLS-1$ - public static final String SDAT = "sdat"; //$NON-NLS-1$ - public static final String SGRD = "sgrd"; //$NON-NLS-1$ + public static final String SHP = "shp"; //$NON-NLS-1$ + public static final String DBF = "dbf"; //$NON-NLS-1$ + public static final String SBN = "sbn"; //$NON-NLS-1$ + public static final String SBX = "sbx"; //$NON-NLS-1$ + public static final String SHI = "shi"; //$NON-NLS-1$ public static final String SHX = "shx"; //$NON-NLS-1$ + + public static final String SDAT = "sdat"; //$NON-NLS-1$ + public static final String SGRD = "sgrd"; //$NON-NLS-1$ public static final String TFW = "tfw"; //$NON-NLS-1$ public static final String TIF = "tif"; //$NON-NLS-1$ public static final String TIFF = "tiff"; //$NON-NLS-1$ diff --git a/commons/core/Commons_Utilities/pom.xml b/commons/core/Commons_Utilities/pom.xml index 4bf846c1..dd8f76ba 100644 --- a/commons/core/Commons_Utilities/pom.xml +++ b/commons/core/Commons_Utilities/pom.xml @@ -11,7 +11,7 @@ net.anwiba.commons anwiba-commons-maven-core - 1.0.24 + 1.0.25 diff --git a/commons/core/Commons_Utilities/src/main/java/net/anwiba/commons/utilities/lang/ClassLoaderUtilities.java b/commons/core/Commons_Utilities/src/main/java/net/anwiba/commons/utilities/lang/ClassLoaderUtilities.java index e86224bd..d82edcd4 100755 --- a/commons/core/Commons_Utilities/src/main/java/net/anwiba/commons/utilities/lang/ClassLoaderUtilities.java +++ b/commons/core/Commons_Utilities/src/main/java/net/anwiba/commons/utilities/lang/ClassLoaderUtilities.java @@ -8,12 +8,12 @@ * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * + * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * . @@ -203,6 +203,36 @@ public static String getReadMe(final URI uri) { return getFirstFile(uri, readMeFileNames); } + private static Set authorsNames = new HashSet<>(); + static { + authorsNames.add("META-INF/AUTHORS.txt"); //$NON-NLS-1$ + authorsNames.add("META-INF/AUTHORS"); //$NON-NLS-1$ + authorsNames.add("AUTHORS.txt"); //$NON-NLS-1$ + authorsNames.add("AUTHORS"); //$NON-NLS-1$ + } + + public static String getAuthors(final URI uri) { + if (uri == null) { + return null; + } + return getFirstFile(uri, authorsNames); + } + + private static Set newsNames = new HashSet<>(); + static { + newsNames.add("META-INF/NEWS.txt"); //$NON-NLS-1$ + newsNames.add("META-INF/NEWS"); //$NON-NLS-1$ + newsNames.add("NEWS.txt"); //$NON-NLS-1$ + newsNames.add("NEWS"); //$NON-NLS-1$ + } + + public static String getNews(final URI uri) { + if (uri == null) { + return null; + } + return getFirstFile(uri, newsNames); + } + private static String getFirstFile(final URI uri, final Set fileNames) { try (JarInputStream jarInputStream = new JarInputStream(uri.toURL().openStream())) { try { @@ -270,8 +300,9 @@ public static URI[] getLibraries(final Manifest manifest, final String parent) { final URI uri = URI.create(string); if (!uri.isAbsolute()) { try { - final File file = new File(parent == null - ? new File(System.getProperty("user.dir")) : new File(new URI(parent)), string); //$NON-NLS-1$ + final File file = new File( + parent == null ? new File(System.getProperty("user.dir")) : new File(new URI(parent)), //$NON-NLS-1$ + string); logger.log(ILevel.DEBUG, "add none absolute file: " + file.getCanonicalFile().toURI()); //$NON-NLS-1$ uris.add(file.getCanonicalFile().toURI()); } catch (final IOException exception) { @@ -409,4 +440,5 @@ public static File getFile(final String name, final String folder) { public static File getFile(final String name) { return getFile(name, null); } + } diff --git a/commons/core/pom.xml b/commons/core/pom.xml index 79052796..c74980b1 100644 --- a/commons/core/pom.xml +++ b/commons/core/pom.xml @@ -12,7 +12,7 @@ net.anwiba.commons anwiba-commons-maven-default - 1.0.24 + 1.0.25 diff --git a/commons/pom.xml b/commons/pom.xml index 25140eec..7053f11d 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -23,7 +23,7 @@ net.anwiba anwiba-maven-default - 1.0.24 + 1.0.25 diff --git a/commons/swing/core/Commons_Swing_Core/pom.xml b/commons/swing/core/Commons_Swing_Core/pom.xml index 0b747a65..e1cfdcd7 100644 --- a/commons/swing/core/Commons_Swing_Core/pom.xml +++ b/commons/swing/core/Commons_Swing_Core/pom.xml @@ -8,7 +8,7 @@ net.anwiba.commons anwiba-commons-maven-swing-core - 1.0.24 + 1.0.25 @@ -22,7 +22,7 @@ net.anwiba.commons.swing.icons org.gnome.gtk-contrast-high-icons - ${net.anwiba.commons.version} + 3.22.1-${net.anwiba.commons.version} @@ -132,6 +132,9 @@ generate + + Copyright (c) 2010-${year} by Andreas W. Bartels (bartels@anwiba.de) + diff --git a/commons/swing/core/Commons_Swing_Icon/pom.xml b/commons/swing/core/Commons_Swing_Icon/pom.xml index 2493861d..f696ff4d 100644 --- a/commons/swing/core/Commons_Swing_Icon/pom.xml +++ b/commons/swing/core/Commons_Swing_Icon/pom.xml @@ -9,7 +9,7 @@ net.anwiba.commons anwiba-commons-maven-swing-core - 1.0.24 + 1.0.25 diff --git a/commons/swing/core/gnome-icons/pom.xml b/commons/swing/core/gnome-icons/pom.xml index 978ecaa3..1353cc2d 100644 --- a/commons/swing/core/gnome-icons/pom.xml +++ b/commons/swing/core/gnome-icons/pom.xml @@ -5,12 +5,12 @@ net.anwiba.commons.swing.icons org.gnome.gnome-icons - + 3.12.0-${net.anwiba.commons.version} net.anwiba.commons anwiba-commons-maven-swing-core - 1.0.24 + 1.0.25 diff --git a/commons/swing/core/gtk-contrast-high-icons/pom.xml b/commons/swing/core/gtk-contrast-high-icons/pom.xml index ef1e798c..f9972c50 100644 --- a/commons/swing/core/gtk-contrast-high-icons/pom.xml +++ b/commons/swing/core/gtk-contrast-high-icons/pom.xml @@ -5,12 +5,12 @@ net.anwiba.commons.swing.icons org.gnome.gtk-contrast-high-icons - + 3.22.1-${net.anwiba.commons.version} net.anwiba.commons anwiba-commons-maven-swing-core - 1.0.24 + 1.0.25 diff --git a/commons/swing/core/oxygen-icons/pom.xml b/commons/swing/core/oxygen-icons/pom.xml index 39422db8..5cf5c2ce 100644 --- a/commons/swing/core/oxygen-icons/pom.xml +++ b/commons/swing/core/oxygen-icons/pom.xml @@ -4,12 +4,12 @@ net.anwiba.commons.swing.icons org.oxygen.oxygen-icons - + 4.13.0-${net.anwiba.commons.version} net.anwiba.commons anwiba-commons-maven-swing-core - 1.0.24 + 1.0.25 diff --git a/commons/swing/core/pom.xml b/commons/swing/core/pom.xml index e4a98e90..d25ff859 100644 --- a/commons/swing/core/pom.xml +++ b/commons/swing/core/pom.xml @@ -13,7 +13,7 @@ net.anwiba.commons anwiba-commons-maven-swing - 1.0.24 + 1.0.25 diff --git a/commons/swing/pom.xml b/commons/swing/pom.xml index 12f21a84..ed816c95 100644 --- a/commons/swing/pom.xml +++ b/commons/swing/pom.xml @@ -13,7 +13,7 @@ net.anwiba.commons anwiba-commons-maven-default - 1.0.24 + 1.0.25 diff --git a/commons/tools/Tools_Definition_Schema_Json/pom.xml b/commons/tools/Tools_Definition_Schema_Json/pom.xml index 5cda862d..a50917d3 100644 --- a/commons/tools/Tools_Definition_Schema_Json/pom.xml +++ b/commons/tools/Tools_Definition_Schema_Json/pom.xml @@ -12,7 +12,7 @@ net.anwiba.commons.tools anwiba-commons-tools - 1.0.24 + 1.0.25 diff --git a/commons/tools/Tools_Generator_Java/pom.xml b/commons/tools/Tools_Generator_Java/pom.xml index 9d1fd4b9..8982637f 100644 --- a/commons/tools/Tools_Generator_Java/pom.xml +++ b/commons/tools/Tools_Generator_Java/pom.xml @@ -11,7 +11,7 @@ net.anwiba.commons.tools anwiba-commons-tools - 1.0.24 + 1.0.25 diff --git a/commons/tools/Tools_Graphml/.externalToolBuilders/xjc graphml.launch b/commons/tools/Tools_Graphml/.externalToolBuilders/xjc graphml.launch deleted file mode 100644 index fd9c73a1..00000000 --- a/commons/tools/Tools_Graphml/.externalToolBuilders/xjc graphml.launch +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/commons/tools/Tools_Graphml/pom.xml b/commons/tools/Tools_Graphml/pom.xml index 51f4e04f..736eabe1 100644 --- a/commons/tools/Tools_Graphml/pom.xml +++ b/commons/tools/Tools_Graphml/pom.xml @@ -10,7 +10,7 @@ net.anwiba.commons.tools anwiba-commons-tools - 1.0.24 + 1.0.25 diff --git a/commons/tools/Tools_Icons/pom.xml b/commons/tools/Tools_Icons/pom.xml index 8f3d13c6..cdd5db12 100644 --- a/commons/tools/Tools_Icons/pom.xml +++ b/commons/tools/Tools_Icons/pom.xml @@ -11,7 +11,7 @@ net.anwiba.commons.tools anwiba-commons-tools - 1.0.24 + 1.0.25 @@ -35,13 +35,13 @@ net.anwiba.commons anwiba-commons-resource - 1.0.24 + 1.0.25 net.anwiba.commons anwiba-commons-utilities - 1.0.24 + 1.0.25 diff --git a/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/ant/icons/GuiIconsGeneratorTask.java b/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/ant/icons/GuiIconsGeneratorTask.java index a376ead8..4608a40c 100644 --- a/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/ant/icons/GuiIconsGeneratorTask.java +++ b/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/ant/icons/GuiIconsGeneratorTask.java @@ -19,6 +19,10 @@ import java.util.List; import java.util.Map; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; + import net.anwiba.tools.icons.configuration.GuiIconConfigurationsReader; import net.anwiba.tools.icons.configuration.IImageExistsValidator; import net.anwiba.tools.icons.configuration.IOutput; @@ -28,10 +32,6 @@ import net.anwiba.tools.icons.configuration.generated.Class; import net.anwiba.tools.icons.generator.GuiIconsClassWriter; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; - @SuppressWarnings("nls") public class GuiIconsGeneratorTask extends Task { @@ -161,7 +161,12 @@ public void execute() throws BuildException { } try (FileWriter fileWriter = new FileWriter(targetFile)) { this.output.info(MessageFormat.format("write file: {0}", targetFile.getCanonicalPath())); //$NON-NLS-1$ - try (GuiIconsClassWriter writer = new GuiIconsClassWriter(fileWriter, this.iconClass, targetClazz, this.output)) { + try (GuiIconsClassWriter writer = new GuiIconsClassWriter( + fileWriter, + this.iconClass, + targetClazz, + "// Copyright (c) ${year} by Andreas W. Bartels (bartels@anwiba.net)\n", //$NON-NLS-1$ + this.output)) { final Map iconConfigurations = reader.getIconConfigurations(); final Map folders = reader.getFolders(); writer.write(folders, iconConfigurations); diff --git a/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/maven/icons/GuiIconsGeneratorMojo.java b/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/maven/icons/GuiIconsGeneratorMojo.java index 405a6112..2cf7cfe6 100644 --- a/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/maven/icons/GuiIconsGeneratorMojo.java +++ b/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/generator/maven/icons/GuiIconsGeneratorMojo.java @@ -18,14 +18,6 @@ import java.util.List; import java.util.Map; -import net.anwiba.tools.icons.configuration.GuiIconConfigurationsReader; -import net.anwiba.tools.icons.configuration.IImageExistsValidator; -import net.anwiba.tools.icons.configuration.IOutput; -import net.anwiba.tools.icons.configuration.IconResource; -import net.anwiba.tools.icons.configuration.ImageExistsValidator; -import net.anwiba.tools.icons.configuration.generated.Class; -import net.anwiba.tools.icons.generator.GuiIconsClassWriter; - import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -35,6 +27,15 @@ import org.apache.maven.project.MavenProject; import org.sonatype.plexus.build.incremental.BuildContext; +import net.anwiba.commons.ensure.Ensure; +import net.anwiba.tools.icons.configuration.GuiIconConfigurationsReader; +import net.anwiba.tools.icons.configuration.IImageExistsValidator; +import net.anwiba.tools.icons.configuration.IOutput; +import net.anwiba.tools.icons.configuration.IconResource; +import net.anwiba.tools.icons.configuration.ImageExistsValidator; +import net.anwiba.tools.icons.configuration.generated.Class; +import net.anwiba.tools.icons.generator.GuiIconsClassWriter; + @SuppressWarnings("nls") @Mojo(name = "generate") public class GuiIconsGeneratorMojo extends AbstractMojo { @@ -51,6 +52,9 @@ public class GuiIconsGeneratorMojo extends AbstractMojo { @Parameter(defaultValue = "net.anwiba.commons.swing.icon.GuiIcon") private String iconClass; + @Parameter(defaultValue = "") + private String comment; + @Component private BuildContext buildContext; @@ -74,6 +78,11 @@ public void setSource(final String source) throws IOException { this.sourceFile = getFile(source); } + public void setComment(final String comment) { + Ensure.ensureArgumentNotNull(comment); + this.comment = comment; + } + public void setOutputDirectory(final String outputDirectory) throws IOException { if (outputDirectory == null || outputDirectory.trim().length() == 0) { this.outputDirectory = null; @@ -160,6 +169,7 @@ public void error(final String message) { reader.add(this.sourceFile); final Class targetClazz = reader.getClazz(); getLog().info("class: " + targetClazz.getName()); + getLog().info("comment: " + this.comment); final File targetFile = createTargetFile(targetClazz); if (!targetFile.exists()) { getLog().info(MessageFormat.format("create file: {0}", targetFile.getCanonicalPath())); //$NON-NLS-1$ @@ -168,16 +178,19 @@ public void error(final String message) { getLog().info(MessageFormat.format("create class: {0}", this.iconClass)); targetFile.createNewFile(); try (FileWriter fileWriter = new FileWriter(targetFile)) { - try (GuiIconsClassWriter writer = new GuiIconsClassWriter(fileWriter, getClass(this.iconClass == null - ? "net.anwiba.commons.swing.icon.GuiIcon" - : this.iconClass), targetClazz, output)) { + try (GuiIconsClassWriter writer = new GuiIconsClassWriter( + fileWriter, + getClass(this.iconClass == null ? "net.anwiba.commons.swing.icon.GuiIcon" : this.iconClass), + targetClazz, + this.comment, + output)) { final Map iconConfigurations = reader.getIconConfigurations(); final Map folders = reader.getFolders(); writer.write(folders, iconConfigurations); } } } catch (final Exception exception) { - getLog().warn(exception); + getLog().error(exception); throw new MojoExecutionException("Internal exception", exception); //$NON-NLS-1$ } } @@ -212,13 +225,16 @@ private String extractPackageName(final String absoluteClassName) { return absoluteClassName.substring(0, index); } - private File createTargetFile(final Class targetClazz) { + private File createTargetFile(final Class targetClazz) throws IOException { final String fileName = getFileName(targetClazz); if (fileName == null) { throw new IllegalArgumentException("no file target"); } if (this.outputDirectory == null) { - return new File(new File(getBasePath(), "target/generated/java"), fileName); + this.outputDirectory = getFile("target/generated/java"); + } + if (!(this.outputDirectory.exists() || this.outputDirectory.mkdirs())) { + throw new IllegalStateException("missing output directory"); //$NON-NLS-1$ } return new File(this.outputDirectory, fileName); } diff --git a/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/icons/generator/GuiIconsClassWriter.java b/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/icons/generator/GuiIconsClassWriter.java index 944c2ef5..598ee3d8 100644 --- a/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/icons/generator/GuiIconsClassWriter.java +++ b/commons/tools/Tools_Icons/src/main/java/net/anwiba/tools/icons/generator/GuiIconsClassWriter.java @@ -8,12 +8,12 @@ * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * + * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * . @@ -21,18 +21,24 @@ */ package net.anwiba.tools.icons.generator; +import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; +import java.io.StringReader; import java.io.Writer; import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import net.anwiba.commons.lang.functional.ResolvingException; +import net.anwiba.commons.utilities.string.StringResolverBuilder; +import net.anwiba.commons.utilities.string.StringUtilities; import net.anwiba.tools.icons.configuration.IIconSizesConfiguration; import net.anwiba.tools.icons.configuration.IOutput; import net.anwiba.tools.icons.configuration.IconResource; @@ -40,75 +46,81 @@ public class GuiIconsClassWriter implements Closeable { + private boolean isInitialized; + private boolean isClosed; private final Writer writer; private final Class targetClass; private final Class iconClass; private final IOutput output; + private final String comment; - public GuiIconsClassWriter(final Writer writer, final Class iconClass, final Class targetClass, final IOutput output) { + public GuiIconsClassWriter( + final Writer writer, + final Class iconClass, + final Class targetClass, + final String comment, + final IOutput output) { this.writer = writer; this.iconClass = iconClass; this.targetClass = targetClass; + this.comment = comment; this.output = output; } public void write(final Map folders, final Map configuration) throws IOException { + if (this.isClosed) { + throw new IOException("writer is closed"); //$NON-NLS-1$ + } + if (!this.isInitialized) { + initialize(); + } + final Set set = configuration.keySet(); final String[] names = set.toArray(new String[set.size()]); Arrays.sort(names); - this.writer - .append(MessageFormat - .format( - "// Copyright (c) {0} by Andreas W. Bartels (bartels@anwiba.net)\n", new SimpleDateFormat("yyyy").format(new Date()))); //$NON-NLS-1$//$NON-NLS-2$ - this.writer.append(MessageFormat.format("package {0};\n", this.targetClass.getPackage())); //$NON-NLS-1$ - this.writer.append("\n"); //$NON-NLS-1$ - this.writer - .append(MessageFormat.format("import {0}.{1};\n", this.iconClass.getPackage(), this.iconClass.getName())); //$NON-NLS-1$ - this.writer.append("import net.anwiba.commons.swing.icon.IconSize;\n"); //$NON-NLS-1$ - this.writer.append("\n"); //$NON-NLS-1$ - this.writer.append("@SuppressWarnings(\"nls\")\n"); //$NON-NLS-1$ - this.writer.append(MessageFormat.format("public class {0} '{\n", this.targetClass.getName())); //$NON-NLS-1$ - this.writer.append("\n"); //$NON-NLS-1$ for (final Map.Entry folder : folders.entrySet()) { - this.writer.append(MessageFormat.format( - " private final static String {0} = \"{1}\";\n", folder.getValue(), folder.getKey())); //$NON-NLS-1$ + this.writer.append( + MessageFormat.format(" private final static String {0} = \"{1}\";\n", folder.getValue(), folder.getKey())); //$NON-NLS-1$ } this.writer.append("\n"); //$NON-NLS-1$ final List referencingNames = new ArrayList<>(); for (final String name : names) { final IconResource iconResource = configuration.get(name); - if (Arrays.equals(new Object[]{ this.targetClass.getPackage(), this.targetClass.getName() }, new Object[]{ - iconResource.getClazz().getPackage(), - iconResource.getClazz().getName() })) { + if (Arrays.equals( + new Object[]{ this.targetClass.getPackage(), this.targetClass.getName() }, + new Object[]{ iconResource.getClazz().getPackage(), iconResource.getClazz().getName() })) { if (iconResource.getReference() != null) { referencingNames.add(name); continue; } final IIconSizesConfiguration iconSizesConfiguration = iconResource.getIconSizesConfiguration(); this.output.info("add icon '" + name + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - this.writer.append(MessageFormat.format(" public final static {0} {1} = new GuiIcon( //\n" //$NON-NLS-1$ - + " IconSize.create({3},\"{4}/{2}\",{5}),\n" //$NON-NLS-1$ - + " IconSize.create({3},\"{6}/{2}\",{7}),\n" //$NON-NLS-1$ - + " IconSize.create({3},\"{8}/{2}\",{9}),\n" //$NON-NLS-1$ - + " {10});\n", //$NON-NLS-1$ - this.iconClass.getName(), - name, - iconResource.getImage(), - getParentPath(folders.get(iconSizesConfiguration.getFolder())), - iconSizesConfiguration.small().path(), - String.valueOf(iconSizesConfiguration.small().size()), - iconSizesConfiguration.medium().path(), - String.valueOf(iconSizesConfiguration.medium().size()), - iconSizesConfiguration.large().path(), - String.valueOf(iconSizesConfiguration.large().size()), - String.valueOf(iconResource.isDecorator()))); + this.writer.append( + MessageFormat.format( + " public final static {0} {1} = new GuiIcon( //\n" //$NON-NLS-1$ + + " IconSize.create({3},\"{4}/{2}\",{5}),\n" //$NON-NLS-1$ + + " IconSize.create({3},\"{6}/{2}\",{7}),\n" //$NON-NLS-1$ + + " IconSize.create({3},\"{8}/{2}\",{9}),\n" //$NON-NLS-1$ + + " {10});\n", //$NON-NLS-1$ + this.iconClass.getName(), + name, + iconResource.getImage(), + getParentPath(folders.get(iconSizesConfiguration.getFolder())), + iconSizesConfiguration.small().path(), + String.valueOf(iconSizesConfiguration.small().size()), + iconSizesConfiguration.medium().path(), + String.valueOf(iconSizesConfiguration.medium().size()), + iconSizesConfiguration.large().path(), + String.valueOf(iconSizesConfiguration.large().size()), + String.valueOf(iconResource.isDecorator()))); continue; } this.output.info("add icon '" + name + "'"); //$NON-NLS-1$ //$NON-NLS-2$ if (iconResource.getReference() != null) { - this.writer.append(MessageFormat.format(" public final static {0} {1} = {2}.{3}.{4};\n", //$NON-NLS-1$ + this.writer.append(MessageFormat.format( + " public final static {0} {1} = {2}.{3}.{4};\n", //$NON-NLS-1$ this.iconClass.getName(), name, iconResource.getClazz().getPackage(), @@ -116,7 +128,8 @@ public void write(final Map folders, final Map folders, final Map lines = reader.lines().iterator(); + while (lines.hasNext()) { + this.writer.append("// "); //$NON-NLS-1$ + this.writer.append(lines.next()); + } + } + this.writer.append("\n"); //$NON-NLS-1$ + } + } + this.writer.append(MessageFormat.format("package {0};\n", this.targetClass.getPackage())); //$NON-NLS-1$ + this.writer.append("\n"); //$NON-NLS-1$ + this.writer + .append(MessageFormat.format("import {0}.{1};\n", this.iconClass.getPackage(), this.iconClass.getName())); //$NON-NLS-1$ + this.writer.append("import net.anwiba.commons.swing.icon.IconSize;\n"); //$NON-NLS-1$ + this.writer.append("\n"); //$NON-NLS-1$ + this.writer.append("@SuppressWarnings(\"nls\")\n"); //$NON-NLS-1$ + this.writer.append(MessageFormat.format("public class {0} '{\n", this.targetClass.getName())); //$NON-NLS-1$ + this.writer.append("\n"); //$NON-NLS-1$ + this.isInitialized = true; + } + + public String resolve(final String string) { + try { + return new StringResolverBuilder() + .add("year", new SimpleDateFormat("yyyy").format(new Date())) //$NON-NLS-1$//$NON-NLS-2$ + .build() + .resolve(string); + } catch (final ResolvingException exception) { + this.output.warn(exception.getMessage()); + return string; + } + } + private Object getParentPath(final String folder) { return folder == null ? "\"icons/\"" : "\"icons/\"+" + folder + "+\"/\""; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } @Override public void close() throws IOException { - this.writer.close(); + if (this.isClosed) { + return; + } + try { + if (!this.isInitialized) { + initialize(); + } + this.writer.append("\n"); //$NON-NLS-1$ + this.writer.append("}\n"); //$NON-NLS-1$ + this.writer.flush(); + this.writer.close(); + } finally { + this.isClosed = true; + } } } diff --git a/commons/tools/Tools_Icons/src/test/java/net/anwiba/tools/ant/icon/generator/test/GuiIconsClassWriterTest.java b/commons/tools/Tools_Icons/src/test/java/net/anwiba/tools/ant/icon/generator/test/GuiIconsClassWriterTest.java index 3767198d..80d0d74c 100644 --- a/commons/tools/Tools_Icons/src/test/java/net/anwiba/tools/ant/icon/generator/test/GuiIconsClassWriterTest.java +++ b/commons/tools/Tools_Icons/src/test/java/net/anwiba/tools/ant/icon/generator/test/GuiIconsClassWriterTest.java @@ -38,34 +38,39 @@ public void write() throws IOException { final StringWriter stringWriter = new StringWriter(); final Class iconClass = getIconClass(); final Class targetClass = getTargetClass(); - try (GuiIconsClassWriter classWriter = new GuiIconsClassWriter(stringWriter, iconClass, targetClass, new IOutput() { - - @Override - public void warn(final String message) { - System.err.println(message); - } - - @Override - public void info(final String message) { - System.out.println(message); - } - - @Override - public void error(final String message) { - System.err.println(message); - } - - @Override - public void error(String message, Throwable throwable) { - System.err.println(message); - throwable.printStackTrace(System.err); - } - })) { + try (GuiIconsClassWriter classWriter = new GuiIconsClassWriter( + stringWriter, + iconClass, + targetClass, + "// Copyright (c) ${year} by Andreas W. Bartels (bartels@anwiba.net)\n", //$NON-NLS-1$ + new IOutput() { + + @Override + public void warn(final String message) { + System.err.println(message); + } + + @Override + public void info(final String message) { + System.out.println(message); + } + + @Override + public void error(final String message) { + System.err.println(message); + } + + @Override + public void error(String message, Throwable throwable) { + System.err.println(message); + throwable.printStackTrace(System.err); + } + })) { final HashMap folders = new HashMap<>(); folders.put("misc", "MISC"); //$NON-NLS-1$//$NON-NLS-2$ classWriter.write(folders, getConfiguration(targetClass)); - assertThat(stringWriter.toString(), equalTo(getClassText())); } + assertThat(stringWriter.toString(), equalTo(getClassText())); } private Class getTargetClass() { diff --git a/commons/tools/pom.xml b/commons/tools/pom.xml index 95a6962d..7b6d7437 100644 --- a/commons/tools/pom.xml +++ b/commons/tools/pom.xml @@ -14,7 +14,7 @@ net.anwiba.commons anwiba-commons-maven-default - 1.0.24 + 1.0.25 diff --git a/eclipse/Eclipse_Commons/META-INF/MANIFEST.MF b/eclipse/Eclipse_Commons/META-INF/MANIFEST.MF index 66fb6ac3..3aadad13 100644 --- a/eclipse/Eclipse_Commons/META-INF/MANIFEST.MF +++ b/eclipse/Eclipse_Commons/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Version: 1.0.24 +Bundle-Version: 1.0.25 Bundle-Vendor: Andreas Bartels Bundle-Name: Commons Bundle-SymbolicName: net.anwiba.eclipse.commons;singleton:=true diff --git a/eclipse/Eclipse_Commons/pom.xml b/eclipse/Eclipse_Commons/pom.xml index d659e54b..c9d4c68a 100644 --- a/eclipse/Eclipse_Commons/pom.xml +++ b/eclipse/Eclipse_Commons/pom.xml @@ -12,7 +12,7 @@ net.anwiba.eclipse anwiba-eclipse-maven-default - 1.0.24 + 1.0.25 diff --git a/eclipse/Eclipse_Distribution/pom.xml b/eclipse/Eclipse_Distribution/pom.xml index e69683b0..ef887ba2 100644 --- a/eclipse/Eclipse_Distribution/pom.xml +++ b/eclipse/Eclipse_Distribution/pom.xml @@ -12,7 +12,7 @@ net.anwiba.eclipse anwiba-eclipse-maven-default - 1.0.24 + 1.0.25 diff --git a/eclipse/Eclipse_Icons/.classpath b/eclipse/Eclipse_Icons/.classpath index f2b26157..ff4fb8a4 100644 --- a/eclipse/Eclipse_Icons/.classpath +++ b/eclipse/Eclipse_Icons/.classpath @@ -8,16 +8,6 @@ - - - - - - - - - - - + diff --git a/eclipse/Eclipse_Icons/META-INF/MANIFEST.MF b/eclipse/Eclipse_Icons/META-INF/MANIFEST.MF index ccf496be..fa5a010f 100644 --- a/eclipse/Eclipse_Icons/META-INF/MANIFEST.MF +++ b/eclipse/Eclipse_Icons/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Version: 1.0.24 +Bundle-Version: 1.0.25 Bundle-Vendor: Andreas W. Bartels Bundle-Name: GuiIcons Bundle-SymbolicName: net.anwiba.eclipse.icons;singleton:=true @@ -11,24 +11,17 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jdt.ui, org.eclipse.jface.text, org.eclipse.jdt.core, - net.anwiba.eclipse.commons;bundle-version="1.0.24" + net.anwiba.eclipse.commons;bundle-version="1.0.25" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.core.databinding.observable.list, org.eclipse.jface.databinding.viewers, org.eclipse.ui.texteditor, net.anwiba.commons.eclipse.utilities, - net.anwiba.commons.eclipse.logging + net.anwiba.commons.eclipse.logging, + net.anwiba.commons.lang.object, + net.anwiba.commons.model, + net.anwiba.commons.process.cancel, + net.anwiba.commons.utilities.string Bundle-ClassPath: ., - lib/anwiba-commons-ensure-1.0.24.jar, - lib/anwiba-commons-lang-1.0.24.jar, - lib/anwiba-commons-logging-1.0.24.jar, - lib/anwiba-commons-message-1.0.24.jar, - lib/anwiba-commons-model-1.0.24.jar, - lib/anwiba-commons-process-1.0.24.jar, - lib/anwiba-commons-reflaction-1.0.24.jar, - lib/anwiba-commons-resource-1.0.24.jar, - lib/anwiba-commons-utilities-1.0.24.jar, - lib/anwiba-tools-icons-1.0.24.jar, - lib/commons-lang3-3.4.jar, - lib/commons-logging-1.2.jar + lib/anwiba-tools-icons-1.0.25.jar diff --git a/eclipse/Eclipse_Icons/pom.xml b/eclipse/Eclipse_Icons/pom.xml index b20ce339..7f1f0d24 100644 --- a/eclipse/Eclipse_Icons/pom.xml +++ b/eclipse/Eclipse_Icons/pom.xml @@ -12,7 +12,7 @@ net.anwiba.eclipse anwiba-eclipse-maven-default - 1.0.24 + 1.0.25 @@ -22,11 +22,19 @@ + + + net.anwiba.eclipse + net.anwiba.eclipse.libraries + ${net.anwiba.commons.version} + + net.anwiba.eclipse net.anwiba.eclipse.commons ${net.anwiba.commons.version} + @@ -43,76 +51,6 @@ - - commons-logging - commons-logging - 1.2 - jar - commons-logging-1.2.jar - - - net.anwiba.commons - anwiba-commons-ensure - ${net.anwiba.commons.version} - jar - anwiba-commons-ensure-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-lang - ${net.anwiba.commons.version} - jar - anwiba-commons-lang-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-logging - ${net.anwiba.commons.version} - jar - anwiba-commons-logging-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-message - ${net.anwiba.commons.version} - jar - anwiba-commons-message-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-model - ${net.anwiba.commons.version} - jar - anwiba-commons-model-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-process - ${net.anwiba.commons.version} - jar - anwiba-commons-process-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-reflaction - ${net.anwiba.commons.version} - jar - anwiba-commons-reflaction-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-resource - ${net.anwiba.commons.version} - jar - anwiba-commons-resource-${net.anwiba.commons.version}.jar - - - net.anwiba.commons - anwiba-commons-utilities - ${net.anwiba.commons.version} - jar - anwiba-commons-utilities-${net.anwiba.commons.version}.jar - net.anwiba.commons.tools anwiba-tools-icons diff --git a/eclipse/Eclipse_Libraries/.classpath b/eclipse/Eclipse_Libraries/.classpath index 0f9c8749..72414f85 100644 --- a/eclipse/Eclipse_Libraries/.classpath +++ b/eclipse/Eclipse_Libraries/.classpath @@ -6,16 +6,15 @@ - - - - - - - - - - + + + + + + + + + diff --git a/eclipse/Eclipse_Libraries/META-INF/MANIFEST.MF b/eclipse/Eclipse_Libraries/META-INF/MANIFEST.MF index a06dee65..a6b5ed89 100644 --- a/eclipse/Eclipse_Libraries/META-INF/MANIFEST.MF +++ b/eclipse/Eclipse_Libraries/META-INF/MANIFEST.MF @@ -1,20 +1,19 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Version: 1.0.24 +Bundle-Version: 1.0.25 Bundle-Name: Libaries Bundle-SymbolicName: net.anwiba.eclipse.libraries;singleton:=true Bundle-Vendor: Andreas Bartels Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Bundle-ClassPath: lib/anwiba-commons-ensure-1.0.24.jar, - lib/anwiba-commons-lang-1.0.24.jar, - lib/anwiba-commons-logging-1.0.24.jar, - lib/anwiba-commons-message-1.0.24.jar, - lib/anwiba-commons-model-1.0.24.jar, - lib/anwiba-commons-process-1.0.24.jar, - lib/anwiba-commons-reflaction-1.0.24.jar, - lib/anwiba-commons-resource-1.0.24.jar, - lib/anwiba-commons-utilities-1.0.24.jar, - lib/anwiba-tools-graphml-1.0.24.jar, +Bundle-ClassPath: lib/anwiba-commons-ensure-1.0.25.jar, + lib/anwiba-commons-lang-1.0.25.jar, + lib/anwiba-commons-logging-1.0.25.jar, + lib/anwiba-commons-message-1.0.25.jar, + lib/anwiba-commons-model-1.0.25.jar, + lib/anwiba-commons-process-1.0.25.jar, + lib/anwiba-commons-reflaction-1.0.25.jar, + lib/anwiba-commons-resource-1.0.25.jar, + lib/anwiba-commons-utilities-1.0.25.jar, lib/commons-lang3-3.4.jar, lib/commons-logging-1.2.jar Eclipse-BuddyPolicy: dependent @@ -26,8 +25,5 @@ Export-Package: net.anwiba.commons.lang.stream, net.anwiba.commons.program, net.anwiba.commons.process.cancel, - net.anwiba.commons.model, - net.anwiba.tools.graphml.io, - net.anwiba.tools.graphml.utilities, - net.anwiba.tools.simple.graphml.generated, - net.anwiba.tools.yworks.shapenode.generated + net.anwiba.commons.model, + net.anwiba.commons.utilities.string diff --git a/eclipse/Eclipse_Libraries/pom.xml b/eclipse/Eclipse_Libraries/pom.xml index b03931c1..85b37e7f 100644 --- a/eclipse/Eclipse_Libraries/pom.xml +++ b/eclipse/Eclipse_Libraries/pom.xml @@ -13,7 +13,7 @@ net.anwiba.eclipse anwiba-eclipse-maven-default - 1.0.24 + 1.0.25 @@ -36,27 +36,6 @@ - - - - - - - - - - - - - - - - - - - - - commons-logging commons-logging @@ -127,13 +106,6 @@ jar anwiba-commons-utilities-${net.anwiba.commons.version}.jar - - net.anwiba.commons.tools - anwiba-tools-graphml - ${net.anwiba.commons.version} - jar - anwiba-tools-graphml-${net.anwiba.commons.version}.jar - lib diff --git a/eclipse/Eclipse_Project_Dependencies/.classpath b/eclipse/Eclipse_Project_Dependencies/.classpath index 0d4d74fe..41910598 100644 --- a/eclipse/Eclipse_Project_Dependencies/.classpath +++ b/eclipse/Eclipse_Project_Dependencies/.classpath @@ -7,5 +7,6 @@ + diff --git a/eclipse/Eclipse_Project_Dependencies/META-INF/MANIFEST.MF b/eclipse/Eclipse_Project_Dependencies/META-INF/MANIFEST.MF index 44bb2d3b..561214a4 100644 --- a/eclipse/Eclipse_Project_Dependencies/META-INF/MANIFEST.MF +++ b/eclipse/Eclipse_Project_Dependencies/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Version: 1.0.24 +Bundle-Version: 1.0.25 Bundle-Name: Dependencies Bundle-SymbolicName: net.anwiba.eclipse.project.dependencies;singleton:=true Bundle-Activator: net.anwiba.eclipse.project.dependency.plugin.DependenciesPlugin @@ -9,8 +9,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.jdt.core, org.eclipse.jface.databinding, - net.anwiba.eclipse.commons, - net.anwiba.eclipse.libraries + net.anwiba.eclipse.commons;bundle-version="1.0.25", + net.anwiba.eclipse.libraries;bundle-version="1.0.25" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: @@ -34,4 +34,5 @@ Import-Package: net.anwiba.commons.model, net.anwiba.commons.program, net.anwiba.commons.process.cancel -Bundle-ClassPath: . +Bundle-ClassPath: ., + lib/anwiba-tools-graphml-1.0.25.jar diff --git a/eclipse/Eclipse_Project_Dependencies/pom.xml b/eclipse/Eclipse_Project_Dependencies/pom.xml index 431912aa..22231ecc 100644 --- a/eclipse/Eclipse_Project_Dependencies/pom.xml +++ b/eclipse/Eclipse_Project_Dependencies/pom.xml @@ -12,7 +12,7 @@ net.anwiba.eclipse anwiba-eclipse-maven-default - 1.0.24 + 1.0.25 @@ -47,4 +47,48 @@ + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + initialize + + copy + + + + + net.anwiba.commons.tools + anwiba-tools-graphml + ${net.anwiba.commons.version} + jar + anwiba-tools-graphml-${net.anwiba.commons.version}.jar + + + lib + + + + + + org.apache.maven.plugins + maven-clean-plugin + + + + lib + + *.jar + + + + + + + + diff --git a/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/runner/ListRunner.java b/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/runner/ListRunner.java index 27aa14a3..391802f3 100644 --- a/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/runner/ListRunner.java +++ b/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/runner/ListRunner.java @@ -51,6 +51,7 @@ import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; @@ -164,6 +165,16 @@ private List createItem(final IWorkspace workspace, final IJavaElement el items.add(type); } return items; + } else if (element instanceof IClassFile) { + final IClassFile classFile = (IClassFile) element; + final org.eclipse.jdt.core.IType eclipseType = classFile.findPrimaryType(); + if (eclipseType != null) { + final String qualifiedName = eclipseType.getFullyQualifiedName(); + final String root = classFile.getPath().toString(); + final IType type = workspace.getTypes().get(MessageFormat.format("{0}.{1}", root, qualifiedName)); //$NON-NLS-1$ + return Arrays.asList(type); + } + return new ArrayList<>(); } else if (element instanceof IPackageFragmentRoot) { final IPackageFragmentRoot packageFragment = (IPackageFragmentRoot) element; final String elementName = packageFragment.getPath().toString(); diff --git a/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/view/WorkspaceUtilities.java b/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/view/WorkspaceUtilities.java index 2e3f01c6..39865764 100644 --- a/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/view/WorkspaceUtilities.java +++ b/eclipse/Eclipse_Project_Dependencies/src/main/java/net/anwiba/eclipse/project/dependency/view/WorkspaceUtilities.java @@ -7,8 +7,11 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jdt.core.IClassFile; +import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; @@ -35,6 +38,19 @@ public static List getProjects(final IProject seletedProject) { return openProjects; } + public static List getProjects() { + final List openProjects = new ArrayList<>(); + for (final org.eclipse.core.resources.IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { + if (project.isOpen()) { + final IJavaProject javaProject = JavaCore.create(project); + if (javaProject != null) { + openProjects.add(javaProject); + } + } + } + return openProjects; + } + public static List getTypes(final IType type) { final ILibrary library = type.getPackage().getLibrary(); final List eclipseTypes = new ArrayList<>(); @@ -44,7 +60,39 @@ public static List getTypes(final IType type) { try { final String qualifiedName = type.getQualifiedName(); final org.eclipse.jdt.core.IType foundedType = javaProject.findType(qualifiedName); - eclipseTypes.add(foundedType.getParent()); + if (foundedType != null) { + eclipseTypes.add(foundedType.getParent()); + } + } catch (final JavaModelException e) { + // nothing to do + } + } + } else { + library.getIdentifier(); + for (final IJavaProject javaProject : getProjects()) { + try { + final String libraryName = library.getName(); + final IPackageFragmentRoot[] packageFragmentRoots = javaProject.getAllPackageFragmentRoots(); + for (final IPackageFragmentRoot packageFragmentRoot : packageFragmentRoots) { + if (packageFragmentRoot instanceof JarPackageFragmentRoot) { + final String elementName = packageFragmentRoot.getPath().toString(); + if (Objects.equals(elementName, libraryName)) { + final IJavaElement[] children = packageFragmentRoot.getChildren(); + for (final IJavaElement javaElement : children) { + final IPackageFragment packageFragment = (IPackageFragment) javaElement; + for (final IClassFile classFile : packageFragment.getClassFiles()) { + final org.eclipse.jdt.core.IType eclipseType = classFile.findPrimaryType(); + final String fullyQualifiedName = eclipseType.getFullyQualifiedName(); + if (Objects.equals(type.getPath().getIdentifier(), fullyQualifiedName)) { + eclipseTypes.add(classFile); + return eclipseTypes; + } + } + } + } + } + packageFragmentRoot.exists(); + } } catch (final JavaModelException e) { // nothing to do } diff --git a/eclipse/pom.xml b/eclipse/pom.xml index 92349206..ca492ea6 100644 --- a/eclipse/pom.xml +++ b/eclipse/pom.xml @@ -13,7 +13,7 @@ net.anwiba anwiba-maven-default - 1.0.24 + 1.0.25 diff --git a/maven/pom.xml b/maven/pom.xml index e05e1759..1ee5ffc4 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -9,7 +9,7 @@ net.anwiba anwiba-maven-default pom - 1.0.24 + 1.0.25 2007 @@ -129,6 +129,7 @@ 512 64 UTF-8 + -Xlint:all,hiding,-unnecessary true true @@ -452,11 +453,11 @@ ${org.mockito.version} - - org.mockito - mockito-all - ${org.mockito.version} - + + + + + org.assertj @@ -470,11 +471,11 @@ ${apache.commons.codec.version} - - commons-httpclient - commons-httpclient - ${apache.commons.httpclient.version} - + + + + + org.apache.httpcomponents @@ -500,6 +501,12 @@ ${log4j.version} + + commons-lang + commons-lang + 2.6 + + commons-logging commons-logging @@ -513,7 +520,7 @@ - dom4j + org.dom4j dom4j ${dom4j.version} @@ -531,6 +538,18 @@ ${groovy.version} + + org.codehaus.groovy + groovy-json + ${groovy.version} + + + + org.codehaus.groovy + groovy-sql + ${groovy.version} + + org.antlr antlr4-runtime @@ -567,6 +586,31 @@ ${com.fasterxml.jackson.version} + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${com.fasterxml.jackson.version} + + + + + + + + + + javax.xml.stream + stax-api + 1.0-2 + compile + + + + com.kjetland + mbknor-jackson-jsonschema_2.12 + 1.0.15 + + org.sonatype.plexus plexus-build-api @@ -661,7 +705,7 @@ - postgresql + org.postgresql postgresql ${postgresql.version} @@ -735,13 +779,19 @@ org.eclipse.jetty jetty-server - 9.2.8.v20150217 + 9.4.4.v20170414 + + + + com.healthmarketscience.jackcess + jackcess + 2.1.6 org.ehcache ehcache - 3.1.3 + 3.3.1 @@ -750,9 +800,9 @@ UTF-8 - 1.0.24 + 1.0.25 https://github.com/AndreasWBartels - 1.0.24 + 1.0.25 scm:git:ssh://github.com:AndreasWBartels ${url.net.anwiba}/libraries/tree/master @@ -760,30 +810,33 @@ 1.8 1.2 - 1.9 + 1.10 3.1 - 1.0.10 + 1.3.0 - 2.8.5 + 2.8.8 2.6 - 2.2.7 + 2.2.11 12.1.0.2 9.3.2 1.6.0 - 1.6.1 - 2.4.5 + 2.0.0 + 2.4.10 1.1.3 - 1.1.4 + 1.1.6 4.12 1.2.17 12.1.0.1b 3.5.2 - 4.5.3 + 4.7 1.9.7 - 4.5.2 + 4.5.3 10.12.1.1 2.0 + 3.5 + 3.3.9 + 2.2.1 2.3.2 2.10 2.4 @@ -793,8 +846,8 @@ 2.13 2.1.2 3.3 - 1.6.1 - 1.54 + 3.6.2 + 1.56 1.9.11 2.5.2 4.5 @@ -802,16 +855,16 @@ 1.3.1 0.13.1 2.2.1 - 1.9.5 - 2.2.0 + 2.7.22 + 2.2.1 0.0.7 0.11.1 3.8.4.3 3.8.0 3.8.2 - 9.1-901.jdbc4 - 1.3.04 + 9.4.1212 + 2.0.2