OmegaT の背景に画像を表示します。
copy trunk/ to tags/0.1.20130807/
@@ -0,0 +1,93 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | +*** GENERATED FROM project.xml - DO NOT EDIT *** | |
4 | +*** EDIT ../build.xml INSTEAD *** | |
5 | + | |
6 | + | |
7 | + --> | |
8 | +<project xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc"> | |
9 | + <target name="-groovy-init-macrodef-javac"> | |
10 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
11 | + <attribute name="srcdir" default="${src.dir}"/> | |
12 | + <attribute name="destdir" default="${build.classes.dir}"/> | |
13 | + <attribute name="classpath" default="${javac.classpath}"/> | |
14 | + <attribute name="includes" default="${includes}"/> | |
15 | + <attribute name="excludes" default="${excludes}"/> | |
16 | + <attribute name="debug" default="${javac.debug}"/> | |
17 | + <attribute name="sourcepath" default="${empty.dir}"/> | |
18 | + <attribute name="gensrcdir" default="${empty.dir}"/> | |
19 | + <attribute name="processorpath" default="${javac.processorpath}"/> | |
20 | + <attribute name="apgeneratedsrcdir" default="${build.generated.sources.dir}/ap-source-output"/> | |
21 | + <element name="customize" optional="true"/> | |
22 | + <sequential> | |
23 | + <taskdef name="groovyc" classpath="${javac.classpath}" classname="org.codehaus.groovy.ant.Groovyc"/> | |
24 | + <property name="empty.dir" location="${build.dir}/empty"/> | |
25 | + <mkdir dir="${empty.dir}"/> | |
26 | + <groovyc srcdir="@{srcdir}" sourcepath="@{sourcepath}" destdir="@{destdir}" encoding="${source.encoding}" includes="@{includes}" excludes="@{excludes}" includeAntRuntime="false" fork="true"> | |
27 | + <src> | |
28 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
29 | + <include name="*"/> | |
30 | + </dirset> | |
31 | + </src> | |
32 | + <classpath> | |
33 | + <path path="@{classpath}"/> | |
34 | + </classpath> | |
35 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" encoding="${source.encoding}" source="${javac.source}" target="${javac.target}"> | |
36 | + <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/> | |
37 | + <customize/> | |
38 | + </javac> | |
39 | + </groovyc> | |
40 | + </sequential> | |
41 | + </macrodef> | |
42 | + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
43 | + <attribute name="srcdir" default="${src.dir}"/> | |
44 | + <attribute name="destdir" default="${build.classes.dir}"/> | |
45 | + <attribute name="classpath" default="${javac.classpath}"/> | |
46 | + <sequential> | |
47 | + <depend srcdir="@{srcdir}" destdir="@{destdir}" cache="${build.dir}/depcache" includes="${includes}" excludes="${excludes}"> | |
48 | + <classpath> | |
49 | + <path path="@{classpath}"/> | |
50 | + </classpath> | |
51 | + </depend> | |
52 | + </sequential> | |
53 | + </macrodef> | |
54 | + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
55 | + <attribute name="destdir" default="${build.classes.dir}"/> | |
56 | + <sequential> | |
57 | + <fail unless="javac.includes">Must set javac.includes</fail> | |
58 | + <pathconvert property="javac.includes.binary" pathsep=","> | |
59 | + <path> | |
60 | + <filelist dir="@{destdir}" files="${javac.includes}"/> | |
61 | + </path> | |
62 | + <globmapper from="*.java" to="*.class"/> | |
63 | + </pathconvert> | |
64 | + <delete> | |
65 | + <files includes="${javac.includes.binary}"/> | |
66 | + </delete> | |
67 | + </sequential> | |
68 | + </macrodef> | |
69 | + </target> | |
70 | + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run-with-groovy"> | |
71 | + <j2seproject3:test testincludes=""/> | |
72 | + </target> | |
73 | + <target depends="init,compile-test,-pre-test-run,-do-test-run-with-groovy" if="have.tests" name="-post-test-run-with-groovy"> | |
74 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
75 | + </target> | |
76 | + <target depends="init,compile-test,-pre-test-run,-do-test-run-with-groovy,test-report,-post-test-run-with-groovy,-test-browse" description="Run unit tests." name="test-with-groovy"/> | |
77 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-groovy"> | |
78 | + <fail unless="test.binarytestincludes">Must select some files in the IDE or set test.includes</fail> | |
79 | + <j2seproject3:test testincludes=""/> | |
80 | + </target> | |
81 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-groovy" if="have.tests" name="-post-test-run-single-groovy"> | |
82 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
83 | + </target> | |
84 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-groovy,-post-test-run-single-groovy" description="Run single unit test." name="test-single-groovy"/> | |
85 | + <target depends="init,compile-test-single,-pre-test-run-single,-debug-start-debugger-test" name="-do-test-debug-single-groovy"> | |
86 | + <fail unless="test.binarytestincludes">Must select some files in the IDE or set test.binarytestincludes</fail> | |
87 | + <j2seproject3:test-debug testincludes=""/> | |
88 | + </target> | |
89 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-debug-single-groovy" if="have.tests" name="-post-test-debug-single-groovy"> | |
90 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
91 | + </target> | |
92 | + <target depends="init,compile-test-single,-pre-test-run-single,-debug-start-debugger-test,-do-test-debug-single-groovy,-post-test-debug-single-groovy" name="debug-test-with-groovy"/> | |
93 | +</project> |
@@ -0,0 +1,20 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project xmlns="http://www.netbeans.org/ns/project/1"> | |
3 | + <type>org.netbeans.modules.java.j2seproject</type> | |
4 | + <configuration> | |
5 | + <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1"> | |
6 | + <extension file="groovy-build.xml" id="groovy"> | |
7 | + <dependency dependsOn="-groovy-init-macrodef-javac" target="-pre-pre-compile"/> | |
8 | + </extension> | |
9 | + </buildExtensions> | |
10 | + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> | |
11 | + <name>Moenizer</name> | |
12 | + <source-roots> | |
13 | + <root id="src.dir"/> | |
14 | + </source-roots> | |
15 | + <test-roots> | |
16 | + <root id="test.src.dir"/> | |
17 | + </test-roots> | |
18 | + </data> | |
19 | + </configuration> | |
20 | +</project> |
@@ -0,0 +1,4 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> | |
3 | + <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> | |
4 | +</project-private> |
@@ -0,0 +1,1412 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | +*** GENERATED FROM project.xml - DO NOT EDIT *** | |
4 | +*** EDIT ../build.xml INSTEAD *** | |
5 | + | |
6 | +For the purpose of easier reading the script | |
7 | +is divided into following sections: | |
8 | + | |
9 | + - initialization | |
10 | + - compilation | |
11 | + - jar | |
12 | + - execution | |
13 | + - debugging | |
14 | + - javadoc | |
15 | + - test compilation | |
16 | + - test execution | |
17 | + - test debugging | |
18 | + - applet | |
19 | + - cleanup | |
20 | + | |
21 | + --> | |
22 | +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="Moenizer-impl"> | |
23 | + <import file="groovy-build.xml"/> | |
24 | + <fail message="Please build using Ant 1.8.0 or higher."> | |
25 | + <condition> | |
26 | + <not> | |
27 | + <antversion atleast="1.8.0"/> | |
28 | + </not> | |
29 | + </condition> | |
30 | + </fail> | |
31 | + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> | |
32 | + <!-- | |
33 | + ====================== | |
34 | + INITIALIZATION SECTION | |
35 | + ====================== | |
36 | + --> | |
37 | + <target name="-pre-init"> | |
38 | + <!-- Empty placeholder for easier customization. --> | |
39 | + <!-- You can override this target in the ../build.xml file. --> | |
40 | + </target> | |
41 | + <target depends="-pre-init" name="-init-private"> | |
42 | + <property file="nbproject/private/config.properties"/> | |
43 | + <property file="nbproject/private/configs/${config}.properties"/> | |
44 | + <property file="nbproject/private/private.properties"/> | |
45 | + </target> | |
46 | + <target depends="-pre-init,-init-private" name="-init-user"> | |
47 | + <property file="${user.properties.file}"/> | |
48 | + <!-- The two properties below are usually overridden --> | |
49 | + <!-- by the active platform. Just a fallback. --> | |
50 | + <property name="default.javac.source" value="1.4"/> | |
51 | + <property name="default.javac.target" value="1.4"/> | |
52 | + </target> | |
53 | + <target depends="-pre-init,-init-private,-init-user" name="-init-project"> | |
54 | + <property file="nbproject/configs/${config}.properties"/> | |
55 | + <property file="nbproject/project.properties"/> | |
56 | + </target> | |
57 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> | |
58 | + <available file="${manifest.file}" property="manifest.available"/> | |
59 | + <condition property="splashscreen.available"> | |
60 | + <and> | |
61 | + <not> | |
62 | + <equals arg1="${application.splash}" arg2="" trim="true"/> | |
63 | + </not> | |
64 | + <available file="${application.splash}"/> | |
65 | + </and> | |
66 | + </condition> | |
67 | + <condition property="main.class.available"> | |
68 | + <and> | |
69 | + <isset property="main.class"/> | |
70 | + <not> | |
71 | + <equals arg1="${main.class}" arg2="" trim="true"/> | |
72 | + </not> | |
73 | + </and> | |
74 | + </condition> | |
75 | + <condition property="manifest.available+main.class"> | |
76 | + <and> | |
77 | + <isset property="manifest.available"/> | |
78 | + <isset property="main.class.available"/> | |
79 | + </and> | |
80 | + </condition> | |
81 | + <condition property="do.archive"> | |
82 | + <not> | |
83 | + <istrue value="${jar.archive.disabled}"/> | |
84 | + </not> | |
85 | + </condition> | |
86 | + <condition property="do.mkdist"> | |
87 | + <and> | |
88 | + <isset property="do.archive"/> | |
89 | + <isset property="libs.CopyLibs.classpath"/> | |
90 | + <not> | |
91 | + <istrue value="${mkdist.disabled}"/> | |
92 | + </not> | |
93 | + </and> | |
94 | + </condition> | |
95 | + <condition property="manifest.available+main.class+mkdist.available"> | |
96 | + <and> | |
97 | + <istrue value="${manifest.available+main.class}"/> | |
98 | + <isset property="do.mkdist"/> | |
99 | + </and> | |
100 | + </condition> | |
101 | + <condition property="do.archive+manifest.available"> | |
102 | + <and> | |
103 | + <isset property="manifest.available"/> | |
104 | + <istrue value="${do.archive}"/> | |
105 | + </and> | |
106 | + </condition> | |
107 | + <condition property="do.archive+main.class.available"> | |
108 | + <and> | |
109 | + <isset property="main.class.available"/> | |
110 | + <istrue value="${do.archive}"/> | |
111 | + </and> | |
112 | + </condition> | |
113 | + <condition property="do.archive+splashscreen.available"> | |
114 | + <and> | |
115 | + <isset property="splashscreen.available"/> | |
116 | + <istrue value="${do.archive}"/> | |
117 | + </and> | |
118 | + </condition> | |
119 | + <condition property="do.archive+manifest.available+main.class"> | |
120 | + <and> | |
121 | + <istrue value="${manifest.available+main.class}"/> | |
122 | + <istrue value="${do.archive}"/> | |
123 | + </and> | |
124 | + </condition> | |
125 | + <condition property="manifest.available-mkdist.available"> | |
126 | + <or> | |
127 | + <istrue value="${manifest.available}"/> | |
128 | + <isset property="do.mkdist"/> | |
129 | + </or> | |
130 | + </condition> | |
131 | + <condition property="manifest.available+main.class-mkdist.available"> | |
132 | + <or> | |
133 | + <istrue value="${manifest.available+main.class}"/> | |
134 | + <isset property="do.mkdist"/> | |
135 | + </or> | |
136 | + </condition> | |
137 | + <condition property="have.tests"> | |
138 | + <or> | |
139 | + <available file="${test.src.dir}"/> | |
140 | + </or> | |
141 | + </condition> | |
142 | + <condition property="have.sources"> | |
143 | + <or> | |
144 | + <available file="${src.dir}"/> | |
145 | + </or> | |
146 | + </condition> | |
147 | + <condition property="netbeans.home+have.tests"> | |
148 | + <and> | |
149 | + <isset property="netbeans.home"/> | |
150 | + <isset property="have.tests"/> | |
151 | + </and> | |
152 | + </condition> | |
153 | + <condition property="no.javadoc.preview"> | |
154 | + <and> | |
155 | + <isset property="javadoc.preview"/> | |
156 | + <isfalse value="${javadoc.preview}"/> | |
157 | + </and> | |
158 | + </condition> | |
159 | + <property name="run.jvmargs" value=""/> | |
160 | + <property name="run.jvmargs.ide" value=""/> | |
161 | + <property name="javac.compilerargs" value=""/> | |
162 | + <property name="work.dir" value="${basedir}"/> | |
163 | + <condition property="no.deps"> | |
164 | + <and> | |
165 | + <istrue value="${no.dependencies}"/> | |
166 | + </and> | |
167 | + </condition> | |
168 | + <property name="javac.debug" value="true"/> | |
169 | + <property name="javadoc.preview" value="true"/> | |
170 | + <property name="application.args" value=""/> | |
171 | + <property name="source.encoding" value="${file.encoding}"/> | |
172 | + <property name="runtime.encoding" value="${source.encoding}"/> | |
173 | + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> | |
174 | + <and> | |
175 | + <isset property="javadoc.encoding"/> | |
176 | + <not> | |
177 | + <equals arg1="${javadoc.encoding}" arg2=""/> | |
178 | + </not> | |
179 | + </and> | |
180 | + </condition> | |
181 | + <property name="javadoc.encoding.used" value="${source.encoding}"/> | |
182 | + <property name="includes" value="**"/> | |
183 | + <property name="excludes" value=""/> | |
184 | + <property name="do.depend" value="false"/> | |
185 | + <condition property="do.depend.true"> | |
186 | + <istrue value="${do.depend}"/> | |
187 | + </condition> | |
188 | + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> | |
189 | + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> | |
190 | + <length length="0" string="${endorsed.classpath}" when="greater"/> | |
191 | + </condition> | |
192 | + <condition else="false" property="jdkBug6558476"> | |
193 | + <and> | |
194 | + <matches pattern="1\.[56]" string="${java.specification.version}"/> | |
195 | + <not> | |
196 | + <os family="unix"/> | |
197 | + </not> | |
198 | + </and> | |
199 | + </condition> | |
200 | + <property name="javac.fork" value="${jdkBug6558476}"/> | |
201 | + <property name="jar.index" value="false"/> | |
202 | + <property name="jar.index.metainf" value="${jar.index}"/> | |
203 | + <property name="copylibs.rebase" value="true"/> | |
204 | + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> | |
205 | + <condition property="junit.available"> | |
206 | + <or> | |
207 | + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> | |
208 | + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> | |
209 | + </or> | |
210 | + </condition> | |
211 | + <condition property="testng.available"> | |
212 | + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> | |
213 | + </condition> | |
214 | + <condition property="junit+testng.available"> | |
215 | + <and> | |
216 | + <istrue value="${junit.available}"/> | |
217 | + <istrue value="${testng.available}"/> | |
218 | + </and> | |
219 | + </condition> | |
220 | + <condition else="testng" property="testng.mode" value="mixed"> | |
221 | + <istrue value="${junit+testng.available}"/> | |
222 | + </condition> | |
223 | + <condition else="" property="testng.debug.mode" value="-mixed"> | |
224 | + <istrue value="${junit+testng.available}"/> | |
225 | + </condition> | |
226 | + </target> | |
227 | + <target name="-post-init"> | |
228 | + <!-- Empty placeholder for easier customization. --> | |
229 | + <!-- You can override this target in the ../build.xml file. --> | |
230 | + </target> | |
231 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> | |
232 | + <fail unless="src.dir">Must set src.dir</fail> | |
233 | + <fail unless="test.src.dir">Must set test.src.dir</fail> | |
234 | + <fail unless="build.dir">Must set build.dir</fail> | |
235 | + <fail unless="dist.dir">Must set dist.dir</fail> | |
236 | + <fail unless="build.classes.dir">Must set build.classes.dir</fail> | |
237 | + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> | |
238 | + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> | |
239 | + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> | |
240 | + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> | |
241 | + <fail unless="dist.jar">Must set dist.jar</fail> | |
242 | + </target> | |
243 | + <target name="-init-macrodef-property"> | |
244 | + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
245 | + <attribute name="name"/> | |
246 | + <attribute name="value"/> | |
247 | + <sequential> | |
248 | + <property name="@{name}" value="${@{value}}"/> | |
249 | + </sequential> | |
250 | + </macrodef> | |
251 | + </target> | |
252 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> | |
253 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
254 | + <attribute default="${src.dir}" name="srcdir"/> | |
255 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
256 | + <attribute default="${javac.classpath}" name="classpath"/> | |
257 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
258 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
259 | + <attribute default="${includes}" name="includes"/> | |
260 | + <attribute default="${excludes}" name="excludes"/> | |
261 | + <attribute default="${javac.debug}" name="debug"/> | |
262 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
263 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
264 | + <element name="customize" optional="true"/> | |
265 | + <sequential> | |
266 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
267 | + <mkdir dir="${empty.dir}"/> | |
268 | + <mkdir dir="@{apgeneratedsrcdir}"/> | |
269 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
270 | + <src> | |
271 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
272 | + <include name="*"/> | |
273 | + </dirset> | |
274 | + </src> | |
275 | + <classpath> | |
276 | + <path path="@{classpath}"/> | |
277 | + </classpath> | |
278 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
279 | + <compilerarg line="${javac.compilerargs}"/> | |
280 | + <compilerarg value="-processorpath"/> | |
281 | + <compilerarg path="@{processorpath}:${empty.dir}"/> | |
282 | + <compilerarg line="${ap.processors.internal}"/> | |
283 | + <compilerarg line="${annotation.processing.processor.options}"/> | |
284 | + <compilerarg value="-s"/> | |
285 | + <compilerarg path="@{apgeneratedsrcdir}"/> | |
286 | + <compilerarg line="${ap.proc.none.internal}"/> | |
287 | + <customize/> | |
288 | + </javac> | |
289 | + </sequential> | |
290 | + </macrodef> | |
291 | + </target> | |
292 | + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> | |
293 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
294 | + <attribute default="${src.dir}" name="srcdir"/> | |
295 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
296 | + <attribute default="${javac.classpath}" name="classpath"/> | |
297 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
298 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
299 | + <attribute default="${includes}" name="includes"/> | |
300 | + <attribute default="${excludes}" name="excludes"/> | |
301 | + <attribute default="${javac.debug}" name="debug"/> | |
302 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
303 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
304 | + <element name="customize" optional="true"/> | |
305 | + <sequential> | |
306 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
307 | + <mkdir dir="${empty.dir}"/> | |
308 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
309 | + <src> | |
310 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
311 | + <include name="*"/> | |
312 | + </dirset> | |
313 | + </src> | |
314 | + <classpath> | |
315 | + <path path="@{classpath}"/> | |
316 | + </classpath> | |
317 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
318 | + <compilerarg line="${javac.compilerargs}"/> | |
319 | + <customize/> | |
320 | + </javac> | |
321 | + </sequential> | |
322 | + </macrodef> | |
323 | + </target> | |
324 | + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> | |
325 | + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
326 | + <attribute default="${src.dir}" name="srcdir"/> | |
327 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
328 | + <attribute default="${javac.classpath}" name="classpath"/> | |
329 | + <sequential> | |
330 | + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> | |
331 | + <classpath> | |
332 | + <path path="@{classpath}"/> | |
333 | + </classpath> | |
334 | + </depend> | |
335 | + </sequential> | |
336 | + </macrodef> | |
337 | + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
338 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
339 | + <sequential> | |
340 | + <fail unless="javac.includes">Must set javac.includes</fail> | |
341 | + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> | |
342 | + <path> | |
343 | + <filelist dir="@{destdir}" files="${javac.includes}"/> | |
344 | + </path> | |
345 | + <globmapper from="*.java" to="*.class"/> | |
346 | + </pathconvert> | |
347 | + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> | |
348 | + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> | |
349 | + <delete> | |
350 | + <files includesfile="${javac.includesfile.binary}"/> | |
351 | + </delete> | |
352 | + <delete> | |
353 | + <fileset file="${javac.includesfile.binary}"/> | |
354 | + </delete> | |
355 | + </sequential> | |
356 | + </macrodef> | |
357 | + </target> | |
358 | + <target if="${junit.available}" name="-init-macrodef-junit-init"> | |
359 | + <condition else="false" property="nb.junit.batch" value="true"> | |
360 | + <and> | |
361 | + <istrue value="${junit.available}"/> | |
362 | + <not> | |
363 | + <isset property="test.method"/> | |
364 | + </not> | |
365 | + </and> | |
366 | + </condition> | |
367 | + <condition else="false" property="nb.junit.single" value="true"> | |
368 | + <and> | |
369 | + <istrue value="${junit.available}"/> | |
370 | + <isset property="test.method"/> | |
371 | + </and> | |
372 | + </condition> | |
373 | + </target> | |
374 | + <target name="-init-test-properties"> | |
375 | + <property name="test.binaryincludes" value="<nothing>"/> | |
376 | + <property name="test.binarytestincludes" value=""/> | |
377 | + <property name="test.binaryexcludes" value=""/> | |
378 | + </target> | |
379 | + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> | |
380 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
381 | + <attribute default="${includes}" name="includes"/> | |
382 | + <attribute default="${excludes}" name="excludes"/> | |
383 | + <attribute default="**" name="testincludes"/> | |
384 | + <attribute default="" name="testmethods"/> | |
385 | + <element name="customize" optional="true"/> | |
386 | + <sequential> | |
387 | + <property name="junit.forkmode" value="perTest"/> | |
388 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
389 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
390 | + <syspropertyset> | |
391 | + <propertyref prefix="test-sys-prop."/> | |
392 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
393 | + </syspropertyset> | |
394 | + <formatter type="brief" usefile="false"/> | |
395 | + <formatter type="xml"/> | |
396 | + <jvmarg value="-ea"/> | |
397 | + <customize/> | |
398 | + </junit> | |
399 | + </sequential> | |
400 | + </macrodef> | |
401 | + </target> | |
402 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> | |
403 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
404 | + <attribute default="${includes}" name="includes"/> | |
405 | + <attribute default="${excludes}" name="excludes"/> | |
406 | + <attribute default="**" name="testincludes"/> | |
407 | + <attribute default="" name="testmethods"/> | |
408 | + <element name="customize" optional="true"/> | |
409 | + <sequential> | |
410 | + <property name="junit.forkmode" value="perTest"/> | |
411 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
412 | + <batchtest todir="${build.test.results.dir}"> | |
413 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
414 | + <filename name="@{testincludes}"/> | |
415 | + </fileset> | |
416 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
417 | + <filename name="${test.binarytestincludes}"/> | |
418 | + </fileset> | |
419 | + </batchtest> | |
420 | + <syspropertyset> | |
421 | + <propertyref prefix="test-sys-prop."/> | |
422 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
423 | + </syspropertyset> | |
424 | + <formatter type="brief" usefile="false"/> | |
425 | + <formatter type="xml"/> | |
426 | + <jvmarg value="-ea"/> | |
427 | + <customize/> | |
428 | + </junit> | |
429 | + </sequential> | |
430 | + </macrodef> | |
431 | + </target> | |
432 | + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> | |
433 | + <target if="${testng.available}" name="-init-macrodef-testng"> | |
434 | + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
435 | + <attribute default="${includes}" name="includes"/> | |
436 | + <attribute default="${excludes}" name="excludes"/> | |
437 | + <attribute default="**" name="testincludes"/> | |
438 | + <attribute default="" name="testmethods"/> | |
439 | + <element name="customize" optional="true"/> | |
440 | + <sequential> | |
441 | + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> | |
442 | + <isset property="test.method"/> | |
443 | + </condition> | |
444 | + <union id="test.set"> | |
445 | + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> | |
446 | + <filename name="@{testincludes}"/> | |
447 | + </fileset> | |
448 | + </union> | |
449 | + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> | |
450 | + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="Moenizer" testname="TestNG tests" workingDir="${work.dir}"> | |
451 | + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> | |
452 | + <propertyset> | |
453 | + <propertyref prefix="test-sys-prop."/> | |
454 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
455 | + </propertyset> | |
456 | + <customize/> | |
457 | + </testng> | |
458 | + </sequential> | |
459 | + </macrodef> | |
460 | + </target> | |
461 | + <target name="-init-macrodef-test-impl"> | |
462 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
463 | + <attribute default="${includes}" name="includes"/> | |
464 | + <attribute default="${excludes}" name="excludes"/> | |
465 | + <attribute default="**" name="testincludes"/> | |
466 | + <attribute default="" name="testmethods"/> | |
467 | + <element implicit="true" name="customize" optional="true"/> | |
468 | + <sequential> | |
469 | + <echo>No tests executed.</echo> | |
470 | + </sequential> | |
471 | + </macrodef> | |
472 | + </target> | |
473 | + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> | |
474 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
475 | + <attribute default="${includes}" name="includes"/> | |
476 | + <attribute default="${excludes}" name="excludes"/> | |
477 | + <attribute default="**" name="testincludes"/> | |
478 | + <attribute default="" name="testmethods"/> | |
479 | + <element implicit="true" name="customize" optional="true"/> | |
480 | + <sequential> | |
481 | + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
482 | + <customize/> | |
483 | + </j2seproject3:junit> | |
484 | + </sequential> | |
485 | + </macrodef> | |
486 | + </target> | |
487 | + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> | |
488 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
489 | + <attribute default="${includes}" name="includes"/> | |
490 | + <attribute default="${excludes}" name="excludes"/> | |
491 | + <attribute default="**" name="testincludes"/> | |
492 | + <attribute default="" name="testmethods"/> | |
493 | + <element implicit="true" name="customize" optional="true"/> | |
494 | + <sequential> | |
495 | + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
496 | + <customize/> | |
497 | + </j2seproject3:testng> | |
498 | + </sequential> | |
499 | + </macrodef> | |
500 | + </target> | |
501 | + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> | |
502 | + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
503 | + <attribute default="${includes}" name="includes"/> | |
504 | + <attribute default="${excludes}" name="excludes"/> | |
505 | + <attribute default="**" name="testincludes"/> | |
506 | + <attribute default="" name="testmethods"/> | |
507 | + <sequential> | |
508 | + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
509 | + <customize> | |
510 | + <classpath> | |
511 | + <path path="${run.test.classpath}"/> | |
512 | + </classpath> | |
513 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
514 | + <jvmarg line="${run.jvmargs}"/> | |
515 | + <jvmarg line="${run.jvmargs.ide}"/> | |
516 | + </customize> | |
517 | + </j2seproject3:test-impl> | |
518 | + </sequential> | |
519 | + </macrodef> | |
520 | + </target> | |
521 | + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> | |
522 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
523 | + <attribute default="${includes}" name="includes"/> | |
524 | + <attribute default="${excludes}" name="excludes"/> | |
525 | + <attribute default="**" name="testincludes"/> | |
526 | + <attribute default="" name="testmethods"/> | |
527 | + <element name="customize" optional="true"/> | |
528 | + <sequential> | |
529 | + <property name="junit.forkmode" value="perTest"/> | |
530 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
531 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
532 | + <syspropertyset> | |
533 | + <propertyref prefix="test-sys-prop."/> | |
534 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
535 | + </syspropertyset> | |
536 | + <formatter type="brief" usefile="false"/> | |
537 | + <formatter type="xml"/> | |
538 | + <jvmarg value="-ea"/> | |
539 | + <jvmarg line="${debug-args-line}"/> | |
540 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
541 | + <customize/> | |
542 | + </junit> | |
543 | + </sequential> | |
544 | + </macrodef> | |
545 | + </target> | |
546 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> | |
547 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
548 | + <attribute default="${includes}" name="includes"/> | |
549 | + <attribute default="${excludes}" name="excludes"/> | |
550 | + <attribute default="**" name="testincludes"/> | |
551 | + <attribute default="" name="testmethods"/> | |
552 | + <element name="customize" optional="true"/> | |
553 | + <sequential> | |
554 | + <property name="junit.forkmode" value="perTest"/> | |
555 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
556 | + <batchtest todir="${build.test.results.dir}"> | |
557 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
558 | + <filename name="@{testincludes}"/> | |
559 | + </fileset> | |
560 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
561 | + <filename name="${test.binarytestincludes}"/> | |
562 | + </fileset> | |
563 | + </batchtest> | |
564 | + <syspropertyset> | |
565 | + <propertyref prefix="test-sys-prop."/> | |
566 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
567 | + </syspropertyset> | |
568 | + <formatter type="brief" usefile="false"/> | |
569 | + <formatter type="xml"/> | |
570 | + <jvmarg value="-ea"/> | |
571 | + <jvmarg line="${debug-args-line}"/> | |
572 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
573 | + <customize/> | |
574 | + </junit> | |
575 | + </sequential> | |
576 | + </macrodef> | |
577 | + </target> | |
578 | + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> | |
579 | + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
580 | + <attribute default="${includes}" name="includes"/> | |
581 | + <attribute default="${excludes}" name="excludes"/> | |
582 | + <attribute default="**" name="testincludes"/> | |
583 | + <attribute default="" name="testmethods"/> | |
584 | + <element implicit="true" name="customize" optional="true"/> | |
585 | + <sequential> | |
586 | + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
587 | + <customize/> | |
588 | + </j2seproject3:junit-debug> | |
589 | + </sequential> | |
590 | + </macrodef> | |
591 | + </target> | |
592 | + <target if="${testng.available}" name="-init-macrodef-testng-debug"> | |
593 | + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
594 | + <attribute default="${main.class}" name="testClass"/> | |
595 | + <attribute default="" name="testMethod"/> | |
596 | + <element name="customize2" optional="true"/> | |
597 | + <sequential> | |
598 | + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> | |
599 | + <isset property="test.method"/> | |
600 | + </condition> | |
601 | + <condition else="-suitename Moenizer -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> | |
602 | + <matches pattern=".*\.xml" string="@{testClass}"/> | |
603 | + </condition> | |
604 | + <delete dir="${build.test.results.dir}" quiet="true"/> | |
605 | + <mkdir dir="${build.test.results.dir}"/> | |
606 | + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> | |
607 | + <customize> | |
608 | + <customize2/> | |
609 | + <jvmarg value="-ea"/> | |
610 | + <arg line="${testng.debug.mode}"/> | |
611 | + <arg line="-d ${build.test.results.dir}"/> | |
612 | + <arg line="-listener org.testng.reporters.VerboseReporter"/> | |
613 | + <arg line="${testng.cmd.args}"/> | |
614 | + </customize> | |
615 | + </j2seproject3:debug> | |
616 | + </sequential> | |
617 | + </macrodef> | |
618 | + </target> | |
619 | + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> | |
620 | + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
621 | + <attribute default="${main.class}" name="testClass"/> | |
622 | + <attribute default="" name="testMethod"/> | |
623 | + <element implicit="true" name="customize2" optional="true"/> | |
624 | + <sequential> | |
625 | + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> | |
626 | + <customize2/> | |
627 | + </j2seproject3:testng-debug> | |
628 | + </sequential> | |
629 | + </macrodef> | |
630 | + </target> | |
631 | + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> | |
632 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
633 | + <attribute default="${includes}" name="includes"/> | |
634 | + <attribute default="${excludes}" name="excludes"/> | |
635 | + <attribute default="**" name="testincludes"/> | |
636 | + <attribute default="" name="testmethods"/> | |
637 | + <attribute default="${main.class}" name="testClass"/> | |
638 | + <attribute default="" name="testMethod"/> | |
639 | + <sequential> | |
640 | + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
641 | + <customize> | |
642 | + <classpath> | |
643 | + <path path="${run.test.classpath}"/> | |
644 | + </classpath> | |
645 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
646 | + <jvmarg line="${run.jvmargs}"/> | |
647 | + <jvmarg line="${run.jvmargs.ide}"/> | |
648 | + </customize> | |
649 | + </j2seproject3:test-debug-impl> | |
650 | + </sequential> | |
651 | + </macrodef> | |
652 | + </target> | |
653 | + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> | |
654 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
655 | + <attribute default="${includes}" name="includes"/> | |
656 | + <attribute default="${excludes}" name="excludes"/> | |
657 | + <attribute default="**" name="testincludes"/> | |
658 | + <attribute default="" name="testmethods"/> | |
659 | + <attribute default="${main.class}" name="testClass"/> | |
660 | + <attribute default="" name="testMethod"/> | |
661 | + <sequential> | |
662 | + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> | |
663 | + <customize2> | |
664 | + <syspropertyset> | |
665 | + <propertyref prefix="test-sys-prop."/> | |
666 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
667 | + </syspropertyset> | |
668 | + </customize2> | |
669 | + </j2seproject3:testng-debug-impl> | |
670 | + </sequential> | |
671 | + </macrodef> | |
672 | + </target> | |
673 | + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> | |
674 | + <!-- | |
675 | + pre NB7.2 profiling section; consider it deprecated | |
676 | + --> | |
677 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> | |
678 | + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> | |
679 | + <!-- Empty placeholder for easier customization. --> | |
680 | + <!-- You can override this target in the ../build.xml file. --> | |
681 | + </target> | |
682 | + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> | |
683 | + <!-- Empty placeholder for easier customization. --> | |
684 | + <!-- You can override this target in the ../build.xml file. --> | |
685 | + </target> | |
686 | + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> | |
687 | + <macrodef name="resolve"> | |
688 | + <attribute name="name"/> | |
689 | + <attribute name="value"/> | |
690 | + <sequential> | |
691 | + <property name="@{name}" value="${env.@{value}}"/> | |
692 | + </sequential> | |
693 | + </macrodef> | |
694 | + <macrodef name="profile"> | |
695 | + <attribute default="${main.class}" name="classname"/> | |
696 | + <element name="customize" optional="true"/> | |
697 | + <sequential> | |
698 | + <property environment="env"/> | |
699 | + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> | |
700 | + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> | |
701 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
702 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
703 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
704 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
705 | + <arg line="${application.args}"/> | |
706 | + <classpath> | |
707 | + <path path="${run.classpath}"/> | |
708 | + </classpath> | |
709 | + <syspropertyset> | |
710 | + <propertyref prefix="run-sys-prop."/> | |
711 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
712 | + </syspropertyset> | |
713 | + <customize/> | |
714 | + </java> | |
715 | + </sequential> | |
716 | + </macrodef> | |
717 | + </target> | |
718 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> | |
719 | + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> | |
720 | + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> | |
721 | + </target> | |
722 | + <!-- | |
723 | + end of pre NB7.2 profiling section | |
724 | + --> | |
725 | + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> | |
726 | + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
727 | + <attribute default="${main.class}" name="name"/> | |
728 | + <attribute default="${debug.classpath}" name="classpath"/> | |
729 | + <attribute default="" name="stopclassname"/> | |
730 | + <sequential> | |
731 | + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> | |
732 | + <classpath> | |
733 | + <path path="@{classpath}"/> | |
734 | + </classpath> | |
735 | + </nbjpdastart> | |
736 | + </sequential> | |
737 | + </macrodef> | |
738 | + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
739 | + <attribute default="${build.classes.dir}" name="dir"/> | |
740 | + <sequential> | |
741 | + <nbjpdareload> | |
742 | + <fileset dir="@{dir}" includes="${fix.classes}"> | |
743 | + <include name="${fix.includes}*.class"/> | |
744 | + </fileset> | |
745 | + </nbjpdareload> | |
746 | + </sequential> | |
747 | + </macrodef> | |
748 | + </target> | |
749 | + <target name="-init-debug-args"> | |
750 | + <property name="version-output" value="java version "${ant.java.version}"/> | |
751 | + <condition property="have-jdk-older-than-1.4"> | |
752 | + <or> | |
753 | + <contains string="${version-output}" substring="java version "1.0"/> | |
754 | + <contains string="${version-output}" substring="java version "1.1"/> | |
755 | + <contains string="${version-output}" substring="java version "1.2"/> | |
756 | + <contains string="${version-output}" substring="java version "1.3"/> | |
757 | + </or> | |
758 | + </condition> | |
759 | + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> | |
760 | + <istrue value="${have-jdk-older-than-1.4}"/> | |
761 | + </condition> | |
762 | + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> | |
763 | + <os family="windows"/> | |
764 | + </condition> | |
765 | + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> | |
766 | + <isset property="debug.transport"/> | |
767 | + </condition> | |
768 | + </target> | |
769 | + <target depends="-init-debug-args" name="-init-macrodef-debug"> | |
770 | + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
771 | + <attribute default="${main.class}" name="classname"/> | |
772 | + <attribute default="${debug.classpath}" name="classpath"/> | |
773 | + <element name="customize" optional="true"/> | |
774 | + <sequential> | |
775 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
776 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
777 | + <jvmarg line="${debug-args-line}"/> | |
778 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
779 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
780 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
781 | + <jvmarg line="${run.jvmargs}"/> | |
782 | + <jvmarg line="${run.jvmargs.ide}"/> | |
783 | + <classpath> | |
784 | + <path path="@{classpath}"/> | |
785 | + </classpath> | |
786 | + <syspropertyset> | |
787 | + <propertyref prefix="run-sys-prop."/> | |
788 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
789 | + </syspropertyset> | |
790 | + <customize/> | |
791 | + </java> | |
792 | + </sequential> | |
793 | + </macrodef> | |
794 | + </target> | |
795 | + <target name="-init-macrodef-java"> | |
796 | + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
797 | + <attribute default="${main.class}" name="classname"/> | |
798 | + <attribute default="${run.classpath}" name="classpath"/> | |
799 | + <attribute default="jvm" name="jvm"/> | |
800 | + <element name="customize" optional="true"/> | |
801 | + <sequential> | |
802 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
803 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
804 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
805 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
806 | + <jvmarg line="${run.jvmargs}"/> | |
807 | + <jvmarg line="${run.jvmargs.ide}"/> | |
808 | + <classpath> | |
809 | + <path path="@{classpath}"/> | |
810 | + </classpath> | |
811 | + <syspropertyset> | |
812 | + <propertyref prefix="run-sys-prop."/> | |
813 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
814 | + </syspropertyset> | |
815 | + <customize/> | |
816 | + </java> | |
817 | + </sequential> | |
818 | + </macrodef> | |
819 | + </target> | |
820 | + <target name="-init-macrodef-copylibs"> | |
821 | + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
822 | + <attribute default="${manifest.file}" name="manifest"/> | |
823 | + <element name="customize" optional="true"/> | |
824 | + <sequential> | |
825 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
826 | + <pathconvert property="run.classpath.without.build.classes.dir"> | |
827 | + <path path="${run.classpath}"/> | |
828 | + <map from="${build.classes.dir.resolved}" to=""/> | |
829 | + </pathconvert> | |
830 | + <pathconvert pathsep=" " property="jar.classpath"> | |
831 | + <path path="${run.classpath.without.build.classes.dir}"/> | |
832 | + <chainedmapper> | |
833 | + <flattenmapper/> | |
834 | + <filtermapper> | |
835 | + <replacestring from=" " to="%20"/> | |
836 | + </filtermapper> | |
837 | + <globmapper from="*" to="lib/*"/> | |
838 | + </chainedmapper> | |
839 | + </pathconvert> | |
840 | + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> | |
841 | + <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> | |
842 | + <fileset dir="${build.classes.dir}"/> | |
843 | + <manifest> | |
844 | + <attribute name="Class-Path" value="${jar.classpath}"/> | |
845 | + <customize/> | |
846 | + </manifest> | |
847 | + </copylibs> | |
848 | + </sequential> | |
849 | + </macrodef> | |
850 | + </target> | |
851 | + <target name="-init-presetdef-jar"> | |
852 | + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
853 | + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> | |
854 | + <j2seproject1:fileset dir="${build.classes.dir}"/> | |
855 | + </jar> | |
856 | + </presetdef> | |
857 | + </target> | |
858 | + <target name="-init-ap-cmdline-properties"> | |
859 | + <property name="annotation.processing.enabled" value="true"/> | |
860 | + <property name="annotation.processing.processors.list" value=""/> | |
861 | + <property name="annotation.processing.processor.options" value=""/> | |
862 | + <property name="annotation.processing.run.all.processors" value="true"/> | |
863 | + <property name="javac.processorpath" value="${javac.classpath}"/> | |
864 | + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> | |
865 | + <condition property="ap.supported.internal" value="true"> | |
866 | + <not> | |
867 | + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> | |
868 | + </not> | |
869 | + </condition> | |
870 | + </target> | |
871 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> | |
872 | + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> | |
873 | + <isfalse value="${annotation.processing.run.all.processors}"/> | |
874 | + </condition> | |
875 | + <condition else="" property="ap.proc.none.internal" value="-proc:none"> | |
876 | + <isfalse value="${annotation.processing.enabled}"/> | |
877 | + </condition> | |
878 | + </target> | |
879 | + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> | |
880 | + <property name="ap.cmd.line.internal" value=""/> | |
881 | + </target> | |
882 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> | |
883 | + <!-- | |
884 | + =================== | |
885 | + COMPILATION SECTION | |
886 | + =================== | |
887 | + --> | |
888 | + <target name="-deps-jar-init" unless="built-jar.properties"> | |
889 | + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> | |
890 | + <delete file="${built-jar.properties}" quiet="true"/> | |
891 | + </target> | |
892 | + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> | |
893 | + <echo level="warn" message="Cycle detected: Moenizer was already built"/> | |
894 | + </target> | |
895 | + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> | |
896 | + <mkdir dir="${build.dir}"/> | |
897 | + <touch file="${built-jar.properties}" verbose="false"/> | |
898 | + <property file="${built-jar.properties}" prefix="already.built.jar."/> | |
899 | + <antcall target="-warn-already-built-jar"/> | |
900 | + <propertyfile file="${built-jar.properties}"> | |
901 | + <entry key="${basedir}" value=""/> | |
902 | + </propertyfile> | |
903 | + </target> | |
904 | + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> | |
905 | + <target depends="init" name="-check-automatic-build"> | |
906 | + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> | |
907 | + </target> | |
908 | + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> | |
909 | + <antcall target="clean"/> | |
910 | + </target> | |
911 | + <target depends="init,deps-jar,-groovy-init-macrodef-javac" name="-pre-pre-compile"> | |
912 | + <mkdir dir="${build.classes.dir}"/> | |
913 | + </target> | |
914 | + <target name="-pre-compile"> | |
915 | + <!-- Empty placeholder for easier customization. --> | |
916 | + <!-- You can override this target in the ../build.xml file. --> | |
917 | + </target> | |
918 | + <target if="do.depend.true" name="-compile-depend"> | |
919 | + <pathconvert property="build.generated.subdirs"> | |
920 | + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
921 | + <include name="*"/> | |
922 | + </dirset> | |
923 | + </pathconvert> | |
924 | + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> | |
925 | + </target> | |
926 | + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> | |
927 | + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> | |
928 | + <copy todir="${build.classes.dir}"> | |
929 | + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
930 | + </copy> | |
931 | + </target> | |
932 | + <target if="has.persistence.xml" name="-copy-persistence-xml"> | |
933 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
934 | + <copy todir="${build.classes.dir}/META-INF"> | |
935 | + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/> | |
936 | + </copy> | |
937 | + </target> | |
938 | + <target name="-post-compile"> | |
939 | + <!-- Empty placeholder for easier customization. --> | |
940 | + <!-- You can override this target in the ../build.xml file. --> | |
941 | + </target> | |
942 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> | |
943 | + <target name="-pre-compile-single"> | |
944 | + <!-- Empty placeholder for easier customization. --> | |
945 | + <!-- You can override this target in the ../build.xml file. --> | |
946 | + </target> | |
947 | + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> | |
948 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
949 | + <j2seproject3:force-recompile/> | |
950 | + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> | |
951 | + </target> | |
952 | + <target name="-post-compile-single"> | |
953 | + <!-- Empty placeholder for easier customization. --> | |
954 | + <!-- You can override this target in the ../build.xml file. --> | |
955 | + </target> | |
956 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> | |
957 | + <!-- | |
958 | + ==================== | |
959 | + JAR BUILDING SECTION | |
960 | + ==================== | |
961 | + --> | |
962 | + <target depends="init" name="-pre-pre-jar"> | |
963 | + <dirname file="${dist.jar}" property="dist.jar.dir"/> | |
964 | + <mkdir dir="${dist.jar.dir}"/> | |
965 | + </target> | |
966 | + <target name="-pre-jar"> | |
967 | + <!-- Empty placeholder for easier customization. --> | |
968 | + <!-- You can override this target in the ../build.xml file. --> | |
969 | + </target> | |
970 | + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> | |
971 | + <j2seproject1:jar/> | |
972 | + </target> | |
973 | + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> | |
974 | + <j2seproject1:jar manifest="${manifest.file}"/> | |
975 | + </target> | |
976 | + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> | |
977 | + <j2seproject1:jar manifest="${manifest.file}"> | |
978 | + <j2seproject1:manifest> | |
979 | + <j2seproject1:attribute name="Main-Class" value="${main.class}"/> | |
980 | + </j2seproject1:manifest> | |
981 | + </j2seproject1:jar> | |
982 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
983 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
984 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
985 | + <pathconvert property="run.classpath.with.dist.jar"> | |
986 | + <path path="${run.classpath}"/> | |
987 | + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> | |
988 | + </pathconvert> | |
989 | + <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> | |
990 | + </target> | |
991 | + <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> | |
992 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
993 | + <touch file="${tmp.manifest.file}" verbose="false"/> | |
994 | + </target> | |
995 | + <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> | |
996 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
997 | + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> | |
998 | + </target> | |
999 | + <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> | |
1000 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
1001 | + <attribute name="Main-Class" value="${main.class}"/> | |
1002 | + </manifest> | |
1003 | + </target> | |
1004 | + <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> | |
1005 | + <basename file="${application.splash}" property="splashscreen.basename"/> | |
1006 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
1007 | + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> | |
1008 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
1009 | + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> | |
1010 | + </manifest> | |
1011 | + </target> | |
1012 | + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> | |
1013 | + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> | |
1014 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
1015 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
1016 | + <echo level="info">java -jar "${dist.jar.resolved}"</echo> | |
1017 | + </target> | |
1018 | + <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> | |
1019 | + <delete> | |
1020 | + <fileset file="${tmp.manifest.file}"/> | |
1021 | + </delete> | |
1022 | + </target> | |
1023 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> | |
1024 | + <target name="-post-jar"> | |
1025 | + <!-- Empty placeholder for easier customization. --> | |
1026 | + <!-- You can override this target in the ../build.xml file. --> | |
1027 | + </target> | |
1028 | + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> | |
1029 | + <!-- | |
1030 | + ================= | |
1031 | + EXECUTION SECTION | |
1032 | + ================= | |
1033 | + --> | |
1034 | + <target depends="init,compile" description="Run a main class." name="run"> | |
1035 | + <j2seproject1:java> | |
1036 | + <customize> | |
1037 | + <arg line="${application.args}"/> | |
1038 | + </customize> | |
1039 | + </j2seproject1:java> | |
1040 | + </target> | |
1041 | + <target name="-do-not-recompile"> | |
1042 | + <property name="javac.includes.binary" value=""/> | |
1043 | + </target> | |
1044 | + <target depends="init,compile-single" name="run-single"> | |
1045 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1046 | + <j2seproject1:java classname="${run.class}"/> | |
1047 | + </target> | |
1048 | + <target depends="init,compile-test-single" name="run-test-with-main"> | |
1049 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1050 | + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> | |
1051 | + </target> | |
1052 | + <!-- | |
1053 | + ================= | |
1054 | + DEBUGGING SECTION | |
1055 | + ================= | |
1056 | + --> | |
1057 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> | |
1058 | + <j2seproject1:nbjpdastart name="${debug.class}"/> | |
1059 | + </target> | |
1060 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> | |
1061 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> | |
1062 | + </target> | |
1063 | + <target depends="init,compile" name="-debug-start-debuggee"> | |
1064 | + <j2seproject3:debug> | |
1065 | + <customize> | |
1066 | + <arg line="${application.args}"/> | |
1067 | + </customize> | |
1068 | + </j2seproject3:debug> | |
1069 | + </target> | |
1070 | + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> | |
1071 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> | |
1072 | + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> | |
1073 | + </target> | |
1074 | + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> | |
1075 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> | |
1076 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
1077 | + <j2seproject3:debug classname="${debug.class}"/> | |
1078 | + </target> | |
1079 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> | |
1080 | + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> | |
1081 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
1082 | + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> | |
1083 | + </target> | |
1084 | + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> | |
1085 | + <target depends="init" name="-pre-debug-fix"> | |
1086 | + <fail unless="fix.includes">Must set fix.includes</fail> | |
1087 | + <property name="javac.includes" value="${fix.includes}.java"/> | |
1088 | + </target> | |
1089 | + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> | |
1090 | + <j2seproject1:nbjpdareload/> | |
1091 | + </target> | |
1092 | + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> | |
1093 | + <!-- | |
1094 | + ================= | |
1095 | + PROFILING SECTION | |
1096 | + ================= | |
1097 | + --> | |
1098 | + <!-- | |
1099 | + pre NB7.2 profiler integration | |
1100 | + --> | |
1101 | + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> | |
1102 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1103 | + <nbprofiledirect> | |
1104 | + <classpath> | |
1105 | + <path path="${run.classpath}"/> | |
1106 | + </classpath> | |
1107 | + </nbprofiledirect> | |
1108 | + <profile/> | |
1109 | + </target> | |
1110 | + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> | |
1111 | + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> | |
1112 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1113 | + <nbprofiledirect> | |
1114 | + <classpath> | |
1115 | + <path path="${run.classpath}"/> | |
1116 | + </classpath> | |
1117 | + </nbprofiledirect> | |
1118 | + <profile classname="${profile.class}"/> | |
1119 | + </target> | |
1120 | + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> | |
1121 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1122 | + <nbprofiledirect> | |
1123 | + <classpath> | |
1124 | + <path path="${run.classpath}"/> | |
1125 | + </classpath> | |
1126 | + </nbprofiledirect> | |
1127 | + <profile classname="sun.applet.AppletViewer"> | |
1128 | + <customize> | |
1129 | + <arg value="${applet.url}"/> | |
1130 | + </customize> | |
1131 | + </profile> | |
1132 | + </target> | |
1133 | + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> | |
1134 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
1135 | + <nbprofiledirect> | |
1136 | + <classpath> | |
1137 | + <path path="${run.test.classpath}"/> | |
1138 | + </classpath> | |
1139 | + </nbprofiledirect> | |
1140 | + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> | |
1141 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
1142 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
1143 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
1144 | + <test name="${profile.class}"/> | |
1145 | + <classpath> | |
1146 | + <path path="${run.test.classpath}"/> | |
1147 | + </classpath> | |
1148 | + <syspropertyset> | |
1149 | + <propertyref prefix="test-sys-prop."/> | |
1150 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
1151 | + </syspropertyset> | |
1152 | + <formatter type="brief" usefile="false"/> | |
1153 | + <formatter type="xml"/> | |
1154 | + </junit> | |
1155 | + </target> | |
1156 | + <!-- | |
1157 | + end of pre NB72 profiling section | |
1158 | + --> | |
1159 | + <target if="netbeans.home" name="-profile-check"> | |
1160 | + <condition property="profiler.configured"> | |
1161 | + <or> | |
1162 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> | |
1163 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> | |
1164 | + </or> | |
1165 | + </condition> | |
1166 | + </target> | |
1167 | + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> | |
1168 | + <startprofiler/> | |
1169 | + <antcall target="run"/> | |
1170 | + </target> | |
1171 | + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> | |
1172 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1173 | + <startprofiler/> | |
1174 | + <antcall target="run-single"/> | |
1175 | + </target> | |
1176 | + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> | |
1177 | + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> | |
1178 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
1179 | + <startprofiler/> | |
1180 | + <antcall target="test-single"/> | |
1181 | + </target> | |
1182 | + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> | |
1183 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
1184 | + <startprofiler/> | |
1185 | + <antcal target="run-test-with-main"/> | |
1186 | + </target> | |
1187 | + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> | |
1188 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
1189 | + <startprofiler/> | |
1190 | + <antcall target="run-applet"/> | |
1191 | + </target> | |
1192 | + <!-- | |
1193 | + =============== | |
1194 | + JAVADOC SECTION | |
1195 | + =============== | |
1196 | + --> | |
1197 | + <target depends="init" if="have.sources" name="-javadoc-build"> | |
1198 | + <mkdir dir="${dist.javadoc.dir}"/> | |
1199 | + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> | |
1200 | + <and> | |
1201 | + <isset property="endorsed.classpath.cmd.line.arg"/> | |
1202 | + <not> | |
1203 | + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> | |
1204 | + </not> | |
1205 | + </and> | |
1206 | + </condition> | |
1207 | + <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> | |
1208 | + <classpath> | |
1209 | + <path path="${javac.classpath}"/> | |
1210 | + </classpath> | |
1211 | + <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}"> | |
1212 | + <filename name="**/*.java"/> | |
1213 | + </fileset> | |
1214 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
1215 | + <include name="**/*.java"/> | |
1216 | + <exclude name="*.java"/> | |
1217 | + </fileset> | |
1218 | + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> | |
1219 | + </javadoc> | |
1220 | + <copy todir="${dist.javadoc.dir}"> | |
1221 | + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> | |
1222 | + <filename name="**/doc-files/**"/> | |
1223 | + </fileset> | |
1224 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
1225 | + <include name="**/doc-files/**"/> | |
1226 | + </fileset> | |
1227 | + </copy> | |
1228 | + </target> | |
1229 | + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> | |
1230 | + <nbbrowse file="${dist.javadoc.dir}/index.html"/> | |
1231 | + </target> | |
1232 | + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> | |
1233 | + <!-- | |
1234 | + ========================= | |
1235 | + TEST COMPILATION SECTION | |
1236 | + ========================= | |
1237 | + --> | |
1238 | + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> | |
1239 | + <mkdir dir="${build.test.classes.dir}"/> | |
1240 | + </target> | |
1241 | + <target name="-pre-compile-test"> | |
1242 | + <!-- Empty placeholder for easier customization. --> | |
1243 | + <!-- You can override this target in the ../build.xml file. --> | |
1244 | + </target> | |
1245 | + <target if="do.depend.true" name="-compile-test-depend"> | |
1246 | + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> | |
1247 | + </target> | |
1248 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> | |
1249 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> | |
1250 | + <copy todir="${build.test.classes.dir}"> | |
1251 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
1252 | + </copy> | |
1253 | + </target> | |
1254 | + <target name="-post-compile-test"> | |
1255 | + <!-- Empty placeholder for easier customization. --> | |
1256 | + <!-- You can override this target in the ../build.xml file. --> | |
1257 | + </target> | |
1258 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> | |
1259 | + <target name="-pre-compile-test-single"> | |
1260 | + <!-- Empty placeholder for easier customization. --> | |
1261 | + <!-- You can override this target in the ../build.xml file. --> | |
1262 | + </target> | |
1263 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> | |
1264 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
1265 | + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> | |
1266 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> | |
1267 | + <copy todir="${build.test.classes.dir}"> | |
1268 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
1269 | + </copy> | |
1270 | + </target> | |
1271 | + <target name="-post-compile-test-single"> | |
1272 | + <!-- Empty placeholder for easier customization. --> | |
1273 | + <!-- You can override this target in the ../build.xml file. --> | |
1274 | + </target> | |
1275 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> | |
1276 | + <!-- | |
1277 | + ======================= | |
1278 | + TEST EXECUTION SECTION | |
1279 | + ======================= | |
1280 | + --> | |
1281 | + <target depends="init" if="have.tests" name="-pre-test-run"> | |
1282 | + <mkdir dir="${build.test.results.dir}"/> | |
1283 | + </target> | |
1284 | + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> | |
1285 | + <j2seproject3:test testincludes="**/*Test.java"/> | |
1286 | + </target> | |
1287 | + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> | |
1288 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
1289 | + </target> | |
1290 | + <target depends="init" if="have.tests" name="test-report"/> | |
1291 | + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> | |
1292 | + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> | |
1293 | + <target depends="init" if="have.tests" name="-pre-test-run-single"> | |
1294 | + <mkdir dir="${build.test.results.dir}"/> | |
1295 | + </target> | |
1296 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> | |
1297 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
1298 | + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> | |
1299 | + </target> | |
1300 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> | |
1301 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
1302 | + </target> | |
1303 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> | |
1304 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> | |
1305 | + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> | |
1306 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
1307 | + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> | |
1308 | + </target> | |
1309 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> | |
1310 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
1311 | + </target> | |
1312 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> | |
1313 | + <!-- | |
1314 | + ======================= | |
1315 | + TEST DEBUGGING SECTION | |
1316 | + ======================= | |
1317 | + --> | |
1318 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> | |
1319 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
1320 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> | |
1321 | + </target> | |
1322 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> | |
1323 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
1324 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
1325 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> | |
1326 | + </target> | |
1327 | + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> | |
1328 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> | |
1329 | + </target> | |
1330 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> | |
1331 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> | |
1332 | + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> | |
1333 | + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> | |
1334 | + </target> | |
1335 | + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> | |
1336 | + <!-- | |
1337 | + ========================= | |
1338 | + APPLET EXECUTION SECTION | |
1339 | + ========================= | |
1340 | + --> | |
1341 | + <target depends="init,compile-single" name="run-applet"> | |
1342 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
1343 | + <j2seproject1:java classname="sun.applet.AppletViewer"> | |
1344 | + <customize> | |
1345 | + <arg value="${applet.url}"/> | |
1346 | + </customize> | |
1347 | + </j2seproject1:java> | |
1348 | + </target> | |
1349 | + <!-- | |
1350 | + ========================= | |
1351 | + APPLET DEBUGGING SECTION | |
1352 | + ========================= | |
1353 | + --> | |
1354 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> | |
1355 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
1356 | + <j2seproject3:debug classname="sun.applet.AppletViewer"> | |
1357 | + <customize> | |
1358 | + <arg value="${applet.url}"/> | |
1359 | + </customize> | |
1360 | + </j2seproject3:debug> | |
1361 | + </target> | |
1362 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> | |
1363 | + <!-- | |
1364 | + =============== | |
1365 | + CLEANUP SECTION | |
1366 | + =============== | |
1367 | + --> | |
1368 | + <target name="-deps-clean-init" unless="built-clean.properties"> | |
1369 | + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> | |
1370 | + <delete file="${built-clean.properties}" quiet="true"/> | |
1371 | + </target> | |
1372 | + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> | |
1373 | + <echo level="warn" message="Cycle detected: Moenizer was already built"/> | |
1374 | + </target> | |
1375 | + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> | |
1376 | + <mkdir dir="${build.dir}"/> | |
1377 | + <touch file="${built-clean.properties}" verbose="false"/> | |
1378 | + <property file="${built-clean.properties}" prefix="already.built.clean."/> | |
1379 | + <antcall target="-warn-already-built-clean"/> | |
1380 | + <propertyfile file="${built-clean.properties}"> | |
1381 | + <entry key="${basedir}" value=""/> | |
1382 | + </propertyfile> | |
1383 | + </target> | |
1384 | + <target depends="init" name="-do-clean"> | |
1385 | + <delete dir="${build.dir}"/> | |
1386 | + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> | |
1387 | + </target> | |
1388 | + <target name="-post-clean"> | |
1389 | + <!-- Empty placeholder for easier customization. --> | |
1390 | + <!-- You can override this target in the ../build.xml file. --> | |
1391 | + </target> | |
1392 | + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> | |
1393 | + <target name="-check-call-dep"> | |
1394 | + <property file="${call.built.properties}" prefix="already.built."/> | |
1395 | + <condition property="should.call.dep"> | |
1396 | + <and> | |
1397 | + <not> | |
1398 | + <isset property="already.built.${call.subproject}"/> | |
1399 | + </not> | |
1400 | + <available file="${call.script}"/> | |
1401 | + </and> | |
1402 | + </condition> | |
1403 | + </target> | |
1404 | + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> | |
1405 | + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> | |
1406 | + <propertyset> | |
1407 | + <propertyref prefix="transfer."/> | |
1408 | + <mapper from="transfer.*" to="*" type="glob"/> | |
1409 | + </propertyset> | |
1410 | + </ant> | |
1411 | + </target> | |
1412 | +</project> |
@@ -0,0 +1,5 @@ | ||
1 | +Manifest-Version: 1.0 | |
2 | +OmegaT-Plugin: true | |
3 | + | |
4 | +Name: org.omegat.plugin.moenizer.Moenizer | |
5 | +OmegaT-Plugin: base | |
\ No newline at end of file |
@@ -0,0 +1,70 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import com.vlsolutions.swing.docking.DockViewTitleBar; | |
20 | +import com.vlsolutions.swing.docking.ui.DockViewTitleBarUI; | |
21 | +import java.awt.Color; | |
22 | +import java.awt.Graphics; | |
23 | +import java.awt.Graphics2D; | |
24 | +import javax.swing.JComponent; | |
25 | +import javax.swing.UIManager; | |
26 | + | |
27 | +/** | |
28 | + * | |
29 | + * @author Yu-Tang | |
30 | + */ | |
31 | +public class MoeDockViewTitleBarUI extends DockViewTitleBarUI { | |
32 | + | |
33 | + /* hack to use custom painting except on mac os (ugly opacity effects) */ | |
34 | + private static boolean useCustomPaint = System.getProperty("os.name"). | |
35 | + toLowerCase().indexOf("mac os") < 0; | |
36 | + | |
37 | + /* Alpha value for transparency (0-255) */ | |
38 | + private static int activeAlpha = 150; // transparent 0 <- ... -> 255 opaque | |
39 | + private static int inactiveAlpha = 100; // transparent 0 <- ... -> 255 opaque | |
40 | + | |
41 | + private Color activePanelColor = MoeDockViewTitleBarUI.makeTranslucentColor( | |
42 | + UIManager.getColor("Panel.background"), activeAlpha); | |
43 | + private Color inactivePanelColor = MoeDockViewTitleBarUI.makeTranslucentColor( | |
44 | + UIManager.getColor("Panel.background"), inactiveAlpha); | |
45 | + //private Color highlight = makeTranslucent(UIManager.getColor("controlLtHighlight")); | |
46 | + | |
47 | + | |
48 | + public MoeDockViewTitleBarUI(DockViewTitleBar tb) { | |
49 | + super(tb); | |
50 | + } | |
51 | + | |
52 | + @Override | |
53 | + public void paint(Graphics g, JComponent c) { | |
54 | + if (MoeDockViewTitleBarUI.useCustomPaint) { | |
55 | + DockViewTitleBar tb = (DockViewTitleBar)c; | |
56 | + | |
57 | + Graphics2D g2 = (Graphics2D) g.create(); | |
58 | + g2.setColor(tb.isActive() ? activePanelColor : inactivePanelColor); | |
59 | + g2.fillRect(0, 0, tb.getWidth(), tb.getHeight()); // emptyborder doesnt repaint | |
60 | + g2.dispose(); | |
61 | + } else { | |
62 | + super.paint(g, c); | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + private static Color makeTranslucentColor(Color color, int alpha) { | |
67 | + return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); | |
68 | + } | |
69 | + | |
70 | +} |
@@ -0,0 +1,36 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import javax.swing.JOptionPane; | |
20 | + | |
21 | +/** | |
22 | + * | |
23 | + * @author Yu-Tang | |
24 | + */ | |
25 | +public class MoeVersionInfo { | |
26 | + | |
27 | + private static final String APP_NAME = "Moenizer"; | |
28 | + private static final String APP_VERSION = "0.1"; | |
29 | + private static final String APP_BUILD = "20130806"; | |
30 | + private static final String APP_AUTHOR = "Yu-Tang"; | |
31 | + | |
32 | + public static void main(String[] args) { | |
33 | + JOptionPane.showMessageDialog(null, | |
34 | + APP_NAME + " ver." + APP_VERSION + "." + APP_BUILD + "\nby " + APP_AUTHOR); | |
35 | + } | |
36 | +} |
@@ -0,0 +1,343 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import java.io.File; | |
20 | +import java.io.FileFilter; | |
21 | +import java.net.URL; | |
22 | +import java.util.HashSet; | |
23 | +import java.util.Set; | |
24 | +import java.util.regex.Matcher; | |
25 | +import java.util.regex.Pattern; | |
26 | +import org.omegat.util.FileUtil; | |
27 | +import org.omegat.util.Log; | |
28 | + | |
29 | +/** | |
30 | + * | |
31 | + * @author Yu-Tang | |
32 | + */ | |
33 | +public class MoeConfig { | |
34 | + private static final String CONFIG_FILE_NAME = "moenizer.conf"; | |
35 | + private static final String SCRIPT_FILE_NAME = "moenizer.groovy"; | |
36 | + | |
37 | + private static final float DEFAULT_OPACITY = 0.5f; | |
38 | + private static final int MAX_OPACITY_IN_PERCENTAGE = 100; // Opaque | |
39 | + private static final int MIN_OPACITY_IN_PERCENTAGE = 0; // Transparent | |
40 | + | |
41 | + private static final long DEFAULT_INTERVAL = 60L * 1000L; // 1 minute in milliseconds | |
42 | + private static final long MAX_INTERVAL = 86400L * 1000L; // 24 hours | |
43 | + private static final long MIN_INTERVAL = 3L * 1000L; // 3 seconds | |
44 | + | |
45 | + private static final Pattern RE_LINEBREAK = Pattern.compile("[\\n\\r]+"); | |
46 | + private static final Pattern RE_OPACITY = Pattern.compile("(\\d+)\\s*%$"); | |
47 | + private static final Pattern RE_INTERVAL = Pattern.compile("(\\d+)\\s*([msh])", Pattern.CASE_INSENSITIVE); | |
48 | + private static final Pattern RE_SCRIPT = Pattern.compile("(?:/|\\\\\\\\[^\\\\]|[a-zA-Z]:\\\\).+\\.groovy"); | |
49 | + private static final Pattern RE_SOURCE = Pattern.compile("(?:http://|https://|/|\\\\\\\\[^\\\\]|[a-zA-Z]:\\\\).+"); | |
50 | + private static final Pattern RE_HAS_IMAGE_EXTENSION = Pattern.compile(".+\\.(?:bmp|png|jpg|jpeg|gif)"); | |
51 | + private static final Pattern RE_HAS_INTERNET_SHORTCUT_EXTENSION = Pattern.compile(".+\\.(?:url|website|webloc)"); | |
52 | + private static final Pattern RE_HTTP_OR_HTTPS_PROTOCOL = Pattern.compile("(?:http://|https://).+"); | |
53 | + private static final Pattern RE_SOURCE_IN_PLUGIN_DIR = Pattern.compile(".+\\.(?:bmp|png|jpg|jpeg|gif|url|website|webloc)"); | |
54 | + | |
55 | + private static ConfigData data; | |
56 | + private static HashSet<Object> sources; | |
57 | + | |
58 | + static { | |
59 | + // load config from file | |
60 | + ConfigData cd = loadConfig(); | |
61 | + | |
62 | + // flatten source dir to files (images only) | |
63 | + HashSet<Object> flattenSources = getFlattenSources(cd.source); | |
64 | + | |
65 | + // scan plugin dir if both sources and script are empty | |
66 | + if (flattenSources.isEmpty() && cd.script.isEmpty()) { | |
67 | + cd.script = getScriptInPluginDir(); | |
68 | + flattenSources = getSourcesInPluginDir(); | |
69 | + } | |
70 | + | |
71 | + // set default interval if current interval is 0 and has multiple sources | |
72 | + if (cd.interval == 0 && flattenSources.size() > 1) { | |
73 | + cd.interval = DEFAULT_INTERVAL; | |
74 | + } | |
75 | + | |
76 | + data = cd; | |
77 | + sources = flattenSources; | |
78 | + } | |
79 | + | |
80 | + public static long getInterval() { | |
81 | + return data.interval; | |
82 | + } | |
83 | + | |
84 | + public static float getOpacity() { | |
85 | + return data.opacity; | |
86 | + } | |
87 | + | |
88 | + public static File getScript() { | |
89 | + return data.script.isEmpty() ? null : new File(data.script); | |
90 | + } | |
91 | + | |
92 | + public static Object[] getSources() { | |
93 | + return sources.toArray(); | |
94 | + } | |
95 | + | |
96 | + | |
97 | + private static ConfigData loadConfig() { | |
98 | + ConfigData data = getDefaultConfig(); | |
99 | + try { | |
100 | + File file = new File(MoeUtil.getPluginJarDir(), CONFIG_FILE_NAME); | |
101 | + if ( file.isFile() ) { | |
102 | + String text = FileUtil.readTextFile(file); | |
103 | + String[] lines = RE_LINEBREAK.split(text); | |
104 | + Log.log("---- Config lines start ----"); | |
105 | + for (String line: lines) { | |
106 | + Log.log("[" + line + "]"); | |
107 | + if ( ! line.isEmpty() ) { | |
108 | + if (setOpacity(data, line) == true) { | |
109 | + // probably opacity value is changed from default | |
110 | + } else if (setInterval(data, line) == true) { | |
111 | + // probably interval value is changed from default | |
112 | + } else if (setScript(data, line) == true) { | |
113 | + // script URI | |
114 | + } else if (addSource(data, line) == true) { | |
115 | + // source URI (image) | |
116 | + } else { | |
117 | + // ignore | |
118 | + } | |
119 | + } | |
120 | + } | |
121 | + Log.log("---- Config lines end ----"); | |
122 | + } else { | |
123 | + Log.log("Config file '" + CONFIG_FILE_NAME + "' is not found."); | |
124 | + } | |
125 | + } catch (Exception ex) { | |
126 | + Log.log(ex); | |
127 | + } | |
128 | + return data; | |
129 | + } | |
130 | + | |
131 | + private static ConfigData getDefaultConfig() { | |
132 | + ConfigData cd = new ConfigData(); | |
133 | + cd.opacity = DEFAULT_OPACITY; | |
134 | + cd.interval = 0L; | |
135 | + cd.script = ""; | |
136 | + cd.source = new HashSet<String>(); // should be unique | |
137 | + return cd; | |
138 | + } | |
139 | + | |
140 | + /** | |
141 | + * set new opacity value to ConfigData | |
142 | + * @param data | |
143 | + * @param line | |
144 | + * @return true if line contains opacity value | |
145 | + */ | |
146 | + private static boolean setOpacity(ConfigData data, String line) { | |
147 | + Matcher matcher = RE_OPACITY.matcher(line); | |
148 | + if ( matcher.matches() ) { | |
149 | + String num = matcher.group(1); | |
150 | + Log.log("new Opacity (String) = " + num + "%"); | |
151 | + int i = Integer.parseInt(num); // in percent | |
152 | + if (i > MAX_OPACITY_IN_PERCENTAGE) { | |
153 | + Log.log("value '" + line + "' is out of range for opacity."); | |
154 | + data.opacity = MAX_OPACITY_IN_PERCENTAGE; | |
155 | + } else if (i < MIN_OPACITY_IN_PERCENTAGE) { | |
156 | + Log.log("value '" + line + "' is out of range for opacity."); | |
157 | + data.opacity = MIN_OPACITY_IN_PERCENTAGE; | |
158 | + } else { | |
159 | + float f = ((float) i / MAX_OPACITY_IN_PERCENTAGE); | |
160 | + data.opacity = f; | |
161 | + Log.log("new Opacity (float) = " + f); | |
162 | + } | |
163 | + return true; | |
164 | + } | |
165 | + return false; | |
166 | + } | |
167 | + | |
168 | + /** | |
169 | + * set new interval value to ConfigData | |
170 | + * @param data | |
171 | + * @param line | |
172 | + * @return true if line contains interval value | |
173 | + */ | |
174 | + private static boolean setInterval(ConfigData data, String line) { | |
175 | + Matcher matcher = RE_INTERVAL.matcher(line); | |
176 | + if ( matcher.matches() ) { | |
177 | + String num = matcher.group(1); | |
178 | + String unit = matcher.group(2).toLowerCase(); // s | m | h | |
179 | + Log.log("new Interval (String) = " + num + unit); | |
180 | + | |
181 | + long i = Long.parseLong(num); | |
182 | + if (unit.equals("s")) { | |
183 | + i = i * 1000; | |
184 | + } else if (unit.equals("m")) { | |
185 | + i = i * 60 * 1000; | |
186 | + } else if (unit.equals("h")) { | |
187 | + i = i * 60 * 60 * 1000; | |
188 | + } | |
189 | + | |
190 | + // validate range | |
191 | + if (i > MAX_INTERVAL) { | |
192 | + Log.log("value '" + line + "' is out of range for interval."); | |
193 | + data.interval = MAX_INTERVAL; | |
194 | + } else if (i < MIN_INTERVAL) { | |
195 | + Log.log("value '" + line + "' is out of range for interval."); | |
196 | + data.interval = MIN_INTERVAL; | |
197 | + } else { | |
198 | + data.interval = i; | |
199 | + Log.log("new Interval (int) = " + i); | |
200 | + } | |
201 | + return true; | |
202 | + } | |
203 | + return false; | |
204 | + } | |
205 | + | |
206 | + /** | |
207 | + * set new script URI to ConfigData | |
208 | + * @param data | |
209 | + * @param line | |
210 | + * @return true if line contains script URI | |
211 | + */ | |
212 | + private static boolean setScript(ConfigData data, String line) { | |
213 | + Matcher matcher = RE_SCRIPT.matcher(line); | |
214 | + if ( matcher.matches() ) { | |
215 | + data.script = line; | |
216 | + Log.log("new script = " + line); | |
217 | + return true; | |
218 | + } | |
219 | + return false; | |
220 | + } | |
221 | + | |
222 | + /** | |
223 | + * add new source URI to ConfigData | |
224 | + * @param data | |
225 | + * @param line | |
226 | + * @return true if line contains source URI | |
227 | + */ | |
228 | + private static boolean addSource(ConfigData data, String line) { | |
229 | + Matcher matcher = RE_SOURCE.matcher(line); | |
230 | + if ( matcher.matches() ) { | |
231 | + data.source.add(line); | |
232 | + return true; | |
233 | + } | |
234 | + return false; | |
235 | + } | |
236 | + | |
237 | + /** | |
238 | + * | |
239 | + * @param source | |
240 | + * @return URL object or File object (file only) | |
241 | + */ | |
242 | + private static HashSet<Object> getFlattenSources(Set<String> source) { | |
243 | + HashSet<Object> newSource = new HashSet<Object>(); // should be unique | |
244 | + for (String s: source) { | |
245 | + try { | |
246 | + if (RE_HTTP_OR_HTTPS_PROTOCOL.matcher(s.toLowerCase()).matches()) { | |
247 | + newSource.add(new URL(s)); | |
248 | + } else { | |
249 | + File file = new File(s); | |
250 | + // Single file and image file ? | |
251 | + if (file.isFile() && RE_HAS_IMAGE_EXTENSION.matcher(s.toLowerCase()).matches()) { | |
252 | + newSource.add(file); | |
253 | + } else if (file.isDirectory()) { | |
254 | + File[] listFiles = file.listFiles(new FileFilter() { | |
255 | + @Override | |
256 | + public boolean accept(File f) { | |
257 | + if (f.isFile()) { | |
258 | + String fileName = f.getName().toLowerCase(); | |
259 | + Log.log("fileName is " + fileName); | |
260 | + if (RE_HAS_IMAGE_EXTENSION.matcher(fileName).matches() || | |
261 | + RE_HAS_INTERNET_SHORTCUT_EXTENSION.matcher(fileName).matches()) { | |
262 | + return true; | |
263 | + } | |
264 | + } | |
265 | + return false; | |
266 | + } | |
267 | + }); | |
268 | + for (File f: listFiles) { | |
269 | + String fileName = f.getName().toLowerCase(); | |
270 | + // image file | |
271 | + if (RE_HAS_IMAGE_EXTENSION.matcher(fileName).matches()) { | |
272 | + newSource.add(file); | |
273 | + // internet shortcut | |
274 | + } else if (RE_HAS_INTERNET_SHORTCUT_EXTENSION.matcher(fileName).matches()) { | |
275 | + URL url = MoeUtil.getURL(file); | |
276 | + if (url != null) { | |
277 | + newSource.add(url); | |
278 | + } | |
279 | + } | |
280 | + } | |
281 | + } | |
282 | + } | |
283 | + } catch (Exception ex) { | |
284 | + Log.log(ex); | |
285 | + } | |
286 | + } | |
287 | + return newSource; | |
288 | + } | |
289 | + | |
290 | + private static String getScriptInPluginDir() { | |
291 | + try { | |
292 | + File file = new File(MoeUtil.getPluginJarDir(), SCRIPT_FILE_NAME); | |
293 | + if (file.isFile()) { | |
294 | + return file.getCanonicalPath(); | |
295 | + } | |
296 | + } catch (Exception ex) { /* ignore */ } | |
297 | + return ""; | |
298 | + } | |
299 | + | |
300 | + private static HashSet<Object> getSourcesInPluginDir() { | |
301 | + HashSet<Object> newSource = new HashSet<Object>(); // should be unique | |
302 | + try { | |
303 | + File dir = MoeUtil.getPluginJarDir(); | |
304 | + File[] listFiles = dir.listFiles(new FileFilter() { | |
305 | + @Override | |
306 | + public boolean accept(File f) { | |
307 | + if (f.isFile()) { | |
308 | + String fileName = f.getName().toLowerCase(); | |
309 | + Log.log("fileName is " + fileName); | |
310 | + if (RE_SOURCE_IN_PLUGIN_DIR.matcher(fileName).matches()) { | |
311 | + return true; | |
312 | + } | |
313 | + } | |
314 | + return false; | |
315 | + } | |
316 | + }); | |
317 | + for (File f: listFiles) { | |
318 | + String fileName = f.getName().toLowerCase(); | |
319 | + Log.log("LowerCaseFileName:" + fileName); | |
320 | + // image file | |
321 | + if (RE_HAS_IMAGE_EXTENSION.matcher(fileName).matches()) { | |
322 | + newSource.add(f); | |
323 | + // internet shortcut | |
324 | + } else if (RE_HAS_INTERNET_SHORTCUT_EXTENSION.matcher(fileName).matches()) { | |
325 | + URL url = MoeUtil.getURL(f); | |
326 | + Log.log(url == null ? "URL is NULL!!" : "URL is not null: " + url.toExternalForm()); | |
327 | + if (url != null) { | |
328 | + newSource.add(url); | |
329 | + } | |
330 | + } | |
331 | + } | |
332 | + } catch (Exception ex) { /* ignore */ } | |
333 | + return newSource; | |
334 | + } | |
335 | + | |
336 | + private static class ConfigData { | |
337 | + protected float opacity; // 0.0f <--> 1.0f | |
338 | + protected long interval; // by milliseconds | |
339 | + protected String script; | |
340 | + protected Set<String> source; | |
341 | + } | |
342 | +} | |
343 | + |
@@ -0,0 +1,149 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import java.awt.image.BufferedImage; | |
20 | +import java.io.IOException; | |
21 | +import java.util.concurrent.TimeUnit; | |
22 | +import java.util.logging.Level; | |
23 | +import java.util.logging.Logger; | |
24 | +import javax.swing.SwingUtilities; | |
25 | +import javax.swing.SwingWorker; | |
26 | +import org.omegat.core.CoreEvents; | |
27 | +import org.omegat.core.events.IApplicationEventListener; | |
28 | +import org.omegat.core.events.IProjectEventListener; | |
29 | +import org.omegat.plugin.moenizer.imageloader.IImageLoader; | |
30 | +import org.omegat.plugin.moenizer.imageloader.ImageLoader; | |
31 | +import org.omegat.util.Log; | |
32 | +import org.omegat.util.StaticUtils; | |
33 | + | |
34 | +/** | |
35 | + * allow to set background image | |
36 | + * | |
37 | + * @author Yu-Tang | |
38 | + */ | |
39 | +public class Moenizer implements IApplicationEventListener, IProjectEventListener { | |
40 | + | |
41 | + private IImageLoader imageLoader; | |
42 | + private MoeUI ui; | |
43 | + | |
44 | + | |
45 | + @SuppressWarnings("LeakingThisInConstructor") | |
46 | + public Moenizer() { | |
47 | + CoreEvents.registerApplicationEventListener(this); | |
48 | + CoreEvents.registerProjectChangeListener(this); | |
49 | + | |
50 | + ui = null; | |
51 | + imageLoader = ImageLoader.getInstance(); | |
52 | + // この時点ではまだウィンドウがインスタンス化されていないので、 | |
53 | + // ウィンドウに対する処理は少し待つ。 | |
54 | + | |
55 | + (new SlideShow()).execute(); | |
56 | + } | |
57 | + | |
58 | + @Override | |
59 | + public void onApplicationStartup() { | |
60 | + try { | |
61 | + ui = MoeUI.getMoeUI(); | |
62 | + | |
63 | + // この時点でコンポーネントの透過設定をしても反映されない(タイミング?)。 | |
64 | + // Workaround として、invokeLater でキューに突っ込んで、後で処理する。 | |
65 | + SwingUtilities.invokeLater(new Runnable() { | |
66 | + @Override | |
67 | + public void run() { | |
68 | + CoreEvents.unregisterApplicationEventListener(Moenizer.this); | |
69 | + ui.transparent(); | |
70 | + } | |
71 | + }); | |
72 | + //CoreEvents.unregisterApplicationEventListener(this); // ここで発行すると、スレッドエラーになるので注意 | |
73 | + } catch(Exception e) { | |
74 | + Log.log("Error raised at " + this.getClass().getCanonicalName() + ".onApplicationStartup()\n" + e); | |
75 | + } | |
76 | + | |
77 | + | |
78 | + try { | |
79 | + // ちょっとテストしますよ。 | |
80 | + Log.log("NTP: " + StaticUtils.downloadFileToString("http://ntp-a1.nict.go.jp/cgi-bin/time")); | |
81 | + // Sun Jul 14 02:24:16 2013 JST | |
82 | + } catch (IOException ex) { | |
83 | + Logger.getLogger(Moenizer.class.getName()).log(Level.SEVERE, null, ex); | |
84 | + } | |
85 | + | |
86 | + | |
87 | + | |
88 | + | |
89 | + | |
90 | + } | |
91 | + | |
92 | + @Override | |
93 | + public void onApplicationShutdown() { | |
94 | + // not used. | |
95 | + } | |
96 | + | |
97 | + @Override | |
98 | + public void onProjectChanged(PROJECT_CHANGE_TYPE eventType) { | |
99 | + switch (eventType) { | |
100 | + case CREATE: | |
101 | + case LOAD: | |
102 | + // ここですぐ透過処理をしてもうまく適用されないので、後まわしにする。 | |
103 | + SwingUtilities.invokeLater(new Runnable() { | |
104 | + @Override | |
105 | + public void run() { | |
106 | + CoreEvents.unregisterProjectChangeListener(Moenizer.this); | |
107 | + ui.transparentEditor(); | |
108 | + } | |
109 | + }); | |
110 | + | |
111 | + // 一回 Editor の透過処理をしたら、透過状態が維持されるので、二回目 | |
112 | + // 以降は、透過処理は不要。 | |
113 | + //CoreEvents.unregisterProjectChangeListener(this); // ここで発行すると、スレッドエラーになるので注意 | |
114 | + break; | |
115 | + case CLOSE: | |
116 | + break; | |
117 | + } | |
118 | + } | |
119 | + | |
120 | + private class SlideShow extends SwingWorker<Object, Void> { | |
121 | + private long interval = -1; | |
122 | + | |
123 | + @Override | |
124 | + protected Object doInBackground() throws Exception { | |
125 | + while (imageLoader.availableNext()) { | |
126 | + imageLoader.readyForNextImage(); | |
127 | + interval = interval < 0 ? 0 : imageLoader.getNextInterval(); | |
128 | + if (interval > 0) { | |
129 | + try { | |
130 | + TimeUnit.MILLISECONDS.sleep(interval); | |
131 | + } catch (InterruptedException e) { /* ignore */ } | |
132 | + } | |
133 | + BufferedImage image = imageLoader.getNextImage(); | |
134 | + | |
135 | + if (image != null) { | |
136 | + // 初期化直後に、まだ MoeUI がインスタンス化されていない | |
137 | + // 空白時間に遭遇する可能性があるため、その場合は 0.1 秒 | |
138 | + // 単位で MoeUI のインスタンス化を待機する。 | |
139 | + while (ui == null) { | |
140 | + TimeUnit.MILLISECONDS.sleep(100); | |
141 | + } | |
142 | + ui.setBackground(image); | |
143 | + } | |
144 | + } | |
145 | + return null; | |
146 | + } | |
147 | + } | |
148 | + | |
149 | +} |
@@ -0,0 +1,60 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer.imageloader; | |
18 | + | |
19 | +import java.awt.image.BufferedImage; | |
20 | + | |
21 | +/** | |
22 | + * Interface for Image Loader | |
23 | + * | |
24 | + * calling order is: | |
25 | + * 1. availableNext() ... exit from loop if returned false | |
26 | + * 2. readyForNextImage() | |
27 | + * 3. getNextInterval() ... skiped first time | |
28 | + * 4. getNextImage() | |
29 | + * ... loop back to step 1 | |
30 | + * | |
31 | + * @author Yu-Tang | |
32 | + */ | |
33 | +public interface IImageLoader { | |
34 | + | |
35 | + /** | |
36 | + * get if next image available. | |
37 | + * @return bool. | |
38 | + */ | |
39 | + boolean availableNext(); | |
40 | + | |
41 | + /** | |
42 | + * get next interval. | |
43 | + * This method is not called at first time loop. | |
44 | + * @return long by milliseconds | |
45 | + */ | |
46 | + long getNextInterval(); | |
47 | + | |
48 | + /** | |
49 | + * Do anything should be done for the next image. | |
50 | + * Calling before getNextImage(). | |
51 | + */ | |
52 | + void readyForNextImage(); | |
53 | + | |
54 | + /** | |
55 | + * get next image. | |
56 | + * @return BufferedImage object. Can be null if image is not available. | |
57 | + */ | |
58 | + BufferedImage getNextImage(); | |
59 | + | |
60 | +} |
@@ -0,0 +1,57 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer.imageloader; | |
18 | + | |
19 | +import java.lang.reflect.Method; | |
20 | +import java.net.URL; | |
21 | +import static org.omegat.plugin.moenizer.MoeConfig.*; | |
22 | +import org.omegat.util.Log; | |
23 | + | |
24 | +/** | |
25 | + * | |
26 | + * @author Yu-Tang | |
27 | + */ | |
28 | +public class ImageLoader { | |
29 | + | |
30 | + public static IImageLoader getInstance() { | |
31 | + Object[] sources = getSources(); | |
32 | + | |
33 | + if (sources.length == 0) { | |
34 | + return null; // no source, no need loader | |
35 | + } | |
36 | + | |
37 | + // default | |
38 | + Log.log("DefaultImageLoader will use."); | |
39 | + return new DefaultImageLoader(); | |
40 | + } | |
41 | + | |
42 | + private static Object getAcceptableSource(Class<?> c, Object[] sources) { | |
43 | + for (Object source: sources) { | |
44 | + try { | |
45 | + Method method = c.getDeclaredMethod("isAcceptable", new Class[]{ Object.class }); | |
46 | + boolean isAcceptable = (Boolean) method.invoke(null, source); | |
47 | + if (isAcceptable) { | |
48 | + return source; | |
49 | + } | |
50 | + } catch (Exception ex) { | |
51 | + Log.log(ex); | |
52 | + } | |
53 | + } | |
54 | + return null; | |
55 | + } | |
56 | + | |
57 | +} |
@@ -0,0 +1,168 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer.imageloader; | |
18 | + | |
19 | +import java.awt.image.BufferedImage; | |
20 | +import java.io.File; | |
21 | +import java.net.URL; | |
22 | +import java.util.regex.Pattern; | |
23 | +import javax.imageio.ImageIO; | |
24 | +import static org.omegat.plugin.moenizer.MoeConfig.*; | |
25 | +import org.omegat.util.Log; | |
26 | + | |
27 | +/** | |
28 | + * Default image loader. | |
29 | + * | |
30 | + * calling order is: | |
31 | + * 1. availableNext() ... exit if returned false | |
32 | + * 2. readyForNextImage() | |
33 | + * 3. getNextInterval() ... skipped first time | |
34 | + * 4. getNextImage() | |
35 | + * ... loop back to step 1 | |
36 | + * | |
37 | + * @author Yu-Tang | |
38 | + */ | |
39 | +public class DefaultImageLoader implements IImageLoader { | |
40 | + | |
41 | + private static final Pattern RE_HAS_IMAGE_EXTENSION = Pattern.compile(".+\\.(?:bmp|png|jpg|jpeg|gif)"); | |
42 | + private long interval; | |
43 | + private Object[] sources; | |
44 | + private Object currentSource; | |
45 | + private int sourceIndex; | |
46 | + | |
47 | + protected BufferedImage image; | |
48 | + | |
49 | + public DefaultImageLoader() { | |
50 | + interval = getInterval(); | |
51 | + sources = getSources(); | |
52 | + currentSource = null; | |
53 | + image = null; | |
54 | + sourceIndex = -1; | |
55 | + } | |
56 | + | |
57 | + /** | |
58 | + * get if source is acceptable. | |
59 | + * @return bool. | |
60 | + */ | |
61 | + public static boolean isAcceptable(Object source) { | |
62 | + if (source instanceof URL) { | |
63 | + return true; | |
64 | + } else if (source instanceof File) { | |
65 | + String name = ((File) source).getName().toLowerCase(); | |
66 | + if (RE_HAS_IMAGE_EXTENSION.matcher(name).matches()) { | |
67 | + return true; | |
68 | + } | |
69 | + } | |
70 | + return false; | |
71 | + } | |
72 | + | |
73 | + @Override | |
74 | + public boolean availableNext() { | |
75 | + boolean ret = false; | |
76 | + if (sources.length == 0) { | |
77 | + // it's over! | |
78 | + } else if (sources.length == 1) { | |
79 | + if (currentSource == null || interval > 0) { // first time or refresh | |
80 | + currentSource = sources[0]; | |
81 | + ret = true; | |
82 | + } | |
83 | + } else { | |
84 | + currentSource = getCircularNextSource(); | |
85 | + ret = true; | |
86 | + } | |
87 | + return ret; | |
88 | + } | |
89 | + | |
90 | + /** | |
91 | + * get next image. | |
92 | + * @return BufferedImage object. Can be null if image is not available. | |
93 | + */ | |
94 | + @Override | |
95 | + public BufferedImage getNextImage() { | |
96 | + Log.log("getNextImage() called."); | |
97 | + return image; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * Do anything should be done for the next image. | |
102 | + * Calling before getNextImage(). | |
103 | + */ | |
104 | + @Override | |
105 | + public void readyForNextImage() { | |
106 | + Log.log("readyForNextImage() called."); | |
107 | + //TODO use cache | |
108 | + image = null; | |
109 | + try { | |
110 | + if (currentSource != null) { | |
111 | + if (currentSource instanceof File) { | |
112 | + Log.log("File = " + ((File) currentSource).getCanonicalPath()); | |
113 | + image = ImageIO.read((File) currentSource); | |
114 | + } else if (currentSource instanceof URL) { | |
115 | + Log.log("File = " + ((URL) currentSource).toExternalForm()); | |
116 | + image = ImageIO.read((URL) currentSource); | |
117 | + } else { | |
118 | + Log.log("Unknown source type:" + currentSource.getClass().getCanonicalName()); | |
119 | + removeCurrentSource(); | |
120 | + } | |
121 | + } | |
122 | + } catch (Exception ex) { | |
123 | + Log.log(ex); | |
124 | + removeCurrentSource(); | |
125 | + } | |
126 | + } | |
127 | + | |
128 | + /** | |
129 | + * get next interval. | |
130 | + * This method is not called at first time loop. | |
131 | + * @return long by milliseconds | |
132 | + */ | |
133 | + @Override | |
134 | + public long getNextInterval() { | |
135 | + return interval; | |
136 | + } | |
137 | + | |
138 | + private Object getCircularNextSource() { | |
139 | + sourceIndex++; | |
140 | + if (sourceIndex >= sources.length) { | |
141 | + sourceIndex = 0; | |
142 | + } | |
143 | + Log.log("getCircularNextSource(): " + sources[sourceIndex].getClass().getCanonicalName()); | |
144 | + return sources[sourceIndex]; | |
145 | + } | |
146 | + | |
147 | + private void removeCurrentSource() { | |
148 | + if (sourceIndex >= 0 && sourceIndex < sources.length) { | |
149 | + sourceIndex = 0; // something is wrong. rewind index. | |
150 | + } else { | |
151 | + Object[] newSources = new Object[sources.length - 1]; | |
152 | + for (int i = 0; i < sources.length; i++) { | |
153 | + if ( i == sourceIndex ) { | |
154 | + // skip | |
155 | + } else if ( i < sourceIndex ) { | |
156 | + newSources[i] = sources[i]; | |
157 | + } else { | |
158 | + newSources[i - 1] = sources[i]; | |
159 | + } | |
160 | + } | |
161 | + sources = newSources; | |
162 | + if (sourceIndex >= sources.length) { | |
163 | + sourceIndex = 0; | |
164 | + } | |
165 | + } | |
166 | + } | |
167 | + | |
168 | +} |
@@ -0,0 +1,88 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import java.awt.AlphaComposite; | |
20 | +import java.awt.Graphics; | |
21 | +import java.awt.Graphics2D; | |
22 | +import java.awt.Rectangle; | |
23 | +import java.awt.TexturePaint; | |
24 | +import java.awt.image.BufferedImage; | |
25 | +import javax.swing.JLayeredPane; | |
26 | + | |
27 | +/** | |
28 | + * | |
29 | + * @author Yu-Tang | |
30 | + */ | |
31 | +public class MoeLayeredPane extends JLayeredPane { | |
32 | + | |
33 | + private BufferedImage image; | |
34 | + private TexturePaint paint; | |
35 | + private float alpha; | |
36 | + | |
37 | + public MoeLayeredPane() { | |
38 | + super(); | |
39 | + this.image = null; | |
40 | + this.paint = null; | |
41 | + this.alpha = MoeConfig.getOpacity(); | |
42 | + } | |
43 | + | |
44 | + public MoeLayeredPane(BufferedImage image) { | |
45 | + super(); | |
46 | + setPicture(image); | |
47 | + this.alpha = MoeConfig.getOpacity(); | |
48 | + } | |
49 | + | |
50 | + public void setBackground(BufferedImage image) { | |
51 | + setPicture(image); | |
52 | + this.repaint(); | |
53 | + } | |
54 | + | |
55 | + @Override | |
56 | + protected void paintComponent(Graphics g) { | |
57 | + if (image != null) { | |
58 | + Graphics2D g2 = (Graphics2D)g.create(); | |
59 | + g2.setComposite(makeComposite(alpha)); | |
60 | + | |
61 | + if (getWidth() > image.getWidth() || getHeight() > image.getHeight()) { | |
62 | + g2.setPaint(paint); | |
63 | + g2.fillRect(0, 0, getWidth(), getHeight()); | |
64 | + } else { | |
65 | + g2.drawImage(image, 0, 0, this); | |
66 | + } | |
67 | + | |
68 | + g2.dispose(); | |
69 | + } | |
70 | + super.paintComponent(g); | |
71 | + } | |
72 | + | |
73 | + private AlphaComposite makeComposite(float alpha) { | |
74 | + int type = AlphaComposite.SRC_OVER; | |
75 | + return(AlphaComposite.getInstance(type, alpha)); | |
76 | + } | |
77 | + | |
78 | + private void setPicture(BufferedImage image) { | |
79 | + this.image = image; | |
80 | + | |
81 | + if (image == null) { | |
82 | + this.paint = null; | |
83 | + } else { | |
84 | + Rectangle rect = new Rectangle(image.getWidth(), image.getHeight()); | |
85 | + this.paint = new TexturePaint(image, rect); | |
86 | + } | |
87 | + } | |
88 | +} |
@@ -0,0 +1,287 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import com.sun.java.swing.plaf.windows.WindowsMenuBarUI; | |
20 | +import com.vlsolutions.swing.docking.DockView; | |
21 | +import com.vlsolutions.swing.docking.DockViewTitleBar; | |
22 | +import com.vlsolutions.swing.docking.Dockable; | |
23 | +import com.vlsolutions.swing.docking.DockableState; | |
24 | +import com.vlsolutions.swing.docking.DockingDesktop; | |
25 | +import com.vlsolutions.swing.docking.SplitContainer; | |
26 | +import java.awt.Color; | |
27 | +import java.awt.Component; | |
28 | +import java.awt.Container; | |
29 | +import java.awt.Graphics; | |
30 | +import java.awt.SystemColor; | |
31 | +import java.awt.image.BufferedImage; | |
32 | +import javax.swing.JComponent; | |
33 | +import javax.swing.JEditorPane; | |
34 | +import javax.swing.JFrame; | |
35 | +import javax.swing.JMenuBar; | |
36 | +import javax.swing.JScrollPane; | |
37 | +import javax.swing.JTextPane; | |
38 | +//import javax.swing.plaf.basic.BasicMenuBarUI; | |
39 | +import org.omegat.core.Core; | |
40 | +import org.omegat.util.gui.UIThreadsUtil; | |
41 | + | |
42 | +/** | |
43 | + * | |
44 | + * @author Yu-Tang | |
45 | + */ | |
46 | +public class MoeUI { | |
47 | + | |
48 | + private static MoeUI moeUI; | |
49 | + | |
50 | + private JFrame frame; | |
51 | + private MoeLayeredPane layeredPane; | |
52 | + private Container contentPane; | |
53 | + private JMenuBar menuBar; | |
54 | + private DockingDesktop desktop; | |
55 | + | |
56 | + static { | |
57 | + moeUI = null; | |
58 | + } | |
59 | + | |
60 | + // Singleton. Not allow to Instanciate from outside. Use getMoeUI() to get instance. | |
61 | + private MoeUI(BufferedImage image) { | |
62 | + UIThreadsUtil.mustBeSwingThread(); | |
63 | + | |
64 | + initUI(image); | |
65 | + } | |
66 | + | |
67 | + private MoeUI() { | |
68 | + UIThreadsUtil.mustBeSwingThread(); | |
69 | + | |
70 | + initUI(null); | |
71 | + } | |
72 | + | |
73 | + public static MoeUI getMoeUI(BufferedImage image) { | |
74 | + if (moeUI == null) { | |
75 | + moeUI = new MoeUI(image); | |
76 | + } | |
77 | + return moeUI; | |
78 | + } | |
79 | + | |
80 | + public static MoeUI getMoeUI() { | |
81 | + if (moeUI == null) { | |
82 | + moeUI = new MoeUI(); | |
83 | + } | |
84 | + return moeUI; | |
85 | + } | |
86 | + | |
87 | + public void transparent() { | |
88 | + UIThreadsUtil.mustBeSwingThread(); | |
89 | + | |
90 | + transparent(menuBar); | |
91 | + transparentRecursive(contentPane); | |
92 | + transparentInstantStart(desktop); | |
93 | + | |
94 | + frame.repaint(); | |
95 | + } | |
96 | + | |
97 | + public void transparentEditor() { | |
98 | + // Editor に表示されるドキュメントは、以下のケースでまったく異なる。 | |
99 | + // | |
100 | + // 1. インスタントスタートガイドが表示されている場合(初期状態) | |
101 | + // -> view = JTextPane, HTMLDocument | |
102 | + // 2. プロジェクトをロードまたは新規作成して、分節編集画面が表示されている場合 | |
103 | + // -> view = JEditorPane, DefaultStyledDocument | |
104 | + // | |
105 | + // そのため、2 のタイミングで透過処理をやり直す必要がある。 | |
106 | + // このメソッドは、2 の透過処理専用。 | |
107 | + | |
108 | + UIThreadsUtil.mustBeSwingThread(); | |
109 | + | |
110 | + JEditorPane editor = getJEditorPaneFromEditor(desktop); | |
111 | + if (editor == null) { | |
112 | + return; | |
113 | + } | |
114 | + | |
115 | + /* ここで JEditorPane に半透明の背景色を設定すると、テキストの選択(反転) | |
116 | + * などの色の変化が正常に更新されず色残りしてしまう。 | |
117 | + * そのため、JEditorPane への処理では単純に背景を透明にして、元画像自体で | |
118 | + * 色味を調整しておく方針とする。 | |
119 | + * | |
120 | + int alpha = 100; // transparent <- 0...255 -> opaque | |
121 | + Color color = SystemColor.menu; | |
122 | + editor.setBackground(new Color( color.getRGB() & 0xffffff | 100 << 24, true)); | |
123 | + * */ | |
124 | + editor.setOpaque(false); | |
125 | + frame.repaint(); | |
126 | + } | |
127 | + | |
128 | + public void setBackground(final BufferedImage image) { | |
129 | + UIThreadsUtil.executeInSwingThread(new Runnable() { | |
130 | + @Override | |
131 | + public void run() { | |
132 | + layeredPane.setBackground(image); | |
133 | + } | |
134 | + }); | |
135 | + } | |
136 | + | |
137 | + private void initUI(BufferedImage image) { | |
138 | + frame = Core.getMainWindow().getApplicationFrame(); | |
139 | + if (image == null) { | |
140 | + layeredPane = new MoeLayeredPane(); | |
141 | + } else { | |
142 | + layeredPane = new MoeLayeredPane(image); | |
143 | + } | |
144 | + contentPane = frame.getContentPane(); | |
145 | + menuBar = frame.getJMenuBar(); | |
146 | + desktop = getDockingDesktop(contentPane); | |
147 | + | |
148 | + // replace LayeredPane with MoeLayeredPane | |
149 | + frame.setLayeredPane(layeredPane); | |
150 | + frame.setContentPane(contentPane); | |
151 | + frame.setJMenuBar(menuBar); | |
152 | + | |
153 | + frame.validate(); | |
154 | + } | |
155 | + | |
156 | + private void transparent(JMenuBar menuBar) { | |
157 | +// menuBar.setUI ( new BasicMenuBarUI () { | |
158 | +// 上記だと初期表示時に、アクティブメニューがアクティブで描画されない。 | |
159 | +// マウス通過などのタイミングで再描画された際にアクティブカラーになるが、 | |
160 | +// 見栄えが悪いので、Windows 用の UI を指定する。 | |
161 | +// アクティブメニューがアクティブで描画されない問題はこれで解決するが、 | |
162 | +// 変わりに Mac や *nix など別 L&F 環境下では違和感があるかもしれない。 | |
163 | + menuBar.setUI ( new WindowsMenuBarUI () { | |
164 | + @Override | |
165 | + public void paint ( Graphics g, JComponent c ) { | |
166 | + int alpha = 100; // transparent <- 0...255 -> opaque | |
167 | + Color oldColor = g.getColor(); | |
168 | + Color color = SystemColor.menu; | |
169 | + g.setColor ( new Color( color.getRGB() & 0xffffff | alpha << 24, true)); | |
170 | + g.fillRect ( 0, 0, c.getWidth (), c.getHeight () ); | |
171 | + g.setColor ( oldColor ); // restore | |
172 | + } | |
173 | + } ); | |
174 | + menuBar.setOpaque(false); | |
175 | + } | |
176 | + | |
177 | + private void transparentRecursive(Component component) { | |
178 | + if (component instanceof JComponent) { | |
179 | + JComponent c = (JComponent) component; | |
180 | + if (c.isOpaque()) { | |
181 | + c.setOpaque(false); | |
182 | + } | |
183 | + } | |
184 | + | |
185 | + if (component instanceof Container) { | |
186 | + Container container = (Container) component; | |
187 | + for (Component c: container.getComponents()) { | |
188 | + transparentRecursive(c); | |
189 | + } | |
190 | + } | |
191 | + | |
192 | + if (component instanceof DockingDesktop) { | |
193 | + transparentRecursive((DockingDesktop) component); | |
194 | + } | |
195 | + } | |
196 | + | |
197 | + private void transparentRecursive(DockingDesktop desktop) { | |
198 | + //DockingPanel dockingPanel = dockingDesktop.getDockingPanel(); // Scoping NG | |
199 | + // DockingPanel にアクセスできないので、下位要素から上にさかのぼって処理する。 | |
200 | + // 階層的には、こんな感じになっている。 | |
201 | + // ----------------------- | |
202 | + // DockingDesktop | |
203 | + // + DockingPanel <-- splitContainer.getParent() | |
204 | + // + splitContainer(HORIZONTAL) <-- splitContainer.getParent() | |
205 | + // + splitContainer(VERTICAL) <-- DockView.getParent() | |
206 | + // + DockView <-- Dockable.getParent() | |
207 | + // + Dockable <-- DockableState.getDockable() | |
208 | + for (DockableState d: desktop.getDockables()) { | |
209 | + double width = d.getPosition().getWidth(); | |
210 | + // width (height や x, y でも可) が 0.0 以外の場合はアイコン化されているので、透過処理不要 | |
211 | + // 他に適切な判定方法がありそうだけれども、分からなかったので、とりあえずこれで。 | |
212 | + if (width == 0.0) { | |
213 | + transparentRecursive(d); | |
214 | + } | |
215 | + } | |
216 | + } | |
217 | + | |
218 | + private void transparentRecursive(DockableState dockableState) { | |
219 | + Dockable dockable = dockableState.getDockable(); | |
220 | + | |
221 | + // DockView | |
222 | + Container container = dockable.getComponent().getParent(); | |
223 | + DockView view = (DockView) container; | |
224 | + if (view.isOpaque()) { | |
225 | + view.setOpaque(false); | |
226 | + } | |
227 | + DockViewTitleBar titleBar = view.getTitleBar(); | |
228 | + if (titleBar.isOpaque()) { | |
229 | + titleBar.setOpaque(false); | |
230 | + } | |
231 | + titleBar.setUI(new MoeDockViewTitleBarUI(titleBar)); | |
232 | + | |
233 | + // SplitContainer(VERTICAL) | |
234 | + container = container.getParent(); | |
235 | + if (container == null) { | |
236 | + return; | |
237 | + } else if (container.isOpaque()) { | |
238 | + ((SplitContainer) container).setOpaque(false); | |
239 | + } | |
240 | + | |
241 | + // SplitContainer(HORIZONTAL) | |
242 | + container = container.getParent(); | |
243 | + if (container == null) { | |
244 | + return; | |
245 | + } else if (container.isOpaque()) { | |
246 | + ((SplitContainer) container).setOpaque(false); | |
247 | + } | |
248 | + } | |
249 | + | |
250 | + private void transparentInstantStart(DockingDesktop desktop) { | |
251 | + // お手軽スタートは、以下のような HTML で背景色が指定されている。 | |
252 | + // <body ... bgcolor="white" ...> | |
253 | + // そのため、コンポーネント自体を透過にしても、HTML Body 背景色の | |
254 | + // 白指定が効いて透過にならない。そこで、背景色指定を削除する。 | |
255 | + for (DockableState d: desktop.getDockables()) { | |
256 | + Dockable dockable = d.getDockable(); | |
257 | + String key = dockable.getDockKey().getKey(); | |
258 | + if (key.equalsIgnoreCase("EDITOR")) { // found InstantStartGuide | |
259 | + JScrollPane sp = (JScrollPane) dockable.getComponent(); | |
260 | + JTextPane tp = (JTextPane) sp.getViewport().getView(); | |
261 | + tp.setText(tp.getText().replace(" bgcolor=\"white\"", "")); | |
262 | + tp.setCaretPosition(0); | |
263 | + return; | |
264 | + } | |
265 | + } | |
266 | + } | |
267 | + | |
268 | + private DockingDesktop getDockingDesktop(Container container) { | |
269 | + for (Component c: container.getComponents()) { | |
270 | + if (c instanceof DockingDesktop) { | |
271 | + return (DockingDesktop) c; | |
272 | + } | |
273 | + } | |
274 | + return null; | |
275 | + } | |
276 | + | |
277 | + private JEditorPane getJEditorPaneFromEditor(DockingDesktop desktop) { | |
278 | + for (DockableState d: desktop.getDockables()) { | |
279 | + Dockable dockable = d.getDockable(); | |
280 | + if (dockable.getDockKey().getKey().equalsIgnoreCase("EDITOR")) { | |
281 | + JScrollPane sp = (JScrollPane) dockable.getComponent(); | |
282 | + return (JEditorPane) sp.getViewport().getView(); | |
283 | + } | |
284 | + } | |
285 | + return null; | |
286 | + } | |
287 | +} |
@@ -0,0 +1,111 @@ | ||
1 | +/************************************************************************** | |
2 | + Moenizer - Allow to set background image for OmegaT. | |
3 | + | |
4 | + Copyright (C) 2013 Yu Tang | |
5 | + Home page: http://sourceforge.jp/users/yu-tang/ | |
6 | + Support center: http://sourceforge.jp/users/yu-tang/ | |
7 | + | |
8 | + This file is part of plugin for OmegaT. | |
9 | + http://www.omegat.org/ | |
10 | + | |
11 | + License: GNU GPL version 3 or (at your option) any later version. | |
12 | + | |
13 | + You should have received a copy of the GNU General Public License | |
14 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | + **************************************************************************/ | |
16 | + | |
17 | +package org.omegat.plugin.moenizer; | |
18 | + | |
19 | +import java.io.BufferedReader; | |
20 | +import java.io.File; | |
21 | +import java.io.FileInputStream; | |
22 | +import java.io.IOException; | |
23 | +import java.io.InputStreamReader; | |
24 | +import java.io.StringWriter; | |
25 | +import java.net.URISyntaxException; | |
26 | +import java.net.URL; | |
27 | +import java.security.CodeSource; | |
28 | +import java.util.regex.Matcher; | |
29 | +import java.util.regex.Pattern; | |
30 | +import org.omegat.util.LFileCopy; | |
31 | +import org.omegat.util.Log; | |
32 | +import org.omegat.util.OConsts; | |
33 | + | |
34 | +/** | |
35 | + * | |
36 | + * @author Yu-Tang | |
37 | + */ | |
38 | +public class MoeUtil { | |
39 | + | |
40 | + private static final Pattern RE_URL_IN_SHORTCUT = Pattern.compile("\\[InternetShortcut\\]\\s+URL=(.+)\\b"); | |
41 | + private static final Pattern RE_URL_IN_WEBLOC = Pattern.compile("<key>URL</key>\\s+<string>(.+)</string>"); | |
42 | + private static File pluginJarFile; | |
43 | + | |
44 | + static { | |
45 | + pluginJarFile = null; | |
46 | + } | |
47 | + | |
48 | + public static File getPluginJarFile() throws URISyntaxException { | |
49 | + if (pluginJarFile == null) { | |
50 | + CodeSource codeSource = MoeUtil.class.getProtectionDomain().getCodeSource(); | |
51 | + pluginJarFile = new File(codeSource.getLocation().toURI().getPath()); | |
52 | + } | |
53 | + return pluginJarFile; | |
54 | + } | |
55 | + | |
56 | + public static File getPluginJarDir() throws URISyntaxException { | |
57 | + File jarFile = getPluginJarFile(); | |
58 | + return new File(jarFile.getParentFile().getPath()); | |
59 | + } | |
60 | + | |
61 | + public static URL getURL(File file) { | |
62 | + String fileName = file.getName().toLowerCase(); | |
63 | + try { | |
64 | + if (fileName.endsWith(".url") || fileName.endsWith(".website")) { | |
65 | + // .url is Internet ShortCut file for IE8 or earlier, Firefox | |
66 | + // .website is Pinned Site ShortCut file for IE9 or later | |
67 | + | |
68 | + // Windows 日本語環境で作成すると Shift-JIS 文字列が含まれること | |
69 | + // があるため、文字コードはその OS の既定文字コードを想定した方 | |
70 | + // が望ましいと思われる。 | |
71 | + String text = readTextFile(file, System.getProperty("sun.jnu.encoding")); | |
72 | + Matcher matcher = RE_URL_IN_SHORTCUT.matcher(text); | |
73 | + if (matcher.find()) { | |
74 | + return new URL(matcher.group(1)); | |
75 | + } else { | |
76 | + Log.log("Could not find valid URL in internet shortcut file '" + file.getCanonicalPath() + "'"); | |
77 | + } | |
78 | + | |
79 | + } else if (fileName.endsWith(".webloc")) { | |
80 | + // .webloc is Mac OS X Website Location file for safari | |
81 | + String text = readTextFile(file, OConsts.UTF8); | |
82 | + Matcher matcher = RE_URL_IN_WEBLOC.matcher(text); | |
83 | + if (matcher.find()) { | |
84 | + return new URL(matcher.group(1)); | |
85 | + } else { | |
86 | + Log.log("Could not find valid URL in website location file '" + file.getCanonicalPath() + "'"); | |
87 | + } | |
88 | + | |
89 | + } else { // unknown | |
90 | + // ignore | |
91 | + } | |
92 | + } catch (IOException ex) { | |
93 | + Log.log(ex); | |
94 | + } | |
95 | + return null; | |
96 | + } | |
97 | + | |
98 | + /** | |
99 | + * Read file as platform dependent encoding text. | |
100 | + */ | |
101 | + public static String readTextFile(File file, String encoding) throws IOException { | |
102 | + BufferedReader rd = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); | |
103 | + try { | |
104 | + StringWriter out = new StringWriter(); | |
105 | + LFileCopy.copy(rd, out); | |
106 | + return out.toString(); | |
107 | + } finally { | |
108 | + rd.close(); | |
109 | + } | |
110 | + } | |
111 | +} |
@@ -0,0 +1,74 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- You may freely edit this file. See commented blocks below for --> | |
3 | +<!-- some examples of how to customize the build. --> | |
4 | +<!-- (If you delete it and reopen the project it will be recreated.) --> | |
5 | +<!-- By default, only the Clean and Build commands use this build script. --> | |
6 | +<!-- Commands such as Run, Debug, and Test only use this build script if --> | |
7 | +<!-- the Compile on Save feature is turned off for the project. --> | |
8 | +<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | |
9 | +<!-- in the project's Project Properties dialog box.--> | |
10 | +<project name="Moenizer" default="default" basedir="."> | |
11 | + <description>Builds, tests, and runs the project Moenizer.</description> | |
12 | + <import file="nbproject/build-impl.xml"/> | |
13 | + <!-- | |
14 | + | |
15 | + There exist several targets which are by default empty and which can be | |
16 | + used for execution of your tasks. These targets are usually executed | |
17 | + before and after some main targets. They are: | |
18 | + | |
19 | + -pre-init: called before initialization of project properties | |
20 | + -post-init: called after initialization of project properties | |
21 | + -pre-compile: called before javac compilation | |
22 | + -post-compile: called after javac compilation | |
23 | + -pre-compile-single: called before javac compilation of single file | |
24 | + -post-compile-single: called after javac compilation of single file | |
25 | + -pre-compile-test: called before javac compilation of JUnit tests | |
26 | + -post-compile-test: called after javac compilation of JUnit tests | |
27 | + -pre-compile-test-single: called before javac compilation of single JUnit test | |
28 | + -post-compile-test-single: called after javac compilation of single JUunit test | |
29 | + -pre-jar: called before JAR building | |
30 | + -post-jar: called after JAR building | |
31 | + -post-clean: called after cleaning build products | |
32 | + | |
33 | + (Targets beginning with '-' are not intended to be called on their own.) | |
34 | + | |
35 | + Example of inserting an obfuscator after compilation could look like this: | |
36 | + | |
37 | + <target name="-post-compile"> | |
38 | + <obfuscate> | |
39 | + <fileset dir="${build.classes.dir}"/> | |
40 | + </obfuscate> | |
41 | + </target> | |
42 | + | |
43 | + For list of available properties check the imported | |
44 | + nbproject/build-impl.xml file. | |
45 | + | |
46 | + | |
47 | + Another way to customize the build is by overriding existing main targets. | |
48 | + The targets of interest are: | |
49 | + | |
50 | + -init-macrodef-javac: defines macro for javac compilation | |
51 | + -init-macrodef-junit: defines macro for junit execution | |
52 | + -init-macrodef-debug: defines macro for class debugging | |
53 | + -init-macrodef-java: defines macro for class execution | |
54 | + -do-jar-with-manifest: JAR building (if you are using a manifest) | |
55 | + -do-jar-without-manifest: JAR building (if you are not using a manifest) | |
56 | + run: execution of project | |
57 | + -javadoc-build: Javadoc generation | |
58 | + test-report: JUnit report generation | |
59 | + | |
60 | + An example of overriding the target for project execution could look like this: | |
61 | + | |
62 | + <target name="run" depends="Moenizer-impl.jar"> | |
63 | + <exec dir="bin" executable="launcher.exe"> | |
64 | + <arg file="${dist.jar}"/> | |
65 | + </exec> | |
66 | + </target> | |
67 | + | |
68 | + Notice that the overridden target depends on the jar target and not only on | |
69 | + the compile target as the regular run target does. Again, for a list of available | |
70 | + properties which you can use, check the target you are overriding in the | |
71 | + nbproject/build-impl.xml file. | |
72 | + | |
73 | + --> | |
74 | +</project> |