Initial application skeleton and build script

master
Marco Maccaferri 2018-12-17 20:25:17 +01:00
rodzic 29df7a80e0
commit 441a344dcf
67 zmienionych plików z 1502 dodań i 0 usunięć

22
.classpath 100644
Wyświetl plik

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin-tests" path="src-tests"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/org.eclipse.swt.gtk.linux.x86_64_3.104.2.v20160212-1350.jar" sourcepath="lib/org.eclipse.swt.gtk.linux.x86_64.source_3.104.2.v20160212-1350.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.core.commands_3.7.0.v20150422-0725.jar" sourcepath="lib/org.eclipse.core.commands.source_3.7.0.v20150422-0725.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.core.databinding_1.5.0.v20150422-0725.jar" sourcepath="lib/org.eclipse.core.databinding.source_1.5.0.v20150422-0725.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.core.databinding.beans_1.3.0.v20150422-0725.jar" sourcepath="lib/org.eclipse.core.databinding.beans.source_1.3.0.v20150422-0725.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.core.databinding.observable_1.5.0.v20150422-0725.jar" sourcepath="lib/org.eclipse.core.databinding.observable.source_1.5.0.v20150422-0725.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.core.databinding.property_1.5.0.v20150422-0725.jar" sourcepath="lib/org.eclipse.core.databinding.property.source_1.5.0.v20150422-0725.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.equinox.common_3.7.0.v20150402-1709.jar" sourcepath="lib/org.eclipse.equinox.common.source_3.7.0.v20150402-1709.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.jface_3.11.1.v20160128-1644.jar" sourcepath="lib/org.eclipse.jface.source_3.11.1.v20160128-1644.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.jface.databinding_1.7.0.v20150406-2148.jar" sourcepath="lib/org.eclipse.jface.databinding.source_1.7.0.v20150406-2148.jar"/>
<classpathentry kind="lib" path="lib/jackson-annotations-2.7.0.jar"/>
<classpathentry kind="lib" path="lib/jackson-core-2.7.0.jar"/>
<classpathentry kind="lib" path="lib/jackson-databind-2.7.0.jar"/>
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar" sourcepath="lib/jssc-2.8.0-src.jar"/>
<classpathentry kind="lib" path="lib/org.easymock_2.4.0.v20090202-0900.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
.project 100644
Wyświetl plik

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>z80-tools</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

210
LICENSE 100644
Wyświetl plik

@ -0,0 +1,210 @@
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates' from
a Contributor if it was added to the Program by such Contributor itself or
anyone acting on such Contributor's behalf. Contributions do not include additions
to the Program which: (i) are separate modules of software distributed in
conjunction with the Program under their own license agreement, and (ii) are
not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement, including
all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce,
prepare derivative works of, publicly display, publicly perform, distribute
and sublicense the Contribution of such Contributor, if any, and such derivative
works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
Patents to make, use, sell, offer to sell, import and otherwise transfer the
Contribution of such Contributor, if any, in source code and object code form.
This patent license shall apply to the combination of the Contribution and
the Program if, at the time the Contribution is added by the Contributor,
such addition of the Contribution causes such combination to be covered by
the Licensed Patents. The patent license shall not apply to any other combinations
which include the Contribution. No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses
to its Contributions set forth herein, no assurances are provided by any Contributor
that the Program does not infringe the patent or other intellectual property
rights of any other entity. Each Contributor disclaims any liability to Recipient
for claims brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the rights and
licenses granted hereunder, each Recipient hereby assumes sole responsibility
to secure any other intellectual property rights needed, if any. For example,
if a third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license before
distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient copyright
rights in its Contribution, if any, to grant the copyright license set forth
in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of title
and non-infringement, and implied warranties or conditions of merchantability
and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for damages,
including direct, indirect, special, incidental and consequential damages,
such as lost profits;
iii) states that any provisions which differ from this Agreement are offered
by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such Contributor,
and informs licensees how to obtain it in a reasonable manner on or through
a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained within
the Program.
Each Contributor must identify itself as the originator of its Contribution,
if any, in a manner that reasonably allows subsequent Recipients to identify
the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor
who includes the Program in a commercial product offering should do so in
a manner which does not create potential liability for other Contributors.
Therefore, if a Contributor includes the Program in a commercial product offering,
such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
every other Contributor ("Indemnified Contributor") against any losses, damages
and costs (collectively "Losses") arising from claims, lawsuits and other
legal actions brought by a third party against the Indemnified Contributor
to the extent caused by the acts or omissions of such Commercial Contributor
in connection with its distribution of the Program in a commercial product
offering. The obligations in this section do not apply to any claims or Losses
relating to any actual or alleged intellectual property infringement. In order
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
Contributor in writing of such claim, and b) allow the Commercial Contributor
to control, and cooperate with the Commercial Contributor in, the defense
and any related settlement negotiations. The Indemnified Contributor may participate
in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers warranties
related to Product X, those performance claims and warranties are such Commercial
Contributor's responsibility alone. Under this section, the Commercial Contributor
would have to defend claims against the other Contributors related to those
performance claims and warranties, and if a court requires any other Contributor
to pay any damages as a result, the Commercial Contributor must pay those
damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS
OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Each Recipient is solely responsible for determining the appropriateness of
using and distributing the Program and assumes all risks associated with its
exercise of rights under this Agreement, including but not limited to the
risks and costs of program errors, compliance with applicable laws, damage
to or loss of data, programs or equipment, and unavailability or interruption
of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under applicable
law, it shall not affect the validity or enforceability of the remainder of
the terms of this Agreement, and without further action by the parties hereto,
such provision shall be reformed to the minimum extent necessary to make such
provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
(excluding combinations of the Program with other software or hardware) infringes
such Recipient's patent(s), then such Recipient's rights granted under Section
2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and
does not cure such failure in a reasonable period of time after becoming aware
of such noncompliance. If all Recipient's rights under this Agreement terminate,
Recipient agrees to cease use and distribution of the Program as soon as reasonably
practicable. However, Recipient's obligations under this Agreement and any
licenses granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but
in order to avoid inconsistency the Agreement is copyrighted and may only
be modified in the following manner. The Agreement Steward reserves the right
to publish new versions (including revisions) of this Agreement from time
to time. No one other than the Agreement Steward has the right to modify this
Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse
Foundation may assign the responsibility to serve as the Agreement Steward
to a suitable separate entity. Each new version of the Agreement will be given
a distinguishing version number. The Program (including Contributions) may
always be distributed subject to the version of the Agreement under which
it was received. In addition, after a new version of the Agreement is published,
Contributor may elect to distribute the Program (including its Contributions)
under the new version. Except as expressly stated in Sections 2(a) and 2(b)
above, Recipient receives no rights or licenses to the intellectual property
of any Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted under
this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the intellectual
property laws of the United States of America. No party to this Agreement
will bring a legal action under this Agreement more than one year after the
cause of action arose. Each party waives its rights to a jury trial in any
resulting litigation.

Wyświetl plik

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/z80-tools/build.xml"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="z80-tools"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/z80-tools/build.xml}"/>
<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
</launchConfiguration>

14
Z80 Tools.launch 100644
Wyświetl plik

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/z80-tools/src/com/maccasoft/tools/Application.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.environmentVariables">
<mapEntry key="UBUNTU_MENUPROXY" value="0"/>
</mapAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.maccasoft.tools.Application"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="z80-tools"/>
</launchConfiguration>

224
build.xml 100644
Wyświetl plik

@ -0,0 +1,224 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build">
<tstamp>
<format property="timestamp" pattern="yyyyMMdd-HHmm"/>
</tstamp>
<property name="app" value="swtapp"/>
<property name="version" value="0.0.0"/>
<property name="folder" value="z80-tools"/>
<property name="mac-folder" value="Z80 Tools"/>
<property name="package" value="com.maccasoft.tools_${version}.v${timestamp}"/>
<property name="work" value="build/work"/>
<property name="launch4j.dir" location="/opt/launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<property name="bundleapp.dir" location="build/macosx" />
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="${bundleapp.dir}/appbundler-1.0.jar" />
<target name="build">
<antcall target="build-linux64" />
<antcall target="build-windows" />
<antcall target="build-windows64" />
<antcall target="build-macosx" />
</target>
<!-- Linux x86/64 -->
<target name="build-linux64">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.gtk.linux.x86_64_3.104.2.v20160212-1350.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib">
<fileset file="lib/org.eclipse.swt.gtk.linux.x86_64_3.104.2.v20160212-1350.jar"/>
<fileset file="build/linux/desktop.template" />
</copy>
<copy todir="${work}/${folder}/lib/icons">
<fileset dir="build/linux/icons" />
</copy>
<copy todir="${work}/${folder}">
<fileset file="build/linux/launcher" />
<fileset file="build/linux/launcher.png" />
<fileset file="build/linux/install.sh" />
<fileset file="build/linux/uninstall.sh" />
</copy>
<chmod file="${work}/${folder}/launcher" perm="755"/>
<chmod file="${work}/${folder}/install.sh" perm="755"/>
<chmod file="${work}/${folder}/uninstall.sh" perm="755"/>
<exec executable="tar" dir="${work}" failonerror="true">
<arg value="czf"/>
<arg value="../${folder}-linux64-${version}.tar.gz"/>
<arg value="${folder}"/>
</exec>
</target>
<!-- Windows x86 -->
<target name="build-windows">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.win32.win32.x86_3.104.2.v20160212-1350.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib">
<fileset file="lib/org.eclipse.swt.win32.win32.x86_3.104.2.v20160212-1350.jar"/>
</copy>
<copy todir="${work}/${folder}">
<fileset file="build/windows/launcher.l4j.ini" />
</copy>
<launch4j configFile="build/windows/config.xml"
outfile="${work}/${folder}/launcher.exe"
fileVersion="${version}.0"
txtFileVersion="${version}.0"
productVersion="${version}.0"
txtProductVersion="${version}.0" />
<exec executable="zip" dir="${work}" failonerror="true">
<arg value="-q"/>
<arg value="-r"/>
<arg value="../${folder}-windows-${version}.zip"/>
<arg value="${folder}"/>
</exec>
</target>
<!-- Windows x86/64 -->
<target name="build-windows64">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.win32.win32.x86_64_3.104.2.v20160212-1350.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib">
<fileset file="lib/org.eclipse.swt.win32.win32.x86_64_3.104.2.v20160212-1350.jar"/>
</copy>
<copy todir="${work}/${folder}">
<fileset file="build/windows/launcher.l4j.ini" />
</copy>
<launch4j configFile="build/windows/config64.xml"
outfile="${work}/${folder}/launcher.exe"
fileVersion="${version}.0"
txtFileVersion="${version}.0"
productVersion="${version}.0"
txtProductVersion="${version}.0" />
<exec executable="zip" dir="${work}" failonerror="true">
<arg value="-q"/>
<arg value="-r"/>
<arg value="../${folder}-windows64-${version}.zip"/>
<arg value="${folder}"/>
</exec>
</target>
<!-- MacOS/X -->
<target name="build-macosx">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.cocoa.macosx.x86_64_3.104.2.v20160212-1350.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib" file="lib/org.eclipse.swt.cocoa.macosx.x86_64_3.104.2.v20160212-1350.jar"/>
<bundleapp
outputdirectory="${work}"
name="${mac-folder}"
displayname="${mac-folder}"
identifier="com.maccasoft.tools"
icon="build/macosx/app.icns"
shortversion="${version}"
signature="????"
copyright="Marco Maccaferri"
applicationCategory="public.app-category.development"
mainclassname="com.maccasoft.tools.Application">
<classpath file="${work}/${folder}/lib/*.jar"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Xms128M"/>
<option value="-Xmx512M"/>
</bundleapp>
<copy todir="${work}/${mac-folder}.app/Contents/Java" includeemptydirs="false">
<fileset dir="${work}/${folder}" excludes="**/*.jar" />
</copy>
<exec executable="tar" dir="${work}" failonerror="true">
<arg value="czf"/>
<arg value="../${folder}-macosx-${version}.tar.gz"/>
<arg value="${mac-folder}.app"/>
</exec>
</target>
<path id="lib.path.ref">
<pathelement location="lib/org.eclipse.core.commands_3.7.0.v20150422-0725.jar"/>
<pathelement location="lib/org.eclipse.core.databinding_1.5.0.v20150422-0725.jar"/>
<pathelement location="lib/org.eclipse.core.databinding.beans_1.3.0.v20150422-0725.jar"/>
<pathelement location="lib/org.eclipse.core.databinding.observable_1.5.0.v20150422-0725.jar"/>
<pathelement location="lib/org.eclipse.core.databinding.property_1.5.0.v20150422-0725.jar"/>
<pathelement location="lib/org.eclipse.equinox.common_3.7.0.v20150402-1709.jar"/>
<pathelement location="lib/org.eclipse.jface_3.11.1.v20160128-1644.jar"/>
<pathelement location="lib/org.eclipse.jface.databinding_1.7.0.v20150406-2148.jar"/>
<pathelement location="lib/org.eclipse.jface.text_3.10.0.v20150603-1752.jar"/>
</path>
<target name="copy-common-files">
<jar destfile="${work}/${folder}/lib/${package}.jar">
<fileset dir="${work}/bin"/>
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</jar>
<copy todir="${work}/${folder}/lib">
<fileset dir="lib" includes="org.eclipse.core.commands_3.7.0.v20150422-0725.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding_1.5.0.v20150422-0725.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding.beans_1.3.0.v20150422-0725.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding.observable_1.5.0.v20150422-0725.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding.property_1.5.0.v20150422-0725.jar"/>
<fileset dir="lib" includes="org.eclipse.equinox.common_3.7.0.v20150402-1709.jar"/>
<fileset dir="lib" includes="org.eclipse.jface_3.11.1.v20160128-1644.jar"/>
<fileset dir="lib" includes="org.eclipse.jface.databinding_1.7.0.v20150406-2148.jar"/>
<fileset dir="lib" includes="org.eclipse.jface.text_3.10.0.v20150603-1752.jar"/>
</copy>
<copy todir="${work}/${folder}">
<fileset file="LICENSE"/>
</copy>
</target>
</project>

3
build/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,3 @@
work
*.tar.gz
*.zip

Wyświetl plik

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=Z80 Tools
GenericName=Z80 Tools
Comment=Z80 Development Tools
Exec=<BINARY_LOCATION>
Icon=<ICON_NAME>
Terminal=false
Categories=Development;IDE;

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.4 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 245 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 587 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 835 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.0 KiB

Wyświetl plik

@ -0,0 +1,178 @@
#!/bin/sh
# This script adds a menu item, icons and mime type for SWT Application for the
# current user. If possible, it will use the xdg-utils - or fall back to just
# creating and copying a desktop file to the user's dir.
# If called with the "-u" option, it will undo the changes.
# Resource name to use (including vendor prefix)
RESOURCE_NAME=maccasoft-z80tools
SCRIPT_NAME=launcher
# Get absolute path from which this script file was executed
# (Could be changed to "pwd -P" to resolve symlinks to their target)
SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
cd "${SCRIPT_PATH}"
# Default mode is to install.
UNINSTALL=false
# If possible, get location of the desktop folder. Default to ~/Desktop
XDG_DESKTOP_DIR="${HOME}/Desktop"
if [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/user-dirs.dirs" ]; then
. "${XDG_CONFIG_HOME:-${HOME}/.config}/user-dirs.dirs"
fi
# Install using xdg-utils
xdg_install_f() {
# Create a temp dir accessible by all users
TMP_DIR=`mktemp --directory`
# Create *.desktop file using the existing template file
sed -e "s,<BINARY_LOCATION>,${SCRIPT_PATH}/${SCRIPT_NAME},g" \
-e "s,<ICON_NAME>,${RESOURCE_NAME},g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop"
# Install the icon files using name and resolutions
xdg-icon-resource install --context apps --size 16 "${SCRIPT_PATH}/lib/icons/app16.png" $RESOURCE_NAME
xdg-icon-resource install --context apps --size 32 "${SCRIPT_PATH}/lib/icons/app32.png" $RESOURCE_NAME
xdg-icon-resource install --context apps --size 48 "${SCRIPT_PATH}/lib/icons/app48.png" $RESOURCE_NAME
xdg-icon-resource install --context apps --size 64 "${SCRIPT_PATH}/lib/icons/app64.png" $RESOURCE_NAME
# Install the created *.desktop file
xdg-desktop-menu install "${TMP_DIR}/${RESOURCE_NAME}.desktop"
# Clean up
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
rmdir "$TMP_DIR"
}
# Install by simply copying desktop file (fallback)
simple_install_f() {
# Create a temp dir accessible by all users
TMP_DIR=`mktemp --directory`
# Create *.desktop file using the existing template file
sed -e "s,<BINARY_LOCATION>,${SCRIPT_PATH}/${SCRIPT_NAME},g" \
-e "s,<ICON_NAME>,${SCRIPT_PATH}/${SCRIPT_NAME}.png,g" "${SCRIPT_PATH}/lib/desktop.template" > "${TMP_DIR}/${RESOURCE_NAME}.desktop"
mkdir -p "${HOME}/.local/share/applications"
cp "${TMP_DIR}/${RESOURCE_NAME}.desktop" "${HOME}/.local/share/applications/"
# Clean up temp dir
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
rmdir "${TMP_DIR}"
}
# Uninstall using xdg-utils
xdg_uninstall_f() {
# Remove *.desktop file
xdg-desktop-menu uninstall ${RESOURCE_NAME}.desktop
# Remove icon from desktop
xdg-desktop-icon uninstall ${RESOURCE_NAME}.desktop
# Remove icons
xdg-icon-resource uninstall --size 16 ${RESOURCE_NAME}
xdg-icon-resource uninstall --size 32 ${RESOURCE_NAME}
xdg-icon-resource uninstall --size 48 ${RESOURCE_NAME}
xdg-icon-resource uninstall --size 64 ${RESOURCE_NAME}
}
# Uninstall by simply removing desktop files (fallback), incl. old one
simple_uninstall_f() {
if [ -f "${HOME}/.local/share/applications/${RESOURCE_NAME}.desktop" ]; then
rm "${HOME}/.local/share/applications/${RESOURCE_NAME}.desktop"
fi
if [ -f "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop" ]; then
rm "${XDG_DESKTOP_DIR}/${RESOURCE_NAME}.desktop"
fi
}
# Update desktop file and mime databases (if possible)
updatedbs_f() {
if [ -d "${HOME}/.local/share/applications" ]; then
if command -v update-desktop-database > /dev/null; then
update-desktop-database "${HOME}/.local/share/applications"
fi
fi
}
# Check availability of xdg-utils
xdg_exists_f() {
if ! command -v xdg-icon-resource > /dev/null; then return 1; fi
if ! command -v xdg-desktop-menu > /dev/null; then return 1; fi
if ! command -v xdg-desktop-icon > /dev/null; then return 1; fi
return 0
}
# Shows a description of the available options
display_help_f() {
printf "\nThis script will add a SWT Application desktop shortcut, menu item,\n"
printf "icons and file associations for the current user.\n"
if ! xdg_exists_f; then
printf "\nxdg-utils are recommended to be installed, so this script can use them.\n"
fi
printf "\nOptional arguments are:\n\n"
printf "\t-u, --uninstall\t\tRemoves shortcut, menu item and icons.\n\n"
printf "\t-h, --help\t\tShows this help again.\n\n"
}
# Check for provided arguments
while [ $# -gt 0 ] ; do
ARG="${1}"
case $ARG in
-u|--uninstall)
UNINSTALL=true
shift
;;
-h|--help)
display_help_f
exit 0
;;
*)
printf "\nInvalid option -- '${ARG}'\n"
display_help_f
exit 1
;;
esac
done
# If possible, use xdg-utils, if not, use a more basic approach
if xdg_exists_f; then
if [ ${UNINSTALL} = true ]; then
printf "Removing desktop shortcut and menu item for SWT Application..."
xdg_uninstall_f
simple_uninstall_f
else
printf "Adding desktop shortcut, menu item and file associations for SWT Application..."
xdg_uninstall_f
simple_uninstall_f
xdg_install_f
fi
else
if [ ${UNINSTALL} = true ]; then
printf "Removing desktop shortcut and menu item for SWT Application..."
simple_uninstall_f
else
printf "Adding desktop shortcut and menu item for SWT Application..."
simple_uninstall_f
simple_install_f
fi
fi
updatedbs_f
printf " done!\n"
exit 0

Wyświetl plik

@ -0,0 +1,31 @@
#!/usr/bin/env bash
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
for LIB in \
"$APPDIR"/java/lib/rt.jar \
"$APPDIR"/java/lib/tools.jar \
"$APPDIR"/lib/*.jar \
;
do
CLASSPATH="${CLASSPATH}:${LIB}"
done
export CLASSPATH
LD_LIBRARY_PATH=$APPDIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
export PATH="${APPDIR}/java/bin:${PATH}"
export JAVA_TOOL_OPTIONS=`echo $JAVA_TOOL_OPTIONS | sed 's|-javaagent:/usr/share/java/jayatanaag.jar||g'`
JAVA=java
if [ -x "$APPDIR/java/bin/java" ]; then
JAVA=$APPDIR/java/bin/java
fi
# Collect options to java in an array, to properly handle whitespace in options
JAVA_OPTIONS=("-DAPP_DIR=$APPDIR")
"$JAVA" "${JAVA_OPTIONS[@]}" com.maccasoft.tools.Application "$@"

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.0 KiB

Wyświetl plik

@ -0,0 +1,6 @@
#!/bin/sh
SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
cd "$SCRIPT_PATH"
./install.sh -u

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,33 @@
<launch4jConfig>
<dontWrapJar>true</dontWrapJar>
<headerType>gui</headerType>
<outfile>launcher.exe</outfile>
<errTitle>Z80 Tools</errTitle>
<downloadUrl>http://www.oracle.com/technetwork/java/javase/downloads/index.html</downloadUrl>
<icon>launcher.ico</icon>
<classPath>
<mainClass>com.maccasoft.tools.Application</mainClass>
<cp>%EXEDIR%/lib/*.jar</cp>
</classPath>
<jre>
<path>java</path>
<minVersion>1.8.0</minVersion>
<runtimeBits>32</runtimeBits>
<opt>-DAPP_DIR="%EXEDIR%"</opt>
</jre>
<versionInfo>
<fileDescription>Z80 Tools</fileDescription>
<copyright>Marco Maccaferri</copyright>
<productName>Z80 Tools</productName>
<companyName>Marco Maccaferri</companyName>
<internalName>Z80 Tools</internalName>
<originalFilename>launcher.exe</originalFilename>
</versionInfo>
<messages>
<startupErr>An error occurred while starting the application.</startupErr>
<bundledJreErr>This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.</bundledJreErr>
<jreVersionErr>This application requires at least Java Development Kit</jreVersionErr>
<launcherErr>The registry refers to a nonexistent Java Development Kit installation or the runtime is corrupted.</launcherErr>
<instanceAlreadyExistsMsg>An application instance is already running.</instanceAlreadyExistsMsg>
</messages>
</launch4jConfig>

Wyświetl plik

@ -0,0 +1,33 @@
<launch4jConfig>
<dontWrapJar>true</dontWrapJar>
<headerType>gui</headerType>
<outfile>launcher.exe</outfile>
<errTitle>Z80 Tools</errTitle>
<downloadUrl>http://www.oracle.com/technetwork/java/javase/downloads/index.html</downloadUrl>
<icon>launcher.ico</icon>
<classPath>
<mainClass>com.maccasoft.tools.Application</mainClass>
<cp>%EXEDIR%/lib/*.jar</cp>
</classPath>
<jre>
<path>java</path>
<minVersion>1.7.0</minVersion>
<runtimeBits>64</runtimeBits>
<opt>-DAPP_DIR="%EXEDIR%"</opt>
</jre>
<versionInfo>
<fileDescription>Z80 Tools</fileDescription>
<copyright>Marco Maccaferri</copyright>
<productName>Z80 Tools</productName>
<companyName>Marco Maccaferri</companyName>
<internalName>Z80 Tools</internalName>
<originalFilename>launcher.exe</originalFilename>
</versionInfo>
<messages>
<startupErr>An error occurred while starting the application.</startupErr>
<bundledJreErr>This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.</bundledJreErr>
<jreVersionErr>This application requires at least Java Development Kit</jreVersionErr>
<launcherErr>The registry refers to a nonexistent Java Development Kit installation or the runtime is corrupted.</launcherErr>
<instanceAlreadyExistsMsg>An application instance is already running.</instanceAlreadyExistsMsg>
</messages>
</launch4jConfig>

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 12 KiB

Wyświetl plik

@ -0,0 +1,2 @@
-Xms128M
-Xmx512M

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

BIN
lib/jssc-2.8.0.jar 100644

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,40 @@
/*
* Copyright (c) 2018 Marco Maccaferri and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.maccasoft.tools;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.jface.databinding.swt.DisplayRealm;
import org.eclipse.swt.widgets.Display;
import junit.framework.TestCase;
import junit.framework.TestResult;
public abstract class DatabindingTestCase extends TestCase {
public DatabindingTestCase() {
}
public DatabindingTestCase(String name) {
super(name);
}
@Override
public void run(final TestResult result) {
Display display = Display.getDefault();
Realm.runWithDefault(DisplayRealm.getRealm(display), new Runnable() {
@Override
public void run() {
DatabindingTestCase.super.run(result);
}
});
}
}

Wyświetl plik

@ -0,0 +1,166 @@
/*
* Copyright (c) 2018 Marco Maccaferri and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.maccasoft.tools;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
public class AboutDialog extends Dialog {
public AboutDialog(Shell parentShell) {
super(parentShell);
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("About " + Application.APP_TITLE);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite content = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = layout.marginWidth = 0;
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
content.setLayout(layout);
content.setLayoutData(new GridData(GridData.FILL_BOTH));
content.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
content.setBackgroundMode(SWT.INHERIT_FORCE);
applyDialogFont(content);
Label label = new Label(content, SWT.NONE);
label.setLayoutData(new GridData(SWT.TOP, SWT.RIGHT, false, false));
final Image image = getImageFromResources("about.png");
label.setImage(image);
label.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent arg0) {
image.dispose();
}
});
String title = Application.APP_TITLE + " " + Application.APP_VERSION;
final String epl = "http://www.eclipse.org/legal/epl-v10.html";
final String famfamfam = "http://www.famfamfam.com/lab/icons/silk";
final String fugue = "http://p.yusukekamiyamane.com";
final String message = title + "\r\n\r\n" + "Copyright \u00a9 2018 Marco Maccaferri and others.\r\nAll rights reserved.\r\n\r\n" + //
"This program and the accompanying materials are made available under the\r\n" + //
"terms of the Eclipse Public License v1.0 which accompanies this distribution\r\n" + //
"and is available at " + epl + "\r\n" + //
"\r\nIcons from " + famfamfam + //
"\r\nand " + fugue + "\r\n";
final StyledText text = new StyledText(content, SWT.READ_ONLY);
text.setLayoutData(new GridData(SWT.TOP, SWT.RIGHT, true, false));
text.setCaret(null);
text.setMargins(0, layout.verticalSpacing, convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), layout.verticalSpacing);
text.setText(message);
final List<StyleRange> linkRanges = new ArrayList<StyleRange>();
StyleRange style = new StyleRange();
style.start = 0;
style.length = title.length();
style.fontStyle = SWT.BOLD;
text.setStyleRange(style);
style = new StyleRange();
style.start = message.indexOf(epl);
style.length = epl.length();
style.underline = true;
style.underlineStyle = SWT.UNDERLINE_LINK;
text.setStyleRange(style);
linkRanges.add(style);
style = new StyleRange();
style.start = message.indexOf(famfamfam);
style.length = famfamfam.length();
style.underline = true;
style.underlineStyle = SWT.UNDERLINE_LINK;
text.setStyleRange(style);
linkRanges.add(style);
style = new StyleRange();
style.start = message.indexOf(fugue);
style.length = fugue.length();
style.underline = true;
style.underlineStyle = SWT.UNDERLINE_LINK;
text.setStyleRange(style);
linkRanges.add(style);
text.addListener(SWT.MouseDown, new Listener() {
@Override
public void handleEvent(Event event) {
try {
int offset = text.getOffsetAtLocation(new Point(event.x, event.y));
for (StyleRange style : linkRanges) {
if (offset >= style.start && offset < (style.start + style.length)) {
String link = text.getText(style.start, style.start + style.length - 1);
Program.launch(link);
break;
}
}
} catch (IllegalArgumentException e) {
// no character under event.x, event.y
}
}
});
return content;
}
Image getImageFromResources(String name) {
InputStream is = getClass().getResourceAsStream(name);
ImageLoader loader = new ImageLoader();
ImageData[] data = loader.load(is);
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
return new Image(Display.getDefault(), data[0]);
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
}
}

Wyświetl plik

@ -0,0 +1,421 @@
/*
* Copyright (c) 2018 Marco Maccaferri and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.maccasoft.tools;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.jface.databinding.swt.DisplayRealm;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import com.maccasoft.tools.internal.ImageRegistry;
public class Application {
public static final String APP_TITLE = "Z80 Tools";
public static final String APP_VERSION = "0.0.0";
Display display;
Shell shell;
CTabFolder tabFolder;
public Application() {
}
public void open() {
display = Display.getDefault();
shell = new Shell(display);
shell.setText(APP_TITLE);
Image[] images = new Image[] {
ImageRegistry.getImageFromResources("app128.png"),
ImageRegistry.getImageFromResources("app64.png"),
ImageRegistry.getImageFromResources("app48.png"),
ImageRegistry.getImageFromResources("app32.png"),
ImageRegistry.getImageFromResources("app16.png"),
};
shell.setImages(images);
Menu menu = new Menu(shell, SWT.BAR);
createFileMenu(menu);
createEditMenu(menu);
createToolsMenu(menu);
createHelpMenu(menu);
shell.setMenuBar(menu);
Rectangle screen = display.getClientArea();
Rectangle rect = new Rectangle(0, 0, (int) ((float) screen.width / (float) screen.height * 800), 800);
rect.x = (screen.width - rect.width) / 2;
rect.y = (screen.height - rect.height) / 2;
if (rect.y < 0) {
rect.height += rect.y * 2;
rect.y = 0;
}
shell.setLocation(rect.x, rect.y);
shell.setSize(rect.width, rect.height);
FillLayout layout = new FillLayout();
layout.marginWidth = layout.marginHeight = 5;
shell.setLayout(layout);
createContents(shell);
shell.open();
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
ImageRegistry.dispose();
}
});
}
void createFileMenu(Menu parent) {
final Menu menu = new Menu(parent.getParent(), SWT.DROP_DOWN);
menu.addMenuListener(new MenuListener() {
@Override
public void menuShown(MenuEvent e) {
MenuItem[] item = menu.getItems();
for (int i = 0; i < item.length; i++) {
item[i].dispose();
}
populateFileMenu(menu);
}
@Override
public void menuHidden(MenuEvent e) {
}
});
populateFileMenu(menu);
MenuItem item = new MenuItem(parent, SWT.CASCADE);
item.setText("&File");
item.setMenu(menu);
}
void populateFileMenu(Menu menu) {
MenuItem item = new MenuItem(menu, SWT.PUSH);
item.setText("New");
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Open...");
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Save\tCtrl+S");
item.setAccelerator(SWT.MOD1 + 'S');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Save As...");
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Save All\tCtrl+Shift+S");
item.setAccelerator(SWT.MOD1 + SWT.MOD2 + 'S');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Preferences");
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
new MenuItem(menu, SWT.SEPARATOR);
populateLruFiles(menu);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Exit");
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
shell.dispose();
}
});
}
void populateLruFiles(Menu menu) {
int index = 0;
Iterator<String> iter = new ArrayList<String>().iterator();
while (iter.hasNext() && index < 4) {
final File fileToOpen = new File(iter.next());
MenuItem item = new MenuItem(menu, SWT.PUSH);
item.setText(String.format("%d %s", index + 1, fileToOpen.getName()));
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
index++;
}
if (index > 0) {
new MenuItem(menu, SWT.SEPARATOR);
}
}
void createEditMenu(Menu parent) {
Menu menu = new Menu(parent.getParent(), SWT.DROP_DOWN);
MenuItem item = new MenuItem(parent, SWT.CASCADE);
item.setText("&Edit");
item.setMenu(menu);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Undo\tCtrl+Z");
item.setAccelerator(SWT.MOD1 + 'Z');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Redo\tCtrl+Shift+Z");
item.setAccelerator(SWT.MOD1 + SWT.MOD2 + 'Z');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Cut\tCtrl+X");
item.setAccelerator(SWT.MOD1 + 'X');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Copy\tCtrl+C");
item.setAccelerator(SWT.MOD1 + 'C');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Paste\tCtrl+V");
item.setAccelerator(SWT.MOD1 + 'V');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Select All\tCtrl+A");
item.setAccelerator(SWT.MOD1 + 'A');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
}
void createToolsMenu(Menu parent) {
Menu menu = new Menu(parent.getParent(), SWT.DROP_DOWN);
MenuItem item = new MenuItem(parent, SWT.CASCADE);
item.setText("&Tools");
item.setMenu(menu);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Verify / Compile\tCtrl+R");
item.setAccelerator(SWT.MOD1 + 'R');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
item = new MenuItem(menu, SWT.PUSH);
item.setText("Upload Intel HEX");
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.PUSH);
item.setText("Serial Terminal\tCtrl+Shift+T");
item.setAccelerator(SWT.MOD1 + SWT.MOD2 + 'T');
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
}
void createHelpMenu(Menu parent) {
Menu menu = new Menu(parent.getParent(), SWT.DROP_DOWN);
MenuItem item = new MenuItem(parent, SWT.CASCADE);
item.setText("&Help");
item.setMenu(menu);
item = new MenuItem(menu, SWT.PUSH);
item.setText("About " + APP_TITLE);
item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
AboutDialog dlg = new AboutDialog(shell);
dlg.open();
}
});
}
protected void createContents(Composite parent) {
GC gc = new GC(parent);
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();
tabFolder = new CTabFolder(parent, SWT.BORDER);
tabFolder.setTabHeight((int) (fontMetrics.getHeight() * 1.5));
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
}
});
}
static {
System.setProperty("SWT_GTK3", "0");
}
public static void main(String[] args) {
final Display display = new Display();
Realm.runWithDefault(DisplayRealm.getRealm(display), new Runnable() {
@Override
public void run() {
try {
Application app = new Application();
app.open();
while (display.getShells().length != 0) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} catch (Exception e) {
e.printStackTrace();
return;
}
}
});
display.dispose();
}
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.3 KiB

Wyświetl plik

@ -0,0 +1,76 @@
/*
* Copyright (c) 2018 Marco Maccaferri and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.maccasoft.tools.internal;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.Display;
public class ImageRegistry {
private static final Map<Object, Image> map = new HashMap<Object, Image>();
ImageRegistry() {
}
public static Image getImage(Object key) {
return map.get(key);
}
public static void setImage(Object key, Image image) {
Image oldImage = map.get(key);
map.put(key, image);
if (oldImage != null) {
oldImage.dispose();
}
}
public static void removeImage(Object key) {
Image oldImage = map.get(key);
map.remove(key);
if (oldImage != null) {
oldImage.dispose();
}
}
public static void dispose() {
for (Image image : map.values()) {
image.dispose();
}
map.clear();
}
public static Image getImageFromResources(String name) {
return getImageFromResources(ImageRegistry.class, name);
}
@SuppressWarnings("rawtypes")
public static Image getImageFromResources(Class clazz, String name) {
if (map.get(name) == null) {
InputStream is = clazz.getResourceAsStream(name);
ImageLoader loader = new ImageLoader();
ImageData[] data = loader.load(is);
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
map.put(name, new Image(Display.getDefault(), data[0]));
}
return map.get(name);
}
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.4 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 245 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 587 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 835 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.0 KiB